diff --git a/pyfpdb/HandHistoryConverter.py b/pyfpdb/HandHistoryConverter.py index b41f9342..6d25d6aa 100644 --- a/pyfpdb/HandHistoryConverter.py +++ b/pyfpdb/HandHistoryConverter.py @@ -50,9 +50,6 @@ import Hand from Exceptions import FpdbParseError import Configuration -import pygtk -import gtk - class HandHistoryConverter(): READ_CHUNK_SIZE = 10000 # bytes to read at a time from file in tail mode @@ -128,9 +125,6 @@ If in follow mode, wait for more data to turn up. Otherwise, finish at EOF. """ - while gtk.events_pending(): - gtk.main_iteration(False) - starttime = time.time() if not self.sanityCheck(): log.warning(_("Failed sanity check")) @@ -182,7 +176,12 @@ Otherwise, finish at EOF. finally: if self.out_fh != sys.stdout: self.out_fh.close() - + + def progressNotify(self): + "A callback to the interface while events are pending" + import gtk, pygtk + while gtk.events_pending(): + gtk.main_iteration(False) def tailHands(self): """Generator of handTexts from a tailed file: diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 7aab478c..a104d5ce 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -453,6 +453,7 @@ class Importer: ,sitename = site ) if hhc.getStatus(): + if self.caller: hhc.progressNotify() handlist = hhc.getProcessedHands() self.pos_in_file[file] = hhc.getLastCharacterRead() (hbulk, hpbulk, habulk, hcbulk, phands, ihands) = ([], [], [], [], [], [])