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

This commit is contained in:
Erki Ferenc 2010-08-15 22:55:51 +02:00
commit f6a1881ba7
17 changed files with 175 additions and 47 deletions

View File

@ -23,9 +23,17 @@ import HandHistoryConverter
import Configuration import Configuration
import sys import sys
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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
(options, argv) = Options.fpdb_options() (options, argv) = Options.fpdb_options()
config = Configuration.Config() config = Configuration.Config()

View File

@ -22,9 +22,17 @@ import sys
import logging import logging
from HandHistoryConverter import * from HandHistoryConverter import *
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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
# Betfair HH format # Betfair HH format

View File

@ -15,9 +15,17 @@
#along with this program. If not, see <http://www.gnu.org/licenses/>. #along with this program. If not, see <http://www.gnu.org/licenses/>.
#In the "official" distribution you can find the license in agpl-3.0.txt. #In the "official" distribution you can find the license in agpl-3.0.txt.
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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
# From fpdb_simple # From fpdb_simple
card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8, card_map = { "0": 0, "2": 2, "3" : 3, "4" : 4, "5" : 5, "6" : 6, "7" : 7, "8" : 8,

View File

@ -36,6 +36,18 @@ import re
import xml.dom.minidom import xml.dom.minidom
from xml.dom.minidom import Node from xml.dom.minidom import Node
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, logging.config import logging, logging.config
import ConfigParser import ConfigParser

View File

@ -33,9 +33,17 @@ import fpdb_import
import Configuration import Configuration
import Exceptions import Exceptions
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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 GuiBulkImport(): class GuiBulkImport():

View File

@ -35,9 +35,17 @@ import Exceptions
import Database import Database
import SQL import SQL
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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 GuiDatabase: class GuiDatabase:

View File

@ -30,9 +30,17 @@ import logging
# logging has been set up in fpdb.py or HUD_main.py, use their settings: # logging has been set up in fpdb.py or HUD_main.py, use their settings:
log = logging.getLogger("logview") log = logging.getLogger("logview")
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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
MAX_LINES = 100000 # max lines to display in window MAX_LINES = 100000 # max lines to display in window
EST_CHARS_PER_LINE = 150 # used to guesstimate number of lines in log file EST_CHARS_PER_LINE = 150 # used to guesstimate number of lines in log file

View File

@ -60,9 +60,18 @@ elif os.name == 'nt':
#import Tables #import Tables
import Hud import Hud
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() print "lang:", lang
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
# get config and set up logger # get config and set up logger
c = Configuration.Config(file=options.config, dbname=options.dbname) c = Configuration.Config(file=options.config, dbname=options.dbname)

View File

@ -41,9 +41,17 @@ import Hand
from Exceptions import FpdbParseError from Exceptions import FpdbParseError
import Configuration import Configuration
#import gettext import locale
#trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
#trans.install() 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 pygtk import pygtk
import gtk import gtk

View File

@ -22,9 +22,17 @@
from imaplib import IMAP4, IMAP4_SSL from imaplib import IMAP4, IMAP4_SSL
import PokerStarsSummary import PokerStarsSummary
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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
def splitPokerStarsSummaries(emailText): def splitPokerStarsSummaries(emailText):
splitSummaries=emailText.split("\nPokerStars Tournament #")[1:] splitSummaries=emailText.split("\nPokerStars Tournament #")[1:]

View File

@ -19,9 +19,17 @@ import sys
from optparse import OptionParser from optparse import OptionParser
# http://docs.python.org/library/optparse.html # http://docs.python.org/library/optparse.html
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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
def fpdb_options(): def fpdb_options():

View File

@ -29,8 +29,19 @@ import os
import sys import sys
import re import re
# Win32 modules 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
# Win32 modules
if os.name == 'nt': if os.name == 'nt':
import win32gui import win32gui
import win32process import win32process
@ -220,7 +231,7 @@ def discover_nt(c):
tw.site = "Full Tilt" tw.site = "Full Tilt"
else: else:
tw.site = "Unknown" tw.site = "Unknown"
sys.stderr.write("Found unknown table = %s" % tw.title) sys.stderr.write(_("Found unknown table = %s") % tw.title)
if tw.site != "Unknown": if tw.site != "Unknown":
eval("%s(tw)" % c.supported_sites[tw.site].decoder) eval("%s(tw)" % c.supported_sites[tw.site].decoder)
else: else:
@ -247,7 +258,7 @@ def discover_nt_by_name(c, tablename):
if 'Chat:' in titles[hwnd]: continue # Some sites (FTP? PS? Others?) have seperable or seperately constructed chat windows if 'Chat:' in titles[hwnd]: continue # Some sites (FTP? PS? Others?) have seperable or seperately constructed chat windows
if ' - Table ' in titles[hwnd]: continue # Absolute table Chat window.. sigh. TODO: Can we tell what site we're trying to discover for somehow in here, so i can limit this check just to AP searches? if ' - Table ' in titles[hwnd]: continue # Absolute table Chat window.. sigh. TODO: Can we tell what site we're trying to discover for somehow in here, so i can limit this check just to AP searches?
temp = decode_windows(c, titles[hwnd], hwnd) temp = decode_windows(c, titles[hwnd], hwnd)
print "attach to window", temp print _("attach to window"), temp
return temp return temp
return None return None
@ -434,5 +445,5 @@ if __name__=="__main__":
for t in tables.keys(): for t in tables.keys():
print tables[t] print tables[t]
print "press enter to continue" print _("press enter to continue")
sys.stdin.readline() sys.stdin.readline()

View File

@ -36,9 +36,17 @@ import gobject
import Configuration import Configuration
from HandHistoryConverter import getTableTitleRe from HandHistoryConverter import getTableTitleRe
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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
# get the correct module for the current os # get the correct module for the current os
if os.name == 'posix': if os.name == 'posix':

View File

@ -45,9 +45,9 @@ class TourneyFilters(Filters.Filters):
self.conf = db.config self.conf = db.config
self.display = display self.display = display
self.filterText = {'playerstitle':'Hero:', 'sitestitle':'Sites:', 'seatstitle':'Number of Players:', self.filterText = {'playerstitle':_('Hero:'), 'sitestitle':_('Sites:'), 'seatstitle':_('Number of Players:'),
'seatsbetween':'Between:', 'seatsand':'And:', 'datestitle':'Date:', 'seatsbetween':_('Between:'), 'seatsand':_('And:'), 'datestitle':_('Date:'),
'tourneyTypesTitle':'Tourney Type'} 'tourneyTypesTitle':_('Tourney Type')}
gen = self.conf.get_general_params() gen = self.conf.get_general_params()
self.day_start = 0 self.day_start = 0
@ -102,7 +102,7 @@ class TourneyFilters(Filters.Filters):
if len(result) == 1: if len(result) == 1:
self.siteid[site] = result[0][0] self.siteid[site] = result[0][0]
else: else:
print "Either 0 or more than one site matched (%s) - EEK" % site print _("Either 0 or more than one site matched (%s) - EEK") % site
# For use in date ranges. # For use in date ranges.
self.start_date = gtk.Entry(max=12) self.start_date = gtk.Entry(max=12)

View File

@ -20,9 +20,17 @@ import sys
import re import re
import Queue import Queue
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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
# if path is set to use an old version of python look for a new one: # if path is set to use an old version of python look for a new one:
# (does this work in linux?) # (does this work in linux?)

View File

@ -17,9 +17,17 @@
# create .bat scripts in windows to try out different gtk dirs # create .bat scripts in windows to try out different gtk dirs
import gettext import locale
trans = gettext.translation("fpdb", localedir="locale", languages=["de_DE"]) lang=locale.getdefaultlocale()[0][0:2]
trans.install() 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
try: try: