mostly formatting cleanups

This commit is contained in:
unknown 2009-11-03 15:06:48 -05:00
parent 0759ded78f
commit d008eceaef
2 changed files with 51 additions and 34 deletions

View File

@ -33,10 +33,9 @@ import string
class GuiAutoImport (threading.Thread): class GuiAutoImport (threading.Thread):
def __init__(self, settings, config, sql): def __init__(self, settings, config, sql):
"""Constructor for GuiAutoImport"""
self.importtimer = 0 self.importtimer = 0
self.settings=settings self.settings = settings
self.config=config self.config = config
self.sql = sql self.sql = sql
imp = self.config.get_import_parameters() imp = self.config.get_import_parameters()
@ -55,12 +54,12 @@ class GuiAutoImport (threading.Thread):
self.importer.setHandCount(0) self.importer.setHandCount(0)
# self.importer.setWatchTime() # self.importer.setWatchTime()
self.server=settings['db-host'] self.server = settings['db-host']
self.user=settings['db-user'] self.user = settings['db-user']
self.password=settings['db-password'] self.password = settings['db-password']
self.database=settings['db-databaseName'] self.database = settings['db-databaseName']
self.mainVBox=gtk.VBox(False,1) self.mainVBox = gtk.VBox(False,1)
hbox = gtk.HBox(True, 0) # contains 2 equal vboxes hbox = gtk.HBox(True, 0) # contains 2 equal vboxes
self.mainVBox.pack_start(hbox, False, False, 0) self.mainVBox.pack_start(hbox, False, False, 0)
@ -144,8 +143,7 @@ class GuiAutoImport (threading.Thread):
sys.stdout.flush() sys.stdout.flush()
gobject.timeout_add(1000, self.reset_startbutton) gobject.timeout_add(1000, self.reset_startbutton)
return True return True
else: return False
return False
def reset_startbutton(self): def reset_startbutton(self):
if self.pipe_to_hud is not None: if self.pipe_to_hud is not None:
@ -230,7 +228,7 @@ class GuiAutoImport (threading.Thread):
#enabling and disabling sites from this interface not possible #enabling and disabling sites from this interface not possible
#expects a box to layout the line horizontally #expects a box to layout the line horizontally
def createSiteLine(self, hbox1, hbox2, site, iconpath, hhpath, filter_name, active = True): def createSiteLine(self, hbox1, hbox2, site, iconpath, hhpath, filter_name, active = True):
label = gtk.Label(site + " auto-import:") label = gtk.Label("%s auto-import:" % site)
hbox1.pack_start(label, False, False, 3) hbox1.pack_start(label, False, False, 3)
label.show() label.show()
@ -244,7 +242,7 @@ class GuiAutoImport (threading.Thread):
hbox2.pack_start(browseButton, False, False, 3) hbox2.pack_start(browseButton, False, False, 3)
browseButton.show() browseButton.show()
label = gtk.Label(' ' + site + " filter:") label = gtk.Label("%s filter:" % site)
hbox2.pack_start(label, False, False, 3) hbox2.pack_start(label, False, False, 3)
label.show() label.show()

View File

@ -142,32 +142,38 @@ class GuiBulkImport():
self.chooser.show() self.chooser.show()
# Table widget to hold the settings # Table widget to hold the settings
self.table = gtk.Table(rows = 5, columns = 5, homogeneous = False) self.table = gtk.Table(rows=5, columns=5, homogeneous=False)
self.vbox.add(self.table) self.vbox.add(self.table)
self.table.show() self.table.show()
# checkbox - print start/stop? # checkbox - print start/stop?
self.chk_st_st = gtk.CheckButton('Print Start/Stop Info') self.chk_st_st = gtk.CheckButton('Print Start/Stop Info')
self.table.attach(self.chk_st_st, 0, 1, 0, 1, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.chk_st_st, 0, 1, 0, 1, xpadding=10, ypadding=0,
yoptions=gtk.SHRINK)
self.chk_st_st.show() self.chk_st_st.show()
self.chk_st_st.set_active(True) self.chk_st_st.set_active(True)
# label - status # label - status
self.lab_status = gtk.Label("Hands/status print:") self.lab_status = gtk.Label("Hands/status print:")
self.table.attach(self.lab_status, 1, 2, 0, 1, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.lab_status, 1, 2, 0, 1, xpadding=0, ypadding=0,
yoptions=gtk.SHRINK)
self.lab_status.show() self.lab_status.show()
self.lab_status.set_justify(gtk.JUSTIFY_RIGHT) self.lab_status.set_justify(gtk.JUSTIFY_RIGHT)
self.lab_status.set_alignment(1.0, 0.5) self.lab_status.set_alignment(1.0, 0.5)
# spin button - status # spin button - status
status_adj = gtk.Adjustment(value=100, lower=0, upper=300, step_incr=10, page_incr=1, page_size=0) #not sure what upper value should be! status_adj = gtk.Adjustment(value=100, lower=0, upper=300, step_incr=10,
self.spin_status = gtk.SpinButton(adjustment=status_adj, climb_rate=0.0, digits=0) page_incr=1, page_size=0) #not sure what upper value should be!
self.table.attach(self.spin_status, 2, 3, 0, 1, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK) self.spin_status = gtk.SpinButton(adjustment=status_adj, climb_rate=0.0,
digits=0)
self.table.attach(self.spin_status, 2, 3, 0, 1, xpadding=10, ypadding=0,
yoptions=gtk.SHRINK)
self.spin_status.show() self.spin_status.show()
# label - threads # label - threads
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()
if not self.allowThreads: if not self.allowThreads:
self.lab_threads.set_sensitive(False) self.lab_threads.set_sensitive(False)
@ -175,34 +181,39 @@ class GuiBulkImport():
self.lab_threads.set_alignment(1.0, 0.5) self.lab_threads.set_alignment(1.0, 0.5)
# spin button - threads # spin button - threads
threads_adj = gtk.Adjustment(value=0, lower=0, upper=32, step_incr=1, page_incr=1, page_size=0) #not sure what upper value should be! threads_adj = gtk.Adjustment(value=0, lower=0, upper=32, step_incr=1,
page_incr=1, page_size=0) #not sure what upper value should be!
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 = 10, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.spin_threads, 4, 5, 0, 1, xpadding=10, ypadding=0,
yoptions=gtk.SHRINK)
self.spin_threads.show() self.spin_threads.show()
if not self.allowThreads: if not self.allowThreads:
self.spin_threads.set_sensitive(False) self.spin_threads.set_sensitive(False)
# checkbox - fail on error? # checkbox - fail on error?
self.chk_fail = gtk.CheckButton('Fail on error') self.chk_fail = gtk.CheckButton('Fail on error')
self.table.attach(self.chk_fail, 0, 1, 1, 2, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.chk_fail, 0, 1, 1, 2, xpadding=10, ypadding=0, yoptions=gtk.SHRINK)
self.chk_fail.show() self.chk_fail.show()
# label - hands # label - hands
self.lab_hands = gtk.Label("Hands/file:") self.lab_hands = gtk.Label("Hands/file:")
self.table.attach(self.lab_hands, 1, 2, 1, 2, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.lab_hands, 1, 2, 1, 2, xpadding=0, ypadding=0, yoptions=gtk.SHRINK)
self.lab_hands.show() self.lab_hands.show()
self.lab_hands.set_justify(gtk.JUSTIFY_RIGHT) self.lab_hands.set_justify(gtk.JUSTIFY_RIGHT)
self.lab_hands.set_alignment(1.0, 0.5) self.lab_hands.set_alignment(1.0, 0.5)
# spin button - hands to import # spin button - hands to import
hands_adj = gtk.Adjustment(value=0, lower=0, upper=10, step_incr=1, page_incr=1, page_size=0) #not sure what upper value should be! hands_adj = gtk.Adjustment(value=0, lower=0, upper=10, step_incr=1,
page_incr=1, page_size=0) #not sure what upper value should be!
self.spin_hands = gtk.SpinButton(adjustment=hands_adj, climb_rate=0.0, digits=0) self.spin_hands = gtk.SpinButton(adjustment=hands_adj, climb_rate=0.0, digits=0)
self.table.attach(self.spin_hands, 2, 3, 1, 2, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.spin_hands, 2, 3, 1, 2, xpadding=10, ypadding=0,
yoptions=gtk.SHRINK)
self.spin_hands.show() self.spin_hands.show()
# label - drop indexes # label - drop indexes
self.lab_drop = gtk.Label("Drop indexes:") self.lab_drop = gtk.Label("Drop indexes:")
self.table.attach(self.lab_drop, 3, 4, 1, 2, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.lab_drop, 3, 4, 1, 2, xpadding=0, ypadding=0,
yoptions=gtk.SHRINK)
self.lab_drop.show() self.lab_drop.show()
self.lab_drop.set_justify(gtk.JUSTIFY_RIGHT) self.lab_drop.set_justify(gtk.JUSTIFY_RIGHT)
self.lab_drop.set_alignment(1.0, 0.5) self.lab_drop.set_alignment(1.0, 0.5)
@ -213,12 +224,14 @@ class GuiBulkImport():
self.cb_dropindexes.append_text("don't drop") self.cb_dropindexes.append_text("don't drop")
self.cb_dropindexes.append_text('drop') self.cb_dropindexes.append_text('drop')
self.cb_dropindexes.set_active(0) self.cb_dropindexes.set_active(0)
self.table.attach(self.cb_dropindexes, 4, 5, 1, 2, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.cb_dropindexes, 4, 5, 1, 2, xpadding=10,
ypadding=0, yoptions=gtk.SHRINK)
self.cb_dropindexes.show() self.cb_dropindexes.show()
# label - filter # label - filter
self.lab_filter = gtk.Label("Site filter:") self.lab_filter = gtk.Label("Site filter:")
self.table.attach(self.lab_filter, 1, 2, 2, 3, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.lab_filter, 1, 2, 2, 3, xpadding=0, ypadding=0,
yoptions=gtk.SHRINK)
self.lab_filter.show() self.lab_filter.show()
self.lab_filter.set_justify(gtk.JUSTIFY_RIGHT) self.lab_filter.set_justify(gtk.JUSTIFY_RIGHT)
self.lab_filter.set_alignment(1.0, 0.5) self.lab_filter.set_alignment(1.0, 0.5)
@ -229,12 +242,14 @@ class GuiBulkImport():
print w print w
self.cbfilter.append_text(w) self.cbfilter.append_text(w)
self.cbfilter.set_active(0) self.cbfilter.set_active(0)
self.table.attach(self.cbfilter, 2, 3, 2, 3, xpadding = 10, ypadding = 1, yoptions=gtk.SHRINK) self.table.attach(self.cbfilter, 2, 3, 2, 3, xpadding=10, ypadding=1,
yoptions=gtk.SHRINK)
self.cbfilter.show() self.cbfilter.show()
# label - drop hudcache # label - drop hudcache
self.lab_hdrop = gtk.Label("Drop HudCache:") self.lab_hdrop = gtk.Label("Drop HudCache:")
self.table.attach(self.lab_hdrop, 3, 4, 2, 3, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.lab_hdrop, 3, 4, 2, 3, xpadding=0, ypadding=0,
yoptions=gtk.SHRINK)
self.lab_hdrop.show() self.lab_hdrop.show()
self.lab_hdrop.set_justify(gtk.JUSTIFY_RIGHT) self.lab_hdrop.set_justify(gtk.JUSTIFY_RIGHT)
self.lab_hdrop.set_alignment(1.0, 0.5) self.lab_hdrop.set_alignment(1.0, 0.5)
@ -245,19 +260,22 @@ class GuiBulkImport():
self.cb_drophudcache.append_text("don't drop") self.cb_drophudcache.append_text("don't drop")
self.cb_drophudcache.append_text('drop') self.cb_drophudcache.append_text('drop')
self.cb_drophudcache.set_active(0) self.cb_drophudcache.set_active(0)
self.table.attach(self.cb_drophudcache, 4, 5, 2, 3, xpadding = 10, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.cb_drophudcache, 4, 5, 2, 3, xpadding=10,
ypadding=0, yoptions=gtk.SHRINK)
self.cb_drophudcache.show() self.cb_drophudcache.show()
# button - Import # button - Import
self.load_button = gtk.Button('Import') # todo: rename variables to import too self.load_button = gtk.Button('Import') # todo: rename variables to import too
self.load_button.connect('clicked', self.load_clicked, self.load_button.connect('clicked', self.load_clicked,
'Import clicked') 'Import clicked')
self.table.attach(self.load_button, 2, 3, 4, 5, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.load_button, 2, 3, 4, 5, xpadding=0, ypadding=0,
yoptions=gtk.SHRINK)
self.load_button.show() self.load_button.show()
# label - spacer (keeps rows 3 & 5 apart) # label - spacer (keeps rows 3 & 5 apart)
self.lab_spacer = gtk.Label() self.lab_spacer = gtk.Label()
self.table.attach(self.lab_spacer, 3, 5, 3, 4, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) self.table.attach(self.lab_spacer, 3, 5, 3, 4, xpadding=0, ypadding=0,
yoptions=gtk.SHRINK)
self.lab_spacer.show() self.lab_spacer.show()
# label - info # label - info
@ -265,7 +283,8 @@ class GuiBulkImport():
# self.table.attach(self.lab_info, 3, 5, 4, 5, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK) # self.table.attach(self.lab_info, 3, 5, 4, 5, xpadding = 0, ypadding = 0, yoptions=gtk.SHRINK)
# self.lab_info.show() # self.lab_info.show()
self.progressbar = gtk.ProgressBar() self.progressbar = gtk.ProgressBar()
self.table.attach(self.progressbar, 3, 5, 4, 5, xpadding = 0, ypadding = 0, yoptions = gtk.SHRINK) self.table.attach(self.progressbar, 3, 5, 4, 5, xpadding=0, ypadding=0,
yoptions=gtk.SHRINK)
self.progressbar.set_text("Waiting...") self.progressbar.set_text("Waiting...")
self.progressbar.set_fraction(0) self.progressbar.set_fraction(0)
self.progressbar.show() self.progressbar.show()