p87 - added profit graph kindly sent by Carl Gherardi, it's got fixed player id and is using the wrong table fields right now, will fix that tomorrow or so. note that this adds a new dependency, matplotlib, but I put it into a try except loop to avoid load failure
added subfolder gentoo to packaging folder and added it to release script
This commit is contained in:
parent
672d2d70af
commit
009161d55b
|
@ -21,6 +21,7 @@ rm pyfpdb/*.pyc
|
||||||
|
|
||||||
mkdir fpdb-$1
|
mkdir fpdb-$1
|
||||||
cp -R docs fpdb-$1/
|
cp -R docs fpdb-$1/
|
||||||
|
cp -R packaging fpdb-$1/
|
||||||
cp -R pyfpdb fpdb-$1/
|
cp -R pyfpdb fpdb-$1/
|
||||||
rm fpdb-$1/pyfpdb/HUD_config.*
|
rm fpdb-$1/pyfpdb/HUD_config.*
|
||||||
cp pyfpdb/HUD_config.xml.example fpdb-$1/pyfpdb/
|
cp pyfpdb/HUD_config.xml.example fpdb-$1/pyfpdb/
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
todolist (db=database, imp=importer, tv=tableviewer)
|
|
||||||
Everything is subject to change and the order does not indicate priority. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts.
|
Everything is subject to change and the order does not indicate priority. Patches for any of these or other features are very welcome, see readme-overview.txt for contacts.
|
||||||
Please also see db-todo.txt
|
Please also see db-todo.txt
|
||||||
|
|
||||||
alpha4 (release 25Sep-2Oct)
|
alpha4 (release 25Sep-2Oct)
|
||||||
======
|
======
|
||||||
|
graph: fixed player id and using the wrong table fields, update dependencies.txt
|
||||||
newsletter&mailing list
|
newsletter&mailing list
|
||||||
update requirements to include new pgsql interface lib and rename to dependencies.txt
|
update requirements to include new pgsql interface lib
|
||||||
ebuild: support pgsql
|
ebuild: support pgsql
|
||||||
fix HUD config location and update release script accordingly
|
fix HUD config location and update release script accordingly
|
||||||
|
|
||||||
|
|
93
pyfpdb/GuiGraphViewer.py
Normal file
93
pyfpdb/GuiGraphViewer.py
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
#Copyright 2008 Steffen Jobbagy-Felso
|
||||||
|
#This program is free software: you can redistribute it and/or modify
|
||||||
|
#it under the terms of the GNU Affero General Public License as published by
|
||||||
|
#the Free Software Foundation, version 3 of the License.
|
||||||
|
#
|
||||||
|
#This program is distributed in the hope that it will be useful,
|
||||||
|
#but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
#GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
#You should have received a copy of the GNU Affero General Public License
|
||||||
|
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#In the "official" distribution you can find the license in
|
||||||
|
#agpl-3.0.txt in the docs folder of the package.
|
||||||
|
|
||||||
|
import threading
|
||||||
|
import pygtk
|
||||||
|
pygtk.require('2.0')
|
||||||
|
import gtk
|
||||||
|
import os
|
||||||
|
|
||||||
|
try:
|
||||||
|
from matplotlib.figure import Figure
|
||||||
|
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
|
||||||
|
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
|
||||||
|
from numpy import arange, sin, pi
|
||||||
|
except:
|
||||||
|
print "Failed to load libs for graphing, graphing will not function. Please install numpy and matplotlib."
|
||||||
|
|
||||||
|
try:
|
||||||
|
import MySQLdb
|
||||||
|
except:
|
||||||
|
diaSQLLibMissing = gtk.Dialog(title="Fatal Error - SQL interface library missing", parent=None, flags=0, buttons=(gtk.STOCK_QUIT,gtk.RESPONSE_OK))
|
||||||
|
|
||||||
|
label = gtk.Label("Please note that the table viewer only works with MySQL, if you use PostgreSQL this error is expected.")
|
||||||
|
diaSQLLibMissing.vbox.add(label)
|
||||||
|
label.show()
|
||||||
|
|
||||||
|
label = gtk.Label("Since the HUD now runs on all supported plattforms I do not see any point in table viewer anymore, if you disagree please send a message to steffen@sycamoretest.info")
|
||||||
|
diaSQLLibMissing.vbox.add(label)
|
||||||
|
label.show()
|
||||||
|
|
||||||
|
response = diaSQLLibMissing.run()
|
||||||
|
#sys.exit(1)
|
||||||
|
|
||||||
|
import fpdb_import
|
||||||
|
import fpdb_db
|
||||||
|
|
||||||
|
class GuiGraphViewer (threading.Thread):
|
||||||
|
def get_vbox(self):
|
||||||
|
"""returns the vbox of this thread"""
|
||||||
|
return self.main_vbox
|
||||||
|
#end def get_vbox
|
||||||
|
|
||||||
|
def __init__(self, db, settings, debug=True):
|
||||||
|
"""Constructor for table_viewer"""
|
||||||
|
self.debug=debug
|
||||||
|
#print "start of table_viewer constructor"
|
||||||
|
self.db=db
|
||||||
|
self.cursor=db.cursor
|
||||||
|
self.settings=settings
|
||||||
|
|
||||||
|
self.main_vbox = gtk.VBox(False, 0)
|
||||||
|
self.main_vbox.show()
|
||||||
|
|
||||||
|
self.fig = Figure(figsize=(5,4), dpi=100)
|
||||||
|
self.ax = self.fig.add_subplot(111)
|
||||||
|
# x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
|
# y = [2.7, 2.8, 31.4, 38.1, 58.0, 76.2, 100.5, 130.0, 149.3, 180.0]
|
||||||
|
|
||||||
|
self.db.reconnect()
|
||||||
|
self.cursor=self.db.cursor
|
||||||
|
|
||||||
|
self.db.cursor.execute("SELECT handId, winnings FROM HandsPlayers WHERE playerId=1 ORDER BY handId")
|
||||||
|
|
||||||
|
self.results = self.db.cursor.fetchall()
|
||||||
|
|
||||||
|
# x=map(lambda x:float(x[0]),self.results)
|
||||||
|
y=map(lambda x:float(x[1]),self.results)
|
||||||
|
line = range(len(y))
|
||||||
|
|
||||||
|
for i in range(len(y)):
|
||||||
|
line[i] = y[i] + line[i-1]
|
||||||
|
|
||||||
|
self.ax.plot(line,)
|
||||||
|
|
||||||
|
self.canvas = FigureCanvas(self.fig) # a gtk.DrawingArea
|
||||||
|
self.main_vbox.pack_start(self.canvas)
|
||||||
|
self.canvas.show()
|
||||||
|
|
||||||
|
#end of table_viewer.__init__
|
|
@ -27,6 +27,7 @@ import fpdb_simple
|
||||||
import GuiBulkImport
|
import GuiBulkImport
|
||||||
import GuiTableViewer
|
import GuiTableViewer
|
||||||
import GuiAutoImport
|
import GuiAutoImport
|
||||||
|
import GuiGraphViewer
|
||||||
|
|
||||||
class fpdb:
|
class fpdb:
|
||||||
def tab_clicked(self, widget, tab_name):
|
def tab_clicked(self, widget, tab_name):
|
||||||
|
@ -399,6 +400,15 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
self.add_and_display_tab(tv_tab, "Table Viewer")
|
self.add_and_display_tab(tv_tab, "Table Viewer")
|
||||||
#end def tab_table_viewer
|
#end def tab_table_viewer
|
||||||
|
|
||||||
|
def tabGraphViewer(self, widget, data):
|
||||||
|
"""opens a graph viewer tab"""
|
||||||
|
#print "start of tabGraphViewer"
|
||||||
|
new_gv_thread=GuiGraphViewer.GuiGraphViewer(self.db, self.settings)
|
||||||
|
self.threads.append(new_gv_thread)
|
||||||
|
gv_tab=new_gv_thread.get_vbox()
|
||||||
|
self.add_and_display_tab(gv_tab, "Graphs")
|
||||||
|
#end def tabGraphViewer
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.threads=[]
|
self.threads=[]
|
||||||
self.db=None
|
self.db=None
|
||||||
|
@ -407,7 +417,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||||
self.window.connect("delete_event", self.delete_event)
|
self.window.connect("delete_event", self.delete_event)
|
||||||
self.window.connect("destroy", self.destroy)
|
self.window.connect("destroy", self.destroy)
|
||||||
self.window.set_title("Free Poker DB - version: alpha4, p86")
|
self.window.set_title("Free Poker DB - version: alpha4+, p87 or higher")
|
||||||
self.window.set_border_width(1)
|
self.window.set_border_width(1)
|
||||||
self.window.set_size_request(1020,400)
|
self.window.set_size_request(1020,400)
|
||||||
self.window.set_resizable(True)
|
self.window.set_resizable(True)
|
||||||
|
@ -425,7 +435,7 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
|
||||||
("/Import/Auto _Rating (todo)", "<control>R", self.not_implemented, 0, None ),
|
("/Import/Auto _Rating (todo)", "<control>R", self.not_implemented, 0, None ),
|
||||||
("/_Viewers", None, None, 0, "<Branch>" ),
|
("/_Viewers", None, None, 0, "<Branch>" ),
|
||||||
("/_Viewers/_Auto Import and HUD", "<control>A", self.tab_auto_import, 0, None ),
|
("/_Viewers/_Auto Import and HUD", "<control>A", self.tab_auto_import, 0, None ),
|
||||||
("/Viewers/_Graphs (todo)", None, self.not_implemented, 0, None ),
|
("/Viewers/_Graphs", None, self.tabGraphViewer, 0, None ),
|
||||||
("/Viewers/Hand _Replayer (todo)", None, self.not_implemented, 0, None ),
|
("/Viewers/Hand _Replayer (todo)", None, self.not_implemented, 0, None ),
|
||||||
("/Viewers/Player _Details (todo)", None, self.not_implemented, 0, None ),
|
("/Viewers/Player _Details (todo)", None, self.not_implemented, 0, None ),
|
||||||
("/Viewers/_Player Stats (tabulated view) (todo)", None, self.not_implemented, 0, None ),
|
("/Viewers/_Player Stats (tabulated view) (todo)", None, self.not_implemented, 0, None ),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user