use Database.py in GuiPlayerStats
This commit is contained in:
parent
a1e0e0539a
commit
9d9f850753
|
@ -20,28 +20,29 @@ import pygtk
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
import gtk
|
import gtk
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
from time import time, strftime
|
from time import time, strftime
|
||||||
|
|
||||||
import Card
|
import Card
|
||||||
import fpdb_import
|
import fpdb_import
|
||||||
|
import Database
|
||||||
import fpdb_db
|
import fpdb_db
|
||||||
import Filters
|
import Filters
|
||||||
import FpdbSQLQueries
|
|
||||||
|
|
||||||
class GuiPlayerStats (threading.Thread):
|
class GuiPlayerStats (threading.Thread):
|
||||||
def __init__(self, config, querylist, mainwin, debug=True):
|
def __init__(self, config, querylist, mainwin, debug=True):
|
||||||
self.debug=debug
|
self.debug = debug
|
||||||
self.conf=config
|
self.conf = config
|
||||||
self.main_window=mainwin
|
self.main_window = mainwin
|
||||||
|
self.sql = querylist
|
||||||
|
|
||||||
self.MYSQL_INNODB = 2
|
self.MYSQL_INNODB = 2
|
||||||
self.PGSQL = 3
|
self.PGSQL = 3
|
||||||
self.SQLITE = 4
|
self.SQLITE = 4
|
||||||
|
|
||||||
# create new db connection to avoid conflicts with other threads
|
# create new db connection to avoid conflicts with other threads
|
||||||
self.db = fpdb_db.fpdb_db()
|
self.db = Database.Database(self.conf, sql=self.sql)
|
||||||
self.db.do_connect(self.conf)
|
self.cursor = self.db.cursor
|
||||||
self.cursor=self.db.cursor
|
|
||||||
self.sql = querylist
|
|
||||||
|
|
||||||
settings = {}
|
settings = {}
|
||||||
settings.update(config.get_db_parameters())
|
settings.update(config.get_db_parameters())
|
||||||
|
@ -216,7 +217,7 @@ class GuiPlayerStats (threading.Thread):
|
||||||
flags = [True]
|
flags = [True]
|
||||||
self.addTable(vbox1, 'playerDetailedStats', flags, playerids, sitenos, limits, seats, groups, dates)
|
self.addTable(vbox1, 'playerDetailedStats', flags, playerids, sitenos, limits, seats, groups, dates)
|
||||||
|
|
||||||
self.db.db.commit()
|
self.db.commit()
|
||||||
print "Stats page displayed in %4.2f seconds" % (time() - starttime)
|
print "Stats page displayed in %4.2f seconds" % (time() - starttime)
|
||||||
#end def fillStatsFrame(self, vbox):
|
#end def fillStatsFrame(self, vbox):
|
||||||
|
|
||||||
|
@ -280,8 +281,10 @@ class GuiPlayerStats (threading.Thread):
|
||||||
if column[colalias] == 'plposition':
|
if column[colalias] == 'plposition':
|
||||||
if value == 'B':
|
if value == 'B':
|
||||||
value = 'BB'
|
value = 'BB'
|
||||||
if value == 'S':
|
elif value == 'S':
|
||||||
value = 'SB'
|
value = 'SB'
|
||||||
|
elif value == '0':
|
||||||
|
value = 'Btn'
|
||||||
else:
|
else:
|
||||||
if column[colalias] == 'game':
|
if column[colalias] == 'game':
|
||||||
if holecards:
|
if holecards:
|
||||||
|
@ -379,7 +382,8 @@ class GuiPlayerStats (threading.Thread):
|
||||||
|
|
||||||
# Group by position?
|
# Group by position?
|
||||||
if groups['posn']:
|
if groups['posn']:
|
||||||
query = query.replace("<position>", 'hp.position')
|
#query = query.replace("<position>", "case hp.position when '0' then 'Btn' else hp.position end")
|
||||||
|
query = query.replace("<position>", "hp.position")
|
||||||
# set flag in self.columns to show posn column
|
# set flag in self.columns to show posn column
|
||||||
[x for x in self.columns if x[0] == 'plposition'][0][1] = True
|
[x for x in self.columns if x[0] == 'plposition'][0][1] = True
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -446,7 +446,7 @@ class fpdb:
|
||||||
#end def tab_bulk_import
|
#end def tab_bulk_import
|
||||||
|
|
||||||
def tab_player_stats(self, widget, data=None):
|
def tab_player_stats(self, widget, data=None):
|
||||||
new_ps_thread=GuiPlayerStats.GuiPlayerStats(self.config, self.querydict, self.window)
|
new_ps_thread=GuiPlayerStats.GuiPlayerStats(self.config, self.sql, self.window)
|
||||||
self.threads.append(new_ps_thread)
|
self.threads.append(new_ps_thread)
|
||||||
ps_tab=new_ps_thread.get_vbox()
|
ps_tab=new_ps_thread.get_vbox()
|
||||||
self.add_and_display_tab(ps_tab, "Player Stats")
|
self.add_and_display_tab(ps_tab, "Player Stats")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user