Move minPrint variable from callling class to setting in Importer class
This commit is contained in:
parent
ae9b70ea5d
commit
1e8333ec5d
|
@ -123,6 +123,7 @@ class GuiAutoImport (threading.Thread):
|
|||
self.settings=settings
|
||||
self.importer = fpdb_import.Importer(self,self.settings)
|
||||
self.importer.setCallHud(True)
|
||||
self.importer.setMinPrint(30)
|
||||
|
||||
self.server=settings['db-host']
|
||||
self.user=settings['db-user']
|
||||
|
@ -130,7 +131,6 @@ class GuiAutoImport (threading.Thread):
|
|||
self.database=settings['db-databaseName']
|
||||
self.quiet=False
|
||||
self.failOnError=False
|
||||
self.minPrint=30
|
||||
self.handCount=0
|
||||
|
||||
self.mainVBox=gtk.VBox(False,1)
|
||||
|
|
|
@ -48,9 +48,9 @@ class GuiBulkImport (threading.Thread):
|
|||
|
||||
self.minPrint=self.min_print_tbuffer.get_text(self.min_print_tbuffer.get_start_iter(), self.min_print_tbuffer.get_end_iter())
|
||||
if (self.minPrint=="never" or self.minPrint=="Never"):
|
||||
self.minPrint=0
|
||||
self.importer.setMinPrint(0)
|
||||
else:
|
||||
self.minPrint=int(self.minPrint)
|
||||
self.importer.setMinPrint=int(self.minPrint)
|
||||
|
||||
self.quiet=self.info_tbuffer.get_text(self.info_tbuffer.get_start_iter(), self.info_tbuffer.get_end_iter())
|
||||
if (self.quiet=="yes"):
|
||||
|
|
|
@ -253,9 +253,9 @@ class GuiTableViewer (threading.Thread):
|
|||
|
||||
self.quiet=False
|
||||
self.failOnError=False
|
||||
self.minPrint=0
|
||||
self.handCount=0
|
||||
self.importer = fpdb_import.Importer(self, self.settings)
|
||||
self.importer.setMinPrint(0)
|
||||
|
||||
self.last_read_hand_id=self.importer.import_file_dict()
|
||||
#end def table_viewer.import_clicked
|
||||
|
|
|
@ -49,8 +49,11 @@ class Importer:
|
|||
self.callHud = False
|
||||
self.lines = None
|
||||
self.pos_in_file = {} # dict to remember how far we have read in the file
|
||||
#Set defaults
|
||||
if not self.settings.has_key('imp-callFpdbHud'):
|
||||
self.settings['imp-callFpdbHud'] = False
|
||||
if not self.settings.has_key('minPrint'):
|
||||
self.settings['minPrint'] = 30
|
||||
self.dbConnect()
|
||||
|
||||
def dbConnect(self):
|
||||
|
@ -77,6 +80,9 @@ class Importer:
|
|||
def addImportFile(self, filename):
|
||||
self.caller.inputFile = filename
|
||||
|
||||
def setMinPrint(self, value):
|
||||
self.settings['minPrint'] = int(value)
|
||||
|
||||
def import_file_dict(self):
|
||||
starttime = time()
|
||||
last_read_hand=0
|
||||
|
@ -163,7 +169,7 @@ class Importer:
|
|||
self.printEmailErrorMessage(errors, self.caller.inputFile, hand[0])
|
||||
|
||||
if (self.caller.failOnError):
|
||||
self.db.commit() #dont remove this, in case hand processing was cancelled this ties up any open ends.
|
||||
self.db.commit() #dont remove this, in case hand processing was cancelled.
|
||||
raise
|
||||
except (fpdb_simple.FpdbError), fe:
|
||||
errors+=1
|
||||
|
@ -173,10 +179,10 @@ class Importer:
|
|||
self.db.rollback()
|
||||
|
||||
if (self.caller.failOnError):
|
||||
self.db.commit() #dont remove this, in case hand processing was cancelled this ties up any open ends.
|
||||
self.db.commit() #dont remove this, in case hand processing was cancelled.
|
||||
raise
|
||||
if (self.caller.minPrint!=0):
|
||||
if ((stored+duplicates+partial+errors)%self.caller.minPrint==0):
|
||||
if (self.settings['minPrint']!=0):
|
||||
if ((stored+duplicates+partial+errors)%self.settings['minPrint']==0):
|
||||
print "stored:", stored, "duplicates:", duplicates, "partial:", partial, "errors:", errors
|
||||
|
||||
if (self.caller.handCount!=0):
|
||||
|
|
Loading…
Reference in New Issue
Block a user