From baefbb5a074d5fa4e8de63859f579def69c7fc0e Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 26 Feb 2009 11:53:31 -0500 Subject: [PATCH] Cleanup in GuiBulkImport, trivial change to Tables. --- pyfpdb/GuiBulkImport.py | 17 ++++++++++++----- pyfpdb/Tables.py | 6 +++--- 2 files changed, 15 insertions(+), 8 deletions(-) mode change 100644 => 100755 pyfpdb/GuiBulkImport.py diff --git a/pyfpdb/GuiBulkImport.py b/pyfpdb/GuiBulkImport.py old mode 100644 new mode 100755 index 6f06f232..4a6acb8a --- a/pyfpdb/GuiBulkImport.py +++ b/pyfpdb/GuiBulkImport.py @@ -40,9 +40,12 @@ class GuiBulkImport(): self.importer.addImportDirectory(self.path) self.importer.setCallHud(False) starttime = time() - (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'\ - % (stored, dups, partial, errs, ttime, stored / ttime) + if not self.importer.settings['threads'] > 1: + (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'\ + % (stored, dups, partial, errs, ttime, stored / ttime) + else: + self.importer.RunImportThreaded() def load_clicked(self, widget, data=None): # get the dir to import from the chooser @@ -73,6 +76,10 @@ class GuiBulkImport(): 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): self.db = db # this is an instance of fpdb_db self.settings = settings @@ -115,7 +122,7 @@ class GuiBulkImport(): 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.lab_threads.show() - self.lab_threads.set_sensitive(False) + self.lab_threads.set_sensitive(True) self.lab_threads.set_justify(gtk.JUSTIFY_RIGHT) # spin button - threads @@ -123,7 +130,7 @@ class GuiBulkImport(): 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.spin_threads.show() - self.spin_threads.set_sensitive(False) + self.spin_threads.set_sensitive(True) # checkbox - fail on error? self.chk_fail = gtk.CheckButton('Fail on error') diff --git a/pyfpdb/Tables.py b/pyfpdb/Tables.py index 6655b7a6..3373a1cb 100755 --- a/pyfpdb/Tables.py +++ b/pyfpdb/Tables.py @@ -390,9 +390,9 @@ if __name__=="__main__": print discover_table_by_name(c, "Ringe") # print discover_tournament_table(c, "118942908", "3") -# tables = discover(c) -# for t in tables.keys(): -# print tables[t] + tables = discover(c) + for t in tables.keys(): + print tables[t] print "press enter to continue" sys.stdin.readline()