Code cleanup: Got rid of the progress bar popup. Use the "waiting" animation instead
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@218 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -400,9 +400,6 @@ class PinpadGTK:
|
||||
else:
|
||||
lbl.modify_font(pango.FontDescription("sans 18"))
|
||||
|
||||
#Prepare the Progress Bar window for later use
|
||||
self.progressWindow = Popup(self.builder)
|
||||
|
||||
#Display Main Window
|
||||
self.window = self.builder.get_object("MainWindow")
|
||||
self.window.show()
|
||||
@@ -465,7 +462,7 @@ class PinpadGTK:
|
||||
|
||||
cmd.append("-v")
|
||||
|
||||
#Try to call pace-tool. This is a blocking call. A progress bar is being
|
||||
#Try to call pace-tool. This is a blocking call. An animation is being
|
||||
#shown while the subprocess is running
|
||||
try:
|
||||
self.cardChecker.pause() #Stop polling the card while PACE is running
|
||||
@@ -479,17 +476,7 @@ class PinpadGTK:
|
||||
self.cardChecker.resume() #Restart cardChecker
|
||||
return
|
||||
|
||||
#Animate the progress bar
|
||||
# line = p.stdout.readline()
|
||||
# self.progressWindow.show()
|
||||
# while gtk.events_pending():
|
||||
# gtk.main_iteration()
|
||||
# while line:
|
||||
# self.progressWindow.inc_fraction()
|
||||
# while gtk.events_pending():
|
||||
# gtk.main_iteration()
|
||||
# line = p.stdout.readline()
|
||||
|
||||
#Show the animation to indicate that the program is not dead
|
||||
waiting = gtk.Window(gtk.WINDOW_POPUP)
|
||||
animation = gtk.gdk.PixbufAnimation(image_dir + "/wait.gif")
|
||||
img = gtk.Image()
|
||||
@@ -501,9 +488,10 @@ class PinpadGTK:
|
||||
waiting.set_decorated(False)
|
||||
waiting.show_all()
|
||||
|
||||
#Try to keep the GUI responsive by taking care of the event queue
|
||||
line = p.stdout.readline()
|
||||
while line:
|
||||
while gtk.events_pending(): #Keep GUI responsive
|
||||
while gtk.events_pending():
|
||||
gtk.main_iteration()
|
||||
line = p.stdout.readline()
|
||||
|
||||
@@ -537,27 +525,6 @@ class PinpadGTK:
|
||||
output = num_digits * '*' + (self.secret_len - num_digits) * "_"
|
||||
self.output.set_text(output)
|
||||
|
||||
class Popup(object):
|
||||
|
||||
def __init__(self, builder):
|
||||
self.builder = builder
|
||||
self.window = self.builder.get_object("progWindow")
|
||||
self.progbar = self.builder.get_object("progBar")
|
||||
|
||||
def show(self):
|
||||
self.window.show()
|
||||
|
||||
def hide(self):
|
||||
self.window.hide()
|
||||
|
||||
def inc_fraction(self):
|
||||
fraction = self.progbar.get_fraction()
|
||||
if fraction < 1.0:
|
||||
fraction += 0.1
|
||||
else:
|
||||
fraction = 0.0
|
||||
self.progbar.set_fraction(fraction)
|
||||
|
||||
class cardChecker(Thread):
|
||||
""" This class searches for a card with a given ATR and displays
|
||||
wether or not it was found on the label of a widget """
|
||||
|
||||
@@ -273,42 +273,4 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkWindow" id="progWindow">
|
||||
<property name="type">popup</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="window_position">center-on-parent</property>
|
||||
<property name="default_width">240</property>
|
||||
<property name="default_height">120</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">popup-menu</property>
|
||||
<property name="skip_taskbar_hint">True</property>
|
||||
<property name="deletable">False</property>
|
||||
<property name="transient_for">MainWindow</property>
|
||||
<property name="opacity">0.90000000022351745</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lblCaption">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><span font_weight="bold" font="11">PACE Progress</span></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="progBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="activity_mode">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
Reference in New Issue
Block a user