merge with ray/carl

GuiGraphViewer: configure matplotlib to use GTK properly, add in error handling for graphing across a database with hands the player you've requested wasn't involved in. please see # todo note on that.
This commit is contained in:
eblade 2008-11-12 06:30:49 -05:00
parent 6e182831ac
commit 5903988e38

View File

@ -23,6 +23,8 @@ import os
#import pokereval #import pokereval
try: try:
import matplotlib
matplotlib.use('GTK')
from matplotlib.figure import Figure from matplotlib.figure import Figure
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
@ -97,7 +99,12 @@ class GuiGraphViewer (threading.Thread):
for i in profit: for i in profit:
self.cursor.execute(self.sql.query['getRingProfitFromHandId'], (name, winnings[i][0], site)) self.cursor.execute(self.sql.query['getRingProfitFromHandId'], (name, winnings[i][0], site))
spent = self.db.cursor.fetchone() spent = self.db.cursor.fetchone()
if not spent[0] == None:
profit[i]=(i, winnings[i][1]-spent[0]) profit[i]=(i, winnings[i][1]-spent[0])
else:
profit[i] = (i, 0)
# todo: this probably adds in flat spots on your graph for hands you were not involved in (ie, observing, sitting out, etc)
# and has that counted in your hand totals. Someone needs to figure out the SQL for totally removing any hand you're not in from the equation entirely
y=map(lambda x:float(x[1]), profit) y=map(lambda x:float(x[1]), profit)
line = cumsum(y) line = cumsum(y)