Merge branch 'master' of git://git.assembla.com/free_poker_tools

This commit is contained in:
Worros
2009-04-06 08:12:56 +08:00
70 changed files with 32 additions and 1904 deletions
+12 -6
View File
@@ -33,6 +33,9 @@ import xml.dom.minidom
from xml.dom.minidom import Node
def fix_tf(x, default = True):
# The xml parser doesn't translate "True" to True. Therefore, we never get
# True or False from the parser only "True" or "False". So translate the
# string to the python boolean representation.
if x == "1" or x == 1 or string.lower(x) == "true" or string.lower(x) == "t":
return True
if x == "0" or x == 0 or string.lower(x) == "false" or string.lower(x) == "f":
@@ -80,11 +83,11 @@ class Site:
self.hudbgcolor = node.getAttribute("bgcolor")
self.hudfgcolor = node.getAttribute("fgcolor")
self.converter = node.getAttribute("converter")
self.enabled = node.getAttribute("enabled")
self.aux_window = node.getAttribute("aux_window")
self.font = node.getAttribute("font")
self.font_size = node.getAttribute("font_size")
self.use_frames = node.getAttribute("use_frames")
self.enabled = fix_tf(node.getAttribute("enabled"), default = True)
self.layout = {}
for layout_node in node.getElementsByTagName('layout'):
@@ -583,14 +586,17 @@ class Config:
( 0, 280), (121, 280), ( 46, 30) )
return locations
def get_supported_sites(self):
def get_supported_sites(self, all = False):
"""Returns the list of supported sites."""
return self.supported_sites.keys()
the_sites = []
for site in self.supported_sites.keys():
params = self.get_site_parameters(site)
if all or params['enabled']:
the_sites.append(site)
return the_sites
def get_site_parameters(self, site):
"""Returns a dict of the site parameters for the specified site"""
if not self.supported_sites.has_key(site):
return None
parms = {}
parms["converter"] = self.supported_sites[site].converter
parms["decoder"] = self.supported_sites[site].decoder
@@ -602,10 +608,10 @@ class Config:
parms["table_finder"] = self.supported_sites[site].table_finder
parms["HH_path"] = self.supported_sites[site].HH_path
parms["site_name"] = self.supported_sites[site].site_name
parms["enabled"] = self.supported_sites[site].enabled
parms["aux_window"] = self.supported_sites[site].aux_window
parms["font"] = self.supported_sites[site].font
parms["font_size"] = self.supported_sites[site].font_size
parms["enabled"] = self.supported_sites[site].enabled
return parms
def set_site_parameters(self, site_name, converter = None, decoder = None,
+4 -3
View File
@@ -202,13 +202,14 @@ class GuiAutoImport (threading.Thread):
filter.show()
def addSites(self, vbox):
for site in self.config.supported_sites.keys():
the_sites = self.config.get_supported_sites()
for site in the_sites:
pathHBox = gtk.HBox(False, 0)
vbox.pack_start(pathHBox, False, True, 0)
pathHBox.show()
paths = self.config.get_default_paths(site)
params = self.config.get_site_parameters(site)
paths = self.config.get_default_paths(site)
self.createSiteLine(pathHBox, site, False, paths['hud-defaultPath'], params['converter'], params['enabled'])
self.input_settings[site] = [paths['hud-defaultPath']] + [params['converter']]
+1 -1
View File
@@ -49,7 +49,7 @@
<location seat="2" x="10" y="288"> </location>
</layout>
</site>
<site enabled="True" site_name="Full Tilt" table_finder="FullTiltPoker.exe" screen_name="DO NOT NEED THIS YET" site_path="~/.wine/drive_c/Program Files/Full Tilt Poker/" HH_path="~/.wine/drive_c/Program Files/Full Tilt Poker/HandHistory/abc/" decoder="fulltilt_decode_table" converter="passthrough" supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
<site enabled="True" site_name="Full Tilt Poker" table_finder="FullTiltPoker.exe" screen_name="DO NOT NEED THIS YET" site_path="~/.wine/drive_c/Program Files/Full Tilt Poker/" HH_path="~/.wine/drive_c/Program Files/Full Tilt Poker/HandHistory/abc/" decoder="fulltilt_decode_table" converter="passthrough" supported_games="holdem,razz,omahahi,omahahilo,studhi,studhilo">
<layout fav_seat="0" height="547" max="8" width="794">
<location seat="1" x="640" y="64"> </location>
<location seat="2" x="650" y="230"> </location>
+8 -3
View File
@@ -197,12 +197,17 @@ class Hud:
s.window.destroy()
self.stat_windows = {}
# also kill any aux windows
(aux.destroy() for aux in self.aux_windows)
for aux in self.aux_windows:
aux.destroy()
self.aux_windows = []
def reposition_windows(self, *args):
if self.stat_windows != {} and len(self.stat_windows) > 0:
(x.window.move(x.x, x.y) for x in self.stat_windows.itervalues() if type(x) != int)
for w in self.stat_windows.itervalues():
if type(w) == int:
print "in reposition, w =", w
continue
print "in reposition, w =", w, w.x, w.y
w.window.move(w.x, w.y)
return True
def debug_stat_windows(self, *args):
+7 -18
View File
@@ -469,23 +469,12 @@ def convert3B4B(site, category, limit_type, actionTypes, actionAmounts):
for k in xrange(len(actionTypes[i][j])):
if (actionTypes[i][j][k]=="bet"):
bets.append((i,j,k))
if (len(bets)==2):
#print "len(bets) 2 or higher, need to correct it. bets:",bets,"len:",len(bets)
amount2=actionAmounts[bets[1][0]][bets[1][1]][bets[1][2]]
amount1=actionAmounts[bets[0][0]][bets[0][1]][bets[0][2]]
actionAmounts[bets[1][0]][bets[1][1]][bets[1][2]]=amount2-amount1
elif (len(bets)>2):
fail=True
#todo: run correction for below
if (site=="ps" and category=="holdem" and limit_type=="nl" and len(bets)==3):
fail=False
if (site=="ftp" and category=="omahahi" and limit_type=="pl" and len(bets)==3):
fail=False
if fail:
print "len(bets)>2 in convert3B4B, i didnt think this is possible. i:",i,"j:",j,"k:",k
print "actionTypes:",actionTypes
raise FpdbError ("too many bets in convert3B4B")
if (len(bets)>=2):
#print "len(bets) 2 or higher, need to correct it. bets:",bets,"len:",len(bets)
for betNo in reversed(xrange (1,len(bets))):
amount2=actionAmounts[bets[betNo][0]][bets[betNo][1]][bets[betNo][2]]
amount1=actionAmounts[bets[betNo-1][0]][bets[betNo-1][1]][bets[betNo-1][2]]
actionAmounts[bets[betNo][0]][bets[betNo][1]][bets[betNo][2]]=amount2-amount1
#print "actionAmounts postConvert",actionAmounts
#end def convert3B4B(actionTypes, actionAmounts)
@@ -1476,7 +1465,7 @@ def recognisePlayerNo(line, names, atype):
#returns the site abbreviation for the given site
def recogniseSite(line):
if (line.startswith("Full Tilt Poker")):
if (line.startswith("Full Tilt Poker") or line.startswith("FullTiltPoker")):
return "ftp"
elif (line.startswith("PokerStars")):
return "ps"