diff --git a/packaging/windows/py2exeWalkthroughPython26.txt b/packaging/windows/py2exeWalkthroughPython26.txt index 7ad865c0..2762699e 100644 --- a/packaging/windows/py2exeWalkthroughPython26.txt +++ b/packaging/windows/py2exeWalkthroughPython26.txt @@ -33,6 +33,7 @@ psycopg2 ... http://www.stickpeople.com/projects/python/win-psycopg/psycopg2-2.2 (py)pokereval v138 ... http://sourceforge.net/projects/fpdb/files/fpdb/pypoker-eval-win32/pokereval-138.win32.exe/download (Note: There are no official windows builds, this installer is built from source. A walkthrough is in the same directory as this walkthrough. + 1.2/ MySQL Install the following file: @@ -67,6 +68,26 @@ with this line: 1.3.4/ Save and exit +1.4/ Patch py2exe to stop popup runtime error message + +see http://www.py2exe.org/index.cgi/StderrLog for technical info. + +1.4.1/ + +dos> write C:\Python26\Lib\site-packages\py2exe\boot_common.py + +replace: + atexit.register(alert, 0, + "See the logfile '%s' for details" % fname, + "Errors occurred") +with: + #atexit.register(alert, 0, + # "See the logfile '%s' for details" % fname, + # "Errors occurred") + +1.4.2/ save and exit + + Step 2 Setup GTK ----------------- diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 8ed0e3bc..e3a8e82e 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -2169,7 +2169,7 @@ class Database: dup = True return dup - def getGameTypeId(self, siteid, game): + def getGameTypeId(self, siteid, game, printdata = False): c = self.get_cursor() #FIXME: Fixed for NL at the moment c.execute(self.sql.query['getGametypeNL'], (siteid, game['type'], game['category'], game['limitType'], game['currency'], @@ -2181,14 +2181,22 @@ class Database: hilo = "s" elif game['category'] in ['razz','27_3draw','badugi', '27_1draw']: hilo = "l" + #FIXME: recognise currency + #TODO: this wont work for non-standard structures tmp = self.insertGameTypes( (siteid, game['currency'], game['type'], game['base'], game['category'], game['limitType'], hilo, int(Decimal(game['sb'])*100), int(Decimal(game['bb'])*100), - int(Decimal(game['bb'])*100), int(Decimal(game['bb'])*200)) ) #TODO: this wont work for non-standard structures - #FIXME: recognise currency + int(Decimal(game['bb'])*100), int(Decimal(game['bb'])*200)), printdata = printdata) return tmp[0] - def insertGameTypes(self, row): + def insertGameTypes(self, row, printdata = False): + if printdata: + print _("######## Gametype ##########") + import pprint + pp = pprint.PrettyPrinter(indent=4) + pp.pprint(row) + print _("###### End Gametype ########") + c = self.get_cursor() c.execute( self.sql.query['insertGameTypes'], row ) return [self.get_last_insert_id(c)] diff --git a/pyfpdb/DerivedStats.py b/pyfpdb/DerivedStats.py index 003f5270..8b1f4177 100644 --- a/pyfpdb/DerivedStats.py +++ b/pyfpdb/DerivedStats.py @@ -40,7 +40,6 @@ class DerivedStats(): self.handsplayers[player[1]]['winnings'] = 0 self.handsplayers[player[1]]['rake'] = 0 self.handsplayers[player[1]]['totalProfit'] = 0 - self.handsplayers[player[1]]['street4Seen'] = False self.handsplayers[player[1]]['street4Aggr'] = False self.handsplayers[player[1]]['wonWhenSeenStreet1'] = 0.0 self.handsplayers[player[1]]['sawShowdown'] = False @@ -58,6 +57,11 @@ class DerivedStats(): self.handsplayers[player[1]]['foldedSbToSteal'] = False self.handsplayers[player[1]]['foldedBbToSteal'] = False self.handsplayers[player[1]]['tourneyTypeId'] = None + self.handsplayers[player[1]]['street1Seen'] = False + self.handsplayers[player[1]]['street2Seen'] = False + self.handsplayers[player[1]]['street3Seen'] = False + self.handsplayers[player[1]]['street4Seen'] = False + for i in range(5): self.handsplayers[player[1]]['street%dCalls' % i] = 0 @@ -152,10 +156,11 @@ class DerivedStats(): else: self.handsplayers[player[1]]['tourneysPlayersIds'] = None + #### seen now processed in playersAtStreetX() # XXX: enumerate(list, start=x) is python 2.6 syntax; 'start' #for i, street in enumerate(hand.actionStreets[2:], start=1): - for i, street in enumerate(hand.actionStreets[2:]): - self.seen(self.hand, i+1) + #for i, street in enumerate(hand.actionStreets[2:]): + # self.seen(self.hand, i+1) for i, street in enumerate(hand.actionStreets[1:]): self.aggr(self.hand, i) @@ -298,6 +303,7 @@ class DerivedStats(): # FIXME?? - This isn't couting people that are all in - at least showdown needs to reflect this # ... new code below hopefully fixes this + # partly fixed, allins are now set as seeing streets because they never do a fold action self.hands['playersAtStreet1'] = 0 self.hands['playersAtStreet2'] = 0 @@ -324,18 +330,58 @@ class DerivedStats(): # actionStreets[1] is 'DEAL', 'THIRD', 'PREFLOP', so any player dealt cards # must act on this street if dealt cards. Almost certainly broken for the 'all-in blind' case # and right now i don't care - CG + p_in = set([x[0] for x in hand.actions[hand.actionStreets[1]]]) + # + # discover who folded on each street and remove them from p_in + # + # i values as follows 0=BLINDSANTES 1=PREFLOP 2=FLOP 3=TURN 4=RIVER + # (for flop games) + # + # At the beginning of the loop p_in contains the players with cards + # at the start of that street. + # p_in is reduced each street to become a list of players still-in + # e.g. when i=1 (preflop) all players who folded during preflop + # are found by pfba() and eliminated from p_in. + # Therefore at the end of the loop, p_in contains players remaining + # at the end of the action on that street, and can therefore be set + # as the value for the number of players who saw the next street + # + # note that i is 1 in advance of the actual street numbers in the db + # + # if p_in reduces to 1 player, we must bomb-out immediately + # because the hand is over, this will ensure playersAtStreetx + # is accurate. + # + for (i, street) in enumerate(hand.actionStreets): + if (i-1) in (1,2,3,4): + # p_in stores players with cards at start of this street, + # so can set streetxSeen & playersAtStreetx with this information + # This hard-coded for i-1 =1,2,3,4 because those are the only columns + # in the db! this code section also replaces seen() - more info log 66 + # nb i=2=flop=street1Seen, hence i-1 term needed + self.hands['playersAtStreet%d' % (i-1)] = len(p_in) + for player_with_cards in p_in: + self.handsplayers[player_with_cards]['street%sSeen' % (i-1)] = True + # + # find out who folded, and eliminate them from p_in + # actions = hand.actions[street] p_in = p_in - self.pfba(actions, l=('folds',)) - self.hands['playersAtStreet%d' % (i-1)] = len(p_in) - - self.hands['playersAtShowdown'] = len(p_in) + # + # if everyone folded, we are done, so exit this method immediately + # + if len(p_in) == 1: return None - if self.hands['playersAtShowdown'] > 1: - for player in p_in: - self.handsplayers[player]['sawShowdown'] = True + # + # The remaining players in p_in reached showdown (including all-ins + # because they never did a "fold" action in pfba() above) + # + self.hands['playersAtShowdown'] = len(p_in) + for showdown_player in p_in: + self.handsplayers[showdown_player]['sawShowdown'] = True def streetXRaises(self, hand): # self.actions[street] is a list of all actions in a tuple, contining the action as the second element @@ -447,17 +493,6 @@ class DerivedStats(): self.handsplayers[pname]['street%dCheckCallRaiseChance' % (i+1)] = True self.handsplayers[pname]['street%dCheckCallRaiseDone' % (i+1)] = act!='folds' - def seen(self, hand, i): - pas = set() - for act in hand.actions[hand.actionStreets[i+1]]: - pas.add(act[0]) - - for player in hand.players: - if player[1] in pas: - self.handsplayers[player[1]]['street%sSeen' % i] = True - else: - self.handsplayers[player[1]]['street%sSeen' % i] = False - def aggr(self, hand, i): aggrers = set() others = set() diff --git a/pyfpdb/FulltiltToFpdb.py b/pyfpdb/FulltiltToFpdb.py index 955b55b9..b672362e 100755 --- a/pyfpdb/FulltiltToFpdb.py +++ b/pyfpdb/FulltiltToFpdb.py @@ -76,8 +76,8 @@ class Fulltilt(HandHistoryConverter): (\s\((?PTurbo)\))?)|(?P.+)) ''' % substitutions, re.VERBOSE) re_Button = re.compile('^The button is in seat #(?P