diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index e7235da2..2d797597 100644 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -32,12 +32,6 @@ import shutil import xml.dom.minidom from xml.dom.minidom import Node -#class Layout: -# def __init__(self, max): -# self.max = int(max) -# self.location = [] -# for i in range(self.max + 1): self.location.append(None) - class Layout: def __init__(self, node): @@ -47,7 +41,7 @@ class Layout: self.height = int( node.getAttribute('height') ) self.location = [] - for i in range(self.max + 1): self.location.append(None) + self.location = map(lambda x: None, range(self.max+1)) # there must be a better way to do this? for location_node in node.getElementsByTagName('location'): if location_node.getAttribute('seat') != "": @@ -639,7 +633,7 @@ class Config: def execution_path(self, filename): """Join the fpdb path to filename.""" - return os.path.join(os.path.dirname(inspect.getfile(sys._getframe(1))), filename) + return os.path.join(os.path.dirname(inspect.getfile(sys._getframe(0))), filename) if __name__== "__main__": c = Config() diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index d994aa4a..11038a68 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -149,8 +149,8 @@ class Database: cv = "card%dValue" % i if cv not in d or d[cv] == None: break - elif d[cv] == 0: - cards = "%sxx" % cards + elif d[key] == 0: + cards += "xx" else: cs = "card%dSuit" % i cards = "%s%s%s" % (cards, ranks[d[cv]], d[cs]) diff --git a/pyfpdb/EverleafToFpdb.py b/pyfpdb/EverleafToFpdb.py index 80637445..edb61f3d 100755 --- a/pyfpdb/EverleafToFpdb.py +++ b/pyfpdb/EverleafToFpdb.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# -*- coding: iso-8859-15 -*- +# -*- coding: utf-8 -*- +# # Copyright 2008, Carl Gherardi # # This program is free software; you can redistribute it and/or modify @@ -11,7 +12,7 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -19,9 +20,7 @@ import sys import logging -import Configuration from HandHistoryConverter import * -from time import strftime # Class for converting Everleaf HH format. @@ -29,45 +28,71 @@ class Everleaf(HandHistoryConverter): # Static regexes re_SplitHands = re.compile(r"\n\n+") - re_GameInfo = re.compile(r"^(Blinds )?\$?(?P[.0-9]+)/\$?(?P[.0-9]+) ((?PNL|PL) )?(?P(Hold\'em|Omaha|7 Card Stud))", re.MULTILINE) - re_HandInfo = re.compile(r".*#(?P[0-9]+)\n.*\n(Blinds )?\$?(?P[.0-9]+)/\$?(?P[.0-9]+) (?P.*) - (?P\d\d\d\d/\d\d/\d\d - \d\d:\d\d:\d\d)\nTable (?P[- a-zA-Z]+)") - re_Button = re.compile(r"^Seat (?P
.+$)", re.MULTILINE) + re_Button = re.compile(ur"^Seat (?P
[- a-zA-Z]+) (\((?P.+)\) )?- \$?(?P[.0-9]+)/\$?(?P[.0-9]+) (Ante \$(?P[.0-9]+) )?- (?P[a-zA-Z\' ]+) - (?P.*)') re_Button = re.compile('^The button is in seat #(?P
[- a-zA-Z]+)\'(?P.+?$)?", re.MULTILINE) + re_Button = re.compile('Seat #(?P
[ a-zA-Z]+) - \$?(?P[.0-9]+)/\$?(?P[.0-9]+) - (?P.*) - (?P
[0-9]+):(?P[0-9]+) ET - (?P[0-9]+)/(?P[0-9]+)/(?P[0-9]+)Table (?P
[ a-zA-Z]+)\nSeat (?P