Add ability for Filters to hide() panes
Also add ability to register a callback and name 2 buttons on hte left panel
This commit is contained in:
parent
1939979e3c
commit
ee1186bd57
|
@ -30,7 +30,7 @@ import fpdb_db
|
|||
import FpdbSQLQueries
|
||||
|
||||
class Filters(threading.Thread):
|
||||
def __init__(self, db, settings, config, qdict, debug=True):
|
||||
def __init__(self, db, settings, config, qdict, display = {},debug=True):
|
||||
self.debug=debug
|
||||
#print "start of GraphViewer constructor"
|
||||
self.db=db
|
||||
|
@ -78,7 +78,7 @@ class Filters(threading.Thread):
|
|||
gamesFrame.add(vbox)
|
||||
|
||||
# Limits
|
||||
limitsFrame = gtk.Frame("Games:")
|
||||
limitsFrame = gtk.Frame("Limits:")
|
||||
limitsFrame.set_label_align(0.0, 0.0)
|
||||
limitsFrame.show()
|
||||
vbox = gtk.VBox(False, 0)
|
||||
|
@ -94,23 +94,38 @@ class Filters(threading.Thread):
|
|||
self.fillDateFrame(vbox)
|
||||
dateFrame.add(vbox)
|
||||
|
||||
self.graphButton=gtk.Button("Generate Graph")
|
||||
self.Button1=gtk.Button("Unamed 1")
|
||||
|
||||
self.fig = None
|
||||
self.exportButton=gtk.Button("Export to File")
|
||||
self.Button2=gtk.Button("Unamed 2")
|
||||
#self.exportButton.connect("clicked", self.exportGraph, "show clicked")
|
||||
self.exportButton.set_sensitive(False)
|
||||
self.Button2.set_sensitive(False)
|
||||
|
||||
self.mainVBox.add(playerFrame)
|
||||
self.mainVBox.add(sitesFrame)
|
||||
self.mainVBox.add(gamesFrame)
|
||||
self.mainVBox.add(limitsFrame)
|
||||
self.mainVBox.add(dateFrame)
|
||||
self.mainVBox.add(self.graphButton)
|
||||
self.mainVBox.add(self.exportButton)
|
||||
self.mainVBox.add(self.Button1)
|
||||
self.mainVBox.add(self.Button2)
|
||||
|
||||
self.mainVBox.show_all()
|
||||
|
||||
# Should do this cleaner
|
||||
if display["Heroes"] == False:
|
||||
playerFrame.hide()
|
||||
if display["Sites"] == False:
|
||||
sitesFrame.hide()
|
||||
if display["Games"] == False:
|
||||
gamesFrame.hide()
|
||||
if display["Limits"] == False:
|
||||
limitsFrame.hide()
|
||||
if display["Dates"] == False:
|
||||
dateFrame.hide()
|
||||
if display["Button1"] == False:
|
||||
self.Button1.hide()
|
||||
if display["Button2"] == False:
|
||||
self.Button2.hide()
|
||||
|
||||
def get_vbox(self):
|
||||
"""returns the vbox of this thread"""
|
||||
return self.mainVBox
|
||||
|
@ -135,8 +150,17 @@ class Filters(threading.Thread):
|
|||
def getDates(self):
|
||||
return self.__get_dates()
|
||||
|
||||
def registerGraphCallback(self, callback):
|
||||
self.graphButton.connect("clicked", callback, "clicked")
|
||||
def registerButton1Name(self, title):
|
||||
self.Button1.set_label(title)
|
||||
|
||||
def registerButton1Callback(self, callback):
|
||||
self.Button1.connect("clicked", callback, "clicked")
|
||||
|
||||
def registerButton2Name(self, title):
|
||||
self.Button2.set_label(title)
|
||||
|
||||
def registerButton2Callback(self, callback):
|
||||
self.Button2.connect("clicked", callback, "clicked")
|
||||
|
||||
def cardCallback(self, widget, data=None):
|
||||
print "DEBUG: %s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
|
||||
|
|
|
@ -53,8 +53,20 @@ class GuiGraphViewer (threading.Thread):
|
|||
self.sql=querylist
|
||||
self.conf = config
|
||||
|
||||
self.filters = Filters.Filters(db, settings, config, querylist)
|
||||
self.filters.registerGraphCallback(self.generateGraph)
|
||||
filters_display = { "Heroes" : True,
|
||||
"Sites" : True,
|
||||
"Games" : True,
|
||||
"Limits" : True,
|
||||
"Dates" : True,
|
||||
"Button1" : True,
|
||||
"Button2" : True
|
||||
}
|
||||
|
||||
self.filters = Filters.Filters(db, settings, config, querylist, display = filters_display)
|
||||
self.filters.registerButton1Name("Refresh Graph")
|
||||
self.filters.registerButton1Callback(self.generateGraph)
|
||||
self.filters.registerButton2Name("Export to File")
|
||||
self.filters.registerButton2Callback(self.exportGraph)
|
||||
|
||||
self.mainHBox = gtk.HBox(False, 0)
|
||||
self.mainHBox.show()
|
||||
|
@ -69,9 +81,7 @@ class GuiGraphViewer (threading.Thread):
|
|||
self.mainHBox.add(self.hpane)
|
||||
|
||||
self.fig = None
|
||||
self.exportButton=gtk.Button("Export to File")
|
||||
self.exportButton.connect("clicked", self.exportGraph, "show clicked")
|
||||
self.exportButton.set_sensitive(False)
|
||||
#self.exportButton.set_sensitive(False)
|
||||
|
||||
self.fig = Figure(figsize=(5,4), dpi=100)
|
||||
self.canvas = None
|
||||
|
|
|
@ -43,7 +43,16 @@ class GuiPlayerStats (threading.Thread):
|
|||
settings.update(config.get_import_parameters())
|
||||
settings.update(config.get_default_paths())
|
||||
|
||||
self.filters = Filters.Filters(db, settings, config, querylist)
|
||||
filters_display = { "Heroes" : True,
|
||||
"Sites" : True,
|
||||
"Games" : False,
|
||||
"Limits" : False,
|
||||
"Dates" : False,
|
||||
"Button1" : False,
|
||||
"Button2" : False
|
||||
}
|
||||
|
||||
self.filters = Filters.Filters(db, settings, config, querylist, display = filters_display)
|
||||
|
||||
self.stat_table = None
|
||||
self.stats_frame = None
|
||||
|
|
|
@ -43,7 +43,16 @@ class GuiPositionalStats (threading.Thread):
|
|||
settings.update(config.get_import_parameters())
|
||||
settings.update(config.get_default_paths())
|
||||
|
||||
self.filters = Filters.Filters(db, settings, config, querylist)
|
||||
filters_display = { "Heroes" : True,
|
||||
"Sites" : True,
|
||||
"Games" : False,
|
||||
"Limits" : False,
|
||||
"Dates" : False,
|
||||
"Button1" : False,
|
||||
"Button2" : False
|
||||
}
|
||||
|
||||
self.filters = Filters.Filters(db, settings, config, querylist, display = filters_display)
|
||||
|
||||
self.stat_table = None
|
||||
self.stats_frame = None
|
||||
|
|
Loading…
Reference in New Issue
Block a user