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

This commit is contained in:
Worros 2010-03-04 19:48:40 +08:00
commit 6c05bac1d0
4 changed files with 32 additions and 13 deletions

View File

@ -77,14 +77,15 @@ class PartyPoker(HandHistoryConverter):
re.VERBOSE) re.VERBOSE)
re_HandInfo = re.compile(""" re_HandInfo = re.compile("""
^Table\s+(?P<TTYPE>[$a-zA-Z0-9 ]+)\s+ ^Table\s+(?P<TTYPE>[$a-zA-Z0-9 ]+)?\s+
(?: \#|\(|)(?P<TABLE>\d+)\)?\s+ (?: \#|\(|)(?P<TABLE>\d+)\)?\s+
(?:[a-zA-Z0-9 ]+\s+\#(?P<MTTTABLE>\d+).+)? (?:[a-zA-Z0-9 ]+\s+\#(?P<MTTTABLE>\d+).+)?
(\(No\sDP\)\s)? (\(No\sDP\)\s)?
\((?P<PLAY>Real|Play)\s+Money\)\s+ # FIXME: check if play money is correct \((?P<PLAY>Real|Play)\s+Money\)\s+ # FIXME: check if play money is correct
Seat\s+(?P<BUTTON>\d+)\sis\sthe\sbutton Seat\s+(?P<BUTTON>\d+)\sis\sthe\sbutton
\s+Total\s+number\s+of\s+players\s+\:\s+(?P<PLYRS>\d+)/?(?P<MAX>\d+)?
""", """,
re.VERBOSE|re.MULTILINE) re.VERBOSE|re.MULTILINE|re.DOTALL)
re_CountedSeats = re.compile("^Total\s+number\s+of\s+players\s*:\s*(?P<COUNTED_SEATS>\d+)", re.MULTILINE) re_CountedSeats = re.compile("^Total\s+number\s+of\s+players\s*:\s*(?P<COUNTED_SEATS>\d+)", re.MULTILINE)
re_SplitHands = re.compile('\x00+') re_SplitHands = re.compile('\x00+')
@ -105,13 +106,18 @@ class PartyPoker(HandHistoryConverter):
def guessMaxSeats(self, hand): def guessMaxSeats(self, hand):
"""Return a guess at max_seats when not specified in HH.""" """Return a guess at max_seats when not specified in HH."""
mo = self.maxOccSeat(hand) try:
m = re_seats.search(hand.handText)
if mo == 10: return mo mo = m.groupdict()
if mo == 2: return 2 mo = _mo['SEATS']
if mo <= 6: return 6 return mo
# there are 9-max tables for cash and 10-max for tournaments except:
return 9 if hand.gametype['type']=='ring' else 10 mo = self.maxOccSeat(hand)
if mo == 10: return mo
if mo == 2: return 2
if mo <= 6: return 6
# there are 9-max tables for cash and 10-max for tournaments
return 9 if hand.gametype['type']=='ring' else 10
def compilePlayerRegexs(self, hand): def compilePlayerRegexs(self, hand):
players = set([player[1] for player in hand.players]) players = set([player[1] for player in hand.players])
@ -260,6 +266,7 @@ class PartyPoker(HandHistoryConverter):
for i,v in enumerate(self.collected): for i,v in enumerate(self.collected):
if v[0] in self.pot.returned: if v[0] in self.pot.returned:
self.collected[i][1] = Decimal(v[1]) - self.pot.returned[v[0]] self.collected[i][1] = Decimal(v[1]) - self.pot.returned[v[0]]
self.collectees[v[0]] -= self.pot.returned[v[0]]
return origTotalPot() return origTotalPot()
return totalPot return totalPot
instancemethod = type(hand.totalPot) instancemethod = type(hand.totalPot)
@ -313,6 +320,9 @@ class PartyPoker(HandHistoryConverter):
if key == 'PLAY' and info['PLAY'] != 'Real': if key == 'PLAY' and info['PLAY'] != 'Real':
# if realy party doesn's save play money hh # if realy party doesn's save play money hh
hand.gametype['currency'] = 'play' hand.gametype['currency'] = 'play'
if key == 'MAX' and info[key] is not None:
hand.maxseats = int(info[key])
def readButton(self, hand): def readButton(self, hand):
m = self.re_Button.search(hand.handText) m = self.re_Button.search(hand.handText)

View File

@ -32,12 +32,16 @@ import gtk
import gobject import gobject
# fpdb/free poker tools modules # fpdb/free poker tools modules
import Configuration
from HandHistoryConverter import getTableTitleRe
# get the correct module for the current os # get the correct module for the current os
if os.name == 'posix': if os.name == 'posix':
import XTables as Tables import XTables as Tables
elif os.name == 'nt': elif os.name == 'nt':
import WinTables as Tables import WinTables as Tables
config = Configuration.Config()
# Main function used for testing # Main function used for testing
if __name__=="__main__": if __name__=="__main__":
# c = Configuration.Config() # c = Configuration.Config()
@ -82,11 +86,16 @@ if __name__=="__main__":
(tour_no, tab_no) = table_name.split(",", 1) (tour_no, tab_no) = table_name.split(",", 1)
tour_no = tour_no.rstrip() tour_no = tour_no.rstrip()
tab_no = tab_no.rstrip() tab_no = tab_no.rstrip()
table = Tables.Table(None, tournament = tour_no, table_number = tab_no) type = "tour"
table_kwargs = dict(tournament = tour_no, table_number = tab_no)
else: # not a tournament else: # not a tournament
print "cash game" print "cash game"
table_name = table_name.rstrip() table_name = table_name.rstrip()
table = Tables.Table(None, table_name = table_name) type = "cash"
table_kwargs = dict(table_name = table_name)
search_string = getTableTitleRe(config, "Full Tilt Poker", type, **table_kwargs)
table = Tables.Table(search_string, **table_kwargs)
table.gdk_handle = gtk.gdk.window_foreign_new(table.number) table.gdk_handle = gtk.gdk.window_foreign_new(table.number)
print "table =", table print "table =", table

View File

@ -68,7 +68,7 @@ class Table(Table_Window):
window_number = None window_number = None
for listing in os.popen('xwininfo -root -tree').readlines(): for listing in os.popen('xwininfo -root -tree').readlines():
if re.search(search_string, listing): if re.search(search_string, listing):
print listing # print listing
mo = re.match('\s+([\dxabcdef]+) (.+):\s\(\"([a-zA-Z.]+)\".+ (\d+)x(\d+)\+\d+\+\d+ \+(\d+)\+(\d+)', listing) mo = re.match('\s+([\dxabcdef]+) (.+):\s\(\"([a-zA-Z.]+)\".+ (\d+)x(\d+)\+\d+\+\d+ \+(\d+)\+(\d+)', listing)
self.number = int( mo.group(1), 0) self.number = int( mo.group(1), 0)
self.width = int( mo.group(4) ) self.width = int( mo.group(4) )

View File

@ -152,7 +152,7 @@ setup(
}, },
# files in 2nd value in tuple are moved to dir named in 1st value # files in 2nd value in tuple are moved to dir named in 1st value
data_files = [('', ['HUD_config.xml.example', 'Cards01.png', 'logging.conf']) data_files = [('', ['HUD_config.xml.example', 'Cards01.png', 'logging.conf', '../docs/readme.txt'])
,(dist_dir, [r'..\run_fpdb.bat']) ,(dist_dir, [r'..\run_fpdb.bat'])
,( dist_dir + r'\gfx', glob.glob(r'..\gfx\*.*') ) ,( dist_dir + r'\gfx', glob.glob(r'..\gfx\*.*') )
# line below has problem with fonts subdir ('not a regular file') # line below has problem with fonts subdir ('not a regular file')