Merge branch 'master' of git://git.assembla.com/fpdb-sql
This commit is contained in:
commit
230eb32615
|
@ -320,13 +320,21 @@ class Config:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if file == None: # that didn't work either, just die
|
if file == None: # that didn't work either, just die
|
||||||
print "No HUD_config_xml found. Exiting"
|
print "No HUD_config_xml found after looking in current directory and "+self.default_config_path+"\nExiting"
|
||||||
sys.stderr.write("No HUD_config_xml found. Exiting")
|
sys.stderr.write("No HUD_config_xml found after looking in current directory and "+self.default_config_path+"\nExiting")
|
||||||
|
print "press enter to continue"
|
||||||
|
sys.stdin.readline()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# Parse even if there was no real config file found and we are using the example
|
# Parse even if there was no real config file found and we are using the example
|
||||||
# If using the example, we'll edit it later
|
# If using the example, we'll edit it later
|
||||||
|
# sc 2009/10/04 Example already copied to main filename, is this ok?
|
||||||
log.info("Reading configuration file %s" % file)
|
log.info("Reading configuration file %s" % file)
|
||||||
|
if os.sep in file:
|
||||||
|
print "\nReading configuration file %s\n" % file
|
||||||
|
else:
|
||||||
|
print "\nReading configuration file %s" % file
|
||||||
|
print "in %s\n" % os.getcwd()
|
||||||
try:
|
try:
|
||||||
doc = xml.dom.minidom.parse(file)
|
doc = xml.dom.minidom.parse(file)
|
||||||
except:
|
except:
|
||||||
|
@ -418,6 +426,8 @@ class Config:
|
||||||
db_pass = df_parms['db-password'])
|
db_pass = df_parms['db-password'])
|
||||||
self.save(file=os.path.join(self.default_config_path, "HUD_config.xml"))
|
self.save(file=os.path.join(self.default_config_path, "HUD_config.xml"))
|
||||||
|
|
||||||
|
print ""
|
||||||
|
|
||||||
def set_hhArchiveBase(self, path):
|
def set_hhArchiveBase(self, path):
|
||||||
self.imp.node.setAttribute("hhArchiveBase", path)
|
self.imp.node.setAttribute("hhArchiveBase", path)
|
||||||
|
|
||||||
|
@ -467,11 +477,15 @@ class Config:
|
||||||
|
|
||||||
def find_example_config(self):
|
def find_example_config(self):
|
||||||
if os.path.exists('HUD_config.xml.example'): # there is a HUD_config in the cwd
|
if os.path.exists('HUD_config.xml.example'): # there is a HUD_config in the cwd
|
||||||
file = 'HUD_config.xml.example' # so we use it
|
file = 'HUD_config.xml' # so we use it
|
||||||
|
try:
|
||||||
|
shutil.copyfile(file+'.example', file)
|
||||||
|
except:
|
||||||
|
file = ''
|
||||||
print "No HUD_config.xml found, using HUD_config.xml.example.\n", \
|
print "No HUD_config.xml found, using HUD_config.xml.example.\n", \
|
||||||
"A HUD_config.xml will be written. You will probably have to edit it."
|
"A HUD_config.xml has been created. You will probably have to edit it."
|
||||||
sys.stderr.write("No HUD_config.xml found, using HUD_config.xml.example.\n" + \
|
sys.stderr.write("No HUD_config.xml found, using HUD_config.xml.example.\n" + \
|
||||||
"A HUD_config.xml will be written. You will probably have to edit it.")
|
"A HUD_config.xml has been created. You will probably have to edit it.")
|
||||||
else:
|
else:
|
||||||
file = None
|
file = None
|
||||||
return file
|
return file
|
||||||
|
|
|
@ -467,11 +467,13 @@ class Database:
|
||||||
c.execute(self.sql.query[query], subs)
|
c.execute(self.sql.query[query], subs)
|
||||||
colnames = [desc[0] for desc in c.description]
|
colnames = [desc[0] for desc in c.description]
|
||||||
for row in c.fetchall():
|
for row in c.fetchall():
|
||||||
t_dict = {}
|
playerid = row[0]
|
||||||
for name, val in zip(colnames, row):
|
if (playerid == hero_id and h_hud_style != 'S') or (playerid != hero_id and hud_style != 'S'):
|
||||||
t_dict[name.lower()] = val
|
t_dict = {}
|
||||||
# print t_dict
|
for name, val in zip(colnames, row):
|
||||||
stat_dict[t_dict['player_id']] = t_dict
|
t_dict[name.lower()] = val
|
||||||
|
# print t_dict
|
||||||
|
stat_dict[t_dict['player_id']] = t_dict
|
||||||
|
|
||||||
return stat_dict
|
return stat_dict
|
||||||
|
|
||||||
|
@ -501,10 +503,10 @@ class Database:
|
||||||
|
|
||||||
row = c.fetchone()
|
row = c.fetchone()
|
||||||
if colnames[0].lower() == 'player_id':
|
if colnames[0].lower() == 'player_id':
|
||||||
playerid = row[0]
|
|
||||||
|
|
||||||
# Loop through stats adding them to appropriate stat_dict:
|
# Loop through stats adding them to appropriate stat_dict:
|
||||||
while row:
|
while row:
|
||||||
|
playerid = row[0]
|
||||||
if (playerid == hero_id and h_hud_style == 'S') or (playerid != hero_id and hud_style == 'S'):
|
if (playerid == hero_id and h_hud_style == 'S') or (playerid != hero_id and hud_style == 'S'):
|
||||||
for name, val in zip(colnames, row):
|
for name, val in zip(colnames, row):
|
||||||
if not playerid in stat_dict:
|
if not playerid in stat_dict:
|
||||||
|
@ -535,6 +537,16 @@ class Database:
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get_player_names(self, config, site_id=None, like_player_name="%"):
|
||||||
|
"""Fetch player names from players. Use site_id and like_player_name if provided"""
|
||||||
|
|
||||||
|
if site_id == None:
|
||||||
|
site_id = -1
|
||||||
|
c = self.get_cursor()
|
||||||
|
c.execute(self.sql.query['get_player_names'], (like_player_name, site_id, site_id))
|
||||||
|
rows = c.fetchall()
|
||||||
|
return rows
|
||||||
|
|
||||||
#returns the SQL ids of the names given in an array
|
#returns the SQL ids of the names given in an array
|
||||||
# TODO: if someone gets industrious, they should make the parts that use the output of this function deal with a dict
|
# TODO: if someone gets industrious, they should make the parts that use the output of this function deal with a dict
|
||||||
# { playername: id } instead of depending on it's relation to the positions list
|
# { playername: id } instead of depending on it's relation to the positions list
|
||||||
|
|
|
@ -23,6 +23,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from time import *
|
from time import *
|
||||||
|
import gobject
|
||||||
#import pokereval
|
#import pokereval
|
||||||
|
|
||||||
import Configuration
|
import Configuration
|
||||||
|
@ -228,7 +229,16 @@ class Filters(threading.Thread):
|
||||||
pname.set_width_chars(20)
|
pname.set_width_chars(20)
|
||||||
hbox.pack_start(pname, False, True, 0)
|
hbox.pack_start(pname, False, True, 0)
|
||||||
pname.connect("changed", self.__set_hero_name, site)
|
pname.connect("changed", self.__set_hero_name, site)
|
||||||
#TODO: Look at GtkCompletion - to fill out usernames
|
|
||||||
|
# Added EntryCompletion but maybe comboBoxEntry is more flexible? (e.g. multiple choices)
|
||||||
|
completion = gtk.EntryCompletion()
|
||||||
|
pname.set_completion(completion)
|
||||||
|
liststore = gtk.ListStore(gobject.TYPE_STRING)
|
||||||
|
completion.set_model(liststore)
|
||||||
|
completion.set_text_column(0)
|
||||||
|
names = self.db.get_player_names(self.conf) # (config=self.conf, site_id=None, like_player_name="%")
|
||||||
|
for n in names:
|
||||||
|
liststore.append(n)
|
||||||
|
|
||||||
self.__set_hero_name(pname, site)
|
self.__set_hero_name(pname, site)
|
||||||
|
|
||||||
|
|
|
@ -603,7 +603,11 @@ Map the tuple self.gametype onto the pokerstars string describing it
|
||||||
return gs + timestr
|
return gs + timestr
|
||||||
|
|
||||||
def writeTableLine(self):
|
def writeTableLine(self):
|
||||||
table_string = "Table \'%s\' %s-max" % (self.tablename, self.maxseats)
|
table_string = "Table "
|
||||||
|
if self.gametype['type'] == 'tour':
|
||||||
|
table_string = table_string + "\'%s %s\' %s-max" % (self.tourNo, self.tablename, self.maxseats)
|
||||||
|
else:
|
||||||
|
table_string = table_string + "\'%s\' %s-max" % (self.tablename, self.maxseats)
|
||||||
if self.gametype['currency'] == 'play':
|
if self.gametype['currency'] == 'play':
|
||||||
table_string = table_string + " (Play Money)"
|
table_string = table_string + " (Play Money)"
|
||||||
if self.buttonpos != None and self.buttonpos != 0:
|
if self.buttonpos != None and self.buttonpos != 0:
|
||||||
|
|
165
pyfpdb/Hud.py
165
pyfpdb/Hud.py
|
@ -147,14 +147,65 @@ class Hud:
|
||||||
menu.append(repositem)
|
menu.append(repositem)
|
||||||
repositem.connect("activate", self.reposition_windows)
|
repositem.connect("activate", self.reposition_windows)
|
||||||
|
|
||||||
aggitem = gtk.MenuItem('Show Stats')
|
aggitem = gtk.MenuItem('Show Player Stats')
|
||||||
menu.append(aggitem)
|
menu.append(aggitem)
|
||||||
self.aggMenu = gtk.Menu()
|
self.aggMenu = gtk.Menu()
|
||||||
aggitem.set_submenu(self.aggMenu)
|
aggitem.set_submenu(self.aggMenu)
|
||||||
# set agg_bb_mult to 1 to stop aggregation
|
# set agg_bb_mult to 1 to stop aggregation
|
||||||
item = gtk.CheckMenuItem('For This Blind Level Only')
|
item = gtk.CheckMenuItem('For This Blind Level Only')
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation, 1)
|
item.connect("activate", self.set_aggregation, ('P',1))
|
||||||
|
setattr(self, 'h_aggBBmultItem1', item)
|
||||||
|
#
|
||||||
|
item = gtk.MenuItem('For Multiple Blind Levels:')
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
#
|
||||||
|
item = gtk.CheckMenuItem(' 0.5 to 2.0 x Current Blinds')
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
item.connect("activate", self.set_aggregation, ('P',2))
|
||||||
|
setattr(self, 'h_aggBBmultItem2', item)
|
||||||
|
#
|
||||||
|
item = gtk.CheckMenuItem(' 0.33 to 3.0 x Current Blinds')
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
item.connect("activate", self.set_aggregation, ('P',3))
|
||||||
|
setattr(self, 'h_aggBBmultItem3', item)
|
||||||
|
#
|
||||||
|
item = gtk.CheckMenuItem(' 0.1 to 10 x Current Blinds')
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
item.connect("activate", self.set_aggregation, ('P',10))
|
||||||
|
setattr(self, 'h_aggBBmultItem10', item)
|
||||||
|
#
|
||||||
|
item = gtk.CheckMenuItem(' All Levels')
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
item.connect("activate", self.set_aggregation, ('P',10000))
|
||||||
|
setattr(self, 'h_aggBBmultItem10000', item)
|
||||||
|
#
|
||||||
|
item = gtk.MenuItem('Since:')
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
#
|
||||||
|
item = gtk.CheckMenuItem(' All Time')
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
item.connect("activate", self.set_hud_style, ('P','A'))
|
||||||
|
setattr(self, 'h_hudStyleOptionA', item)
|
||||||
|
#
|
||||||
|
item = gtk.CheckMenuItem(' Session')
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
item.connect("activate", self.set_hud_style, ('P','S'))
|
||||||
|
setattr(self, 'h_hudStyleOptionS', item)
|
||||||
|
#
|
||||||
|
item = gtk.CheckMenuItem(' %s Days' % (self.hud_params['h_hud_days']))
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
item.connect("activate", self.set_hud_style, ('P','T'))
|
||||||
|
setattr(self, 'h_hudStyleOptionT', item)
|
||||||
|
|
||||||
|
aggitem = gtk.MenuItem('Show Opponent Stats')
|
||||||
|
menu.append(aggitem)
|
||||||
|
self.aggMenu = gtk.Menu()
|
||||||
|
aggitem.set_submenu(self.aggMenu)
|
||||||
|
# set agg_bb_mult to 1 to stop aggregation
|
||||||
|
item = gtk.CheckMenuItem('For This Blind Level Only')
|
||||||
|
self.aggMenu.append(item)
|
||||||
|
item.connect("activate", self.set_aggregation, ('O',1))
|
||||||
setattr(self, 'aggBBmultItem1', item)
|
setattr(self, 'aggBBmultItem1', item)
|
||||||
#
|
#
|
||||||
item = gtk.MenuItem('For Multiple Blind Levels:')
|
item = gtk.MenuItem('For Multiple Blind Levels:')
|
||||||
|
@ -162,44 +213,54 @@ class Hud:
|
||||||
#
|
#
|
||||||
item = gtk.CheckMenuItem(' 0.5 to 2.0 x Current Blinds')
|
item = gtk.CheckMenuItem(' 0.5 to 2.0 x Current Blinds')
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation, 2)
|
item.connect("activate", self.set_aggregation, ('O',2))
|
||||||
setattr(self, 'aggBBmultItem2', item)
|
setattr(self, 'aggBBmultItem2', item)
|
||||||
#
|
#
|
||||||
item = gtk.CheckMenuItem(' 0.33 to 3.0 x Current Blinds')
|
item = gtk.CheckMenuItem(' 0.33 to 3.0 x Current Blinds')
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation, 3)
|
item.connect("activate", self.set_aggregation, ('O',3))
|
||||||
setattr(self, 'aggBBmultItem3', item)
|
setattr(self, 'aggBBmultItem3', item)
|
||||||
#
|
#
|
||||||
item = gtk.CheckMenuItem(' 0.1 to 10 x Current Blinds')
|
item = gtk.CheckMenuItem(' 0.1 to 10 x Current Blinds')
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation, 10)
|
item.connect("activate", self.set_aggregation, ('O',10))
|
||||||
setattr(self, 'aggBBmultItem10', item)
|
setattr(self, 'aggBBmultItem10', item)
|
||||||
#
|
#
|
||||||
item = gtk.CheckMenuItem(' All Levels')
|
item = gtk.CheckMenuItem(' All Levels')
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_aggregation, 10000)
|
item.connect("activate", self.set_aggregation, ('O',10000))
|
||||||
setattr(self, 'aggBBmultItem10000', item)
|
setattr(self, 'aggBBmultItem10000', item)
|
||||||
#
|
#
|
||||||
item = gtk.MenuItem('For Hero:')
|
item = gtk.MenuItem('Since:')
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
setattr(self, 'showStatsMenuItem7', item)
|
|
||||||
#
|
#
|
||||||
item = gtk.CheckMenuItem(' All Time')
|
item = gtk.CheckMenuItem(' All Time')
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_hud_style, 'HA')
|
item.connect("activate", self.set_hud_style, ('O','A'))
|
||||||
setattr(self, 'HAStyleOption', item)
|
setattr(self, 'hudStyleOptionA', item)
|
||||||
#
|
#
|
||||||
item = gtk.CheckMenuItem(' Session')
|
item = gtk.CheckMenuItem(' Session')
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_hud_style, 'HS')
|
item.connect("activate", self.set_hud_style, ('O','S'))
|
||||||
setattr(self, 'HSStyleOption', item)
|
setattr(self, 'hudStyleOptionS', item)
|
||||||
#
|
#
|
||||||
item = gtk.CheckMenuItem(' %s Days' % (self.hud_params['h_hud_days']))
|
item = gtk.CheckMenuItem(' %s Days' % (self.hud_params['h_hud_days']))
|
||||||
self.aggMenu.append(item)
|
self.aggMenu.append(item)
|
||||||
item.connect("activate", self.set_hud_style, 'HT')
|
item.connect("activate", self.set_hud_style, ('O','T'))
|
||||||
setattr(self, 'HTStyleOption', item)
|
setattr(self, 'hudStyleOptionT', item)
|
||||||
|
|
||||||
# set active on current options:
|
# set active on current options:
|
||||||
|
if self.hud_params['h_agg_bb_mult'] == 1:
|
||||||
|
getattr(self, 'h_aggBBmultItem1').set_active(True)
|
||||||
|
elif self.hud_params['h_agg_bb_mult'] == 2:
|
||||||
|
getattr(self, 'h_aggBBmultItem2').set_active(True)
|
||||||
|
elif self.hud_params['h_agg_bb_mult'] == 3:
|
||||||
|
getattr(self, 'h_aggBBmultItem3').set_active(True)
|
||||||
|
elif self.hud_params['h_agg_bb_mult'] == 10:
|
||||||
|
getattr(self, 'h_aggBBmultItem10').set_active(True)
|
||||||
|
elif self.hud_params['h_agg_bb_mult'] > 9000:
|
||||||
|
getattr(self, 'h_aggBBmultItemAll').set_active(True)
|
||||||
|
#
|
||||||
if self.hud_params['agg_bb_mult'] == 1:
|
if self.hud_params['agg_bb_mult'] == 1:
|
||||||
getattr(self, 'aggBBmultItem1').set_active(True)
|
getattr(self, 'aggBBmultItem1').set_active(True)
|
||||||
elif self.hud_params['agg_bb_mult'] == 2:
|
elif self.hud_params['agg_bb_mult'] == 2:
|
||||||
|
@ -210,12 +271,20 @@ class Hud:
|
||||||
getattr(self, 'aggBBmultItem10').set_active(True)
|
getattr(self, 'aggBBmultItem10').set_active(True)
|
||||||
elif self.hud_params['agg_bb_mult'] > 9000:
|
elif self.hud_params['agg_bb_mult'] > 9000:
|
||||||
getattr(self, 'aggBBmultItemAll').set_active(True)
|
getattr(self, 'aggBBmultItemAll').set_active(True)
|
||||||
|
#
|
||||||
if self.hud_params['h_hud_style'] == 'A':
|
if self.hud_params['h_hud_style'] == 'A':
|
||||||
getattr(self, 'HAStyleOption').set_active(True)
|
getattr(self, 'h_hudStyleOptionA').set_active(True)
|
||||||
elif self.hud_params['h_hud_style'] == 'S':
|
elif self.hud_params['h_hud_style'] == 'S':
|
||||||
getattr(self, 'HSStyleOption').set_active(True)
|
getattr(self, 'h_hudStyleOptionS').set_active(True)
|
||||||
elif self.hud_params['h_hud_style'] == 'T':
|
elif self.hud_params['h_hud_style'] == 'T':
|
||||||
getattr(self, 'HTStyleOption').set_active(True)
|
getattr(self, 'h_hudStyleOptionT').set_active(True)
|
||||||
|
#
|
||||||
|
if self.hud_params['hud_style'] == 'A':
|
||||||
|
getattr(self, 'hudStyleOptionA').set_active(True)
|
||||||
|
elif self.hud_params['hud_style'] == 'S':
|
||||||
|
getattr(self, 'hudStyleOptionS').set_active(True)
|
||||||
|
elif self.hud_params['hud_style'] == 'T':
|
||||||
|
getattr(self, 'hudStyleOptionT').set_active(True)
|
||||||
|
|
||||||
eventbox.connect_object("button-press-event", self.on_button_press, menu)
|
eventbox.connect_object("button-press-event", self.on_button_press, menu)
|
||||||
|
|
||||||
|
@ -255,41 +324,53 @@ class Hud:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def set_aggregation(self, widget, val):
|
def set_aggregation(self, widget, val):
|
||||||
# try setting these to true all the time, and set the multiplier to 1 to turn agg off:
|
(player_opp, num) = val
|
||||||
self.hud_params['aggregate_ring'] = True
|
if player_opp == 'P':
|
||||||
self.hud_params['aggregate_tour'] = True
|
# set these true all the time, set the multiplier to 1 to turn agg off:
|
||||||
self.hud_params['h_aggregate_ring'] = True
|
self.hud_params['h_aggregate_ring'] = True
|
||||||
self.hud_params['h_aggregate_tour'] = True
|
self.hud_params['h_aggregate_tour'] = True
|
||||||
|
|
||||||
if self.hud_params['agg_bb_mult'] != val \
|
if self.hud_params['h_agg_bb_mult'] != num \
|
||||||
and getattr(self, 'aggBBmultItem'+str(val)).get_active():
|
and getattr(self, 'h_aggBBmultItem'+str(num)).get_active():
|
||||||
print 'set_aggregation', val
|
print 'set_player_aggregation', num
|
||||||
self.hud_params['agg_bb_mult'] = val
|
self.hud_params['h_agg_bb_mult'] = num
|
||||||
self.hud_params['h_agg_bb_mult'] = val
|
for mult in ('1', '2', '3', '10', '10000'):
|
||||||
for mult in ('1', '2', '3', '10', '10000'):
|
if mult != str(num):
|
||||||
if mult != str(val):
|
getattr(self, 'h_aggBBmultItem'+mult).set_active(False)
|
||||||
getattr(self, 'aggBBmultItem'+mult).set_active(False)
|
else:
|
||||||
|
self.hud_params['aggregate_ring'] = True
|
||||||
|
self.hud_params['aggregate_tour'] = True
|
||||||
|
|
||||||
|
if self.hud_params['agg_bb_mult'] != num \
|
||||||
|
and getattr(self, 'aggBBmultItem'+str(num)).get_active():
|
||||||
|
print 'set_opponent_aggregation', num
|
||||||
|
self.hud_params['agg_bb_mult'] = num
|
||||||
|
for mult in ('1', '2', '3', '10', '10000'):
|
||||||
|
if mult != str(num):
|
||||||
|
getattr(self, 'aggBBmultItem'+mult).set_active(False)
|
||||||
|
|
||||||
def set_hud_style(self, widget, val):
|
def set_hud_style(self, widget, val):
|
||||||
# try setting these to true all the time, and set the multiplier to 1 to turn agg off:
|
(player_opp, style) = val
|
||||||
if val[0] == 'H':
|
if player_opp == 'P':
|
||||||
param = 'h_hud_style'
|
param = 'h_hud_style'
|
||||||
|
prefix = 'h_'
|
||||||
else:
|
else:
|
||||||
param = 'hud_style'
|
param = 'hud_style'
|
||||||
|
prefix = ''
|
||||||
|
|
||||||
if val[1] == 'A' and getattr(self, 'HAStyleOption').get_active():
|
if style == 'A' and getattr(self, prefix+'hudStyleOptionA').get_active():
|
||||||
self.hud_params[param] = 'A'
|
self.hud_params[param] = 'A'
|
||||||
getattr(self, 'HSStyleOption').set_active(False)
|
getattr(self, prefix+'hudStyleOptionS').set_active(False)
|
||||||
getattr(self, 'HTStyleOption').set_active(False)
|
getattr(self, prefix+'hudStyleOptionT').set_active(False)
|
||||||
elif val[1] == 'S' and getattr(self, 'HSStyleOption').get_active():
|
elif style == 'S' and getattr(self, prefix+'hudStyleOptionS').get_active():
|
||||||
self.hud_params[param] = 'S'
|
self.hud_params[param] = 'S'
|
||||||
getattr(self, 'HAStyleOption').set_active(False)
|
getattr(self, prefix+'hudStyleOptionA').set_active(False)
|
||||||
getattr(self, 'HTStyleOption').set_active(False)
|
getattr(self, prefix+'hudStyleOptionT').set_active(False)
|
||||||
elif val[1] == 'T' and self.HTStyleOption.get_active():
|
elif style == 'T' and getattr(self, prefix+'hudStyleOptionT').get_active():
|
||||||
self.hud_params[param] = 'T'
|
self.hud_params[param] = 'T'
|
||||||
getattr(self, 'HAStyleOption').set_active(False)
|
getattr(self, prefix+'hudStyleOptionA').set_active(False)
|
||||||
getattr(self, 'HSStyleOption').set_active(False)
|
getattr(self, prefix+'hudStyleOptionS').set_active(False)
|
||||||
print "setting self.hud_params[%s] = %s" % (param, val[1])
|
print "setting self.hud_params[%s] = %s" % (param, style)
|
||||||
|
|
||||||
def update_table_position(self):
|
def update_table_position(self):
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
|
|
|
@ -1235,6 +1235,13 @@ class Sql:
|
||||||
and Players.siteId = Sites.id
|
and Players.siteId = Sites.id
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.query['get_player_names'] = """
|
||||||
|
select p.name
|
||||||
|
from Players p
|
||||||
|
where lower(p.name) like lower(%s)
|
||||||
|
and (p.siteId = %s or %s = -1)
|
||||||
|
"""
|
||||||
|
|
||||||
self.query['getSiteId'] = """SELECT id from Sites where name = %s"""
|
self.query['getSiteId'] = """SELECT id from Sites where name = %s"""
|
||||||
|
|
||||||
self.query['get_stats_from_hand'] = """
|
self.query['get_stats_from_hand'] = """
|
||||||
|
|
|
@ -257,6 +257,10 @@ def discover_nt_tournament(c, tour_number, tab_number):
|
||||||
titles ={}
|
titles ={}
|
||||||
win32gui.EnumWindows(win_enum_handler, titles)
|
win32gui.EnumWindows(win_enum_handler, titles)
|
||||||
for hwnd in titles:
|
for hwnd in titles:
|
||||||
|
if 'Chat:' in titles[hwnd]: continue # Some sites (FTP? PS? Others?) have seperable or seperately constructed chat windows
|
||||||
|
if 'History for table:' in titles[hwnd]: continue # Everleaf Network HH viewer window
|
||||||
|
if 'HUD:' in titles[hwnd]: continue # FPDB HUD window
|
||||||
|
|
||||||
if re.search(search_string, titles[hwnd]):
|
if re.search(search_string, titles[hwnd]):
|
||||||
return decode_windows(c, titles[hwnd], hwnd)
|
return decode_windows(c, titles[hwnd], hwnd)
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -453,7 +453,14 @@ class fpdb:
|
||||||
self.db.disconnect()
|
self.db.disconnect()
|
||||||
|
|
||||||
self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server'])
|
self.sql = SQL.Sql(type = self.settings['db-type'], db_server = self.settings['db-server'])
|
||||||
self.db = Database.Database(self.config, sql = self.sql)
|
try:
|
||||||
|
self.db = Database.Database(self.config, sql = self.sql)
|
||||||
|
except FpdbError:
|
||||||
|
print "Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user'])
|
||||||
|
sys.stderr.write("Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user']))
|
||||||
|
except:
|
||||||
|
print "Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user'])
|
||||||
|
sys.stderr.write("Failed to connect to %s database with username %s." % (self.settings['db-server'], self.settings['db-user']))
|
||||||
|
|
||||||
if self.db.fdb.wrongDbVersion:
|
if self.db.fdb.wrongDbVersion:
|
||||||
diaDbVersionWarning = gtk.Dialog(title="Strong Warning - Invalid database version", parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))
|
diaDbVersionWarning = gtk.Dialog(title="Strong Warning - Invalid database version", parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user