Move callHud to class attribute and remove from function parameters

Fix all callers
This commit is contained in:
Worros 2008-10-10 01:21:01 +08:00
parent 037178ead3
commit ed7122ca31
4 changed files with 12 additions and 7 deletions

View File

@ -57,7 +57,7 @@ class GuiAutoImport (threading.Thread):
self.inputFile = os.path.join(self.path, file) self.inputFile = os.path.join(self.path, file)
stat_info = os.stat(self.inputFile) stat_info = os.stat(self.inputFile)
if not self.import_files.has_key(self.inputFile) or stat_info.st_mtime > self.import_files[self.inputFile]: if not self.import_files.has_key(self.inputFile) or stat_info.st_mtime > self.import_files[self.inputFile]:
self.importer.import_file_dict(self, self.settings, callHud = True) self.importer.import_file_dict(self, self.settings)
self.import_files[self.inputFile] = stat_info.st_mtime self.import_files[self.inputFile] = stat_info.st_mtime
print "GuiAutoImport.import_dir done" print "GuiAutoImport.import_dir done"
@ -122,6 +122,7 @@ class GuiAutoImport (threading.Thread):
"""Constructor for GuiAutoImport""" """Constructor for GuiAutoImport"""
self.settings=settings self.settings=settings
self.importer = fpdb_import.Importer() self.importer = fpdb_import.Importer()
self.importer.setCallHud(True)
self.server=settings['db-host'] self.server=settings['db-host']
self.user=settings['db-user'] self.user=settings['db-user']

View File

@ -32,7 +32,7 @@ class GuiBulkImport (threading.Thread):
print "BulkImport is not recursive - please select the final directory in which the history files are" print "BulkImport is not recursive - please select the final directory in which the history files are"
else: else:
self.inputFile=self.path+os.sep+file self.inputFile=self.path+os.sep+file
self.importer.import_file_dict(self, self.settings, False) self.importer.import_file_dict(self, self.settings)
print "GuiBulkImport.import_dir done" print "GuiBulkImport.import_dir done"
def load_clicked(self, widget, data=None): def load_clicked(self, widget, data=None):
@ -69,7 +69,7 @@ class GuiBulkImport (threading.Thread):
if os.path.isdir(self.inputFile): if os.path.isdir(self.inputFile):
self.import_dir() self.import_dir()
else: else:
self.importer.import_file_dict(self, self.settings, False) self.importer.import_file_dict(self, self.settings)
def get_vbox(self): def get_vbox(self):
"""returns the vbox of this thread""" """returns the vbox of this thread"""

View File

@ -257,7 +257,7 @@ class GuiTableViewer (threading.Thread):
self.handCount=0 self.handCount=0
self.importer = fpdb_import.Importer() self.importer = fpdb_import.Importer()
self.last_read_hand_id=importer.import_file_dict(self, self.settings, False) self.last_read_hand_id=importer.import_file_dict(self, self.settings)
#end def table_viewer.import_clicked #end def table_viewer.import_clicked
def all_clicked(self, widget, data): def all_clicked(self, widget, data):

View File

@ -46,6 +46,7 @@ class Importer:
self.db = None self.db = None
self.cursor = None self.cursor = None
self.options = None self.options = None
self.callHud = False
def dbConnect(self, options, settings): def dbConnect(self, options, settings):
#connect to DB #connect to DB
@ -65,7 +66,10 @@ class Importer:
pass pass
self.cursor = self.db.cursor() self.cursor = self.db.cursor()
def import_file_dict(self, options, settings, callHud=False): def setCallHud(self, value):
self.callHud = value
def import_file_dict(self, options, settings):
last_read_hand=0 last_read_hand=0
if (options.inputFile=="stdin"): if (options.inputFile=="stdin"):
inputFile=sys.stdin inputFile=sys.stdin
@ -135,8 +139,8 @@ class Importer:
stored+=1 stored+=1
self.db.commit() self.db.commit()
# if settings['imp-callFpdbHud'] and callHud and os.sep=='/': # if settings['imp-callFpdbHud'] and self.callHud and os.sep=='/':
if settings['imp-callFpdbHud'] and callHud: if settings['imp-callFpdbHud'] and self.callHud:
#print "call to HUD here. handsId:",handsId #print "call to HUD here. handsId:",handsId
#pipe the Hands.id out to the HUD #pipe the Hands.id out to the HUD
# options.pipe_to_hud.write("%s" % (handsId) + os.linesep) # options.pipe_to_hud.write("%s" % (handsId) + os.linesep)