Cleanup in GuiBulkImport, trivial change to Tables.

This commit is contained in:
Ray 2009-02-26 11:53:31 -05:00
parent 333cbdbf6d
commit baefbb5a07
2 changed files with 15 additions and 8 deletions

11
pyfpdb/GuiBulkImport.py Normal file → Executable file
View File

@ -40,9 +40,12 @@ class GuiBulkImport():
self.importer.addImportDirectory(self.path) self.importer.addImportDirectory(self.path)
self.importer.setCallHud(False) self.importer.setCallHud(False)
starttime = time() starttime = time()
if not self.importer.settings['threads'] > 1:
(stored, dups, partial, errs, ttime) = self.importer.runImport() (stored, dups, partial, errs, ttime) = self.importer.runImport()
print 'GuiBulkImport.import_dir done: Stored: %d Duplicates: %d Partial: %d Errors: %d in %s seconds - %d/sec'\ print 'GuiBulkImport.import_dir done: Stored: %d Duplicates: %d Partial: %d Errors: %d in %s seconds - %d/sec'\
% (stored, dups, partial, errs, ttime, stored / ttime) % (stored, dups, partial, errs, ttime, stored / ttime)
else:
self.importer.RunImportThreaded()
def load_clicked(self, widget, data=None): def load_clicked(self, widget, data=None):
# get the dir to import from the chooser # get the dir to import from the chooser
@ -73,6 +76,10 @@ class GuiBulkImport():
self.lab_info.set_text("Import finished") self.lab_info.set_text("Import finished")
def get_vbox(self):
"""returns the vbox of this thread"""
return self.vbox
def __init__(self, db, settings, config): def __init__(self, db, settings, config):
self.db = db # this is an instance of fpdb_db self.db = db # this is an instance of fpdb_db
self.settings = settings self.settings = settings
@ -115,7 +122,7 @@ class GuiBulkImport():
self.lab_threads = gtk.Label("Number of threads:") self.lab_threads = gtk.Label("Number of threads:")
self.table.attach(self.lab_threads, 3, 4, 0, 1, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.lab_threads, 3, 4, 0, 1, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
self.lab_threads.show() self.lab_threads.show()
self.lab_threads.set_sensitive(False) self.lab_threads.set_sensitive(True)
self.lab_threads.set_justify(gtk.JUSTIFY_RIGHT) self.lab_threads.set_justify(gtk.JUSTIFY_RIGHT)
# spin button - threads # spin button - threads
@ -123,7 +130,7 @@ class GuiBulkImport():
self.spin_threads = gtk.SpinButton(adjustment=threads_adj, climb_rate=0.0, digits=0) self.spin_threads = gtk.SpinButton(adjustment=threads_adj, climb_rate=0.0, digits=0)
self.table.attach(self.spin_threads, 4, 5, 0, 1, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.spin_threads, 4, 5, 0, 1, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
self.spin_threads.show() self.spin_threads.show()
self.spin_threads.set_sensitive(False) self.spin_threads.set_sensitive(True)
# checkbox - fail on error? # checkbox - fail on error?
self.chk_fail = gtk.CheckButton('Fail on error') self.chk_fail = gtk.CheckButton('Fail on error')

View File

@ -390,9 +390,9 @@ if __name__=="__main__":
print discover_table_by_name(c, "Ringe") print discover_table_by_name(c, "Ringe")
# print discover_tournament_table(c, "118942908", "3") # print discover_tournament_table(c, "118942908", "3")
# tables = discover(c) tables = discover(c)
# for t in tables.keys(): for t in tables.keys():
# print tables[t] print tables[t]
print "press enter to continue" print "press enter to continue"
sys.stdin.readline() sys.stdin.readline()