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