From a125e77135959a7eea4d17609b2c3497fa6c3e34 Mon Sep 17 00:00:00 2001 From: Worros Date: Mon, 4 Oct 2010 11:56:52 +0800 Subject: [PATCH] Grapher/Filters: Fix graph labels and whitespace Remove some trailing whitespace from Antistffs patch. Change format of Graph labels from: Blah: $0.00 or Blah 0.00BB to Blah($|BB): 0.00 --- pyfpdb/Filters.py | 6 +++--- pyfpdb/GuiGraphViewer.py | 38 ++++++-------------------------------- 2 files changed, 9 insertions(+), 35 deletions(-) diff --git a/pyfpdb/Filters.py b/pyfpdb/Filters.py index 4226bced..a4660eb2 100644 --- a/pyfpdb/Filters.py +++ b/pyfpdb/Filters.py @@ -106,7 +106,7 @@ class Filters(threading.Thread): self.numHands = 0 # for use in graphops - # dspin = display in '$' or 'B' + # dspin = display in '$' or 'B' self.graphops['dspin'] = "$" self.graphops['showdown'] = 'OFF' self.graphops['nonshowdown'] = 'OFF' @@ -566,7 +566,7 @@ class Filters(threading.Thread): def __set_displayin_select(self, w, ops): self.graphops['dspin'] = ops - + def __set_graphopscheck_select(self, w, data): #print "%s was toggled %s" % (data, ("OFF", "ON")[w.get_active()]) self.graphops[data] = ("OFF", "ON")[w.get_active()] @@ -841,7 +841,7 @@ class Filters(threading.Thread): button = gtk.CheckButton("Showdown Winnings", False) vbox1.pack_start(button, True, True, 0) - # wouldn't it be awesome if there was a way to remember the state of things like + # wouldn't it be awesome if there was a way to remember the state of things like # this and be able to set it to what it was last time? #button.set_active(True) button.connect("toggled", self.__set_graphopscheck_select, "showdown") diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index 7f4dc7b9..e6e783a6 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.py @@ -73,7 +73,7 @@ class GuiGraphViewer (threading.Thread): "Seats" : False, "SeatSep" : False, "Dates" : True, - "GraphOps" : True, + "GraphOps" : True, "Groups" : False, "Button1" : True, "Button2" : True @@ -146,11 +146,6 @@ class GuiGraphViewer (threading.Thread): limits = self.filters.getLimits() games = self.filters.getGames() graphops = self.filters.getGraphOps() - graphs = { - "profit" : True, - "sawShowdown" : True, - "nonShowdown" : True - } for i in ('show', 'none'): if i in limits: @@ -232,27 +227,11 @@ class GuiGraphViewer (threading.Thread): self.ax.set_title(_("Profit graph for ring games")) #Draw plot - # this if is only to switch the dollar sign in the labels - # since one goes in the front and one goes in back i cant think of a better - # way to do it. - if graphops['dspin'] == '$': - if graphs['profit'] == True: - self.ax.plot(green, color='green', label=_('Hands: %d\nProfit: $%.2f') %(len(green),green[-1])) - if graphops['showdown'] == 'ON': - if graphs['sawShowdown'] == True: - self.ax.plot(blue, color='blue', label=_('Showdown: $%.2f') %(blue[-1])) - if graphops['nonshowdown'] == 'ON': - if graphs['nonShowdown'] == True: - self.ax.plot(red, color='red', label=_('Non-showdown: $%.2f') %(red[-1])) - elif graphops['dspin'] == 'BB': - if graphs['profit'] == True: - self.ax.plot(green, color='green', label=_('Hands: %d\nProfit: %.2fBB') %(len(green),green[-1])) - if graphops['showdown'] == 'ON': - if graphs['sawShowdown'] == True: - self.ax.plot(blue, color='blue', label=_('Showdown: %.2fBB') %(blue[-1])) - if graphops['nonshowdown'] == 'ON': - if graphs['nonShowdown'] == True: - self.ax.plot(red, color='red', label=_('Non-showdown: %.2fBB') %(red[-1])) + self.ax.plot(green, color='green', label=_('Hands: %d\nProfit (%s): %.2f') %(len(green),graphops['dspin'], green[-1])) + if graphops['showdown'] == 'ON': + self.ax.plot(blue, color='blue', label=_('Showdown (%s): %.2f') %(graphops['dspin'], blue[-1])) + if graphops['nonshowdown'] == 'ON': + self.ax.plot(red, color='red', label=_('Non-showdown (%s): %.2f') %(graphops['dspin'], red[-1])) if sys.version[0:3] == '2.5': self.ax.legend(loc='upper left', shadow=True, prop=FontProperties(size='smaller')) @@ -270,11 +249,6 @@ class GuiGraphViewer (threading.Thread): #end of def showClicked - - - - - def getRingProfitGraph(self, names, sites, limits, games, units): # tmp = self.sql.query['getRingProfitAllHandsPlayerIdSite'] # print "DEBUG: getRingProfitGraph"