From b4200f9f516534eb52500b2a6ceb3ece21b155b0 Mon Sep 17 00:00:00 2001 From: grindi Date: Sun, 25 Oct 2009 14:22:49 +0300 Subject: [PATCH 1/5] Tiny fix --- pyfpdb/GuiGraphViewer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index f91c9870..d148d841 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.py @@ -20,6 +20,7 @@ import pygtk pygtk.require('2.0') import gtk import os +import sys import traceback from time import * #import pokereval From c7410d6fc8b3c12d8cf3073949e75841bab9b0f3 Mon Sep 17 00:00:00 2001 From: grindi Date: Wed, 28 Oct 2009 18:57:54 +0300 Subject: [PATCH 2/5] Fix config's default values for hud colors 00000 -> #000000 FFFFF -> #FFFFFF --- pyfpdb/Configuration.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 5dba6aac..9fcfd623 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -132,8 +132,8 @@ class Site: if self.use_frames == "": self.use_frames = False if self.font == "": self.font = "Sans" - if self.hudbgcolor == "": self.hudbgcolor = "000000" - if self.hudfgcolor == "": self.hudfgcolor = "FFFFFF" + if self.hudbgcolor == "": self.hudbgcolor = "#000000" + if self.hudfgcolor == "": self.hudfgcolor = "#FFFFFF" def __str__(self): temp = "Site = " + self.site_name + "\n" From 19b46e84441b574ab235380636be7c4bae5f5378 Mon Sep 17 00:00:00 2001 From: grindi Date: Sat, 31 Oct 2009 17:46:11 +0300 Subject: [PATCH 3/5] Revert "Revert "Print out actual exception when import fails"" This reverts commit ce0e2c139bb7547339f12a403e1100dab3774c24. --- pyfpdb/GuiGraphViewer.py | 3 ++- pyfpdb/GuiSessionViewer.py | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index 9387bdb7..9ce5c17a 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.py @@ -33,11 +33,12 @@ try: from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar from numpy import arange, cumsum from pylab import * -except ImportError: +except ImportError as inst: print """Failed to load libs for graphing, graphing will not function. Please in stall numpy and matplotlib if you want to use graphs.""" print """This is of no consequence for other parts of the program, e.g. import and HUD are NOT affected by this problem.""" + print "ImportError: %s" % inst.args import fpdb_import import Database diff --git a/pyfpdb/GuiSessionViewer.py b/pyfpdb/GuiSessionViewer.py index 7695cf73..5711cb89 100755 --- a/pyfpdb/GuiSessionViewer.py +++ b/pyfpdb/GuiSessionViewer.py @@ -37,11 +37,10 @@ try: # from matplotlib.dates import DateFormatter, WeekdayLocator, HourLocator, \ # DayLocator, MONDAY, timezone -except: - err = traceback.extract_tb(sys.exc_info()[2])[-1] - print "***Error: "+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1]) +except ImportError as inst: print """Failed to load numpy in Session Viewer""" - print """This is of no consequence as the module currently doesn't do anything.""" + print """This is of no consequence as the page is broken and only of interest to developers.""" + print "ImportError: %s" % inst.args import Card import fpdb_import From 5e6899a29e867e1e7c66a961433a4915d3a7e8c2 Mon Sep 17 00:00:00 2001 From: grindi Date: Sat, 31 Oct 2009 17:48:48 +0300 Subject: [PATCH 4/5] Print out actual exception when import fails. Python 2.5 compatible --- pyfpdb/GuiGraphViewer.py | 2 +- pyfpdb/GuiSessionViewer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfpdb/GuiGraphViewer.py b/pyfpdb/GuiGraphViewer.py index 9ce5c17a..670554e7 100644 --- a/pyfpdb/GuiGraphViewer.py +++ b/pyfpdb/GuiGraphViewer.py @@ -33,7 +33,7 @@ try: from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar from numpy import arange, cumsum from pylab import * -except ImportError as inst: +except ImportError, inst: print """Failed to load libs for graphing, graphing will not function. Please in stall numpy and matplotlib if you want to use graphs.""" print """This is of no consequence for other parts of the program, e.g. import diff --git a/pyfpdb/GuiSessionViewer.py b/pyfpdb/GuiSessionViewer.py index 5711cb89..0d391102 100755 --- a/pyfpdb/GuiSessionViewer.py +++ b/pyfpdb/GuiSessionViewer.py @@ -37,7 +37,7 @@ try: # from matplotlib.dates import DateFormatter, WeekdayLocator, HourLocator, \ # DayLocator, MONDAY, timezone -except ImportError as inst: +except ImportError, inst: print """Failed to load numpy in Session Viewer""" print """This is of no consequence as the page is broken and only of interest to developers.""" print "ImportError: %s" % inst.args From 97d2052cbe0046e7d4f1f83fa1198a8ba7f568e9 Mon Sep 17 00:00:00 2001 From: grindi Date: Sat, 31 Oct 2009 17:53:31 +0300 Subject: [PATCH 5/5] Party hhc tiny fixes --- pyfpdb/PartyPokerToFpdb.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/pyfpdb/PartyPokerToFpdb.py b/pyfpdb/PartyPokerToFpdb.py index a3ea0ad0..4ed0c965 100755 --- a/pyfpdb/PartyPokerToFpdb.py +++ b/pyfpdb/PartyPokerToFpdb.py @@ -28,11 +28,12 @@ from HandHistoryConverter import * class PartyPokerParseError(FpdbParseError): "Usage: raise PartyPokerParseError([, hh=][, hid=])" + def __init__(self, msg='', hh=None, hid=None): if hh is not None: msg += "\n\nHand history attached below:\n" + self.wrapHh(hh) - return super(PartyPokerParseError, self).__init__(hid=hid) - #return super(PartyPokerParseError, self).__init__(msg, hid=hid) + return super(PartyPokerParseError, self).__init__(msg, hid=hid) + def wrapHh(self, hh): return ("%(DELIMETER)s\n%(HH)s\n%(DELIMETER)s") % \ {'DELIMETER': '#'*50, 'HH': hh} @@ -93,7 +94,7 @@ class PartyPoker(HandHistoryConverter): """, re.MULTILINE|re.VERBOSE) - re_TotalPlayers = re.compile("^Total\s+number\s+of\s+players\s*:\s*(?P\d+)", re.MULTILINE) +# re_TotalPlayers = re.compile("^Total\s+number\s+of\s+players\s*:\s*(?P\d+)", re.MULTILINE) re_SplitHands = re.compile('\x00+') re_TailSplitHands = re.compile('(\x00+)') lineSplitter = '\n' @@ -229,7 +230,6 @@ class PartyPoker(HandHistoryConverter): "Unknown game type '%s'" % mg['GAME'], hh = handText) - if 'TOURNO' in mg: info['type'] = 'tour' else: @@ -237,15 +237,12 @@ class PartyPoker(HandHistoryConverter): if info['type'] == 'ring': info['sb'], info['bb'] = ringBlinds(mg['RINGLIMIT']) - # FIXME: there are only $ and play money availible for cash - # to be honest, party doesn't save play money hh info['currency'] = currencies[mg['CURRENCY']] else: info['sb'] = clearMoneyString(mg['SB']) info['bb'] = clearMoneyString(mg['BB']) info['currency'] = 'T$' - # NB: SB, BB must be interpreted as blinds or bets depending on limit type. return info @@ -269,8 +266,8 @@ class PartyPoker(HandHistoryConverter): hh=hand.handText, hid = info['HID']) - m = self.re_TotalPlayers.search(hand.handText) - if m: info.update(m.groupdict()) +# m = self.re_TotalPlayers.search(hand.handText) +# if m: info.update(m.groupdict()) # FIXME: it's dirty hack @@ -318,7 +315,7 @@ class PartyPoker(HandHistoryConverter): hand.tourNo = info[key] if key == 'BUYIN': # FIXME: it's dirty hack T_T - # code below assumes that rake is equal to zero + # code below assumes that tournament rake is equal to zero cur = info[key][0] if info[key][0] not in '0123456789' else '' hand.buyin = info[key] + '+%s0' % cur if key == 'LEVEL': @@ -474,11 +471,9 @@ class PartyPoker(HandHistoryConverter): if m.group('CARDS') is not None: cards = renderCards(m.group('CARDS')) - (shown, mucked) = (False, False) - if m.group('SHOWED') == "show": shown = True - else: mucked = True + mucked = m.group('SHOWED') != "show" - hand.addShownCards(cards=cards, player=m.group('PNAME'), shown=shown, mucked=mucked) + hand.addShownCards(cards=cards, player=m.group('PNAME'), shown=True, mucked=mucked) def ringBlinds(ringLimit): "Returns blinds for current limit in cash games"