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."""
if self.doAutoImportBool:
self.importer.runUpdated() self.importer.runUpdated()
print "GuiAutoImport.import_dir done" print "GuiAutoImport.import_dir done"
return self.doAutoImportBool 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"""
@ -150,11 +153,14 @@ class GuiAutoImport (threading.Thread):
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"
self.pipe_to_hud.communicate('\n') # waits for process to terminate print >>self.pipe_to_hud.stdin, "\n"
#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):