autoimport a bit better, no?

This commit is contained in:
Matt Turnbull 2008-12-18 17:49:17 +00:00
parent fe2c806822
commit 7803f52307

View File

@ -104,9 +104,12 @@ class GuiAutoImport (threading.Thread):
def do_import(self): def do_import(self):
"""Callback for timer to do an import iteration.""" """Callback for timer to do an import iteration."""
self.importer.runUpdated() if self.doAutoImportBool:
print "GuiAutoImport.import_dir done" self.importer.runUpdated()
return self.doAutoImportBool print "GuiAutoImport.import_dir done"
return True
else:
return False
def startClicked(self, widget, data): def startClicked(self, widget, data):
"""runs when user clicks start on auto import tab""" """runs when user clicks start on auto import tab"""
@ -149,12 +152,15 @@ class GuiAutoImport (threading.Thread):
interval=int(self.intervalEntry.get_text()) interval=int(self.intervalEntry.get_text())
gobject.timeout_add(interval*1000, self.do_import) gobject.timeout_add(interval*1000, self.do_import)
else: # toggled off else: # toggled off
self.doAutoImportBool = False # do_import will return this and stop the gobject callback timer self.doAutoImportBool = False # do_import will return this and stop the gobject callback timer
#TODO: other clean up, such as killing HUD print "Stopping autoimport"
print "Stopping autoimport" print >>self.pipe_to_hud.stdin, "\n"
self.pipe_to_hud.communicate('\n') # waits for process to terminate #self.pipe_to_hud.communicate('\n') # waits for process to terminate
self.pipe_to_hud = None self.pipe_to_hud = None
widget.set_label(u'Start Autoimport') self.startButton.set_label(u'Start Autoimport')
#end def GuiAutoImport.startClicked #end def GuiAutoImport.startClicked
def get_vbox(self): def get_vbox(self):