Merge branch 'master' of git://git.assembla.com/fpdb
This commit is contained in:
commit
243a140aa4
|
@ -2,6 +2,19 @@
|
|||
# Distributed under the terms of the GNU General Public License v2
|
||||
# created by Steffen Schaumburg, steffen@schaumburger.info
|
||||
|
||||
29 Aug 2010; Erki Ferenc <erkiferenc@gmail.com>
|
||||
fpdb-0.20.906.ebuild, fpdb-9999.ebuild:
|
||||
improve l10n handling
|
||||
|
||||
29 Aug 2010; Steffen Schaumburg <steffen@schaumburger.info>
|
||||
fpdb-0.20.1.ebuild, fpdb-0.20.906.ebuild, fpdb-9999.ebuild:
|
||||
change required python version to 2.6
|
||||
|
||||
*fpdb-0.20.906 (29 Aug 2010)
|
||||
29 Aug 2010; Steffen Schaumburg <steffen@schaumburger.info>
|
||||
+fpdb-0.20.906.ebuild -fpdb-0.20.904.ebuild:
|
||||
Bump version
|
||||
|
||||
*fpdb-0.20.1 fpdb-0.20.904 fpdb-9999 (17 Aug 2010)
|
||||
|
||||
17 Aug 2010; Steffen Schaumburg <steffen@schaumburger.info>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
DIST fpdb-0.20.1.tar.bz2 662807 RMD160 b5f22a684c605ddbba7d2154005a822b02a19490 SHA1 e4cc40de5849d3ae33a680d917b340ab37c6448b SHA256 46eff0625f300c070ce88c519ae6019f6e1c98a7725733c5e16b50a058247fe3
|
||||
DIST fpdb-0.20.904.tar.bz2 632871 RMD160 6af83a9b30e8b3f394b011a4dc92937f130b9e15 SHA1 083c51f1627f901e24801bf6abebf1d07646bd89 SHA256 5e72055fe7ebb0c6048282f8edc972ee01be21063d6f8071abef22111f3e82f9
|
||||
EBUILD fpdb-0.20.1.ebuild 1591 RMD160 56ccbca72353e56718a927178e58d148177f5846 SHA1 770df692b29b7314d70703010e1f6afac623c3f3 SHA256 e3f434df58d98760a118458166f9fdfcf3612712c78c704f089f6e8ec72bd224
|
||||
EBUILD fpdb-0.20.904.ebuild 1595 RMD160 b5cbcdb8d2984b149c833db8b6aee362168e9c7d SHA1 7151fd3cef087c38060b44adb622843a84209f33 SHA256 41c6ed71aa0ff727d670c94cc72cf595bcd038f601121e51222532df727a6d01
|
||||
EBUILD fpdb-9999.ebuild 1618 RMD160 843d309bbc2ccdd95dbb4b0eb08571d8e16d06ad SHA1 b1ebdbe0e40bd6c0d4ec417dd2b8a135884547a6 SHA256 72205c1f94bcf2c3f310d396928e357fabaee4861773044c1dac71f98f6596bf
|
||||
MISC ChangeLog 395 RMD160 b195ccf198011356ca79b16071093c4d92e5927a SHA1 9aa56e5dc9c5d03b62fb60bc81069f3440b1f606 SHA256 b7ba8c180da0e6a405d939c4485f9c8e52fdcafb04207ef6de217a807015bd03
|
||||
DIST fpdb-0.20.906.tar.bz2 702558 RMD160 bc5d01ef4899502aea33f286ac4274ef7ef498ef SHA1 9791680d53de1b276dc0297ac43a0e11758d3e19 SHA256 9ae706d5e9c2a2ee031d2b222ba46e088993cc892fc08b5276bbfd5e44a0436b
|
||||
EBUILD fpdb-0.20.1.ebuild 1508 RMD160 7585cd1de73172649e182782d427a476afed4036 SHA1 3c92d6dbb868b8b4c26b75539771641087742761 SHA256 9a7d302016e4c4d6cc18af14514bd5112d18aeb7dc6390a3413e3e4cc71da6bd
|
||||
EBUILD fpdb-0.20.906.ebuild 1643 RMD160 ed44ee49d715458b54edbbe054eb5c9775c6ac7a SHA1 ebd8ea291ace0671d4eb264754dfb0616373a51a SHA256 a9bdad768a0ab5ef065f3e6e2e1bd89dded6e0d3b64c4771944c4aae7d163efd
|
||||
EBUILD fpdb-9999.ebuild 1685 RMD160 f06457ead33dca99c0acf830f26bbf2f8ca12cd1 SHA1 70444fa4a88439955472407ec0b072970993631a SHA256 2df59120b376bb4e5966f8a719bc881c756b3210b7a30d394ee1753efbfd706e
|
||||
MISC ChangeLog 831 RMD160 efd32886d09b0750e680716030c0034c3a280a25 SHA1 82f3eda3cd83cbba3e45d4b75593e74f3dd4f568 SHA256 d74efef05cf51ef3840ef043218c8a30c1bcccfa9d9d2e4ca1b7198ed1c91f29
|
||||
MISC metadata.xml 550 RMD160 a6fa8799f644c0882f832a12cc9e6a0f4f09ae7f SHA1 3a40c442cadb1f532e0299040c2da79e9721dd4f SHA256 b5a1c538de3786446a87479b1023cdb4f084085feb7290959619739969ce7d3b
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
|
||||
EAPI="2"
|
||||
|
||||
inherit eutils
|
||||
inherit games
|
||||
|
||||
NEED_PYTHON=2.5
|
||||
inherit eutils games
|
||||
|
||||
DESCRIPTION="A free/open source tracker/HUD for use with online poker"
|
||||
HOMEPAGE="http://fpdb.wiki.sourceforge.net/"
|
||||
|
@ -49,7 +46,7 @@ src_install() {
|
|||
newicon gfx/fpdb-icon.png ${PN}.png
|
||||
make_desktop_entry ${PN}
|
||||
|
||||
chmod +x "${D}/${GAMES_DATADIR}"/${PN}/pyfpdb/*.pyw
|
||||
fperms +x "${GAMES_DATADIR}"/${PN}/pyfpdb/*.pyw
|
||||
prepgamesdirs
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,7 @@
|
|||
|
||||
EAPI="2"
|
||||
|
||||
inherit eutils
|
||||
inherit games
|
||||
|
||||
NEED_PYTHON=2.5
|
||||
inherit eutils games
|
||||
|
||||
DESCRIPTION="A free/open source tracker/HUD for use with online poker"
|
||||
HOMEPAGE="http://fpdb.wiki.sourceforge.net/"
|
||||
|
@ -18,7 +15,7 @@ SLOT="0"
|
|||
KEYWORDS="~amd64 ~x86"
|
||||
#note: this should work on other architectures too, please send me your experiences
|
||||
|
||||
IUSE="graph mysql postgres sqlite linguas_hu linguas_it"
|
||||
IUSE="graph mysql postgres sqlite linguas_hu"
|
||||
RDEPEND="
|
||||
mysql? ( virtual/mysql
|
||||
dev-python/mysql-python )
|
||||
|
@ -36,29 +33,27 @@ DEPEND="${RDEPEND}"
|
|||
|
||||
src_install() {
|
||||
insinto "${GAMES_DATADIR}"/${PN}
|
||||
doins -r gfx
|
||||
doins -r pyfpdb
|
||||
doins -r gfx || die "failed to install gfx directory"
|
||||
doins -r pyfpdb || die "failed to install pyfpdb directory"
|
||||
|
||||
if use linguas_hu; then
|
||||
dosym "${GAMES_DATADIR}"/${PN}/pyfpdb/locale/hu/LC_MESSAGES/${PN}.mo /usr/share/locale/hu/LC_MESSAGES/${PN}.mo
|
||||
msgfmt pyfpdb/locale/fpdb-hu_HU.po -o pyfpdb/locale/hu.mo || die "failed to create hungarian mo file"
|
||||
fi
|
||||
|
||||
if use linguas_it; then
|
||||
dosym "${GAMES_DATADIR}"/${PN}/pyfpdb/locale/it/LC_MESSAGES/${PN}.mo /usr/share/locale/it/LC_MESSAGES/${PN}.mo
|
||||
fi
|
||||
domo pyfpdb/locale/*.mo || die "failed to install mo files"
|
||||
|
||||
doins readme.txt
|
||||
doins readme.txt || die "failed to install readme.txt file"
|
||||
|
||||
exeinto "${GAMES_DATADIR}"/${PN}
|
||||
doexe run_fpdb.py
|
||||
doexe run_fpdb.py || die "failed to install executable run_fpdb.py"
|
||||
|
||||
dodir "${GAMES_BINDIR}"
|
||||
dosym "${GAMES_DATADIR}"/${PN}/run_fpdb.py "${GAMES_BINDIR}"/${PN}
|
||||
dosym "${GAMES_DATADIR}"/${PN}/run_fpdb.py "${GAMES_BINDIR}"/${PN} || die "failed to create symlink for starting fpdb"
|
||||
|
||||
newicon gfx/fpdb-icon.png ${PN}.png
|
||||
make_desktop_entry ${PN}
|
||||
newicon gfx/fpdb-icon.png ${PN}.png || die "failed to install fpdb icon"
|
||||
make_desktop_entry ${PN} || die "failed to create desktop entry"
|
||||
|
||||
chmod +x "${D}/${GAMES_DATADIR}"/${PN}/pyfpdb/*.pyw
|
||||
fperms +x "${GAMES_DATADIR}"/${PN}/pyfpdb/*.pyw
|
||||
prepgamesdirs
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
Repoman currently gives the following errors for our ebuilds:
|
||||
ebuild.allmasked: This error can be ignored, as all our packages are supposed to be masked
|
||||
ebuild.badheader 3
|
||||
games-util/fpdb/fpdb-0.20.1.ebuild: Malformed CVS Header on line: 3
|
||||
games-util/fpdb/fpdb-0.20.904.ebuild: Malformed CVS Header on line: 3
|
||||
games-util/fpdb/fpdb-9999.ebuild: Malformed CVS Header on line: 3
|
||||
not sure what the correct header is for a sunrise ebuild so leaving as-is for now
|
||||
|
||||
Useful Links:
|
||||
http://overlays.gentoo.org/proj/sunrise/wiki/SunriseFaq
|
||||
|
|
|
@ -4,11 +4,7 @@
|
|||
|
||||
EAPI="2"
|
||||
|
||||
inherit eutils
|
||||
inherit games
|
||||
inherit git
|
||||
|
||||
NEED_PYTHON=2.5
|
||||
inherit eutils games git
|
||||
|
||||
DESCRIPTION="A free/open source tracker/HUD for use with online poker"
|
||||
HOMEPAGE="http://fpdb.wiki.sourceforge.net/"
|
||||
|
@ -17,9 +13,8 @@ EGIT_REPO_URI="git://git.assembla.com/fpdb.git"
|
|||
LICENSE="AGPL-3"
|
||||
SLOT="0"
|
||||
KEYWORDS=""
|
||||
#note: this should work on other architectures too, please send me your experiences
|
||||
|
||||
IUSE="graph mysql postgres sqlite linguas_hu linguas_it"
|
||||
IUSE="graph mysql postgres sqlite linguas_de linguas_hu"
|
||||
RDEPEND="
|
||||
mysql? ( virtual/mysql
|
||||
dev-python/mysql-python )
|
||||
|
@ -44,14 +39,16 @@ src_install() {
|
|||
doins -r gfx
|
||||
doins -r pyfpdb
|
||||
|
||||
if use linguas_hu; then
|
||||
dosym "${GAMES_DATADIR}"/${PN}/pyfpdb/locale/hu/LC_MESSAGES/${PN}.mo /usr/share/locale/hu/LC_MESSAGES/${PN}.mo
|
||||
if use linguas_de; then
|
||||
msgfmt pyfpdb/locale/fpdb-de_DE.po -o pyfpdb/locale/de.mo
|
||||
fi
|
||||
|
||||
if use linguas_it; then
|
||||
dosym "${GAMES_DATADIR}"/${PN}/pyfpdb/locale/it/LC_MESSAGES/${PN}.mo /usr/share/locale/it/LC_MESSAGES/${PN}.mo
|
||||
if use linguas_hu; then
|
||||
msgfmt pyfpdb/locale/fpdb-hu_HU.po -o pyfpdb/locale/hu.mo
|
||||
fi
|
||||
|
||||
domo pyfpdb/locale/*.mo
|
||||
|
||||
doins readme.txt
|
||||
|
||||
exeinto "${GAMES_DATADIR}"/${PN}
|
||||
|
@ -63,7 +60,7 @@ src_install() {
|
|||
newicon gfx/fpdb-icon.png ${PN}.png
|
||||
make_desktop_entry ${PN}
|
||||
|
||||
chmod +x "${D}/${GAMES_DATADIR}"/${PN}/pyfpdb/*.pyw
|
||||
fperms +x "${GAMES_DATADIR}"/${PN}/pyfpdb/*.pyw
|
||||
prepgamesdirs
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ class Absolute(HandHistoryConverter):
|
|||
def readHandInfo(self, hand):
|
||||
m = self.re_HandInfo.search(hand.handText)
|
||||
if(m == None):
|
||||
logging.info("Didn't match re_HandInfo")
|
||||
logging.info(_("Didn't match re_HandInfo"))
|
||||
logging.info(hand.handText)
|
||||
return None
|
||||
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
|
||||
|
@ -221,7 +221,7 @@ class Absolute(HandHistoryConverter):
|
|||
hand.setCommunityCards(street=street, cards=cards)
|
||||
|
||||
def readAntes(self, hand):
|
||||
logging.debug("reading antes")
|
||||
logging.debug(_("reading antes"))
|
||||
m = self.re_Antes.finditer(hand.handText)
|
||||
for player in m:
|
||||
logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')))
|
||||
|
@ -230,17 +230,17 @@ class Absolute(HandHistoryConverter):
|
|||
def readBringIn(self, hand):
|
||||
m = self.re_BringIn.search(hand.handText,re.DOTALL)
|
||||
if m:
|
||||
logging.debug("Player bringing in: %s for %s" %(m.group('PNAME'), m.group('BRINGIN')))
|
||||
logging.debug(_("Player bringing in: %s for %s" %(m.group('PNAME'), m.group('BRINGIN'))))
|
||||
hand.addBringIn(m.group('PNAME'), m.group('BRINGIN'))
|
||||
else:
|
||||
logging.warning("No bringin found.")
|
||||
logging.warning(_("No bringin found."))
|
||||
|
||||
def readBlinds(self, hand):
|
||||
m = self.re_PostSB.search(hand.handText)
|
||||
if m is not None:
|
||||
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
|
||||
else:
|
||||
logging.debug("No small blind")
|
||||
logging.debug(_("No small blind"))
|
||||
hand.addBlind(None, None, None)
|
||||
for a in self.re_PostBB.finditer(hand.handText):
|
||||
hand.addBlind(a.group('PNAME'), 'big blind', a.group('BB'))
|
||||
|
@ -267,7 +267,7 @@ class Absolute(HandHistoryConverter):
|
|||
|
||||
def readStudPlayerCards(self, hand, street):
|
||||
# lol. see Plymouth.txt
|
||||
logging.warning("Absolute readStudPlayerCards is only a stub.")
|
||||
logging.warning(_("Absolute readStudPlayerCards is only a stub."))
|
||||
#~ if street in ('THIRD', 'FOURTH', 'FIFTH', 'SIXTH'):
|
||||
#~ hand.addPlayerCards(player = player.group('PNAME'), street = street, closed = [], open = [])
|
||||
|
||||
|
@ -290,7 +290,7 @@ class Absolute(HandHistoryConverter):
|
|||
elif action.group('ATYPE') == ' complete to': # TODO: not supported yet ?
|
||||
hand.addComplete( street, action.group('PNAME'), action.group('BET'))
|
||||
else:
|
||||
logging.debug("Unimplemented readAction: %s %s" %(action.group('PNAME'),action.group('ATYPE'),))
|
||||
logging.debug(_("Unimplemented readAction: %s %s" %(action.group('PNAME'),action.group('ATYPE'),)))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
@ -334,9 +334,9 @@ if __name__ == "__main__":
|
|||
config = Configuration.Config(None)
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="-")
|
||||
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False)
|
||||
parser.add_option("-i", "--input", dest="ipath", help=_("parse input hand history"), default="-")
|
||||
parser.add_option("-o", "--output", dest="opath", help=_("output translation to"), default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help=_("follow (tail -f) the input"), action="store_true", default=False)
|
||||
parser.add_option("-q", "--quiet",
|
||||
action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO)
|
||||
parser.add_option("-v", "--verbose",
|
||||
|
|
|
@ -127,7 +127,7 @@ class Betfair(HandHistoryConverter):
|
|||
|
||||
#Shouldn't really dip into the Hand object, but i've no idea how to tell the length of iter m
|
||||
if len(hand.players) < 2:
|
||||
logging.info("readPlayerStacks: Less than 2 players found in a hand")
|
||||
logging.info(_("readPlayerStacks: Less than 2 players found in a hand"))
|
||||
|
||||
def markStreets(self, hand):
|
||||
m = re.search(r"\*\* Dealing down cards \*\*(?P<PREFLOP>.+(?=\*\* Dealing Flop \*\*)|.+)"
|
||||
|
@ -164,7 +164,7 @@ class Betfair(HandHistoryConverter):
|
|||
def readBringIn(self, hand):
|
||||
m = self.re_BringIn.search(hand.handText,re.DOTALL)
|
||||
if m:
|
||||
logging.debug("Player bringing in: %s for %s" %(m.group('PNAME'), m.group('BRINGIN')))
|
||||
logging.debug(_("Player bringing in: %s for %s" %(m.group('PNAME'), m.group('BRINGIN'))))
|
||||
hand.addBringIn(m.group('PNAME'), m.group('BRINGIN'))
|
||||
else:
|
||||
logging.warning(_("No bringin found"))
|
||||
|
|
|
@ -148,7 +148,7 @@ or None if we fail to get the info """
|
|||
def readHandInfo(self, hand):
|
||||
m = self.re_HandInfo.search(hand.handText)
|
||||
if m is None:
|
||||
logging.info("Didn't match re_HandInfo")
|
||||
logging.info(_("Didn't match re_HandInfo"))
|
||||
logging.info(hand.handText)
|
||||
return None
|
||||
logging.debug("HID %s-%s, Table %s" % (m.group('HID1'),
|
||||
|
@ -254,8 +254,8 @@ or None if we fail to get the info """
|
|||
elif action.group('ATYPE') == 'ALL_IN':
|
||||
hand.addAllIn(street, player, action.group('BET'))
|
||||
else:
|
||||
logging.debug("Unimplemented readAction: %s %s"
|
||||
% (action.group('PSEAT'),action.group('ATYPE'),))
|
||||
logging.debug(_("Unimplemented readAction: %s %s"
|
||||
% (action.group('PSEAT'),action.group('ATYPE'),)))
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
||||
|
@ -285,9 +285,9 @@ or None if we fail to get the info """
|
|||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="-")
|
||||
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False)
|
||||
parser.add_option("-i", "--input", dest="ipath", help=_("parse input hand history"), default="-")
|
||||
parser.add_option("-o", "--output", dest="opath", help=_("output translation to"), default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help=_("follow (tail -f) the input"), action="store_true", default=False)
|
||||
parser.add_option("-q", "--quiet", action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO)
|
||||
parser.add_option("-v", "--verbose", action="store_const", const=logging.INFO, dest="verbosity")
|
||||
parser.add_option("--vv", action="store_const", const=logging.DEBUG, dest="verbosity")
|
||||
|
|
|
@ -82,6 +82,11 @@ def get_exec_path():
|
|||
|
||||
def get_config(file_name, fallback = True):
|
||||
"""Looks in cwd and in self.default_config_path for a config file."""
|
||||
|
||||
# look for example file even if not used here, path is returned to caller
|
||||
config_found,example_found,example_copy = False,False,False
|
||||
config_path, example_path = None,None
|
||||
|
||||
exec_dir = get_exec_path()
|
||||
if file_name == 'logging.conf' and not hasattr(sys, "frozen"):
|
||||
config_path = os.path.join(exec_dir, 'pyfpdb', file_name)
|
||||
|
@ -89,17 +94,13 @@ def get_config(file_name, fallback = True):
|
|||
config_path = os.path.join(exec_dir, file_name)
|
||||
# print "config_path=", config_path
|
||||
if os.path.exists(config_path): # there is a file in the cwd
|
||||
return (config_path,False) # so we use it
|
||||
config_found = True # so we use it
|
||||
else: # no file in the cwd, look where it should be in the first place
|
||||
default_dir = get_default_config_path()
|
||||
config_path = os.path.join(default_dir, file_name)
|
||||
# print "config path 2=", config_path
|
||||
if os.path.exists(config_path):
|
||||
return (config_path,False)
|
||||
|
||||
# No file found
|
||||
if not fallback:
|
||||
return (False,False)
|
||||
config_found = True
|
||||
|
||||
# Example configuration for debian package
|
||||
if os.name == 'posix':
|
||||
|
@ -108,38 +109,43 @@ def get_config(file_name, fallback = True):
|
|||
# the config directory for us so there's no need to check it
|
||||
# again
|
||||
example_path = '/usr/share/python-fpdb/' + file_name + '.example'
|
||||
try:
|
||||
shutil.copyfile(example_path, config_path)
|
||||
msg = _("Config file has been created at %s.\n") % config_path
|
||||
logging.info(msg)
|
||||
return (config_path,False)
|
||||
except IOError:
|
||||
pass
|
||||
if not config_found and fallback:
|
||||
try:
|
||||
shutil.copyfile(example_path, config_path)
|
||||
example_copy = True
|
||||
msg = _("Config file has been created at %s.\n") % config_path
|
||||
logging.info(msg)
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
# OK, fall back to the .example file, should be in the start dir
|
||||
if os.path.exists(file_name + ".example"):
|
||||
elif os.path.exists(file_name + ".example"):
|
||||
try:
|
||||
print ""
|
||||
example_path = file_name + ".example"
|
||||
check_dir(default_dir)
|
||||
shutil.copyfile(file_name + ".example", config_path)
|
||||
msg = _("No %s found\n in %s\n or %s\n") % (file_name, exec_dir, default_dir) \
|
||||
+ _("Config file has been created at %s.\n") % config_path
|
||||
print msg
|
||||
logging.info(msg)
|
||||
file_name = config_path
|
||||
if not config_found and fallback:
|
||||
shutil.copyfile(example_path, config_path)
|
||||
example_copy = True
|
||||
msg = _("No %s found\n in %s\n or %s\n") % (file_name, exec_dir, default_dir) \
|
||||
+ _("Config file has been created at %s.\n") % config_path
|
||||
print msg
|
||||
logging.info(msg)
|
||||
except:
|
||||
print _("Error copying .example file, cannot fall back. Exiting.\n")
|
||||
sys.stderr.write(_("Error copying .example file, cannot fall back. Exiting.\n"))
|
||||
print _("Error copying .example config file, cannot fall back. Exiting.\n")
|
||||
sys.stderr.write(_("Error copying .example config file, cannot fall back. Exiting.\n"))
|
||||
sys.stderr.write( str(sys.exc_info()) )
|
||||
sys.exit()
|
||||
else:
|
||||
elif fallback:
|
||||
print _("No %s found, cannot fall back. Exiting.\n") % file_name
|
||||
sys.stderr.write(_("No %s found, cannot fall back. Exiting.\n") % file_name)
|
||||
sys.exit()
|
||||
return (file_name,True)
|
||||
|
||||
#print "get_config: returning "+str( (config_path,example_copy,example_path) )
|
||||
return (config_path,example_copy,example_path)
|
||||
|
||||
def get_logger(file_name, config = "config", fallback = False, log_dir=None, log_file=None):
|
||||
(conf_file,copied) = get_config(file_name, fallback = fallback)
|
||||
(conf_file,copied,example_file) = get_config(file_name, fallback = fallback)
|
||||
|
||||
if log_dir is None:
|
||||
log_dir = os.path.join(get_exec_path(), u'log')
|
||||
|
@ -674,7 +680,7 @@ class Config:
|
|||
sys.stderr.write(_("Configuration file %s not found. Using defaults.") % (file))
|
||||
file = None
|
||||
|
||||
if file is None: (file,self.example_copy) = get_config("HUD_config.xml", True)
|
||||
if file is None: (file,self.example_copy,example_file) = get_config("HUD_config.xml", True)
|
||||
|
||||
self.file = file
|
||||
self.dir_self = get_exec_path()
|
||||
|
@ -685,27 +691,6 @@ class Config:
|
|||
self.log_file = os.path.join(self.dir_log, u'fpdb-log.txt')
|
||||
log = get_logger("logging.conf", "config", log_dir=self.dir_log)
|
||||
|
||||
# Parse even if there was no real config file found and we are using the example
|
||||
# If using the example, we'll edit it later
|
||||
log.info(_("Reading configuration file %s") % file)
|
||||
print _("\nReading configuration file %s\n") % file
|
||||
try:
|
||||
doc = xml.dom.minidom.parse(file)
|
||||
self.file_error = None
|
||||
except:
|
||||
log.error(_("Error parsing %s. See error log file.") % (file))
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
self.file_error = sys.exc_info()[1]
|
||||
# we could add a parameter to decide whether to return or read a line and exit?
|
||||
return
|
||||
#print "press enter to continue"
|
||||
#sys.stdin.readline()
|
||||
#sys.exit()
|
||||
#ExpatError: not well-formed (invalid token): line 511, column 4
|
||||
#sys.exc_info = (<class 'xml.parsers.expat.ExpatError'>, ExpatError('not well-formed (invalid token): line 511,
|
||||
# column 4',), <traceback object at 0x024503A0>)
|
||||
|
||||
self.doc = doc
|
||||
self.supported_sites = {}
|
||||
self.supported_games = {}
|
||||
self.supported_databases = {} # databaseName --> Database instance
|
||||
|
@ -717,6 +702,32 @@ class Config:
|
|||
self.emails = {}
|
||||
self.gui_cash_stats = GUICashStats()
|
||||
|
||||
added,n = 1,0 # use n to prevent infinite loop if add_missing_elements() fails somehow
|
||||
while added > 0 and n < 2:
|
||||
n = n + 1
|
||||
log.info(_("Reading configuration file %s") % file)
|
||||
print _("\nReading configuration file %s\n") % file
|
||||
try:
|
||||
doc = xml.dom.minidom.parse(file)
|
||||
self.doc = doc
|
||||
self.file_error = None
|
||||
except:
|
||||
log.error(_("Error parsing %s. See error log file.") % (file))
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
self.file_error = sys.exc_info()[1]
|
||||
# we could add a parameter to decide whether to return or read a line and exit?
|
||||
return
|
||||
#print "press enter to continue"
|
||||
#sys.stdin.readline()
|
||||
#sys.exit()
|
||||
#ExpatError: not well-formed (invalid token): line 511, column 4
|
||||
#sys.exc_info = (<class 'xml.parsers.expat.ExpatError'>, ExpatError('not well-formed (invalid token): line 511,
|
||||
# column 4',), <traceback object at 0x024503A0>)
|
||||
|
||||
if not self.example_copy and example_file is not None:
|
||||
# reads example file and adds missing elements into current config
|
||||
added = self.add_missing_elements(doc, example_file)
|
||||
|
||||
if doc.getElementsByTagName("general") == []:
|
||||
self.general.get_defaults()
|
||||
for gen_node in doc.getElementsByTagName("general"):
|
||||
|
@ -792,7 +803,7 @@ class Config:
|
|||
self.set_db_parameters(db_name = 'fpdb', db_ip = df_parms['db-host'],
|
||||
db_user = df_parms['db-user'],
|
||||
db_pass = df_parms['db-password'])
|
||||
self.save(file=os.path.join(self.default_config_path, "HUD_config.xml"))
|
||||
self.save(file=os.path.join(self.dir_config, "HUD_config.xml"))
|
||||
|
||||
if doc.getElementsByTagName("raw_hands") == []:
|
||||
self.raw_hands = RawHands()
|
||||
|
@ -807,6 +818,40 @@ class Config:
|
|||
print ""
|
||||
#end def __init__
|
||||
|
||||
def add_missing_elements(self, doc, example_file):
|
||||
""" Look through example config file and add any elements that are not in the config
|
||||
May need to add some 'enabled' attributes to turn things off - can't just delete a
|
||||
config section now because this will add it back in"""
|
||||
|
||||
nodes_added = 0
|
||||
|
||||
try:
|
||||
example_doc = xml.dom.minidom.parse(example_file)
|
||||
except:
|
||||
log.error(_("Error parsing example file %s. See error log file.") % (example_file))
|
||||
return nodes_added
|
||||
|
||||
for cnode in doc.getElementsByTagName("FreePokerToolsConfig"):
|
||||
for example_cnode in example_doc.childNodes:
|
||||
if example_cnode.localName == "FreePokerToolsConfig":
|
||||
for e in example_cnode.childNodes:
|
||||
#print "nodetype", e.nodeType, "name", e.localName, "found", len(doc.getElementsByTagName(e.localName))
|
||||
if e.nodeType == e.ELEMENT_NODE and doc.getElementsByTagName(e.localName) == []:
|
||||
new = doc.importNode(e, True) # True means do deep copy
|
||||
t_node = self.doc.createTextNode(" ")
|
||||
cnode.appendChild(t_node)
|
||||
cnode.appendChild(new)
|
||||
t_node = self.doc.createTextNode("\r\n\r\n")
|
||||
cnode.appendChild(t_node)
|
||||
print "... adding missing config section: " + e.localName
|
||||
nodes_added = nodes_added + 1
|
||||
|
||||
if nodes_added > 0:
|
||||
print "Added %d missing config sections\n" % nodes_added
|
||||
self.save()
|
||||
|
||||
return nodes_added
|
||||
|
||||
def set_hhArchiveBase(self, path):
|
||||
self.imp.node.setAttribute("hhArchiveBase", path)
|
||||
|
||||
|
|
|
@ -19,6 +19,10 @@
|
|||
import Card
|
||||
from decimal import Decimal
|
||||
|
||||
import logging
|
||||
# logging has been set up in fpdb.py or HUD_main.py, use their settings:
|
||||
log = logging.getLogger("parser")
|
||||
|
||||
DEBUG = False
|
||||
|
||||
if DEBUG:
|
||||
|
|
|
@ -22,6 +22,18 @@ import sys
|
|||
import logging
|
||||
from HandHistoryConverter import *
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
# Class for converting Everleaf HH format.
|
||||
|
||||
class Everleaf(HandHistoryConverter):
|
||||
|
@ -133,7 +145,7 @@ or None if we fail to get the info """
|
|||
def readHandInfo(self, hand):
|
||||
m = self.re_HandInfo.search(hand.handText)
|
||||
if(m == None):
|
||||
logging.info("Didn't match re_HandInfo")
|
||||
logging.info(_("Didn't match re_HandInfo"))
|
||||
logging.info(hand.handText)
|
||||
return None
|
||||
logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE')))
|
||||
|
@ -202,7 +214,7 @@ or None if we fail to get the info """
|
|||
hand.setCommunityCards(street=street, cards=cards)
|
||||
|
||||
def readAntes(self, hand):
|
||||
logging.debug("reading antes")
|
||||
logging.debug(_("reading antes"))
|
||||
m = self.re_Antes.finditer(hand.handText)
|
||||
for player in m:
|
||||
logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')))
|
||||
|
@ -214,14 +226,14 @@ or None if we fail to get the info """
|
|||
logging.debug("Player bringing in: %s for %s" %(m.group('PNAME'), m.group('BRINGIN')))
|
||||
hand.addBringIn(m.group('PNAME'), m.group('BRINGIN'))
|
||||
else:
|
||||
logging.warning("No bringin found.")
|
||||
logging.warning(_("No bringin found."))
|
||||
|
||||
def readBlinds(self, hand):
|
||||
m = self.re_PostSB.search(hand.handText)
|
||||
if m is not None:
|
||||
hand.addBlind(m.group('PNAME'), 'small blind', m.group('SB'))
|
||||
else:
|
||||
logging.debug("No small blind")
|
||||
logging.debug(_("No small blind"))
|
||||
hand.addBlind(None, None, None)
|
||||
for a in self.re_PostBB.finditer(hand.handText):
|
||||
hand.addBlind(a.group('PNAME'), 'big blind', a.group('BB'))
|
||||
|
@ -249,7 +261,7 @@ or None if we fail to get the info """
|
|||
|
||||
def readStudPlayerCards(self, hand, street):
|
||||
# lol. see Plymouth.txt
|
||||
logging.warning("Everleaf readStudPlayerCards is only a stub.")
|
||||
logging.warning(_("Everleaf readStudPlayerCards is only a stub."))
|
||||
#~ if street in ('THIRD', 'FOURTH', 'FIFTH', 'SIXTH'):
|
||||
#~ hand.addPlayerCards(player = player.group('PNAME'), street = street, closed = [], open = [])
|
||||
|
||||
|
@ -272,7 +284,7 @@ or None if we fail to get the info """
|
|||
elif action.group('ATYPE') == ' complete to':
|
||||
hand.addComplete( street, action.group('PNAME'), action.group('BET'))
|
||||
else:
|
||||
logging.debug("Unimplemented readAction: %s %s" %(action.group('PNAME'),action.group('ATYPE'),))
|
||||
logging.debug(_("Unimplemented readAction: %s %s" %(action.group('PNAME'),action.group('ATYPE'),)))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
@ -281,7 +293,7 @@ or None if we fail to get the info """
|
|||
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
||||
cards = shows.group('CARDS')
|
||||
cards = cards.split(', ')
|
||||
logging.debug("readShowdownActions %s %s" %(cards, shows.group('PNAME')))
|
||||
logging.debug(_("readShowdownActions %s %s" %(cards, shows.group('PNAME'))))
|
||||
hand.addShownCards(cards, shows.group('PNAME'))
|
||||
|
||||
|
||||
|
@ -310,9 +322,9 @@ or None if we fail to get the info """
|
|||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="-")
|
||||
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False)
|
||||
parser.add_option("-i", "--input", dest="ipath", help=_("parse input hand history"), default="-")
|
||||
parser.add_option("-o", "--output", dest="opath", help=_("output translation to"), default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help=_("follow (tail -f) the input"), action="store_true", default=False)
|
||||
parser.add_option("-q", "--quiet",
|
||||
action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO)
|
||||
parser.add_option("-v", "--verbose",
|
||||
|
|
|
@ -63,7 +63,7 @@ class Filters(threading.Thread):
|
|||
,'seatsbetween':_('Between:'), 'seatsand':_('And:'), 'seatsshow':_('Show Number of _Players')
|
||||
,'playerstitle':_('Hero:'), 'sitestitle':_('Sites:'), 'gamestitle':_('Games:')
|
||||
,'limitstitle':_('Limits:'), 'seatstitle':_('Number of Players:')
|
||||
,'groupstitle':_('Grouping:'), 'posnshow':_('Show Position Stats:')
|
||||
,'groupstitle':_('Grouping:'), 'posnshow':_('Show Position Stats')
|
||||
,'datestitle':_('Date:')
|
||||
,'groupsall':_('All Players')
|
||||
,'limitsFL':'FL', 'limitsNL':'NL', 'limitsPL':'PL', 'ring':_('Ring'), 'tour':_('Tourney')
|
||||
|
@ -891,7 +891,7 @@ class Filters(threading.Thread):
|
|||
hbox = gtk.HBox()
|
||||
vbox1.pack_start(hbox, False, True, 0)
|
||||
|
||||
lbl_start = gtk.Label('From:')
|
||||
lbl_start = gtk.Label(_('From:'))
|
||||
|
||||
btn_start = gtk.Button()
|
||||
btn_start.set_image(gtk.image_new_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON))
|
||||
|
@ -905,7 +905,7 @@ class Filters(threading.Thread):
|
|||
hbox = gtk.HBox()
|
||||
vbox1.pack_start(hbox, False, True, 0)
|
||||
|
||||
lbl_end = gtk.Label(' To:')
|
||||
lbl_end = gtk.Label(_('To:'))
|
||||
btn_end = gtk.Button()
|
||||
btn_end.set_image(gtk.image_new_from_stock(gtk.STOCK_INDEX, gtk.ICON_SIZE_BUTTON))
|
||||
btn_end.connect('clicked', self.__calendar_dialog, self.end_date)
|
||||
|
|
|
@ -18,6 +18,18 @@
|
|||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
########################################################################
|
||||
|
||||
import locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
if lang=="en":
|
||||
def _(string): return string
|
||||
else:
|
||||
import gettext
|
||||
try:
|
||||
trans = gettext.translation("fpdb", localedir="locale", languages=[lang])
|
||||
trans.install()
|
||||
except IOError:
|
||||
def _(string): return string
|
||||
|
||||
import logging
|
||||
from HandHistoryConverter import *
|
||||
#import TourneySummary
|
||||
|
@ -206,7 +218,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
def readHandInfo(self, hand):
|
||||
m = self.re_HandInfo.search(hand.handText)
|
||||
if m is None:
|
||||
logging.info("Didn't match re_HandInfo")
|
||||
logging.info(_("Didn't match re_HandInfo"))
|
||||
logging.info(hand.handText)
|
||||
raise FpdbParseError("No match in readHandInfo.")
|
||||
hand.handid = m.group('HID')
|
||||
|
@ -336,7 +348,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
hand.addBlind(a.group('PNAME'), 'small & big blinds', a.group('SBBB'))
|
||||
|
||||
def readAntes(self, hand):
|
||||
logging.debug("reading antes")
|
||||
logging.debug(_("reading antes"))
|
||||
m = self.re_Antes.finditer(hand.handText)
|
||||
for player in m:
|
||||
logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')))
|
||||
|
@ -346,10 +358,10 @@ class Fulltilt(HandHistoryConverter):
|
|||
def readBringIn(self, hand):
|
||||
m = self.re_BringIn.search(hand.handText,re.DOTALL)
|
||||
if m:
|
||||
logging.debug("Player bringing in: %s for %s" %(m.group('PNAME'), m.group('BRINGIN')))
|
||||
logging.debug(_("Player bringing in: %s for %s") %(m.group('PNAME'), m.group('BRINGIN')))
|
||||
hand.addBringIn(m.group('PNAME'), m.group('BRINGIN'))
|
||||
else:
|
||||
logging.warning("No bringin found, handid =%s" % hand.handid)
|
||||
logging.warning(_("No bringin found, handid =%s") % hand.handid)
|
||||
|
||||
def readButton(self, hand):
|
||||
hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON'))
|
||||
|
@ -406,7 +418,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
elif action.group('ATYPE') == ' checks':
|
||||
hand.addCheck( street, action.group('PNAME'))
|
||||
else:
|
||||
print "FullTilt: DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),)
|
||||
print _("FullTilt: DEBUG: unimplemented readAction: '%s' '%s'") %(action.group('PNAME'),action.group('ATYPE'),)
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
@ -482,7 +494,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
|
||||
m = self.re_TourneyInfo.search(tourneyText)
|
||||
if not m:
|
||||
log.info( "determineTourneyType : Parsing NOK" )
|
||||
log.info(_("determineTourneyType : Parsing NOK"))
|
||||
return False
|
||||
mg = m.groupdict()
|
||||
#print mg
|
||||
|
@ -540,7 +552,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
if mg['TOURNO'] is not None:
|
||||
tourney.tourNo = mg['TOURNO']
|
||||
else:
|
||||
log.info( "Unable to get a valid Tournament ID -- File rejected" )
|
||||
log.info(_("Unable to get a valid Tournament ID -- File rejected"))
|
||||
return False
|
||||
if tourney.isMatrix:
|
||||
if mg['MATCHNO'] is not None:
|
||||
|
@ -571,18 +583,18 @@ class Fulltilt(HandHistoryConverter):
|
|||
tourney.buyin = 100*Decimal(re.sub(u',', u'', "%s" % mg['BUYIN']))
|
||||
else :
|
||||
if 100*Decimal(re.sub(u',', u'', "%s" % mg['BUYIN'])) != tourney.buyin:
|
||||
log.error( "Conflict between buyins read in topline (%s) and in BuyIn field (%s)" % (tourney.buyin, 100*Decimal(re.sub(u',', u'', "%s" % mg['BUYIN']))) )
|
||||
log.error(_("Conflict between buyins read in topline (%s) and in BuyIn field (%s)") % (tourney.buyin, 100*Decimal(re.sub(u',', u'', "%s" % mg['BUYIN']))) )
|
||||
tourney.subTourneyBuyin = 100*Decimal(re.sub(u',', u'', "%s" % mg['BUYIN']))
|
||||
if mg['FEE'] is not None:
|
||||
if tourney.fee is None:
|
||||
tourney.fee = 100*Decimal(re.sub(u',', u'', "%s" % mg['FEE']))
|
||||
else :
|
||||
if 100*Decimal(re.sub(u',', u'', "%s" % mg['FEE'])) != tourney.fee:
|
||||
log.error( "Conflict between fees read in topline (%s) and in BuyIn field (%s)" % (tourney.fee, 100*Decimal(re.sub(u',', u'', "%s" % mg['FEE']))) )
|
||||
log.error(_("Conflict between fees read in topline (%s) and in BuyIn field (%s)") % (tourney.fee, 100*Decimal(re.sub(u',', u'', "%s" % mg['FEE']))) )
|
||||
tourney.subTourneyFee = 100*Decimal(re.sub(u',', u'', "%s" % mg['FEE']))
|
||||
|
||||
if tourney.buyin is None:
|
||||
log.info( "Unable to affect a buyin to this tournament : assume it's a freeroll" )
|
||||
log.info(_("Unable to affect a buyin to this tournament : assume it's a freeroll"))
|
||||
tourney.buyin = 0
|
||||
tourney.fee = 0
|
||||
else:
|
||||
|
@ -683,7 +695,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
|
||||
tourney.addPlayer(rank, a.group('PNAME'), winnings, "USD", 0, 0, 0) #TODO: make it store actual winnings currency
|
||||
else:
|
||||
print "FullTilt: Player finishing stats unreadable : %s" % a
|
||||
print (_("FullTilt: Player finishing stats unreadable : %s") % a)
|
||||
|
||||
# Find Hero
|
||||
n = self.re_TourneyHeroFinishingP.search(playersText)
|
||||
|
@ -692,17 +704,17 @@ class Fulltilt(HandHistoryConverter):
|
|||
tourney.hero = heroName
|
||||
# Is this really useful ?
|
||||
if heroName not in tourney.ranks:
|
||||
print "FullTilt:", heroName, "not found in tourney.ranks ..."
|
||||
print (_("FullTilt: %s not found in tourney.ranks ...") % heroName)
|
||||
elif (tourney.ranks[heroName] != Decimal(n.group('HERO_FINISHING_POS'))):
|
||||
print "FullTilt: Bad parsing : finish position incoherent : %s / %s" % (tourney.ranks[heroName], n.group('HERO_FINISHING_POS'))
|
||||
print (_("FullTilt: Bad parsing : finish position incoherent : %s / %s") % (tourney.ranks[heroName], n.group('HERO_FINISHING_POS')))
|
||||
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="regression-test-files/fulltilt/razz/FT20090223 Danville - $0.50-$1 Ante $0.10 - Limit Razz.txt")
|
||||
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False)
|
||||
parser.add_option("-i", "--input", dest="ipath", help=_("parse input hand history"), default="regression-test-files/fulltilt/razz/FT20090223 Danville - $0.50-$1 Ante $0.10 - Limit Razz.txt")
|
||||
parser.add_option("-o", "--output", dest="opath", help=_("output translation to"), default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help=_("follow (tail -f) the input"), action="store_true", default=False)
|
||||
parser.add_option("-q", "--quiet",
|
||||
action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO)
|
||||
parser.add_option("-v", "--verbose",
|
||||
|
|
|
@ -113,7 +113,7 @@ class GuiAutoImport (threading.Thread):
|
|||
hbox.pack_start(lbl1, expand=True, fill=False)
|
||||
|
||||
self.doAutoImportBool = False
|
||||
self.startButton = gtk.ToggleButton(_(" Start _Autoimport "))
|
||||
self.startButton = gtk.ToggleButton(_(" Start _Auto Import "))
|
||||
self.startButton.connect("clicked", self.startClicked, "start clicked")
|
||||
hbox.pack_start(self.startButton, expand=False, fill=False)
|
||||
|
||||
|
@ -132,7 +132,7 @@ class GuiAutoImport (threading.Thread):
|
|||
scrolledwindow.add(self.textview)
|
||||
|
||||
self.mainVBox.show_all()
|
||||
self.addText(_("AutoImport Ready."))
|
||||
self.addText(_("Auto Import Ready."))
|
||||
|
||||
def addText(self, text):
|
||||
end_iter = self.textbuffer.get_end_iter()
|
||||
|
@ -145,7 +145,7 @@ class GuiAutoImport (threading.Thread):
|
|||
"""runs when user clicks one of the browse buttons in the auto import tab"""
|
||||
current_path=data[1].get_text()
|
||||
|
||||
dia_chooser = gtk.FileChooserDialog(title=_("Please choose the path that you want to auto import"),
|
||||
dia_chooser = gtk.FileChooserDialog(title=_("Please choose the path that you want to Auto Import"),
|
||||
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
|
||||
buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
|
||||
#dia_chooser.set_current_folder(pathname)
|
||||
|
@ -179,9 +179,9 @@ class GuiAutoImport (threading.Thread):
|
|||
|
||||
def reset_startbutton(self):
|
||||
if self.pipe_to_hud is not None:
|
||||
self.startButton.set_label(_(u' Stop _Autoimport '))
|
||||
self.startButton.set_label(_(u' Stop _Auto Import '))
|
||||
else:
|
||||
self.startButton.set_label(_(u' Start _Autoimport '))
|
||||
self.startButton.set_label(_(u' Start _Auto Import '))
|
||||
|
||||
return False
|
||||
|
||||
|
@ -206,7 +206,7 @@ class GuiAutoImport (threading.Thread):
|
|||
if self.settings['global_lock'].acquire(False): # returns false immediately if lock not acquired
|
||||
self.addText(_("\nGlobal lock taken ... Auto Import Started.\n"))
|
||||
self.doAutoImportBool = True
|
||||
widget.set_label(_(u' _Stop Autoimport '))
|
||||
widget.set_label(_(u' _Stop Auto Import '))
|
||||
if self.pipe_to_hud is None:
|
||||
if Configuration.FROZEN:
|
||||
path = Configuration.EXEC_PATH
|
||||
|
@ -246,19 +246,19 @@ class GuiAutoImport (threading.Thread):
|
|||
self.importtimer = gobject.timeout_add(interval * 1000, self.do_import)
|
||||
|
||||
else:
|
||||
self.addText(_("\nauto-import aborted - global lock not available"))
|
||||
self.addText(_("\nAuto Import aborted - global lock not available"))
|
||||
else: # toggled off
|
||||
gobject.source_remove(self.importtimer)
|
||||
self.settings['global_lock'].release()
|
||||
self.doAutoImportBool = False # do_import will return this and stop the gobject callback timer
|
||||
self.addText(_("\nStopping autoimport - global lock released."))
|
||||
self.addText(_("\nStopping Auto Import - global lock released."))
|
||||
if self.pipe_to_hud.poll() is not None:
|
||||
self.addText(_("\n * Stop Autoimport: HUD already terminated"))
|
||||
self.addText(_("\n * Stop Auto Import: HUD already terminated"))
|
||||
else:
|
||||
#print >>self.pipe_to_hud.stdin, "\n"
|
||||
self.pipe_to_hud.communicate('\n') # waits for process to terminate
|
||||
self.pipe_to_hud = None
|
||||
self.startButton.set_label(_(u' Start _Autoimport '))
|
||||
self.startButton.set_label(_(u' Start _Auto Import '))
|
||||
|
||||
#end def GuiAutoImport.startClicked
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ class GuiBulkImport():
|
|||
#self.settings['global_lock'].release()
|
||||
self.settings['global_lock'].release()
|
||||
else:
|
||||
print _("bulk-import aborted - global lock not available")
|
||||
print _("bulk import aborted - global lock not available")
|
||||
|
||||
def get_vbox(self):
|
||||
"""returns the vbox of this thread"""
|
||||
|
|
|
@ -300,7 +300,7 @@ class GuiDatabase:
|
|||
self.dia.show()
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print _('loaddbs error: ')+str(dbms_num)+','+host+','+name+','+user+','+passwd+' failed: ' \
|
||||
print _('loadDbs error: ')+str(dbms_num)+','+host+','+name+','+user+','+passwd+' failed: ' \
|
||||
+ err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1])
|
||||
|
||||
def sortCols(self, col, n):
|
||||
|
@ -368,7 +368,7 @@ class GuiDatabase:
|
|||
try:
|
||||
# is creating empty db for sqlite ... mod db.py further?
|
||||
# add noDbTables flag to db.py?
|
||||
log.debug(_("loaddbs: trying to connect to: %s/%s, %s, %s/%s") % (str(dbms_num),dbms,name,user,passwd))
|
||||
log.debug(_("testDB: trying to connect to: %s/%s, %s, %s/%s") % (str(dbms_num),dbms,name,user,passwd))
|
||||
db.connect(backend=dbms_num, host=host, database=name, user=user, password=passwd, create=False)
|
||||
if db.connected:
|
||||
log.debug(_(" connected ok"))
|
||||
|
@ -384,14 +384,16 @@ class GuiDatabase:
|
|||
status = "failed"
|
||||
icon = gtk.STOCK_CANCEL
|
||||
except Exceptions.FpdbMySQLNoDatabase:
|
||||
err_msg = _("MySQL client reports: 2002 or 2003 error. Unable to connect - Please check that the MySQL service has been started")
|
||||
err_msg = _("MySQL client reports: 2002 or 2003 error. Unable to connect - ") \
|
||||
+ _("Please check that the MySQL service has been started")
|
||||
status = "failed"
|
||||
icon = gtk.STOCK_CANCEL
|
||||
except Exceptions.FpdbPostgresqlAccessDenied:
|
||||
err_msg = _("Postgres Server reports: Access denied. Are your permissions set correctly?")
|
||||
err_msg = _("PostgreSQL Server reports: Access denied. Are your permissions set correctly?")
|
||||
status = "failed"
|
||||
except Exceptions.FpdbPostgresqlNoDatabase:
|
||||
err_msg = _("Postgres client reports: Unable to connect - Please check that the Postgres service has been started")
|
||||
err_msg = _("PostgreSQL client reports: Unable to connect - ") \
|
||||
+ _("Please check that the PostgreSQL service has been started")
|
||||
status = "failed"
|
||||
icon = gtk.STOCK_CANCEL
|
||||
except:
|
||||
|
@ -401,8 +403,7 @@ class GuiDatabase:
|
|||
status = "failed"
|
||||
icon = gtk.STOCK_CANCEL
|
||||
if err_msg:
|
||||
log.info( _('db connection to ') + str(dbms_num)+','+host+','+name+','+user+','+passwd+' failed: '
|
||||
+ err_msg )
|
||||
log.info( _('db connection to %s, %s, %s, %s, %s failed: %s') % (str(dbms_num), host, name, user, passwd, err_msg))
|
||||
|
||||
return( status, err_msg, icon )
|
||||
|
||||
|
@ -410,7 +411,7 @@ class GuiDatabase:
|
|||
class AddDB(gtk.Dialog):
|
||||
|
||||
def __init__(self, config, parent):
|
||||
log.debug("AddDB starting")
|
||||
log.debug(_("AddDB starting"))
|
||||
self.dbnames = { 'Sqlite' : Configuration.DATABASE_TYPE_SQLITE
|
||||
, 'MySQL' : Configuration.DATABASE_TYPE_MYSQL
|
||||
, 'PostgreSQL' : Configuration.DATABASE_TYPE_POSTGRESQL
|
||||
|
@ -419,7 +420,7 @@ class AddDB(gtk.Dialog):
|
|||
# create dialog and add icon and label
|
||||
super(AddDB,self).__init__( parent=parent
|
||||
, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT
|
||||
, title="Add New Database"
|
||||
, title=_("Add New Database")
|
||||
, buttons = (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT
|
||||
,gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT)
|
||||
) # , buttons=btns
|
||||
|
@ -487,7 +488,7 @@ class AddDB(gtk.Dialog):
|
|||
|
||||
def run(self):
|
||||
response = super(AddDB,self).run()
|
||||
log.debug("adddb.run: response is "+str(response)+" accept is "+str(int(gtk.RESPONSE_ACCEPT)))
|
||||
log.debug(_("addDB.run: response is %s accept is %s" % (str(response), str(int(gtk.RESPONSE_ACCEPT)))))
|
||||
|
||||
ok,retry = False,True
|
||||
while response == gtk.RESPONSE_ACCEPT:
|
||||
|
@ -501,7 +502,7 @@ class AddDB(gtk.Dialog):
|
|||
,name, db_desc, user, passwd, host) = ("error", "error", None, None, None
|
||||
,None, None, None, None, None)
|
||||
if ok:
|
||||
log.debug("start creating new db")
|
||||
log.debug(_("start creating new db"))
|
||||
# add a new db
|
||||
master_password = None
|
||||
dbms = self.dbnames[ self.cb_dbms.get_active_text() ]
|
||||
|
@ -520,7 +521,7 @@ class AddDB(gtk.Dialog):
|
|||
|
||||
# test db after creating?
|
||||
status, err_msg, icon = GuiDatabase.testDB(self.config, dbms, dbms_num, name, user, passwd, host)
|
||||
log.debug('tested new db, result='+str((status,err_msg)))
|
||||
log.debug(_('tested new db, result=%s') % str((status,err_msg)))
|
||||
if status == 'ok':
|
||||
#dia = InfoBox( parent=self, str1=_('Database created') )
|
||||
str1 = _('Database created')
|
||||
|
@ -539,7 +540,7 @@ class AddDB(gtk.Dialog):
|
|||
"""check fields and return true/false according to whether user wants to try again
|
||||
return False if fields are ok
|
||||
"""
|
||||
log.debug("check_fields: starting")
|
||||
log.debug(_("check_fields: starting"))
|
||||
try_again = False
|
||||
ok = True
|
||||
|
||||
|
@ -571,11 +572,11 @@ class AddDB(gtk.Dialog):
|
|||
# checks for postgres
|
||||
pass
|
||||
else:
|
||||
msg = "Unknown Database Type selected"
|
||||
msg = _("Unknown Database Type selected")
|
||||
ok = False
|
||||
|
||||
if not ok:
|
||||
log.debug("check_fields: open dialog")
|
||||
log.debug(_("check_fields: open dialog"))
|
||||
dia = gtk.MessageDialog( parent=self
|
||||
, flags=gtk.DIALOG_DESTROY_WITH_PARENT
|
||||
, type=gtk.MESSAGE_ERROR
|
||||
|
@ -588,14 +589,14 @@ class AddDB(gtk.Dialog):
|
|||
dia.vbox.add(l)
|
||||
dia.show_all()
|
||||
ret = dia.run()
|
||||
log.debug("check_fields: ret is "+str(ret)+" cancel is "+str(int(gtk.RESPONSE_CANCEL)))
|
||||
log.debug(_("check_fields: ret is %s cancel is %s" % (str(ret), str(int(gtk.RESPONSE_CANCEL)))))
|
||||
if ret == gtk.RESPONSE_YES:
|
||||
try_again = True
|
||||
log.debug("check_fields: destroy dialog")
|
||||
log.debug(_("check_fields: destroy dialog"))
|
||||
dia.hide()
|
||||
dia.destroy()
|
||||
|
||||
log.debug("check_fields: returning ok as "+str(ok)+", try_again as "+str(try_again))
|
||||
log.debug(_("check_fields: returning ok as %s, try_again as %s") % (str(ok), str(try_again)))
|
||||
return(ok,try_again)
|
||||
|
||||
def db_type_changed(self, widget, data):
|
||||
|
|
|
@ -26,22 +26,6 @@ from time import *
|
|||
from datetime import datetime
|
||||
#import pokereval
|
||||
|
||||
try:
|
||||
import matplotlib
|
||||
matplotlib.use('GTKCairo')
|
||||
from matplotlib.figure import Figure
|
||||
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
|
||||
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
|
||||
from matplotlib.font_manager import FontProperties
|
||||
from numpy import arange, cumsum
|
||||
from pylab import *
|
||||
except ImportError, inst:
|
||||
print _("""Failed to load libs for graphing, graphing will not function. Please
|
||||
install 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 locale
|
||||
lang=locale.getdefaultlocale()[0][0:2]
|
||||
if lang=="en":
|
||||
|
@ -59,6 +43,22 @@ import Database
|
|||
import Filters
|
||||
import Charset
|
||||
|
||||
try:
|
||||
import matplotlib
|
||||
matplotlib.use('GTKCairo')
|
||||
from matplotlib.figure import Figure
|
||||
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
|
||||
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
|
||||
from matplotlib.font_manager import FontProperties
|
||||
from numpy import arange, cumsum
|
||||
from pylab import *
|
||||
except ImportError, inst:
|
||||
print _("""Failed to load libs for graphing, graphing will not function. Please
|
||||
install 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
|
||||
|
||||
class GuiGraphViewer (threading.Thread):
|
||||
|
||||
def __init__(self, querylist, config, parent, debug=True):
|
||||
|
|
|
@ -586,7 +586,7 @@ class Hud:
|
|||
|
||||
self.stat_dict = stat_dict
|
||||
self.cards = cards
|
||||
sys.stderr.write(_("------------------------------------------------------------\nCreating hud from hand %s\n") % hand)
|
||||
log.info(_('Creating hud from hand ')+str(hand))
|
||||
adj = self.adj_seats(hand, config)
|
||||
loc = self.config.get_locations(self.table.site, self.max)
|
||||
if loc is None and self.max != 10:
|
||||
|
|
|
@ -502,7 +502,10 @@ class PartyPoker(HandHistoryConverter):
|
|||
if type=="tour":
|
||||
TableName = table_name.split(" ")
|
||||
print 'party', 'getTableTitleRe', "%s.+Table\s#%s" % (TableName[0], table_number)
|
||||
return "%s.+Table\s#%s" % (TableName[0], table_number)
|
||||
if len(TableName[1]) > 6:
|
||||
return "#%s" % (table_number)
|
||||
else:
|
||||
return "%s.+Table\s#%s" % (TableName[0], table_number)
|
||||
else:
|
||||
print 'party', 'getTableTitleRe', table_number
|
||||
return table_name
|
||||
|
|
493
pyfpdb/Stats.py
493
pyfpdb/Stats.py
|
@ -78,45 +78,49 @@ log = logging.getLogger("db")
|
|||
|
||||
|
||||
re_Places = re.compile("_[0-9]$")
|
||||
re_Percent = re.compile("%$")
|
||||
|
||||
# String manipulation
|
||||
import codecs
|
||||
encoder = codecs.lookup(Configuration.LOCALE_ENCODING)
|
||||
|
||||
|
||||
# Since tuples are immutable, we have to create a new one when
|
||||
# overriding any decimal placements. Copy old ones and recreate the
|
||||
# second value in tuple to specified format-
|
||||
def __stat_override(decimals, stat_vals):
|
||||
s = '%.*f' % (decimals, 100.0*stat_vals[0])
|
||||
res = (stat_vals[0], s, stat_vals[2],
|
||||
stat_vals[3], stat_vals[4], stat_vals[5])
|
||||
return res
|
||||
|
||||
|
||||
def do_tip(widget, tip):
|
||||
_tip = Charset.to_utf8(tip)
|
||||
widget.set_tooltip_text(_tip)
|
||||
|
||||
def do_stat(stat_dict, player = 24, stat = 'vpip'):
|
||||
match = re_Places.search(stat)
|
||||
if match is None:
|
||||
result = eval("%(stat)s(stat_dict, %(player)d)" % {'stat': stat, 'player': player})
|
||||
else:
|
||||
base = stat[0:-2]
|
||||
places = int(stat[-1:])
|
||||
result = (0.0, '0.0', 'notset=0', 'notset=0', '0', 'not set')
|
||||
try:
|
||||
result = eval("%(stat)s(stat_dict, %(player)d)" % {'stat': base, 'player': player})
|
||||
except:
|
||||
pass #
|
||||
log.info(_("exception getting stat %s for player %s %s") % (base, str(player), str(sys.exc_info())))
|
||||
log.debug(_("Stats.do_stat result = %s") % str(result) )
|
||||
|
||||
match = re_Percent.search(result[1])
|
||||
try:
|
||||
if match is None:
|
||||
result = (result[0], "%.*f" % (places, result[0]), result[2], result[3], result[4], result[5])
|
||||
else:
|
||||
result = (result[0], "%.*f%%" % (places, 100*result[0]), result[2], result[3], result[4], result[5])
|
||||
except:
|
||||
log.info(_("error: %s") % str(sys.exc_info()))
|
||||
raise
|
||||
def do_stat(stat_dict, player = 24, stat = 'vpip'):
|
||||
statname = stat
|
||||
match = re_Places.search(stat)
|
||||
if match: # override if necessary
|
||||
statname = stat[0:-2]
|
||||
|
||||
result = eval("%(stat)s(stat_dict, %(player)d)" % {'stat': statname, 'player': player})
|
||||
|
||||
# If decimal places have been defined, override result[1]
|
||||
# NOTE: decimal place override ALWAYS assumes the raw result is a
|
||||
# fraction (x/100); manual decimal places really only make sense for
|
||||
# percentage values. Also, profit/100 hands (bb/BB) already default
|
||||
# to three decimal places anyhow, so they are unlikely override
|
||||
# candidates.
|
||||
if match:
|
||||
places = int(stat[-1:])
|
||||
result = __stat_override(places, result)
|
||||
return result
|
||||
|
||||
# OK, for reference the tuple returned by the stat is:
|
||||
# 0 - The stat, raw, no formating, eg 0.33333333
|
||||
# 1 - formatted stat with appropriate precision and punctuation, eg 33%
|
||||
# 1 - formatted stat with appropriate precision, eg. 33; shown in HUD
|
||||
# 2 - formatted stat with appropriate precision, punctuation and a hint, eg v=33%
|
||||
# 3 - same as #2 except name of stat instead of hint, eg vpip=33%
|
||||
# 4 - the calculation that got the stat, eg 9/27
|
||||
|
@ -147,17 +151,17 @@ def vpip(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['vpip'])/float(stat_dict[player]['n'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'v=%3.1f' % (100*stat) + '%',
|
||||
'vpip=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['vpip'], stat_dict[player]['n']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'v=%3.1f%%' % (100.0*stat),
|
||||
'vpip=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['vpip'], stat_dict[player]['n']),
|
||||
_('Voluntarily Put In Pot Pre-Flop%')
|
||||
)
|
||||
except: return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'v=%3.1f' % (0) + '%',
|
||||
'vpip=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'v=NA',
|
||||
'vpip=NA',
|
||||
'(0/0)',
|
||||
_('Voluntarily Put In Pot Pre-Flop%')
|
||||
)
|
||||
|
||||
|
@ -167,18 +171,18 @@ def pfr(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['pfr'])/float(stat_dict[player]['n'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'p=%3.1f' % (100*stat) + '%',
|
||||
'pfr=%3.1f' % (100*stat) + '%',
|
||||
'%3.1f' % (100.0*stat),
|
||||
'p=%3.1f%%' % (100.0*stat),
|
||||
'pfr=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['pfr'], stat_dict[player]['n']),
|
||||
_('Pre-Flop Raise %')
|
||||
)
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'p=%3.1f' % (0) + '%',
|
||||
'pfr=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'p=NA',
|
||||
'pfr=NA',
|
||||
'(0/0)',
|
||||
_('Pre-Flop Raise %')
|
||||
)
|
||||
|
||||
|
@ -188,18 +192,18 @@ def wtsd(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['sd'])/float(stat_dict[player]['saw_f'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'w=%3.1f' % (100*stat) + '%',
|
||||
'wtsd=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['sd'], stat_dict[player]['saw_f']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'w=%3.1f%%' % (100.0*stat),
|
||||
'wtsd=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['sd'], stat_dict[player]['saw_f']),
|
||||
_('% went to showdown')
|
||||
)
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'w=%3.1f' % (0) + '%',
|
||||
'wtsd=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'w=NA',
|
||||
'wtsd=NA',
|
||||
'(0/0)',
|
||||
_('% went to showdown')
|
||||
)
|
||||
|
||||
|
@ -209,18 +213,18 @@ def wmsd(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['wmsd'])/float(stat_dict[player]['sd'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'w=%3.1f' % (100*stat) + '%',
|
||||
'wmsd=%3.1f' % (100*stat) + '%',
|
||||
'%3.1f' % (100.0*stat),
|
||||
'w=%3.1f%%' % (100.0*stat),
|
||||
'wmsd=%3.1f%%' % (100.0*stat),
|
||||
'(%5.1f/%d)' % (float(stat_dict[player]['wmsd']), stat_dict[player]['sd']),
|
||||
_('% won money at showdown')
|
||||
)
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'w=%3.1f' % (0) + '%',
|
||||
'wmsd=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'w=NA',
|
||||
'wmsd=NA',
|
||||
'(0/0)',
|
||||
_('% won money at showdown')
|
||||
)
|
||||
|
||||
|
@ -230,19 +234,19 @@ def profit100(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['net'])/float(stat_dict[player]['n'])
|
||||
return (stat,
|
||||
'%.0f' % (100.0*stat),
|
||||
'p=%.0f' % (100.0*stat),
|
||||
'p/100=%.0f' % (100.0*stat),
|
||||
'%.0f' % (100.0*stat),
|
||||
'p=%.0f' % (100.0*stat),
|
||||
'p/100=%.0f' % (100.0*stat),
|
||||
'%d/%d' % (stat_dict[player]['net'], stat_dict[player]['n']),
|
||||
_('profit/100hands')
|
||||
)
|
||||
except:
|
||||
print _("exception calcing p/100: 100 * %d / %d") % (stat_dict[player]['net'], stat_dict[player]['n'])
|
||||
return (stat,
|
||||
'%.0f' % (0.0),
|
||||
'p=%.0f' % (0.0),
|
||||
'p/100=%.0f' % (0.0),
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'p=NA',
|
||||
'p/100=NA',
|
||||
'(0/0)',
|
||||
_('profit/100hands')
|
||||
)
|
||||
|
||||
|
@ -252,19 +256,19 @@ def bbper100(stat_dict, player):
|
|||
try:
|
||||
stat = 100.0 * float(stat_dict[player]['net']) / float(stat_dict[player]['bigblind'])
|
||||
return (stat,
|
||||
'%5.3f' % (stat),
|
||||
'bb100=%5.3f' % (stat),
|
||||
'bb100=%5.3f' % (stat),
|
||||
'(%d,%d)' % (100*stat_dict[player]['net'],stat_dict[player]['bigblind']),
|
||||
'%5.3f' % (stat),
|
||||
'bb100=%5.3f' % (stat),
|
||||
'bb100=%5.3f' % (stat),
|
||||
'(%d,%d)' % (100*stat_dict[player]['net'],stat_dict[player]['bigblind']),
|
||||
_('big blinds/100 hands')
|
||||
)
|
||||
except:
|
||||
log.info("exception calcing bb/100: "+str(stat_dict[player]))
|
||||
return (stat,
|
||||
'%.0f' % (0),
|
||||
'bb100=%.0f' % (0),
|
||||
'bb100=%.0f' % (0),
|
||||
'(%f)' % (0),
|
||||
'NA',
|
||||
'bb100=NA',
|
||||
'bb100=NA',
|
||||
'(--)',
|
||||
_('big blinds/100 hands')
|
||||
)
|
||||
|
||||
|
@ -274,19 +278,19 @@ def BBper100(stat_dict, player):
|
|||
try:
|
||||
stat = 50 * float(stat_dict[player]['net']) / float(stat_dict[player]['bigblind'])
|
||||
return (stat,
|
||||
'%5.3f' % (stat),
|
||||
'BB100=%5.3f' % (stat),
|
||||
'BB100=%5.3f' % (stat),
|
||||
'(%d,%d)' % (100*stat_dict[player]['net'],2*stat_dict[player]['bigblind']),
|
||||
'%5.3f' % (stat),
|
||||
'BB100=%5.3f' % (stat),
|
||||
'BB100=%5.3f' % (stat),
|
||||
'(%d,%d)' % (100*stat_dict[player]['net'],2*stat_dict[player]['bigblind']),
|
||||
_('Big Bets/100 hands')
|
||||
)
|
||||
except:
|
||||
log.info(_("exception calcing BB/100: ")+str(stat_dict[player]))
|
||||
return (stat,
|
||||
'%.0f' % (0.0),
|
||||
'BB100=%.0f' % (0.0),
|
||||
'BB100=%.0f' % (0.0),
|
||||
'(%f)' % (0.0),
|
||||
'NA',
|
||||
'BB100=NA',
|
||||
'BB100=NA',
|
||||
'(--)',
|
||||
_('Big Bets/100 hands')
|
||||
)
|
||||
|
||||
|
@ -297,21 +301,19 @@ def saw_f(stat_dict, player):
|
|||
den = float(stat_dict[player]['n'])
|
||||
stat = num/den
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'sf=%3.1f' % (100*stat) + '%',
|
||||
'saw_f=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['saw_f'], stat_dict[player]['n']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'sf=%3.1f%%' % (100.0*stat),
|
||||
'saw_f=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['saw_f'], stat_dict[player]['n']),
|
||||
_('Flop Seen %')
|
||||
)
|
||||
except:
|
||||
stat = 0.0
|
||||
num = 0
|
||||
den = 0
|
||||
return (stat,
|
||||
'%3.1f' % (stat) + '%',
|
||||
'sf=%3.1f' % (stat) + '%',
|
||||
'saw_f=%3.1f' % (stat) + '%',
|
||||
'(%d/%d)' % (num, den),
|
||||
'NA',
|
||||
'sf=NA',
|
||||
'saw_f=NA',
|
||||
'(0/0)',
|
||||
_('Flop Seen %')
|
||||
)
|
||||
|
||||
|
@ -338,6 +340,7 @@ def n(stat_dict, player):
|
|||
_('number hands seen')
|
||||
)
|
||||
except:
|
||||
# Number of hands shouldn't ever be "NA"; zeroes are better here
|
||||
return (0,
|
||||
'%d' % (0),
|
||||
'n=%d' % (0),
|
||||
|
@ -352,18 +355,18 @@ def fold_f(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['fold_2'])/float(stat_dict[player]['saw_f'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'ff=%3.1f' % (100*stat) + '%',
|
||||
'fold_f=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['fold_2'], stat_dict[player]['saw_f']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'ff=%3.1f%%' % (100.0*stat),
|
||||
'fold_f=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['fold_2'], stat_dict[player]['saw_f']),
|
||||
_('folded flop/4th')
|
||||
)
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'ff=%3.1f' % (0) + '%',
|
||||
'fold_f=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'ff=NA',
|
||||
'fold_f=NA',
|
||||
'(0/0)',
|
||||
_('folded flop/4th')
|
||||
)
|
||||
|
||||
|
@ -373,10 +376,10 @@ def steal(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['steal'])/float(stat_dict[player]['steal_opp'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'st=%3.1f' % (100*stat) + '%',
|
||||
'steal=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['steal'], stat_dict[player]['steal_opp']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'st=%3.1f%%' % (100.0*stat),
|
||||
'steal=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['steal'], stat_dict[player]['steal_opp']),
|
||||
_('% steal attempted')
|
||||
)
|
||||
except:
|
||||
|
@ -388,10 +391,10 @@ def f_SB_steal(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['sbnotdef'])/float(stat_dict[player]['sbstolen'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'fSB=%3.1f' % (100*stat) + '%',
|
||||
'fSB_s=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['sbnotdef'], stat_dict[player]['sbstolen']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'fSB=%3.1f%%' % (100.0*stat),
|
||||
'fSB_s=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['sbnotdef'], stat_dict[player]['sbstolen']),
|
||||
_('% folded SB to steal'))
|
||||
except:
|
||||
return (stat,
|
||||
|
@ -407,10 +410,10 @@ def f_BB_steal(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['bbnotdef'])/float(stat_dict[player]['bbstolen'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'fBB=%3.1f' % (100*stat) + '%',
|
||||
'fBB_s=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['bbnotdef'], stat_dict[player]['bbstolen']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'fBB=%3.1f%%' % (100.0*stat),
|
||||
'fBB_s=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['bbnotdef'], stat_dict[player]['bbstolen']),
|
||||
_('% folded BB to steal'))
|
||||
except:
|
||||
return (stat,
|
||||
|
@ -429,10 +432,10 @@ def f_steal(stat_dict, player):
|
|||
|
||||
stat = float(folded_blind)/float(blind_stolen)
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'fB=%3.1f' % (100*stat) + '%',
|
||||
'fB_s=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (folded_blind, blind_stolen),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'fB=%3.1f%%' % (100.0*stat),
|
||||
'fB_s=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (folded_blind, blind_stolen),
|
||||
_('% folded blind to steal'))
|
||||
except:
|
||||
return (stat,
|
||||
|
@ -448,17 +451,17 @@ def three_B(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['tb_0'])/float(stat_dict[player]['tb_opp_0'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'3B=%3.1f' % (100*stat) + '%',
|
||||
'3B_pf=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['tb_0'], stat_dict[player]['tb_opp_0']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'3B=%3.1f%%' % (100.0*stat),
|
||||
'3B_pf=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['tb_0'], stat_dict[player]['tb_opp_0']),
|
||||
_('% 3/4 Bet preflop/3rd'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'3B=%3.1f' % (0) + '%',
|
||||
'3B_pf=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'3B=NA',
|
||||
'3B_pf=NA',
|
||||
'(0/0)',
|
||||
_('% 3/4 Bet preflop/3rd'))
|
||||
|
||||
def WMsF(stat_dict, player):
|
||||
|
@ -467,17 +470,17 @@ def WMsF(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['w_w_s_1'])/float(stat_dict[player]['saw_1'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'wf=%3.1f' % (100*stat) + '%',
|
||||
'w_w_f=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['w_w_s_1'], stat_dict[player]['saw_f']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'wf=%3.1f%%' % (100.0*stat),
|
||||
'w_w_f=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['w_w_s_1'], stat_dict[player]['saw_f']),
|
||||
_('% won$/saw flop/4th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'wf=%3.1f' % (0) + '%',
|
||||
'w_w_f=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'wf=NA',
|
||||
'w_w_f=NA',
|
||||
'(0/0)',
|
||||
_('% won$/saw flop/4th'))
|
||||
|
||||
def a_freq1(stat_dict, player):
|
||||
|
@ -486,17 +489,17 @@ def a_freq1(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['aggr_1'])/float(stat_dict[player]['saw_f'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'a1=%3.1f' % (100*stat) + '%',
|
||||
'a_fq_1=%3.1f' % (100*stat) + '%',
|
||||
'%3.1f' % (100.0*stat),
|
||||
'a1=%3.1f%%' % (100.0*stat),
|
||||
'a_fq_1=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['aggr_1'], stat_dict[player]['saw_f']),
|
||||
_('Aggression Freq flop/4th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'a1=%3.1f' % (0) + '%',
|
||||
'a_fq_1=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'a1=NA',
|
||||
'a_fq_1=NA',
|
||||
'(0/0)',
|
||||
_('Aggression Freq flop/4th'))
|
||||
|
||||
def a_freq2(stat_dict, player):
|
||||
|
@ -505,17 +508,17 @@ def a_freq2(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['aggr_2'])/float(stat_dict[player]['saw_2'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'a2=%3.1f' % (100*stat) + '%',
|
||||
'a_fq_2=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['aggr_2'], stat_dict[player]['saw_2']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'a2=%3.1f%%' % (100.0*stat),
|
||||
'a_fq_2=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['aggr_2'], stat_dict[player]['saw_2']),
|
||||
_('Aggression Freq turn/5th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'a2=%3.1f' % (0) + '%',
|
||||
'a_fq_2=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'a2=NA',
|
||||
'a_fq_2=NA',
|
||||
'(0/0)',
|
||||
_('Aggression Freq turn/5th'))
|
||||
|
||||
def a_freq3(stat_dict, player):
|
||||
|
@ -524,17 +527,17 @@ def a_freq3(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['aggr_3'])/float(stat_dict[player]['saw_3'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'a3=%3.1f' % (100*stat) + '%',
|
||||
'a_fq_3=%3.1f' % (100*stat) + '%',
|
||||
'%3.1f' % (100.0*stat),
|
||||
'a3=%3.1f%%' % (100.0*stat),
|
||||
'a_fq_3=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['aggr_3'], stat_dict[player]['saw_3']),
|
||||
_('Aggression Freq river/6th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'a3=%3.1f' % (0) + '%',
|
||||
'a_fq_3=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'a3=NA',
|
||||
'a_fq_3=NA',
|
||||
'(0/0)',
|
||||
_('Aggression Freq river/6th'))
|
||||
|
||||
def a_freq4(stat_dict, player):
|
||||
|
@ -543,17 +546,17 @@ def a_freq4(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['aggr_4'])/float(stat_dict[player]['saw_4'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'a4=%3.1f' % (100*stat) + '%',
|
||||
'a_fq_4=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['aggr_4'], stat_dict[player]['saw_4']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'a4=%3.1f%%' % (100.0*stat),
|
||||
'a_fq_4=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['aggr_4'], stat_dict[player]['saw_4']),
|
||||
_('Aggression Freq 7th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'a4=%3.1f' % (0) + '%',
|
||||
'a_fq_4=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'a4=NA',
|
||||
'a_fq_4=NA',
|
||||
'(0/0)',
|
||||
_('Aggression Freq 7th'))
|
||||
|
||||
def a_freq_123(stat_dict, player):
|
||||
|
@ -563,9 +566,9 @@ def a_freq_123(stat_dict, player):
|
|||
stat = float( stat_dict[player]['aggr_1'] + stat_dict[player]['aggr_2'] + stat_dict[player]['aggr_3']
|
||||
) / float( stat_dict[player]['saw_1'] + stat_dict[player]['saw_2'] + stat_dict[player]['saw_3']);
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'afq=%3.1f' % (100*stat) + '%',
|
||||
'postf_aggfq=%3.1f' % (100*stat) + '%',
|
||||
'%3.1f' % (100.0*stat),
|
||||
'afq=%3.1f%%' % (100.0*stat),
|
||||
'postf_aggfq=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % ( stat_dict[player]['aggr_1']
|
||||
+ stat_dict[player]['aggr_2']
|
||||
+ stat_dict[player]['aggr_3']
|
||||
|
@ -576,10 +579,10 @@ def a_freq_123(stat_dict, player):
|
|||
_('Post-Flop Aggression Freq'))
|
||||
except:
|
||||
return (stat,
|
||||
'%2.0f' % (0) + '%',
|
||||
'a3=%2.0f' % (0) + '%',
|
||||
'a_fq_3=%2.0f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'a3=NA',
|
||||
'a_fq_3=NA',
|
||||
'(0/0)',
|
||||
_('Post-Flop Aggression Freq'))
|
||||
|
||||
def agg_freq(stat_dict, player):
|
||||
|
@ -597,17 +600,17 @@ def agg_freq(stat_dict, player):
|
|||
stat = float (bet_raise) / float(post_call + post_fold + bet_raise)
|
||||
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'afr=%3.1f' % (100*stat) + '%',
|
||||
'agg_fr=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (bet_raise, (post_call + post_fold + bet_raise)),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'afr=%3.1f%%' % (100.0*stat),
|
||||
'agg_fr=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (bet_raise, (post_call + post_fold + bet_raise)),
|
||||
_('Aggression Freq'))
|
||||
except:
|
||||
return (stat,
|
||||
'%2.1f' % (0) + '%',
|
||||
'af=%3.1f' % (0) + '%',
|
||||
'agg_f=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'af=NA',
|
||||
'agg_f=NA',
|
||||
'(0/0)',
|
||||
_('Aggression Freq'))
|
||||
|
||||
def agg_fact(stat_dict, player):
|
||||
|
@ -630,10 +633,10 @@ def agg_fact(stat_dict, player):
|
|||
_('Aggression Factor'))
|
||||
except:
|
||||
return (stat,
|
||||
'%2.2f' % (0) ,
|
||||
'afa=%2.2f' % (0) ,
|
||||
'agg_fa=%2.2f' % (0),
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'afa=NA',
|
||||
'agg_fa=NA',
|
||||
'(0/0)',
|
||||
_('Aggression Factor'))
|
||||
|
||||
def cbet(stat_dict, player):
|
||||
|
@ -647,17 +650,17 @@ def cbet(stat_dict, player):
|
|||
oppt = stat_dict[player]['cb_opp_1']+stat_dict[player]['cb_opp_2']+stat_dict[player]['cb_opp_3']+stat_dict[player]['cb_opp_4']
|
||||
stat = float(cbets)/float(oppt)
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'cbet=%3.1f' % (100*stat) + '%',
|
||||
'cbet=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (cbets, oppt),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'cbet=%3.1f%%' % (100.0*stat),
|
||||
'cbet=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (cbets, oppt),
|
||||
_('% continuation bet '))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'cbet=%3.1f' % (0) + '%',
|
||||
'cbet=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'cbet=NA',
|
||||
'cbet=NA',
|
||||
'(0/0)',
|
||||
_('% continuation bet '))
|
||||
|
||||
def cb1(stat_dict, player):
|
||||
|
@ -666,17 +669,17 @@ def cb1(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['cb_1'])/float(stat_dict[player]['cb_opp_1'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'cb1=%3.1f' % (100*stat) + '%',
|
||||
'cb_1=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['cb_1'], stat_dict[player]['cb_opp_1']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'cb1=%3.1f%%' % (100.0*stat),
|
||||
'cb_1=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['cb_1'], stat_dict[player]['cb_opp_1']),
|
||||
_('% continuation bet flop/4th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'cb1=%3.1f' % (0) + '%',
|
||||
'cb_1=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'cb1=NA',
|
||||
'cb_1=NA',
|
||||
'(0/0)',
|
||||
_('% continuation bet flop/4th'))
|
||||
|
||||
def cb2(stat_dict, player):
|
||||
|
@ -685,17 +688,17 @@ def cb2(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['cb_2'])/float(stat_dict[player]['cb_opp_2'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'cb2=%3.1f' % (100*stat) + '%',
|
||||
'cb_2=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['cb_2'], stat_dict[player]['cb_opp_2']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'cb2=%3.1f%%' % (100.0*stat),
|
||||
'cb_2=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['cb_2'], stat_dict[player]['cb_opp_2']),
|
||||
_('% continuation bet turn/5th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'cb2=%3.1f' % (0) + '%',
|
||||
'cb_2=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'cb2=NA',
|
||||
'cb_2=NA',
|
||||
'(0/0)',
|
||||
_('% continuation bet turn/5th'))
|
||||
|
||||
def cb3(stat_dict, player):
|
||||
|
@ -704,17 +707,17 @@ def cb3(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['cb_3'])/float(stat_dict[player]['cb_opp_3'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'cb3=%3.1f' % (100*stat) + '%',
|
||||
'cb_3=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['cb_3'], stat_dict[player]['cb_opp_3']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'cb3=%3.1f%%' % (100.0*stat),
|
||||
'cb_3=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['cb_3'], stat_dict[player]['cb_opp_3']),
|
||||
_('% continuation bet river/6th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'cb3=%3.1f' % (0) + '%',
|
||||
'cb_3=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'cb3=NA',
|
||||
'cb_3=NA',
|
||||
'(0/0)',
|
||||
_('% continuation bet river/6th'))
|
||||
|
||||
def cb4(stat_dict, player):
|
||||
|
@ -723,17 +726,17 @@ def cb4(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['cb_4'])/float(stat_dict[player]['cb_opp_4'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'cb4=%3.1f' % (100*stat) + '%',
|
||||
'cb_4=%3.1f' % (100*stat) + '%',
|
||||
'%3.1f' % (100.0*stat),
|
||||
'cb4=%3.1f%%' % (100.0*stat),
|
||||
'cb_4=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['cb_4'], stat_dict[player]['cb_opp_4']),
|
||||
_('% continuation bet 7th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'cb4=%3.1f' % (0) + '%',
|
||||
'cb_4=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'cb4=NA',
|
||||
'cb_4=NA',
|
||||
'(0/0)',
|
||||
_('% continuation bet 7th'))
|
||||
|
||||
def ffreq1(stat_dict, player):
|
||||
|
@ -742,10 +745,10 @@ def ffreq1(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['f_freq_1'])/float(stat_dict[player]['was_raised_1'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'ff1=%3.1f' % (100*stat) + '%',
|
||||
'ff_1=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['f_freq_1'], stat_dict[player]['was_raised_1']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'ff1=%3.1f%%' % (100.0*stat),
|
||||
'ff_1=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['f_freq_1'], stat_dict[player]['was_raised_1']),
|
||||
_('% fold frequency flop/4th'))
|
||||
except:
|
||||
return (stat,
|
||||
|
@ -761,17 +764,17 @@ def ffreq2(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['f_freq_2'])/float(stat_dict[player]['was_raised_2'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'ff2=%3.1f' % (100*stat) + '%',
|
||||
'ff_2=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['f_freq_2'], stat_dict[player]['was_raised_2']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'ff2=%3.1f%%' % (100.0*stat),
|
||||
'ff_2=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['f_freq_2'], stat_dict[player]['was_raised_2']),
|
||||
_('% fold frequency turn/5th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'ff2=%3.1f' % (0) + '%',
|
||||
'ff_2=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'ff2=NA',
|
||||
'ff_2=NA',
|
||||
'(0/0)',
|
||||
_('% fold frequency turn/5th'))
|
||||
|
||||
def ffreq3(stat_dict, player):
|
||||
|
@ -780,17 +783,17 @@ def ffreq3(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['f_freq_3'])/float(stat_dict[player]['was_raised_3'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'ff3=%3.1f' % (100*stat) + '%',
|
||||
'ff_3=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['f_freq_3'], stat_dict[player]['was_raised_3']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'ff3=%3.1f%%' % (100.0*stat),
|
||||
'ff_3=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['f_freq_3'], stat_dict[player]['was_raised_3']),
|
||||
_('% fold frequency river/6th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'ff3=%3.1f' % (0) + '%',
|
||||
'ff_3=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'ff3=NA',
|
||||
'ff_3=NA',
|
||||
'(0/0)',
|
||||
_('% fold frequency river/6th'))
|
||||
|
||||
def ffreq4(stat_dict, player):
|
||||
|
@ -799,24 +802,24 @@ def ffreq4(stat_dict, player):
|
|||
try:
|
||||
stat = float(stat_dict[player]['f_freq_4'])/float(stat_dict[player]['was_raised_4'])
|
||||
return (stat,
|
||||
'%3.1f' % (100*stat) + '%',
|
||||
'ff4=%3.1f' % (100*stat) + '%',
|
||||
'ff_4=%3.1f' % (100*stat) + '%',
|
||||
'(%d/%d)' % (stat_dict[player]['f_freq_4'], stat_dict[player]['was_raised_4']),
|
||||
'%3.1f' % (100.0*stat),
|
||||
'ff4=%3.1f%%' % (100.0*stat),
|
||||
'ff_4=%3.1f%%' % (100.0*stat),
|
||||
'(%d/%d)' % (stat_dict[player]['f_freq_4'], stat_dict[player]['was_raised_4']),
|
||||
_('% fold frequency 7th'))
|
||||
except:
|
||||
return (stat,
|
||||
'%3.1f' % (0) + '%',
|
||||
'ff4=%3.1f' % (0) + '%',
|
||||
'ff_4=%3.1f' % (0) + '%',
|
||||
'(%d/%d)' % (0, 0),
|
||||
'NA',
|
||||
'ff4=NA',
|
||||
'ff_4=NA',
|
||||
'(0/0)',
|
||||
_('% fold frequency 7th'))
|
||||
|
||||
if __name__== "__main__":
|
||||
statlist = dir()
|
||||
misslist = [ "Configuration", "Database", "Charset", "codecs", "encoder"
|
||||
, "do_stat", "do_tip", "GInitiallyUnowned", "gtk", "pygtk"
|
||||
, "re", "re_Percent", "re_Places"
|
||||
, "re", "re_Places"
|
||||
]
|
||||
statlist = [ x for x in statlist if x not in dir(sys) ]
|
||||
statlist = [ x for x in statlist if x not in dir(codecs) ]
|
||||
|
|
19
pyfpdb/TestHandsPlayers.py
Normal file → Executable file
19
pyfpdb/TestHandsPlayers.py
Normal file → Executable file
|
@ -1,4 +1,23 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright 2010, Carl Gherardi
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# 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
|
||||
########################################################################
|
||||
|
||||
import sys
|
||||
import os
|
||||
import codecs
|
||||
|
|
|
@ -39,7 +39,7 @@ in_path (default '-' = sys.stdin)
|
|||
out_path (default '-' = sys.stdout)
|
||||
follow : whether to tail -f the input"""
|
||||
HandHistoryConverter.__init__(self, in_path, out_path, sitename="UltimateBet", follow=follow, index=index)
|
||||
logging.info("Initialising UltimateBetconverter class")
|
||||
logging.info(_("Initialising UltimateBetconverter class"))
|
||||
self.filetype = "text"
|
||||
self.codepage = "cp1252"
|
||||
self.siteId = 6 # Needs to match id entry in Sites database
|
||||
|
@ -141,7 +141,7 @@ follow : whether to tail -f the input"""
|
|||
if m:
|
||||
hand.buttonpos = int(m.group('BUTTON'))
|
||||
else:
|
||||
logging.info('readButton: not found')
|
||||
logging.info(_('readButton: not found'))
|
||||
|
||||
def readPlayerStacks(self, hand):
|
||||
logging.debug("readPlayerStacks")
|
||||
|
@ -180,7 +180,7 @@ follow : whether to tail -f the input"""
|
|||
hand.setCommunityCards(street, m.group('CARDS').split(' '))
|
||||
|
||||
def readAntes(self, hand):
|
||||
logging.debug("reading antes")
|
||||
logging.debug(_("reading antes"))
|
||||
m = self.re_Antes.finditer(hand.handText)
|
||||
for player in m:
|
||||
#~ logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')))
|
||||
|
@ -290,7 +290,7 @@ follow : whether to tail -f the input"""
|
|||
#elif action.group('ATYPE') == ' stands pat':
|
||||
# hand.addStandsPat( street, action.group('PNAME'))
|
||||
else:
|
||||
print "DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),)
|
||||
print _("DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
@ -312,9 +312,9 @@ follow : whether to tail -f the input"""
|
|||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="regression-test-files/pokerstars/HH20090226 Natalie V - $0.10-$0.20 - HORSE.txt")
|
||||
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False)
|
||||
parser.add_option("-i", "--input", dest="ipath", help=_("parse input hand history"), default="regression-test-files/pokerstars/HH20090226 Natalie V - $0.10-$0.20 - HORSE.txt")
|
||||
parser.add_option("-o", "--output", dest="opath", help=_("output translation to"), default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help=_("follow (tail -f) the input"), action="store_true", default=False)
|
||||
parser.add_option("-q", "--quiet",
|
||||
action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO)
|
||||
parser.add_option("-v", "--verbose",
|
||||
|
|
|
@ -153,7 +153,7 @@ class Win2day(HandHistoryConverter):
|
|||
hand.buttonpos = player[0]
|
||||
break
|
||||
else:
|
||||
logging.info('readButton: not found')
|
||||
logging.info(_('readButton: not found'))
|
||||
|
||||
def readPlayerStacks(self, hand):
|
||||
logging.debug("readPlayerStacks")
|
||||
|
@ -194,7 +194,7 @@ class Win2day(HandHistoryConverter):
|
|||
hand.setCommunityCards(street, boardCards)
|
||||
|
||||
def readAntes(self, hand):
|
||||
logging.debug("reading antes")
|
||||
logging.debug(_("reading antes"))
|
||||
m = self.re_Antes.finditer(hand.handText)
|
||||
for player in m:
|
||||
#~ logging.debug("hand.addAnte(%s,%s)" %(player.group('PNAME'), player.group('ANTE')))
|
||||
|
@ -332,7 +332,7 @@ class Win2day(HandHistoryConverter):
|
|||
elif action.group('ATYPE') == 'ACTION_STAND':
|
||||
hand.addStandsPat( street, action.group('PNAME'))
|
||||
else:
|
||||
print "DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),)
|
||||
print _("DEBUG: unimplemented readAction: '%s' '%s'" %(action.group('PNAME'),action.group('ATYPE'),))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
@ -359,9 +359,9 @@ class Win2day(HandHistoryConverter):
|
|||
|
||||
if __name__ == "__main__":
|
||||
parser = OptionParser()
|
||||
parser.add_option("-i", "--input", dest="ipath", help="parse input hand history", default="-")
|
||||
parser.add_option("-o", "--output", dest="opath", help="output translation to", default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help="follow (tail -f) the input", action="store_true", default=False)
|
||||
parser.add_option("-i", "--input", dest="ipath", help=_("parse input hand history"), default="-")
|
||||
parser.add_option("-o", "--output", dest="opath", help=_("output translation to"), default="-")
|
||||
parser.add_option("-f", "--follow", dest="follow", help=_("follow (tail -f) the input"), action="store_true", default=False)
|
||||
parser.add_option("-q", "--quiet",
|
||||
action="store_const", const=logging.CRITICAL, dest="verbosity", default=logging.INFO)
|
||||
parser.add_option("-v", "--verbose",
|
||||
|
|
|
@ -52,7 +52,7 @@ if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6', '2.7') and '-r' no
|
|||
else:
|
||||
os.execvpe('python', ('python', 'fpdb.pyw', '-r'), os.environ) # first arg is ignored (name of program being run)
|
||||
else:
|
||||
print _("\npython 2.5 not found, please install python 2.5, 2.6 or 2.7 for fpdb\n")
|
||||
print _("\npython 2.5-2.7 not found, please install python 2.5, 2.6 or 2.7 for fpdb\n")
|
||||
raw_input(_("Press ENTER to continue."))
|
||||
exit()
|
||||
else:
|
||||
|
@ -86,7 +86,7 @@ try:
|
|||
import gtk
|
||||
import pango
|
||||
except:
|
||||
print _("Unable to load PYGTK modules required for GUI. Please install PyCairo, PyGObject, and PyGTK from www.pygtk.org.")
|
||||
print _("Unable to load PyGTK modules required for GUI. Please install PyCairo, PyGObject, and PyGTK from www.pygtk.org.")
|
||||
raw_input(_("Press ENTER to continue."))
|
||||
exit()
|
||||
|
||||
|
@ -129,7 +129,7 @@ import Configuration
|
|||
import Exceptions
|
||||
import Stats
|
||||
|
||||
VERSION = "0.20.906"
|
||||
VERSION = "0.20.906 plus git"
|
||||
|
||||
|
||||
class fpdb:
|
||||
|
@ -436,7 +436,7 @@ class fpdb:
|
|||
diaHudTable.vbox.add(label)
|
||||
label.show()
|
||||
|
||||
label=gtk.Label(_("To configure things like colouring you will still have to manually edit your HUD_config.xml."))
|
||||
label=gtk.Label(_("To configure things like colouring you will still have to use the Preferences dialogue or manually edit your HUD_config.xml."))
|
||||
diaHudTable.vbox.add(label)
|
||||
label.show()
|
||||
|
||||
|
@ -544,8 +544,9 @@ class fpdb:
|
|||
#lock_released = False
|
||||
dia_confirm = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_WARNING,
|
||||
buttons=(gtk.BUTTONS_YES_NO), message_format=_("Confirm deleting and recreating tables"))
|
||||
diastring = _("Please confirm that you want to (re-)create the tables. If there already are tables in the database ") \
|
||||
+self.db.database+" on "+self.db.host+_(" they will be deleted.\nThis may take a while.")
|
||||
diastring = _("Please confirm that you want to (re-)create the tables.") \
|
||||
+ (_(" If there already are tables in the database %s on %s they will be deleted and you will have to re-import your histories.\n") % (self.db.database, self.db.host)) \
|
||||
+ _("This may take a while.")
|
||||
dia_confirm.format_secondary_text(diastring)#todo: make above string with bold for db, host and deleted
|
||||
# disable windowclose, do not want the the underlying processing interrupted mid-process
|
||||
dia_confirm.set_deletable(False)
|
||||
|
@ -755,24 +756,6 @@ class fpdb:
|
|||
def dia_save_profile(self, widget, data=None):
|
||||
self.warning_box(_("Unimplemented: Save Profile (try saving a HUD layout, that should do it)"))
|
||||
|
||||
def diaSetupWizard(self, path):
|
||||
diaSetupWizard = gtk.Dialog(title=_("Fatal Error - Config File Missing"), parent=None, flags=0, buttons=(gtk.STOCK_QUIT,gtk.RESPONSE_OK))
|
||||
|
||||
label = gtk.Label(_("Please copy the config file from the docs folder to:"))
|
||||
diaSetupWizard.vbox.add(label)
|
||||
label.show()
|
||||
|
||||
label = gtk.Label(path)
|
||||
diaSetupWizard.vbox.add(label)
|
||||
label.show()
|
||||
|
||||
label = gtk.Label(_("and edit it according to the install documentation at http://fpdb.sourceforge.net"))
|
||||
diaSetupWizard.vbox.add(label)
|
||||
label.show()
|
||||
|
||||
response = diaSetupWizard.run()
|
||||
sys.exit(1)
|
||||
|
||||
def get_menu(self, window):
|
||||
"""returns the menu for this program"""
|
||||
fpdbmenu = """
|
||||
|
@ -876,8 +859,7 @@ class fpdb:
|
|||
if self.config.example_copy:
|
||||
self.info_box(_("Config file")
|
||||
, _("has been created at:\n%s.\n") % self.config.file
|
||||
+ _("Edit your screen_name and hand history path in the supported_sites ")
|
||||
+ _("section of the Preferences window (Main menu) before trying to import hands."))
|
||||
+ _("Edit your screen_name and hand history path in the supported_sites section of the Preferences window (Main menu) before trying to import hands."))
|
||||
self.settings = {}
|
||||
self.settings['global_lock'] = self.lock
|
||||
if (os.sep=="/"):
|
||||
|
@ -906,10 +888,10 @@ class fpdb:
|
|||
err_msg = _("MySQL client reports: 2002 or 2003 error. Unable to connect - ") \
|
||||
+ _("Please check that the MySQL service has been started")
|
||||
except Exceptions.FpdbPostgresqlAccessDenied:
|
||||
err_msg = _("Postgres Server reports: Access denied. Are your permissions set correctly?")
|
||||
err_msg = _("PostgreSQL Server reports: Access denied. Are your permissions set correctly?")
|
||||
except Exceptions.FpdbPostgresqlNoDatabase:
|
||||
err_msg = _("Postgres client reports: Unable to connect - ") \
|
||||
+ _("Please check that the Postgres service has been started")
|
||||
err_msg = _("PostgreSQL client reports: Unable to connect - ") \
|
||||
+ _("Please check that the PostgreSQL service has been started")
|
||||
if err_msg is not None:
|
||||
self.db = None
|
||||
self.warning_box(err_msg)
|
||||
|
@ -966,10 +948,10 @@ class fpdb:
|
|||
def obtain_global_lock(self, source):
|
||||
ret = self.lock.acquire(source=source) # will return false if lock is already held
|
||||
if ret:
|
||||
print _("\nGlobal lock taken by"), source
|
||||
print (_("\nGlobal lock taken by %s") % source)
|
||||
self.lockTakenBy=source
|
||||
else:
|
||||
print _("\nFailed to get global lock, it is currently held by"), source
|
||||
print (_("\nFailed to get global lock, it is currently held by %s") % source)
|
||||
return ret
|
||||
# need to release it later:
|
||||
# self.lock.release()
|
||||
|
@ -1134,8 +1116,8 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
|||
|
||||
if not options.errorsToConsole:
|
||||
fileName = os.path.join(self.config.dir_log, 'fpdb-errors.txt')
|
||||
print _("\nNote: error output is being diverted to fpdb-errors.txt and HUD-errors.txt in:\n") \
|
||||
+ self.config.dir_log + _("\nAny major error will be reported there _only_.\n")
|
||||
print (_("\nNote: error output is being diverted to fpdb-errors.txt and HUD-errors.txt in: %s") % self.config.dir_log) \
|
||||
+ _("\nAny major error will be reported there _only_.\n")
|
||||
errorFile = open(fileName, 'w', 0)
|
||||
sys.stderr = errorFile
|
||||
|
||||
|
@ -1239,7 +1221,7 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
|||
hhdir = hhbase
|
||||
if not os.path.isdir(hhdir):
|
||||
diapath = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Setup hh dir")
|
||||
diastring = _("WARNING: Unable to find output hh directory %s\n\n Press YES to create this directory, or NO to select a new one.") % hhdir
|
||||
diastring = _("WARNING: Unable to find output hand history directory %s\n\n Press YES to create this directory, or NO to select a new one.") % hhdir
|
||||
diapath.format_secondary_text(diastring)
|
||||
response = diapath.run()
|
||||
diapath.destroy()
|
||||
|
|
|
@ -224,7 +224,7 @@ class Importer:
|
|||
#print " adding file ", file
|
||||
self.addImportFile(os.path.join(dir, file), site, filter)
|
||||
else:
|
||||
log.warning(_("Attempted to add non-directory: '%s' as an import directory") % str(dir))
|
||||
log.warning(_("Attempted to add non-directory '%s' as an import directory") % str(dir))
|
||||
|
||||
def runImport(self):
|
||||
""""Run full import on self.filelist. This is called from GuiBulkImport.py"""
|
||||
|
@ -310,7 +310,7 @@ class Importer:
|
|||
toterrors += errors
|
||||
|
||||
for i in xrange( self.settings['threads'] ):
|
||||
print _("sending finish msg qlen ="), q.qsize()
|
||||
print _("sending finish message queue length ="), q.qsize()
|
||||
db.send_finish_msg(q)
|
||||
|
||||
return (totstored, totdups, totpartial, toterrors)
|
||||
|
@ -436,9 +436,9 @@ class Importer:
|
|||
|
||||
# Load filter, process file, pass returned filename to import_fpdb_file
|
||||
if self.settings['threads'] > 0 and self.writeq is not None:
|
||||
log.info(_("Converting ") + file + " (" + str(q.qsize()) + ")")
|
||||
log.info((_("Converting %s") % file) + " (" + str(q.qsize()) + ")")
|
||||
else:
|
||||
log.info(_("Converting ") + file)
|
||||
log.info(_("Converting %s") % file)
|
||||
hhbase = self.config.get_import_parameters().get("hhArchiveBase")
|
||||
hhbase = os.path.expanduser(hhbase)
|
||||
hhdir = os.path.join(hhbase,site)
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
cd ..
|
||||
python /usr/share/doc/python-2.7/examples/Tools/i18n/msgfmt.py --output-file=locale/hu/LC_MESSAGES/fpdb.mo locale/fpdb-hu_HU.po
|
||||
python /usr/share/doc/python-2.7/examples/Tools/i18n/msgfmt.py --output-file=locale/de/LC_MESSAGES/fpdb.mo locale/fpdb-de_DE.po
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
cd ..
|
||||
python /usr/share/doc/python-2.7/examples/Tools/i18n/pygettext.py --output-dir=locale --default-domain=fpdb --output=fpdb-en_GB.po *.py*
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
16
pyfpdb/locale/localise.sh
Executable file
16
pyfpdb/locale/localise.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
cd ..
|
||||
rm *.pyc
|
||||
|
||||
echo "creating template po file"
|
||||
python /usr/share/doc/python-2.7/examples/Tools/i18n/pygettext.py --output-dir=locale --default-domain=fpdb --output=fpdb-en_GB.pot *.py*
|
||||
|
||||
echo "merging template with existing translations"
|
||||
msgmerge --update locale/fpdb-de_DE.po locale/fpdb-en_GB.pot
|
||||
msgmerge --update locale/fpdb-fr_FR.po locale/fpdb-en_GB.pot
|
||||
msgmerge --update locale/fpdb-hu_HU.po locale/fpdb-en_GB.pot
|
||||
|
||||
echo "compiling mo files"
|
||||
python /usr/share/doc/python-2.7/examples/Tools/i18n/msgfmt.py --output-file=locale/de/LC_MESSAGES/fpdb.mo locale/fpdb-de_DE.po
|
||||
python /usr/share/doc/python-2.7/examples/Tools/i18n/msgfmt.py --output-file=locale/hu/LC_MESSAGES/fpdb.mo locale/fpdb-hu_HU.po
|
||||
|
||||
pocount locale/*.po
|
|
@ -1,3 +0,0 @@
|
|||
msgmerge --update fpdb-hu_HU.po fpdb-en_GB.po
|
||||
msgmerge --update fpdb-de_DE.po fpdb-en_GB.po
|
||||
|
Loading…
Reference in New Issue
Block a user