Merge branch 'next'
Conflicts: pyfpdb/Configuration.py pyfpdb/locale/de/LC_MESSAGES/fpdb.mo pyfpdb/locale/es/LC_MESSAGES/fpdb.mo pyfpdb/locale/fpdb-de_DE.po pyfpdb/locale/fpdb-en_GB.pot pyfpdb/locale/fpdb-es_ES.po pyfpdb/locale/fpdb-fr_FR.po pyfpdb/locale/fpdb-hu_HU.po pyfpdb/locale/fpdb-it_IT.po pyfpdb/locale/fpdb-pl_PL.po pyfpdb/locale/fpdb-pt_BR.po pyfpdb/locale/fpdb-ru_RU.po pyfpdb/locale/fpdb-zh_CN.po pyfpdb/locale/fr/LC_MESSAGES/fpdb.mo pyfpdb/locale/hu/LC_MESSAGES/fpdb.mo pyfpdb/locale/it/LC_MESSAGES/fpdb.mo pyfpdb/locale/pl/LC_MESSAGES/fpdb.mo pyfpdb/locale/pt/LC_MESSAGES/fpdb.mo pyfpdb/locale/ru/LC_MESSAGES/fpdb.mo pyfpdb/locale/zh/LC_MESSAGES/fpdb.mo
This commit is contained in:
commit
28dead2905
|
@ -321,11 +321,7 @@ class Absolute(HandHistoryConverter):
|
|||
hand.involved = False
|
||||
|
||||
def readStudPlayerCards(self, hand, street):
|
||||
# lol. see Plymouth.txt
|
||||
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 = [])
|
||||
|
||||
logging.warning(_("%s cannot read all stud/razz hands yet.") % hand.sitename)
|
||||
|
||||
def readAction(self, hand, street):
|
||||
logging.debug("readAction (%s)" % street)
|
||||
|
@ -349,7 +345,7 @@ class Absolute(HandHistoryConverter):
|
|||
bet = action.group('BET').replace(',', '')
|
||||
hand.addComplete( street, action.group('PNAME'), bet)
|
||||
else:
|
||||
logging.debug(_("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
|
||||
logging.debug(_("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
|
|
@ -196,7 +196,7 @@ class Betfair(HandHistoryConverter):
|
|||
elif action.group('ATYPE') == 'checks':
|
||||
hand.addCheck( street, action.group('PNAME'))
|
||||
else:
|
||||
sys.stderr.write(_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
|
||||
sys.stderr.write(_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
|
|
@ -264,7 +264,7 @@ 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 %s: '%s' '%s'") % ("readAction", action.group('PSEAT'), action.group('ATYPE')))
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
||||
|
|
|
@ -40,10 +40,10 @@ def to_utf8(s):
|
|||
_out = unicode(s, Configuration.LOCALE_ENCODING).encode('utf-8')
|
||||
return _out
|
||||
except UnicodeDecodeError:
|
||||
sys.stderr.write(_('Could not convert: "%s"\n') % s)
|
||||
sys.stderr.write(_('Could not convert: "%s"') % (s+"\n"))
|
||||
raise
|
||||
except UnicodeEncodeError:
|
||||
sys.stderr.write(_('Could not encode: "%s"\n') % s)
|
||||
sys.stderr.write(_('Could not encode: "%s"') % (s+"\n"))
|
||||
raise
|
||||
except TypeError: # TypeError is raised when we give unicode() an already encoded string
|
||||
return s
|
||||
|
@ -55,10 +55,10 @@ def to_db_utf8(s):
|
|||
(_out, _len) = encoder_to_utf.encode(unicode(s))
|
||||
return _out
|
||||
except UnicodeDecodeError:
|
||||
sys.stderr.write(_('Could not convert: "%s"\n') % s)
|
||||
sys.stderr.write(_('Could not convert: "%s"') % (s+"\n"))
|
||||
raise
|
||||
except UnicodeEncodeError:
|
||||
sys.stderr.write(_('Could not encode: "%s"\n') % s)
|
||||
sys.stderr.write(_('Could not encode: "%s"') % (s+"\n"))
|
||||
raise
|
||||
|
||||
def to_gui(s):
|
||||
|
@ -70,8 +70,8 @@ def to_gui(s):
|
|||
(_out, _len) = encoder_to_sys.encode(s, 'replace')
|
||||
return _out
|
||||
except UnicodeDecodeError:
|
||||
sys.stderr.write(_('Could not convert: "%s"\n') % s)
|
||||
sys.stderr.write(_('Could not convert: "%s"') % (s+"\n"))
|
||||
raise
|
||||
except UnicodeEncodeError:
|
||||
sys.stderr.write(_('Could not encode: "%s"\n') % s)
|
||||
sys.stderr.write(_('Could not encode: "%s"') % (s+"\n"))
|
||||
raise
|
||||
|
|
|
@ -114,14 +114,14 @@ def get_config(file_name, fallback = True):
|
|||
try:
|
||||
shutil.copyfile(example_path, config_path)
|
||||
example_copy = True
|
||||
msg = _("Config file has been created at %s.\n") % config_path
|
||||
msg = _("Config file has been created at %s.") % (config_path+"\n")
|
||||
logging.info(msg)
|
||||
except IOError:
|
||||
try:
|
||||
example_path = file_name + '.example'
|
||||
shutil.copyfile(example_path, config_path)
|
||||
example_copy = True
|
||||
msg = _("Config file has been created at %s.\n") % config_path
|
||||
msg = _("Config file has been created at %s.") % (config_path+"\n")
|
||||
logging.info(msg)
|
||||
except IOError:
|
||||
pass
|
||||
|
@ -135,18 +135,18 @@ def get_config(file_name, fallback = True):
|
|||
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
|
||||
msg = _("No %s found\n in %s\n or %s") % (file_name, exec_dir, default_dir) \
|
||||
+ " " + _("Config file has been created at %s.") % (config_path+"\n")
|
||||
print msg
|
||||
logging.info(msg)
|
||||
except:
|
||||
print _("Error copying .example config file, cannot fall back. Exiting.\n")
|
||||
sys.stderr.write(_("Error copying .example config 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()
|
||||
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)
|
||||
print _("No %s found, cannot fall back. Exiting.") % file_name, "\n"
|
||||
sys.stderr.write((_("No %s found, cannot fall back. Exiting.") % file_name) + "\n")
|
||||
sys.exit()
|
||||
|
||||
#print "get_config: returning "+str( (config_path,example_copy,example_path) )
|
||||
|
@ -215,9 +215,10 @@ DATABASE_TYPES = (
|
|||
|
||||
LOCALE_ENCODING = locale.getpreferredencoding()
|
||||
if LOCALE_ENCODING in ("US-ASCII", "", None):
|
||||
print _("Default encoding set to US-ASCII, defaulting to CP1252 instead -- If you're not on a Mac, please report this problem.")
|
||||
LOCALE_ENCODING = "cp1252"
|
||||
|
||||
if (os.uname()[0]!="Darwin"):
|
||||
print _("Default encoding set to US-ASCII, defaulting to CP1252 instead."), _("Please report this problem.")
|
||||
|
||||
|
||||
# needs LOCALE_ENCODING (above), imported for sqlite setup in Config class below
|
||||
|
||||
|
@ -994,7 +995,13 @@ class Config:
|
|||
location_node.setAttribute("x", str( locations[i-1][0] ))
|
||||
location_node.setAttribute("y", str( locations[i-1][1] ))
|
||||
self.supported_sites[site_name].layout[max].location[i] = ( locations[i-1][0], locations[i-1][1] )
|
||||
|
||||
|
||||
def edit_site(self, site_name, enabled, screen_name, history_path):
|
||||
site_node = self.get_site_node(site_name)
|
||||
site_node.setAttribute("enabled", enabled)
|
||||
site_node.setAttribute("screen_name", screen_name)
|
||||
site_node.setAttribute("HH_path", history_path)
|
||||
|
||||
def editStats(self, gameName, statArray):
|
||||
"""replaces stat selection for the given gameName with the given statArray"""
|
||||
gameNode = self.getGameNode(gameName)
|
||||
|
@ -1035,7 +1042,7 @@ class Config:
|
|||
newStat.setAttribute("tip", "tip1")
|
||||
|
||||
gameNode.appendChild(newStat)
|
||||
statNodes = gameNode.getElementsByTagName("stat")
|
||||
statNodes = gameNode.getElementsByTagName("stat") #TODO remove this line?
|
||||
#end def editStats
|
||||
|
||||
def edit_aux_layout(self, aux_name, max, width = None, height = None, locations = None):
|
||||
|
|
147
pyfpdb/Database.py
Normal file → Executable file
147
pyfpdb/Database.py
Normal file → Executable file
|
@ -503,9 +503,9 @@ class Database:
|
|||
self.check_version(database=database, create=create)
|
||||
|
||||
def get_sites(self):
|
||||
self.cursor.execute("SELECT name,id FROM Sites")
|
||||
sites = self.cursor.fetchall()
|
||||
self.config.set_site_ids(sites)
|
||||
self.cursor.execute("SELECT name,id FROM Sites")
|
||||
sites = self.cursor.fetchall()
|
||||
self.config.set_site_ids(sites)
|
||||
|
||||
def add_site(self, site, site_code):
|
||||
self.cursor.execute("INSERT INTO Sites "
|
||||
|
@ -765,7 +765,7 @@ class Database:
|
|||
if row and row[0]:
|
||||
self.date_nhands_ago[str(playerid)] = row[0]
|
||||
c.close()
|
||||
print _("Database: date n hands ago = ") + self.date_nhands_ago[str(playerid)] + "(playerid "+str(playerid)+")"
|
||||
print _("Database: n hands ago the date was:") + " " + self.date_nhands_ago[str(playerid)] + " (playerid "+str(playerid)+")"
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print _("*** Database Error: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
|
@ -1070,14 +1070,15 @@ class Database:
|
|||
cons = c.fetchone()
|
||||
#print "preparebulk find fk: cons=", cons
|
||||
if cons:
|
||||
print "dropping mysql fk", cons[0], fk['fktab'], fk['fkcol']
|
||||
print _("Dropping foreign key:"), cons[0], fk['fktab'], fk['fkcol']
|
||||
try:
|
||||
c.execute("alter table " + fk['fktab'] + " drop foreign key " + cons[0])
|
||||
except:
|
||||
print " drop failed: " + str(sys.exc_info())
|
||||
print _("Warning:"), _("Drop foreign key %s_%s_fkey failed: %s, continuing ...") \
|
||||
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
|
||||
elif self.backend == self.PGSQL:
|
||||
# DON'T FORGET TO RECREATE THEM!!
|
||||
print "dropping pg fk", fk['fktab'], fk['fkcol']
|
||||
print _("Dropping foreign key:"), fk['fktab'], fk['fkcol']
|
||||
try:
|
||||
# try to lock table to see if index drop will work:
|
||||
# hmmm, tested by commenting out rollback in grapher. lock seems to work but
|
||||
|
@ -1089,14 +1090,14 @@ class Database:
|
|||
#print "alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol'])
|
||||
try:
|
||||
c.execute("alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol']))
|
||||
print "dropped pg fk pg fk %s_%s_fkey, continuing ..." % (fk['fktab'], fk['fkcol'])
|
||||
print _("dropped foreign key %s_%s_fkey, continuing ...") % (fk['fktab'], fk['fkcol'])
|
||||
except:
|
||||
if "does not exist" not in str(sys.exc_value):
|
||||
print _("warning: drop pg fk %s_%s_fkey failed: %s, continuing ...") \
|
||||
print _("Warning:"), _("Drop foreign key %s_%s_fkey failed: %s, continuing ...") \
|
||||
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
|
||||
c.execute("END TRANSACTION")
|
||||
except:
|
||||
print _("warning: constraint %s_%s_fkey not dropped: %s, continuing ...") \
|
||||
print _("Warning:"), _("constraint %s_%s_fkey not dropped: %s, continuing ...") \
|
||||
% (fk['fktab'],fk['fkcol'], str(sys.exc_value).rstrip('\n'))
|
||||
else:
|
||||
return -1
|
||||
|
@ -1104,18 +1105,18 @@ class Database:
|
|||
for idx in self.indexes[self.backend]:
|
||||
if idx['drop'] == 1:
|
||||
if self.backend == self.MYSQL_INNODB:
|
||||
print _("dropping mysql index "), idx['tab'], idx['col']
|
||||
print _("Dropping index:"), idx['tab'], idx['col']
|
||||
try:
|
||||
# apparently nowait is not implemented in mysql so this just hangs if there are locks
|
||||
# preventing the index drop :-(
|
||||
c.execute( "alter table %s drop index %s;", (idx['tab'],idx['col']) )
|
||||
except:
|
||||
print _(" drop index failed: ") + str(sys.exc_info())
|
||||
print _("Drop index failed:"), str(sys.exc_info())
|
||||
# ALTER TABLE `fpdb`.`handsplayers` DROP INDEX `playerId`;
|
||||
# using: 'HandsPlayers' drop index 'playerId'
|
||||
elif self.backend == self.PGSQL:
|
||||
# DON'T FORGET TO RECREATE THEM!!
|
||||
print _("dropping pg index "), idx['tab'], idx['col']
|
||||
print _("Dropping index:"), idx['tab'], idx['col']
|
||||
try:
|
||||
# try to lock table to see if index drop will work:
|
||||
c.execute("BEGIN TRANSACTION")
|
||||
|
@ -1128,11 +1129,11 @@ class Database:
|
|||
#print "dropped pg index ", idx['tab'], idx['col']
|
||||
except:
|
||||
if "does not exist" not in str(sys.exc_value):
|
||||
print _("warning: drop index %s_%s_idx failed: %s, continuing ...") \
|
||||
print _("Warning:"), _("drop index %s_%s_idx failed: %s, continuing ...") \
|
||||
% (idx['tab'],idx['col'], str(sys.exc_value).rstrip('\n'))
|
||||
c.execute("END TRANSACTION")
|
||||
except:
|
||||
print _("warning: index %s_%s_idx not dropped %s, continuing ...") \
|
||||
print _("Warning:"), _("index %s_%s_idx not dropped: %s, continuing ...") \
|
||||
% (idx['tab'],idx['col'], str(sys.exc_value).rstrip('\n'))
|
||||
else:
|
||||
return -1
|
||||
|
@ -1172,43 +1173,43 @@ class Database:
|
|||
if cons:
|
||||
pass
|
||||
else:
|
||||
print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||
print _("Creating foreign key:"), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||
try:
|
||||
c.execute("alter table " + fk['fktab'] + " add foreign key ("
|
||||
+ fk['fkcol'] + ") references " + fk['rtab'] + "("
|
||||
+ fk['rcol'] + ")")
|
||||
except:
|
||||
print _("Create foreign key failed: ") + str(sys.exc_info())
|
||||
print _("Create foreign key failed:"), str(sys.exc_info())
|
||||
elif self.backend == self.PGSQL:
|
||||
print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||
print _("Creating foreign key:"), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||
try:
|
||||
c.execute("alter table " + fk['fktab'] + " add constraint "
|
||||
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
|
||||
+ " foreign key (" + fk['fkcol']
|
||||
+ ") references " + fk['rtab'] + "(" + fk['rcol'] + ")")
|
||||
except:
|
||||
print _("Create foreign key failed: ") + str(sys.exc_info())
|
||||
print _("Create foreign key failed:"), str(sys.exc_info())
|
||||
else:
|
||||
return -1
|
||||
|
||||
for idx in self.indexes[self.backend]:
|
||||
if idx['drop'] == 1:
|
||||
if self.backend == self.MYSQL_INNODB:
|
||||
print _("Creating MySQL index %s %s") % (idx['tab'], idx['col'])
|
||||
print _("Creating index %s %s") % (idx['tab'], idx['col'])
|
||||
try:
|
||||
s = "alter table %s add index %s(%s)" % (idx['tab'],idx['col'],idx['col'])
|
||||
c.execute(s)
|
||||
except:
|
||||
print _("Create foreign key failed: ") + str(sys.exc_info())
|
||||
print _("Create foreign key failed:"), str(sys.exc_info())
|
||||
elif self.backend == self.PGSQL:
|
||||
# pass
|
||||
# mod to use tab_col for index name?
|
||||
print _("Creating PostgreSQL index "), idx['tab'], idx['col']
|
||||
print _("Creating index %s %s") % (idx['tab'], idx['col'])
|
||||
try:
|
||||
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
||||
c.execute(s)
|
||||
except:
|
||||
print _("Create index failed: ") + str(sys.exc_info())
|
||||
print _("Create index failed:"), str(sys.exc_info())
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
@ -1299,7 +1300,7 @@ class Database:
|
|||
except:
|
||||
#print "Error creating tables: ", str(sys.exc_value)
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print _("***Error creating tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
print _("***Error creating tables:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
self.rollback()
|
||||
raise
|
||||
#end def disconnect
|
||||
|
@ -1321,7 +1322,7 @@ class Database:
|
|||
c.execute(self.sql.query['drop_table'] + table[0])
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print _("***Error dropping tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
print _("***Error dropping tables:"), +err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
self.rollback()
|
||||
elif backend == 'PostgreSQL':
|
||||
try:
|
||||
|
@ -1332,7 +1333,7 @@ class Database:
|
|||
c.execute(self.sql.query['drop_table'] + table[0] + ' cascade')
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print _("***Error dropping tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
print _("***Error dropping tables:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
self.rollback()
|
||||
elif backend == 'SQLite':
|
||||
try:
|
||||
|
@ -1342,14 +1343,14 @@ class Database:
|
|||
c.execute(self.sql.query['drop_table'] + table[0])
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print _("***Error dropping tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
print _("***Error dropping tables:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
self.rollback()
|
||||
try:
|
||||
self.commit()
|
||||
except:
|
||||
print _("*** Error in committing table drop")
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print _("***Error dropping tables: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
print _("***Error dropping tables:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
self.rollback()
|
||||
#end def drop_tables
|
||||
|
||||
|
@ -1361,38 +1362,37 @@ class Database:
|
|||
self.connection.set_isolation_level(0) # allow table/index operations to work
|
||||
for idx in self.indexes[self.backend]:
|
||||
if self.backend == self.MYSQL_INNODB:
|
||||
print _("Creating mysql index %s %s") %(idx['tab'], idx['col'])
|
||||
log.debug(_("Creating mysql index %s %s") %(idx['tab'], idx['col']))
|
||||
print _("Creating index %s %s") %(idx['tab'], idx['col'])
|
||||
log.debug(_("Creating index %s %s") %(idx['tab'], idx['col']))
|
||||
try:
|
||||
s = "create index %s on %s(%s)" % (idx['col'],idx['tab'],idx['col'])
|
||||
self.get_cursor().execute(s)
|
||||
except:
|
||||
print _("Create index failed: ") + str(sys.exc_info())
|
||||
print _("Create index failed:"), str(sys.exc_info())
|
||||
elif self.backend == self.PGSQL:
|
||||
# mod to use tab_col for index name?
|
||||
print _("Creating pgsql index %s %s") %(idx['tab'], idx['col'])
|
||||
log.debug(_("Creating pgsql index %s %s") %(idx['tab'], idx['col']))
|
||||
print _("Creating index %s %s") %(idx['tab'], idx['col'])
|
||||
log.debug(_("Creating index %s %s") %(idx['tab'], idx['col']))
|
||||
try:
|
||||
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
||||
self.get_cursor().execute(s)
|
||||
except:
|
||||
print _("Create index failed: ") + str(sys.exc_info())
|
||||
print _("Create index failed:"), str(sys.exc_info())
|
||||
elif self.backend == self.SQLITE:
|
||||
print _("Creating sqlite index %s %s") %(idx['tab'], idx['col'])
|
||||
log.debug(_("Creating sqlite index %s %s") %(idx['tab'], idx['col']))
|
||||
print _("Creating index %s %s") %(idx['tab'], idx['col'])
|
||||
log.debug(_("Creating index %s %s") %(idx['tab'], idx['col']))
|
||||
try:
|
||||
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
|
||||
self.get_cursor().execute(s)
|
||||
except:
|
||||
log.debug(_("Create index failed: ") + str(sys.exc_info()))
|
||||
log.debug(_("Create index failed:"), str(sys.exc_info()))
|
||||
else:
|
||||
print _("Unknown database: MySQL, Postgres and SQLite supported")
|
||||
return -1
|
||||
if self.backend == self.PGSQL:
|
||||
self.connection.set_isolation_level(1) # go back to normal isolation level
|
||||
except:
|
||||
print _("Error creating indexes: ") + str(sys.exc_value)
|
||||
raise FpdbError("Error creating indexes: " + str(sys.exc_value) )
|
||||
print _("Error creating indexes:"), str(sys.exc_value)
|
||||
raise FpdbError("Error creating indexes:" + " " + str(sys.exc_value) )
|
||||
#end def createAllIndexes
|
||||
|
||||
def dropAllIndexes(self):
|
||||
|
@ -1403,29 +1403,28 @@ class Database:
|
|||
self.connection.set_isolation_level(0) # allow table/index operations to work
|
||||
for idx in self.indexes[self.backend]:
|
||||
if self.backend == self.MYSQL_INNODB:
|
||||
print _("dropping mysql index "), idx['tab'], idx['col']
|
||||
print (_("Dropping index:"), idx['tab'], idx['col'])
|
||||
try:
|
||||
self.get_cursor().execute( "alter table %s drop index %s"
|
||||
, (idx['tab'], idx['col']) )
|
||||
except:
|
||||
print _(" drop index failed: ") + str(sys.exc_info())
|
||||
print _("Drop index failed:"), str(sys.exc_info())
|
||||
elif self.backend == self.PGSQL:
|
||||
print _("dropping pg index "), idx['tab'], idx['col']
|
||||
print (_("Dropping index:"), idx['tab'], idx['col'])
|
||||
# mod to use tab_col for index name?
|
||||
try:
|
||||
self.get_cursor().execute( "drop index %s_%s_idx"
|
||||
% (idx['tab'],idx['col']) )
|
||||
except:
|
||||
print _(" drop index failed: ") + str(sys.exc_info())
|
||||
print (_("Drop index failed:"), str(sys.exc_info()))
|
||||
elif self.backend == self.SQLITE:
|
||||
print _("Dropping sqlite index "), idx['tab'], idx['col']
|
||||
print (_("Dropping index:"), idx['tab'], idx['col'])
|
||||
try:
|
||||
self.get_cursor().execute( "drop index %s_%s_idx"
|
||||
% (idx['tab'],idx['col']) )
|
||||
except:
|
||||
print _(" drop index failed: ") + str(sys.exc_info())
|
||||
print _("Drop index failed:"), str(sys.exc_info())
|
||||
else:
|
||||
print _("Fpdb only supports MySQL, Postgres and SQLITE, what are you trying to use?")
|
||||
return -1
|
||||
if self.backend == self.PGSQL:
|
||||
self.connection.set_isolation_level(1) # go back to normal isolation level
|
||||
|
@ -1439,7 +1438,7 @@ class Database:
|
|||
self.connection.set_isolation_level(0) # allow table/index operations to work
|
||||
c = self.get_cursor()
|
||||
except:
|
||||
print _(" set_isolation_level failed: ") + str(sys.exc_info())
|
||||
print _("set_isolation_level failed:"), str(sys.exc_info())
|
||||
|
||||
for fk in self.foreignKeys[self.backend]:
|
||||
if self.backend == self.MYSQL_INNODB:
|
||||
|
@ -1456,30 +1455,30 @@ class Database:
|
|||
if cons:
|
||||
pass
|
||||
else:
|
||||
print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||
print _("Creating foreign key:"), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||
try:
|
||||
c.execute("alter table " + fk['fktab'] + " add foreign key ("
|
||||
+ fk['fkcol'] + ") references " + fk['rtab'] + "("
|
||||
+ fk['rcol'] + ")")
|
||||
except:
|
||||
print _("Create foreign key failed: ") + str(sys.exc_info())
|
||||
print _("Create foreign key failed:"), str(sys.exc_info())
|
||||
elif self.backend == self.PGSQL:
|
||||
print _("Creating foreign key "), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||
print _("Creating foreign key:"), fk['fktab'], fk['fkcol'], "->", fk['rtab'], fk['rcol']
|
||||
try:
|
||||
c.execute("alter table " + fk['fktab'] + " add constraint "
|
||||
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
|
||||
+ " foreign key (" + fk['fkcol']
|
||||
+ ") references " + fk['rtab'] + "(" + fk['rcol'] + ")")
|
||||
except:
|
||||
print _("Create foreign key failed: ") + str(sys.exc_info())
|
||||
print _("Create foreign key failed:"), str(sys.exc_info())
|
||||
else:
|
||||
print _("Only MySQL and Postgres supported so far")
|
||||
pass
|
||||
|
||||
try:
|
||||
if self.backend == self.PGSQL:
|
||||
self.connection.set_isolation_level(1) # go back to normal isolation level
|
||||
except:
|
||||
print _(" set_isolation_level failed: ") + str(sys.exc_info())
|
||||
print _("set_isolation_level failed:"), str(sys.exc_info())
|
||||
#end def createAllForeignKeys
|
||||
|
||||
def dropAllForeignKeys(self):
|
||||
|
@ -1503,14 +1502,15 @@ class Database:
|
|||
cons = c.fetchone()
|
||||
#print "preparebulk find fk: cons=", cons
|
||||
if cons:
|
||||
print _("dropping mysql foreign key"), cons[0], fk['fktab'], fk['fkcol']
|
||||
print _("Dropping foreign key:"), cons[0], fk['fktab'], fk['fkcol']
|
||||
try:
|
||||
c.execute("alter table " + fk['fktab'] + " drop foreign key " + cons[0])
|
||||
except:
|
||||
print _(" drop failed: ") + str(sys.exc_info())
|
||||
print _("Warning:"), _("Drop foreign key %s_%s_fkey failed: %s, continuing ...") \
|
||||
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
|
||||
elif self.backend == self.PGSQL:
|
||||
# DON'T FORGET TO RECREATE THEM!!
|
||||
print _("dropping pg foreign key"), fk['fktab'], fk['fkcol']
|
||||
print _("Dropping foreign key:"), fk['fktab'], fk['fkcol']
|
||||
try:
|
||||
# try to lock table to see if index drop will work:
|
||||
# hmmm, tested by commenting out rollback in grapher. lock seems to work but
|
||||
|
@ -1522,17 +1522,18 @@ class Database:
|
|||
#print "alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol'])
|
||||
try:
|
||||
c.execute("alter table %s drop constraint %s_%s_fkey" % (fk['fktab'], fk['fktab'], fk['fkcol']))
|
||||
print _("dropped pg foreign key %s_%s_fkey, continuing ...") % (fk['fktab'], fk['fkcol'])
|
||||
print _("dropped foreign key %s_%s_fkey, continuing ...") % (fk['fktab'], fk['fkcol'])
|
||||
except:
|
||||
if "does not exist" not in str(sys.exc_value):
|
||||
print _("warning: drop pg fk %s_%s_fkey failed: %s, continuing ...") \
|
||||
print _("Warning:"), _("Drop foreign key %s_%s_fkey failed: %s, continuing ...") \
|
||||
% (fk['fktab'], fk['fkcol'], str(sys.exc_value).rstrip('\n') )
|
||||
c.execute("END TRANSACTION")
|
||||
except:
|
||||
print _("warning: constraint %s_%s_fkey not dropped: %s, continuing ...") \
|
||||
print _("Warning:"), _("constraint %s_%s_fkey not dropped: %s, continuing ...") \
|
||||
% (fk['fktab'],fk['fkcol'], str(sys.exc_value).rstrip('\n'))
|
||||
else:
|
||||
print _("Only MySQL and Postgres supported so far")
|
||||
#print _("Only MySQL and Postgres supported so far")
|
||||
pass
|
||||
|
||||
if self.backend == self.PGSQL:
|
||||
self.connection.set_isolation_level(1) # go back to normal isolation level
|
||||
|
@ -2639,7 +2640,7 @@ class Database:
|
|||
print _("queue empty too long - writer stopping ...")
|
||||
break
|
||||
except:
|
||||
print _("writer stopping, error reading queue: ") + str(sys.exc_info())
|
||||
print _("writer stopping, error reading queue:"), str(sys.exc_info())
|
||||
break
|
||||
#print "got hand", str(h.get_finished())
|
||||
|
||||
|
@ -2669,11 +2670,11 @@ class Database:
|
|||
wait = wait + wait
|
||||
again = True
|
||||
else:
|
||||
print _("too many deadlocks - failed to store hand ") + h.get_siteHandNo()
|
||||
print _("Too many deadlocks - failed to store hand"), h.get_siteHandNo()
|
||||
if not again:
|
||||
fails = fails + 1
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print _("***Error storing hand: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
print _("***Error storing hand:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
# finished trying to store hand
|
||||
|
||||
# always reduce q count, whether or not this hand was saved ok
|
||||
|
@ -2693,7 +2694,7 @@ class Database:
|
|||
q.put(h)
|
||||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
print _("***Error sending finish: ")+err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
print _("***Error sending finish:"), err[2]+"("+str(err[1])+"): "+str(sys.exc_info()[1])
|
||||
# end def send_finish_msg():
|
||||
|
||||
def createTourneyType(self, hand):#note: this method is used on Hand and TourneySummary objects
|
||||
|
@ -2779,7 +2780,7 @@ class Database:
|
|||
(hand.tourneyTypeId, hand.tourNo, hand.entries, hand.prizepool, hand.startTime,
|
||||
hand.endTime, hand.tourneyName, hand.matrixIdProcessed, hand.totalRebuyCount, hand.totalAddOnCount))
|
||||
else:
|
||||
raise FpdbParseError(_("invalid source in Database.createOrUpdateTourney"))
|
||||
raise FpdbParseError(_("invalid source in %s") % Database.createOrUpdateTourney)
|
||||
tourneyId = self.get_last_insert_id(cursor)
|
||||
return tourneyId
|
||||
#end def createOrUpdateTourney
|
||||
|
@ -2792,7 +2793,7 @@ class Database:
|
|||
elif source=="HHC":
|
||||
playerId = hand.dbid_pids[player[1]]
|
||||
else:
|
||||
raise FpdbParseError(_("invalid source in Database.createOrUpdateTourneysPlayers"))
|
||||
raise FpdbParseError(_("invalid source in %s") % Database.createOrUpdateTourneysPlayers)
|
||||
|
||||
cursor = self.get_cursor()
|
||||
cursor.execute (self.sql.query['getTourneysPlayersByIds'].replace('%s', self.sql.query['placeholder']),
|
||||
|
@ -2928,7 +2929,7 @@ class HandToWrite:
|
|||
self.tableName = None
|
||||
self.seatNos = None
|
||||
except:
|
||||
print _("HandToWrite.init error: ") + str(sys.exc_info())
|
||||
print _("%s error: %s") % ("HandToWrite.init", str(sys.exc_info()))
|
||||
raise
|
||||
# end def __init__
|
||||
|
||||
|
@ -2978,7 +2979,7 @@ class HandToWrite:
|
|||
self.tableName = tableName
|
||||
self.seatNos = seatNos
|
||||
except:
|
||||
print _("HandToWrite.set_all error: ") + str(sys.exc_info())
|
||||
print _("%s error: %s") % ("HandToWrite.set_all", str(sys.exc_info()))
|
||||
raise
|
||||
# end def set_hand
|
||||
|
||||
|
@ -3009,7 +3010,7 @@ if __name__=="__main__":
|
|||
|
||||
hero = db_connection.get_player_id(c, 'PokerStars', 'nutOmatic')
|
||||
if hero:
|
||||
print _("nutOmatic is id_player = %d") % hero
|
||||
print "nutOmatic player_id", hero
|
||||
|
||||
# example of displaying query plan in sqlite:
|
||||
if db_connection.backend == 4:
|
||||
|
@ -3017,7 +3018,7 @@ if __name__=="__main__":
|
|||
c = db_connection.get_cursor()
|
||||
c.execute('explain query plan '+sql.query['get_table_name'], (h, ))
|
||||
for row in c.fetchall():
|
||||
print _("query plan: "), row
|
||||
print "Query plan:", row
|
||||
print
|
||||
|
||||
t0 = time()
|
||||
|
@ -3029,9 +3030,9 @@ if __name__=="__main__":
|
|||
print _("cards ="), db_connection.get_cards(u'1')
|
||||
db_connection.close_connection
|
||||
|
||||
print _("get_stats took: %4.3f seconds") % (t1-t0)
|
||||
print _("get_stats took: %4.3f seconds") % (t1-t0)
|
||||
|
||||
print _("press enter to continue")
|
||||
print _("Press ENTER to continue.")
|
||||
sys.stdin.readline()
|
||||
|
||||
#Code borrowed from http://push.cx/2008/caching-dictionaries-in-python-vs-ruby
|
||||
|
|
|
@ -105,7 +105,7 @@ class Everest(HandHistoryConverter):
|
|||
if not m2:
|
||||
tmp = handText[0:100]
|
||||
log.error("determineGameType: " + _("Raising FpdbParseError"))
|
||||
raise FpdbParseError(_("Unable to recognise handinfo from: '%s'") % tmp)
|
||||
raise FpdbParseError(_("Unable to recognise hand info from: '%s'") % tmp)
|
||||
|
||||
self.info = {}
|
||||
mg = m.groupdict()
|
||||
|
@ -231,8 +231,8 @@ class Everest(HandHistoryConverter):
|
|||
elif action.group('ATYPE') in ('FOLD', 'SIT_OUT'):
|
||||
hand.addFold(street, player)
|
||||
else:
|
||||
print (_("Unimplemented readAction: '%s' '%s'") % (action.group('PSEAT'), action.group('ATYPE')))
|
||||
logging.debug(_("Unimplemented readAction: '%s' '%s'") % (action.group('PSEAT'), action.group('ATYPE')))
|
||||
print (_("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PSEAT'), action.group('ATYPE')))
|
||||
logging.debug(_("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PSEAT'), action.group('ATYPE')))
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
||||
|
|
|
@ -271,7 +271,7 @@ or None if we fail to get the info """
|
|||
|
||||
|
||||
def readStudPlayerCards(self, hand, street):
|
||||
logging.warning(_("Everleaf readStudPlayerCards is only a stub."))
|
||||
logging.warning(_("%s cannot read all stud/razz hands yet.") % hand.sitename)
|
||||
|
||||
|
||||
def readAction(self, hand, street):
|
||||
|
@ -292,7 +292,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 %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
@ -301,7 +301,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'))
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ class Filters(threading.Thread):
|
|||
self.mainVBox = gtk.VBox(False, 0)
|
||||
self.sw.add_with_viewport(self.mainVBox)
|
||||
self.sw.show()
|
||||
print(_("DEBUG: ") + _("New packing box created!"))
|
||||
#print(_("DEBUG:") + _("New packing box created!"))
|
||||
|
||||
self.found = {'nl':False, 'fl':False, 'pl':False, 'cn':False, 'ring':False, 'tour':False}
|
||||
self.label = {}
|
||||
|
@ -1046,7 +1046,7 @@ class Filters(threading.Thread):
|
|||
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)
|
||||
|
||||
btn_clear = gtk.Button(label=_(' Clear Dates '))
|
||||
btn_clear = gtk.Button(label=_('Clear Dates'))
|
||||
btn_clear.connect('clicked', self.__clear_dates)
|
||||
|
||||
hbox.pack_start(lbl_end, expand=False, padding=3)
|
||||
|
|
|
@ -282,9 +282,9 @@ class Fulltilt(HandHistoryConverter):
|
|||
m = self.re_HandInfo.search(hand.handText)
|
||||
if m is None:
|
||||
tmp = hand.handText[0:100]
|
||||
log.error(_("Unable to recognise handinfo from: '%s'") % tmp)
|
||||
log.error(_("Unable to recognise hand info from: '%s'") % tmp)
|
||||
log.error("readHandInfo: " + _("Raising FpdbParseError"))
|
||||
raise FpdbParseError(_("Unable to recognise handinfo from: '%s'"))
|
||||
raise FpdbParseError(_("Unable to recognise hand info from: '%s'"))
|
||||
|
||||
#print "DEBUG: m.groupdict: %s" % m.groupdict()
|
||||
hand.handid = m.group('HID')
|
||||
|
@ -467,7 +467,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
hand.buttonpos = int(self.re_Button.search(hand.handText).group('BUTTON'))
|
||||
except AttributeError, e:
|
||||
# FTP has no indication that a hand is cancelled.
|
||||
raise FpdbParseError(_("readButton: Failed to detect button (hand #%s cancelled?)") % hand.handid)
|
||||
raise FpdbParseError(_("%s Failed to detect button (hand #%s cancelled?)") % ("readButton:", hand.handid))
|
||||
|
||||
def readHeroCards(self, hand):
|
||||
# streets PREFLOP, PREDRAW, and THIRD are special cases beacause
|
||||
|
@ -525,7 +525,7 @@ class Fulltilt(HandHistoryConverter):
|
|||
elif action.group('ATYPE') == ' stands pat':
|
||||
hand.addStandsPat( street, action.group('PNAME'), action.group('CARDS'))
|
||||
else:
|
||||
print (_("DEBUG: ") + " " + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
|
||||
print (_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
@ -689,18 +689,18 @@ class Fulltilt(HandHistoryConverter):
|
|||
tourney.buyin = 100*Decimal(clearMoneyString(mg['BUYIN']))
|
||||
else :
|
||||
if 100*Decimal(clearMoneyString(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 top line (%s) and in BuyIn field (%s)") % (tourney.buyin, 100*Decimal(re.sub(u',', u'', "%s" % mg['BUYIN']))) )
|
||||
tourney.subTourneyBuyin = 100*Decimal(clearMoneyString(mg['BUYIN']))
|
||||
if mg['FEE'] is not None:
|
||||
if tourney.fee is None:
|
||||
tourney.fee = 100*Decimal(clearMoneyString(mg['FEE']))
|
||||
else :
|
||||
if 100*Decimal(clearMoneyString(mg['FEE'])) != tourney.fee:
|
||||
log.error(_("Conflict between fees read in topline (%s) and in BuyIn field (%s)") % (tourney.fee, 100*Decimal(clearMoneyString(mg['FEE']))) )
|
||||
log.error(_("Conflict between fees read in top line (%s) and in BuyIn field (%s)") % (tourney.fee, 100*Decimal(clearMoneyString(mg['FEE']))) )
|
||||
tourney.subTourneyFee = 100*Decimal(clearMoneyString(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 detect a buyin to this tournament : assume it's a freeroll"))
|
||||
tourney.buyin = 0
|
||||
tourney.fee = 0
|
||||
else:
|
||||
|
@ -810,9 +810,9 @@ class Fulltilt(HandHistoryConverter):
|
|||
tourney.hero = heroName
|
||||
# Is this really useful ?
|
||||
if heroName not in tourney.ranks:
|
||||
print (_("%s not found in tourney.ranks ...") % heroName)
|
||||
print (_("%s not found in %s...") % ("tourney.ranks", heroName))
|
||||
elif (tourney.ranks[heroName] != Decimal(n.group('HERO_FINISHING_POS'))):
|
||||
print (_("Bad parsing : finish position incoherent : %s / %s") % (tourney.ranks[heroName], n.group('HERO_FINISHING_POS')))
|
||||
print (_("Error:")+ _("Parsed finish position incoherent : %s / %s") % (tourney.ranks[heroName], n.group('HERO_FINISHING_POS')))
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class GuiAutoImport (threading.Thread):
|
|||
hbox.pack_start(lbl1, expand=True, fill=False)
|
||||
|
||||
self.doAutoImportBool = False
|
||||
self.startButton = gtk.ToggleButton(_(" Start _Auto Import "))
|
||||
self.startButton = gtk.ToggleButton(_("Start _Auto Import"))
|
||||
self.startButton.connect("clicked", self.startClicked, "start clicked")
|
||||
hbox.pack_start(self.startButton, expand=False, fill=False)
|
||||
|
||||
|
@ -177,7 +177,7 @@ class GuiAutoImport (threading.Thread):
|
|||
def do_import(self):
|
||||
"""Callback for timer to do an import iteration."""
|
||||
if self.doAutoImportBool:
|
||||
self.startButton.set_label(_(u' _Auto Import Running '))
|
||||
self.startButton.set_label(_(u'_Auto Import Running'))
|
||||
self.importer.runUpdated()
|
||||
self.addText(".")
|
||||
#sys.stdout.write(".")
|
||||
|
@ -188,9 +188,9 @@ class GuiAutoImport (threading.Thread):
|
|||
|
||||
def reset_startbutton(self):
|
||||
if self.pipe_to_hud is not None:
|
||||
self.startButton.set_label(_(u' Stop _Auto Import '))
|
||||
self.startButton.set_label(_(u'Stop _Auto Import'))
|
||||
else:
|
||||
self.startButton.set_label(_(u' Start _Auto Import '))
|
||||
self.startButton.set_label(_(u'Start _Auto Import'))
|
||||
|
||||
return False
|
||||
|
||||
|
@ -200,7 +200,7 @@ class GuiAutoImport (threading.Thread):
|
|||
for site in the_sites:
|
||||
params = self.config.get_site_parameters(site)
|
||||
if params['enabled'] == True:
|
||||
print (_("DEBUG: ") + _("Detecting hh directory for site: '%s'") % site)
|
||||
print (_("DEBUG:") + " " + _("Detecting hand history directory for site: '%s'") % site)
|
||||
if os.name == 'posix':
|
||||
if self.posix_detect_hh_dirs(site):
|
||||
#data[1].set_text(dia_chooser.get_filename())
|
||||
|
@ -240,9 +240,9 @@ class GuiAutoImport (threading.Thread):
|
|||
# - Ideally we want to release the lock if the auto-import is killed by some
|
||||
# kind of exception - is this possible?
|
||||
if self.settings['global_lock'].acquire(wait=False, source="AutoImport"): # returns false immediately if lock not acquired
|
||||
self.addText(_("\nGlobal lock taken ... Auto Import Started.\n"))
|
||||
self.addText("\n" + _("Global lock taken ... Auto Import Started.")+"\n")
|
||||
self.doAutoImportBool = True
|
||||
self.startButton.set_label(_(u' _Stop Auto Import '))
|
||||
self.startButton.set_label(_(u'Stop _Auto Import'))
|
||||
while gtk.events_pending(): # change the label NOW don't wait for the pipe to open
|
||||
gtk.main_iteration(False)
|
||||
if self.pipe_to_hud is None:
|
||||
|
@ -276,7 +276,7 @@ class GuiAutoImport (threading.Thread):
|
|||
except:
|
||||
err = traceback.extract_tb(sys.exc_info()[2])[-1]
|
||||
#self.addText( "\n*** GuiAutoImport Error opening pipe: " + err[2] + "(" + str(err[1]) + "): " + str(sys.exc_info()[1]))
|
||||
self.addText(_("\n*** GuiAutoImport Error opening pipe: ") + traceback.format_exc() )
|
||||
self.addText("\n" + _("*** GuiAutoImport Error opening pipe:") + " " + traceback.format_exc() )
|
||||
else:
|
||||
for site in self.input_settings:
|
||||
self.importer.addImportDirectory(self.input_settings[site][0], True, site, self.input_settings[site][1])
|
||||
|
|
|
@ -341,10 +341,8 @@ def main(argv=None):
|
|||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-f", "--file", dest="filename", metavar="FILE", default=None,
|
||||
help=_("Input file in quiet mode"))
|
||||
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True,
|
||||
help=_("don't start gui; deprecated (just give a filename with -f)."))
|
||||
parser.add_option("-c", "--convert", dest="filtername", default="PokerStars", metavar="FILTER",
|
||||
help=_("Input file"))
|
||||
parser.add_option("-c", "--convert", dest="filtername", default=None, metavar="FILTER",
|
||||
help=_("Conversion filter (*Full Tilt Poker, PokerStars, Everleaf, Absolute)"))
|
||||
parser.add_option("-x", "--failOnError", action="store_true", default=False,
|
||||
help=_("If this option is passed it quits when it encounters any error"))
|
||||
|
@ -378,9 +376,6 @@ def main(argv=None):
|
|||
settings.update(config.get_import_parameters())
|
||||
settings.update(config.get_default_paths())
|
||||
|
||||
if not options.gui:
|
||||
print _('-q is deprecated. Just use "-f filename" instead')
|
||||
# This is because -q on its own causes an error, so -f is necessary and sufficient for cmd line use
|
||||
if not options.filename:
|
||||
i = GuiBulkImport(settings, config, None)
|
||||
main_window = gtk.Window()
|
||||
|
@ -389,6 +384,8 @@ def main(argv=None):
|
|||
main_window.show()
|
||||
gtk.main()
|
||||
else:
|
||||
if not options.filtername:
|
||||
print _("You have to select a site with the -c parameter. E.g.:"), "Everleaf converter: ./GuiBulkImport.py -c Everleaf -f filename"
|
||||
#Do something useful
|
||||
importer = fpdb_import.Importer(False,settings, config, None)
|
||||
# importer.setDropIndexes("auto")
|
||||
|
|
|
@ -134,7 +134,7 @@ class GuiPositionalStats (threading.Thread):
|
|||
def toggleCallback(self, widget, data=None):
|
||||
# print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
|
||||
self.activesite = data
|
||||
print (_("DEBUG: ") + _("activesite set to %s") % (self.activesite))
|
||||
print (_("DEBUG:") + " " + _("activesite set to %s") % (self.activesite))
|
||||
|
||||
def refreshStats(self, widget, data):
|
||||
try: self.stats_vbox.destroy()
|
||||
|
|
|
@ -175,12 +175,12 @@ if __name__=="__main__":
|
|||
config = Configuration.Config()
|
||||
|
||||
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
win.set_title(_("Test Preferences Dialog"))
|
||||
win.set_title(_("Advanced Preferences Dialog"))
|
||||
win.set_border_width(1)
|
||||
win.set_default_size(600, 500)
|
||||
win.set_resizable(True)
|
||||
|
||||
dia = gtk.Dialog(_("Preferences"),
|
||||
dia = gtk.Dialog(_("Advanced Preferences"),
|
||||
win,
|
||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
||||
|
|
|
@ -218,25 +218,25 @@ Against the range: {
|
|||
self.outputlabel.set_text(string)
|
||||
|
||||
def set_board_flop(self, caller, widget):
|
||||
print (_("DEBUG: ") + _("called set_board_flop: '%s' '%s'") % (caller ,widget))
|
||||
print (_("DEBUG:") + " " + _("called") + " set_board_flop: '%s' '%s'" % (caller ,widget))
|
||||
self.boardtext = widget.get_text()
|
||||
|
||||
def set_hero_cards_flop(self, caller, widget):
|
||||
print (_("DEBUG: ") + _("called set_hero_cards_flop"))
|
||||
print (_("DEBUG:") + " " + _("called") + " set_hero_cards_flop")
|
||||
self.herorange = widget.get_text()
|
||||
|
||||
def set_villain_cards_flop(self, caller, widget):
|
||||
print (_("DEBUG: ") + _("called set_villain_cards_flop"))
|
||||
print (_("DEBUG:") + " " + _("called") + " set_villain_cards_flop")
|
||||
self.villainrange = widget.get_text()
|
||||
|
||||
def update_flop_output_pane(self, caller, widget):
|
||||
print (_("DEBUG: ") + _("called update_flop_output_pane"))
|
||||
print (_("DEBUG:") + " " + _("called") + " update_flop_output_pane")
|
||||
self.stove.set_board_string(self.boardtext)
|
||||
self.stove.set_hero_cards_string(self.herorange)
|
||||
self.stove.set_villain_range_string(self.villainrange)
|
||||
print (_("DEBUG: ") + ("odds_for_range"))
|
||||
print (_("DEBUG:") + ("odds_for_range"))
|
||||
self.ev = Stove.odds_for_range(self.stove)
|
||||
print (_("DEBUG: ") + ("set_output_label"))
|
||||
print (_("DEBUG:") + " " + ("set_output_label"))
|
||||
self.set_output_label(self.ev.output)
|
||||
|
||||
|
||||
|
|
|
@ -259,14 +259,14 @@ Left-Drag to Move"
|
|||
</layout>
|
||||
</site>
|
||||
|
||||
<site HH_path="C:\Users\WindowsUserName\Documents\EverleafSiteName\HandHistory\PlayerName"
|
||||
<site HH_path="C:\Users\WindowsUserName\Documents\EverleafSiteName\HandHistory\YOUR SCREEN NAME HERE"
|
||||
bgcolor="#000000"
|
||||
converter="EverleafToFpdb"
|
||||
decoder="everleaf_decode_table"
|
||||
enabled="True"
|
||||
fgcolor="#EEEEEE"
|
||||
hudopacity="0.75"
|
||||
screen_name="PlayerName"
|
||||
screen_name="YOUR SCREEN NAME HERE"
|
||||
site_name="Everleaf"
|
||||
site_path="C:\Users\WindowsUserName\AppData\Roaming\EverleafSiteName\"
|
||||
supported_games="holdem,omahahi,omahahilo"
|
||||
|
|
|
@ -491,8 +491,8 @@ If a player has None chips he won't be added."""
|
|||
|
||||
def checkPlayerExists(self,player):
|
||||
if player not in [p[1] for p in self.players]:
|
||||
print (_("DEBUG: ") + _("checkPlayerExists: %s fail on hand number %s") % (player, self.handid))
|
||||
raise FpdbParseError(_("checkPlayerExists: %s fail on hand number %s") % (player, self.handid))
|
||||
print (_("DEBUG:") + " checkPlayerExists: " + _("%s fail on hand number %s") % (player, self.handid))
|
||||
raise FpdbParseError("checkPlayerExists: " + _("%s fail on hand number %s") % (player, self.handid))
|
||||
|
||||
def setCommunityCards(self, street, cards):
|
||||
log.debug("setCommunityCards %s %s" %(street, cards))
|
||||
|
@ -1717,7 +1717,7 @@ class Pot(object):
|
|||
if self.sym is None:
|
||||
self.sym = "C"
|
||||
if self.total is None:
|
||||
print (_("DEBUG: ") + _("call Pot.end() before printing pot total"))
|
||||
print (_("DEBUG:") + " " + _("call Pot.end() before printing pot total"))
|
||||
# NB if I'm sure end() is idempotent, call it here.
|
||||
raise FpdbParseError(_("Error in printing Hand object"))
|
||||
|
||||
|
|
|
@ -597,8 +597,8 @@ class Hud:
|
|||
if adj[j] > self.max:
|
||||
adj[j] = adj[j] - self.max
|
||||
except Exception, inst:
|
||||
sys.stderr.write(_("exception in Hud.adj_seats\n\n"))
|
||||
sys.stderr.write(_("error is %s") % inst) # __str__ allows args to printed directly
|
||||
sys.stderr.write(_("Exception in Hud.adj_seats\n\n"))
|
||||
sys.stderr.write(_("Error is %s") % inst) # __str__ allows args to printed directly
|
||||
return adj
|
||||
|
||||
def get_actual_seat(self, name):
|
||||
|
|
|
@ -41,7 +41,7 @@ def splitPokerStarsSummaries(summaryText): #TODO: this needs to go to PSS.py
|
|||
splitSummaries = re.split(re_SplitTourneys, summaryText)
|
||||
|
||||
if len(splitSummaries) <= 1:
|
||||
print (_("DEBUG: ") + _("re_SplitTourneys isn't matching"))
|
||||
print (_("DEBUG:") + " " + _("re_SplitTourneys isn't matching"))
|
||||
|
||||
return splitSummaries
|
||||
|
||||
|
@ -50,7 +50,7 @@ def splitFullTiltSummaries(summaryText):#TODO: this needs to go to FTPS.py
|
|||
splitSummaries = re.split(re_SplitTourneys, summaryText)
|
||||
|
||||
if len(splitSummaries) <= 1:
|
||||
print(_("DEBUG: ") + _("re_SplitTourneys isn't matching"))
|
||||
print(_("DEBUG:") + " " + _("re_SplitTourneys isn't matching"))
|
||||
|
||||
return splitSummaries
|
||||
|
||||
|
|
|
@ -213,8 +213,8 @@ class OnGame(HandHistoryConverter):
|
|||
tzoffset = a.group('OFFSET')
|
||||
else:
|
||||
datetimestr = "2010/Jan/01 01:01:01"
|
||||
log.error(_("readHandInfo: DATETIME not matched: '%s'") % info[key])
|
||||
print (_("DEBUG: ") + _("readHandInfo: DATETIME not matched: '%s'") % info[key])
|
||||
log.error("readHandInfo: " + _("DATETIME not matched: '%s'") % info[key])
|
||||
print (_("DEBUG:") + " readHandInfo: " + _("DATETIME not matched: '%s'") % info[key])
|
||||
# TODO: Manually adjust time against OFFSET
|
||||
hand.startTime = datetime.datetime.strptime(datetimestr, "%Y/%b/%d %H:%M:%S") # also timezone at end, e.g. " ET"
|
||||
hand.startTime = HandHistoryConverter.changeTimezone(hand.startTime, tzoffset, "UTC")
|
||||
|
@ -345,7 +345,7 @@ class OnGame(HandHistoryConverter):
|
|||
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 %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
||||
|
|
|
@ -426,7 +426,7 @@ class PacificPoker(HandHistoryConverter):
|
|||
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 %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
|
|
@ -532,7 +532,7 @@ class PartyPoker(HandHistoryConverter):
|
|||
elif actionType == 'checks':
|
||||
hand.addCheck( street, playerName )
|
||||
else:
|
||||
raise FpdbParseError(_("Unimplemented readAction: '%s' '%s'") % (playerName,actionType), hid = hand.hid)
|
||||
raise FpdbParseError(_("Unimplemented %s: '%s' '%s'") % ("readAction", playerName,actionType), hid = hand.hid)
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
# all action in readShownCards
|
||||
|
|
|
@ -348,7 +348,7 @@ class Pkr(HandHistoryConverter):
|
|||
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 %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
|
|
@ -444,7 +444,7 @@ class PokerStars(HandHistoryConverter):
|
|||
elif action.group('ATYPE') == ' stands pat':
|
||||
hand.addStandsPat( street, action.group('PNAME'), action.group('CARDS'))
|
||||
else:
|
||||
print (_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
|
||||
print (_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
|
|
@ -292,7 +292,7 @@ class Win2day(HandHistoryConverter):
|
|||
|
||||
def readStudPlayerCards(self, hand, street):
|
||||
# See comments of reference implementation in FullTiltToFpdb.py
|
||||
logging.debug("readStudPlayerCards")
|
||||
# logging.debug("readStudPlayerCards")
|
||||
m = self.re_HeroCards.finditer(hand.streets[street])
|
||||
for player in m:
|
||||
#~ logging.debug(player.groupdict())
|
||||
|
@ -345,7 +345,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 %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
|
|
|
@ -403,7 +403,7 @@ class Winamax(HandHistoryConverter):
|
|||
elif action.group('ATYPE') == ' stands pat':
|
||||
hand.addStandsPat( street, action.group('PNAME'))
|
||||
else:
|
||||
log.fatal(_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
|
||||
log.fatal(_("DEBUG:") + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
# print "Processed %s"%acts
|
||||
# print "committed=",hand.pot.committed
|
||||
|
||||
|
|
202
pyfpdb/fpdb.pyw
202
pyfpdb/fpdb.pyw
|
@ -310,8 +310,8 @@ class fpdb:
|
|||
for t in self.threads:
|
||||
log.debug("........." + str(t.__class__))
|
||||
|
||||
def dia_preferences(self, widget, data=None):
|
||||
dia = gtk.Dialog(_("Preferences"),
|
||||
def dia_advanced_preferences(self, widget, data=None):
|
||||
dia = gtk.Dialog(_("Advanced Preferences"),
|
||||
self.window,
|
||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
|
||||
|
@ -323,13 +323,7 @@ class fpdb:
|
|||
if response == gtk.RESPONSE_ACCEPT:
|
||||
# save updated config
|
||||
self.config.save()
|
||||
if len(self.nb_tab_names) == 1:
|
||||
# only main tab open, reload profile
|
||||
self.load_profile()
|
||||
dia.destroy()
|
||||
else:
|
||||
dia.destroy() # destroy prefs before raising warning, otherwise parent is dia rather than self.window
|
||||
self.warning_box(_("Updated preferences have not been loaded because windows are open. Re-start fpdb to load them."))
|
||||
self.reload_config(dia)
|
||||
else:
|
||||
dia.destroy()
|
||||
|
||||
|
@ -371,24 +365,29 @@ class fpdb:
|
|||
diatitle=_("Database Statistics"))
|
||||
#end def dia_database_stats
|
||||
|
||||
def diaHudConfigurator(self, widget, data=None):
|
||||
"""Opens dialog to set parameters (game category, row count, column count for HUD stat configurator"""
|
||||
self.hudConfiguratorRows = None
|
||||
self.hudConfiguratorColumns = None
|
||||
self.hudConfiguratorGame = None
|
||||
def dia_hud_preferences(self, widget, data=None):
|
||||
"""Opens dialog to set parameters (game category, row count, column count) for HUD preferences"""
|
||||
#Note: No point in working on this until the new HUD configuration system is in place
|
||||
self.hud_preferences_rows = None
|
||||
self.hud_preferences_columns = None
|
||||
self.hud_preferences_game = None
|
||||
|
||||
diaSelections = gtk.Dialog(_("HUD Configurator - choose category"),
|
||||
diaSelections = gtk.Dialog(_("HUD Preferences - choose category"),
|
||||
self.window,
|
||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
|
||||
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
|
||||
|
||||
label = gtk.Label(_("Note that this does not existing settings, but overwrites them."))
|
||||
diaSelections.vbox.add(label)
|
||||
label.show()
|
||||
|
||||
label = gtk.Label(_("Please select the game category for which you want to configure HUD stats:"))
|
||||
diaSelections.vbox.add(label)
|
||||
label.show()
|
||||
|
||||
comboGame = gtk.combo_box_new_text()
|
||||
comboGame.connect("changed", self.hudConfiguratorComboSelection)
|
||||
comboGame.connect("changed", self.hud_preferences_combo_selection)
|
||||
diaSelections.vbox.add(comboGame)
|
||||
games = self.config.get_supported_games()
|
||||
for game in games:
|
||||
|
@ -397,7 +396,7 @@ class fpdb:
|
|||
comboGame.show()
|
||||
|
||||
comboRows = gtk.combo_box_new_text()
|
||||
comboRows.connect("changed", self.hudConfiguratorComboSelection)
|
||||
comboRows.connect("changed", self.hud_preferences_combo_selection)
|
||||
diaSelections.vbox.add(comboRows)
|
||||
for i in range(1, 8):
|
||||
comboRows.append_text(str(i) + " rows")
|
||||
|
@ -405,7 +404,7 @@ class fpdb:
|
|||
comboRows.show()
|
||||
|
||||
comboColumns = gtk.combo_box_new_text()
|
||||
comboColumns.connect("changed", self.hudConfiguratorComboSelection)
|
||||
comboColumns.connect("changed", self.hud_preferences_combo_selection)
|
||||
diaSelections.vbox.add(comboColumns)
|
||||
for i in range(1, 8):
|
||||
comboColumns.append_text(str(i) + " columns")
|
||||
|
@ -416,29 +415,27 @@ class fpdb:
|
|||
diaSelections.destroy()
|
||||
|
||||
if (response == gtk.RESPONSE_ACCEPT and
|
||||
self.hudConfiguratorRows != None and
|
||||
self.hudConfiguratorColumns != None and
|
||||
self.hudConfiguratorGame != None):
|
||||
#print "clicked ok and selected:", self.hudConfiguratorGame,"with", str(self.hudConfiguratorRows), "rows and", str(self.hudConfiguratorColumns), "columns"
|
||||
self.diaHudConfiguratorTable()
|
||||
#end def diaHudConfigurator
|
||||
self.hud_preferences_rows != None and
|
||||
self.hud_preferences_columns != None and
|
||||
self.hud_preferences_game != None):
|
||||
self.dia_hud_preferences_table()
|
||||
#end def dia_hud_preferences
|
||||
|
||||
def hudConfiguratorComboSelection(self, widget):
|
||||
#TODO: remove this and handle it directly in diaHudConfigurator
|
||||
def hud_preferences_combo_selection(self, widget):
|
||||
#TODO: remove this and handle it directly in dia_hud_preferences
|
||||
result = widget.get_active_text()
|
||||
if result.endswith(" rows"):
|
||||
self.hudConfiguratorRows = int(result[0])
|
||||
self.hud_preferences_rows = int(result[0])
|
||||
elif result.endswith(" columns"):
|
||||
self.hudConfiguratorColumns = int(result[0])
|
||||
self.hud_preferences_columns = int(result[0])
|
||||
else:
|
||||
self.hudConfiguratorGame = result
|
||||
#end def hudConfiguratorComboSelection
|
||||
self.hud_preferences_game = result
|
||||
#end def hud_preferences_combo_selection
|
||||
|
||||
def diaHudConfiguratorTable(self):
|
||||
def dia_hud_preferences_table(self):
|
||||
"""shows dialogue with Table of ComboBoxes to allow choosing of HUD stats"""
|
||||
#TODO: add notices to hud configurator: no duplicates, no empties, display options
|
||||
#TODO: show explanation of what each stat means
|
||||
diaHudTable = gtk.Dialog(_("HUD Configurator - please choose your stats"),
|
||||
diaHudTable = gtk.Dialog(_("HUD Preferences - please choose your stats"),
|
||||
self.window,
|
||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT,
|
||||
|
@ -456,12 +453,12 @@ class fpdb:
|
|||
diaHudTable.vbox.add(label)
|
||||
label.show()
|
||||
|
||||
label = gtk.Label(_("To configure things like colouring you will still have to use the Preferences dialogue or manually edit your HUD_config.xml."))
|
||||
label = gtk.Label(_("To configure things like colouring you will still have to use the Advanced Preferences dialogue or manually edit your HUD_config.xml."))
|
||||
diaHudTable.vbox.add(label)
|
||||
label.show()
|
||||
|
||||
self.hudConfiguratorTableContents = []
|
||||
table = gtk.Table(rows=self.hudConfiguratorRows + 1, columns=self.hudConfiguratorColumns + 1, homogeneous=True)
|
||||
self.hud_preferences_table_contents = []
|
||||
table = gtk.Table(rows=self.hud_preferences_rows + 1, columns=self.hud_preferences_columns + 1, homogeneous=True)
|
||||
|
||||
statDir = dir(Stats)
|
||||
statDict = {}
|
||||
|
@ -474,9 +471,9 @@ class fpdb:
|
|||
continue
|
||||
statDict[attr] = eval("Stats.%s.__doc__" % (attr))
|
||||
|
||||
for rowNumber in range(self.hudConfiguratorRows + 1):
|
||||
for rowNumber in range(self.hud_preferences_rows + 1):
|
||||
newRow = []
|
||||
for columnNumber in range(self.hudConfiguratorColumns + 1):
|
||||
for columnNumber in range(self.hud_preferences_columns + 1):
|
||||
if rowNumber == 0:
|
||||
if columnNumber == 0:
|
||||
pass
|
||||
|
@ -509,7 +506,7 @@ class fpdb:
|
|||
|
||||
comboBox.show()
|
||||
if rowNumber != 0:
|
||||
self.hudConfiguratorTableContents.append(newRow)
|
||||
self.hud_preferences_table_contents.append(newRow)
|
||||
diaHudTable.vbox.add(table)
|
||||
table.show()
|
||||
|
||||
|
@ -518,20 +515,20 @@ class fpdb:
|
|||
|
||||
if response == gtk.RESPONSE_ACCEPT:
|
||||
self.storeNewHudStatConfig()
|
||||
#end def diaHudConfiguratorTable
|
||||
#end def dia_hud_preferences_table
|
||||
|
||||
def storeNewHudStatConfig(self):
|
||||
"""stores selections made in diaHudConfiguratorTable"""
|
||||
self.obtain_global_lock("diaHudConfiguratorTable")
|
||||
"""stores selections made in dia_hud_preferences_table"""
|
||||
self.obtain_global_lock("dia_hud_preferences")
|
||||
statTable = []
|
||||
for row in self.hudConfiguratorTableContents:
|
||||
for row in self.hud_preferences_table_contents:
|
||||
newRow = []
|
||||
for column in row:
|
||||
newField = column.get_active_text()
|
||||
newRow.append(newField)
|
||||
statTable.append(newRow)
|
||||
|
||||
self.config.editStats(self.hudConfiguratorGame, statTable)
|
||||
self.config.editStats(self.hud_preferences_game, statTable)
|
||||
self.config.save() # TODO: make it not store in horrible formatting
|
||||
self.release_global_lock()
|
||||
#end def storeNewHudStatConfig
|
||||
|
@ -545,29 +542,6 @@ class fpdb:
|
|||
dumpFile.close()
|
||||
#end def dia_database_stats
|
||||
|
||||
def dia_load_profile(self, widget, data=None):
|
||||
"""Dialogue to select a file to load a profile from"""
|
||||
if self.obtain_global_lock("fpdb.dia_load_profile"): # returns true if successful
|
||||
#try:
|
||||
# chooser = gtk.FileChooserDialog(title="Please select a profile file to load",
|
||||
# action=gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||
# buttons=(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK))
|
||||
# chooser.set_filename(self.profile)
|
||||
|
||||
# response = chooser.run()
|
||||
# chooser.destroy()
|
||||
# if response == gtk.RESPONSE_OK:
|
||||
# self.load_profile(chooser.get_filename())
|
||||
# elif response == gtk.RESPONSE_CANCEL:
|
||||
# print 'User cancelled loading profile'
|
||||
#except:
|
||||
# pass
|
||||
#try:
|
||||
self.load_profile()
|
||||
#except:
|
||||
# pass
|
||||
self.release_global_lock()
|
||||
|
||||
def dia_recreate_tables(self, widget, data=None):
|
||||
"""Dialogue that asks user to confirm that he wants to delete and recreate the tables"""
|
||||
if self.obtain_global_lock("fpdb.dia_recreate_tables"): # returns true if successful
|
||||
|
@ -723,6 +697,78 @@ class fpdb:
|
|||
#if lock_set:
|
||||
# self.release_global_lock()
|
||||
|
||||
def dia_site_preferences(self, widget, data=None):
|
||||
dia = gtk.Dialog(_("Site Preferences"), self.window,
|
||||
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
|
||||
label = gtk.Label(_("Please select which sites you play on and enter your usernames."))
|
||||
dia.vbox.add(label)
|
||||
|
||||
site_names = self.config.site_ids
|
||||
available_site_names=[]
|
||||
for site_name in site_names:
|
||||
try:
|
||||
tmp = self.config.supported_sites[site_name].enabled
|
||||
available_site_names.append(site_name)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
label = gtk.Label(_(" "))
|
||||
dia.vbox.add(label)
|
||||
|
||||
column_headers=[_("Site"), _("Screen Name"), _("History Path")] #TODO , _("Summary Path"), _("HUD")]
|
||||
#HUD column will contain a button that shows favseat and HUD locations. Make it possible to load screenshot to arrange HUD windowlets.
|
||||
table = gtk.Table(rows=len(available_site_names)+1, columns=len(column_headers), homogeneous=False)
|
||||
dia.vbox.add(table)
|
||||
|
||||
for header_number in range (0, len(column_headers)):
|
||||
label = gtk.Label(column_headers[header_number])
|
||||
table.attach(label, header_number, header_number+1, 0, 1)
|
||||
|
||||
check_buttons=[]
|
||||
screen_names=[]
|
||||
history_paths=[]
|
||||
y_pos=1
|
||||
for site_number in range(0, len(available_site_names)):
|
||||
check_button = gtk.CheckButton(label=available_site_names[site_number])
|
||||
check_button.set_active(self.config.supported_sites[available_site_names[site_number]].enabled)
|
||||
table.attach(check_button, 0, 1, y_pos, y_pos+1)
|
||||
check_buttons.append(check_button)
|
||||
|
||||
entry = gtk.Entry()
|
||||
entry.set_text(self.config.supported_sites[available_site_names[site_number]].screen_name)
|
||||
table.attach(entry, 1, 2, y_pos, y_pos+1)
|
||||
screen_names.append(entry)
|
||||
|
||||
entry = gtk.Entry()
|
||||
entry.set_text(self.config.supported_sites[available_site_names[site_number]].HH_path)
|
||||
table.attach(entry, 2, 3, y_pos, y_pos+1)
|
||||
history_paths.append(entry)
|
||||
|
||||
y_pos+=1
|
||||
|
||||
dia.show_all()
|
||||
response = dia.run()
|
||||
if (response == gtk.RESPONSE_ACCEPT):
|
||||
for site_number in range(0, len(available_site_names)):
|
||||
#print "site %s enabled=%s name=%s" % (available_site_names[site_number], check_buttons[site_number].get_active(), screen_names[site_number].get_text(), history_paths[site_number].get_text())
|
||||
self.config.edit_site(available_site_names[site_number], str(check_buttons[site_number].get_active()), screen_names[site_number].get_text(), history_paths[site_number].get_text())
|
||||
|
||||
self.config.save()
|
||||
self.reload_config(dia)
|
||||
|
||||
dia.destroy()
|
||||
|
||||
def reload_config(self, dia):
|
||||
if len(self.nb_tab_names) == 1:
|
||||
# only main tab open, reload profile
|
||||
self.load_profile()
|
||||
dia.destroy() # destroy prefs before raising warning, otherwise parent is dia rather than self.window
|
||||
self.warning_box(_("If you had previously opened any tabs they cannot use the new settings without restart.")+" "+_("Re-start fpdb to load them."))
|
||||
else:
|
||||
dia.destroy() # destroy prefs before raising warning, otherwise parent is dia rather than self.window
|
||||
self.warning_box(_("Updated preferences have not been loaded because windows are open.")+" "+_("Re-start fpdb to load them."))
|
||||
|
||||
def addLogText(self, text):
|
||||
end_iter = self.logbuffer.get_end_iter()
|
||||
self.logbuffer.insert(end_iter, text)
|
||||
|
@ -792,10 +838,10 @@ class fpdb:
|
|||
<ui>
|
||||
<menubar name="MenuBar">
|
||||
<menu action="main">
|
||||
<menuitem action="LoadProf"/>
|
||||
<menuitem action="SaveProf"/>
|
||||
<menuitem action="hudConfigurator"/>
|
||||
<menuitem action="Preferences"/>
|
||||
<menuitem action="site_preferences"/>
|
||||
<menuitem action="hud_preferences"/>
|
||||
<menuitem action="advanced_preferences"/>
|
||||
<separator/>
|
||||
<menuitem action="Quit"/>
|
||||
</menu>
|
||||
|
@ -807,7 +853,7 @@ class fpdb:
|
|||
</menu>
|
||||
<menu action="viewers">
|
||||
<menuitem action="autoimp"/>
|
||||
<menuitem action="hudConfigurator"/>
|
||||
<menuitem action="hud_preferences"/>
|
||||
<menuitem action="graphs"/>
|
||||
<menuitem action="tourneygraphs"/>
|
||||
<menuitem action="ringplayerstats"/>
|
||||
|
@ -841,16 +887,16 @@ class fpdb:
|
|||
# Create actions
|
||||
actiongroup.add_actions([('main', None, _('_Main')),
|
||||
('Quit', gtk.STOCK_QUIT, _('_Quit'), None, 'Quit the Program', self.quit),
|
||||
('LoadProf', None, _('_Load Profile (broken)'), _('<control>L'), 'Load your profile', self.dia_load_profile),
|
||||
('SaveProf', None, _('_Save Profile (todo)'), _('<control>S'), 'Save your profile', self.dia_save_profile),
|
||||
('Preferences', None, _('Pre_ferences'), _('<control>F'), 'Edit your preferences', self.dia_preferences),
|
||||
('SaveProf', None, _('Save Profile (todo)'), None, 'Save your profile', self.dia_save_profile),
|
||||
('site_preferences', None, _('_Site Preferences'), None, 'Site Preferences', self.dia_site_preferences),
|
||||
('advanced_preferences', None, _('_Advanced Preferences'), _('<control>F'), 'Edit your preferences', self.dia_advanced_preferences),
|
||||
('import', None, _('_Import')),
|
||||
('bulkimp', None, _('_Bulk Import'), _('<control>B'), 'Bulk Import', self.tab_bulk_import),
|
||||
('tourneyimp', None, _('Tournament _Results Import'), _('<control>R'), 'Tournament Results Import', self.tab_tourney_import),
|
||||
('imapimport', None, _('_Import through eMail/IMAP'), _('<control>I'), 'Import through eMail/IMAP', self.tab_imap_import),
|
||||
('viewers', None, _('_Viewers')),
|
||||
('autoimp', None, _('_Auto Import and HUD'), _('<control>A'), 'Auto Import and HUD', self.tab_auto_import),
|
||||
('hudConfigurator', None, _('_HUD Configurator'), _('<control>H'), 'HUD Configurator', self.diaHudConfigurator),
|
||||
('hud_preferences', None, _('_HUD Preferences'), _('<control>H'), 'HUD Preferences', self.dia_hud_preferences),
|
||||
('graphs', None, _('_Graphs'), _('<control>G'), 'Graphs', self.tabGraphViewer),
|
||||
('tourneygraphs', None, _('Tourney Graphs'), None, 'TourneyGraphs', self.tabTourneyGraphViewer),
|
||||
('stove', None, _('Stove (preview)'), None, 'Stove', self.tabStove),
|
||||
|
@ -895,8 +941,8 @@ class fpdb:
|
|||
print (_("Logfile is %s\n") % os.path.join(self.config.dir_log, self.config.log_file))
|
||||
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."))
|
||||
_("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 Advanced Preferences window (Main menu) before trying to import hands."))
|
||||
self.settings = {}
|
||||
self.settings['global_lock'] = self.lock
|
||||
if (os.sep == "/"):
|
||||
|
@ -1338,7 +1384,7 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
|
|||
except KeyError, exc:
|
||||
log.warning("site %s missing from db" % site)
|
||||
dia = gtk.MessageDialog(parent=None, flags=0, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Unknown Site")
|
||||
diastring = _("WARNING: Unable to find site '%s'\n\nPress YES to add this site to the database.") % site
|
||||
diastring = _("Warning:") +" " + _("Unable to find site '%s'\n\nPress YES to add this site to the database.") % site
|
||||
dia.format_secondary_text(diastring)
|
||||
response = dia.run()
|
||||
dia.destroy()
|
||||
|
|
|
@ -258,7 +258,7 @@ or None if we fail to get the info """
|
|||
#print "DEBUG: addBringIn(%s, %s)" %(action.group('PNAME'), action.group('BET'))
|
||||
hand.addBringIn(action.group('PNAME'), action.group('BET'))
|
||||
else:
|
||||
logging.error(_("DEBUG: ") + _("Unimplemented readAction: '%s' '%s'") % (action.group('PNAME'), action.group('ATYPE')))
|
||||
logging.error(_("DEBUG:") + " " + _("Unimplemented %s: '%s' '%s'") % ("readAction", action.group('PNAME'), action.group('ATYPE')))
|
||||
|
||||
def readShowdownActions(self, hand):
|
||||
for shows in self.re_ShowdownAction.finditer(hand.handText):
|
||||
|
|
Binary file not shown.
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
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
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
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,42 @@
|
|||
Everleaf Gaming Game #190075259
|
||||
***** Hand history for game #190075259 *****
|
||||
Blinds $0.01/$0.02 NL Hold'em - 2010/08/03 - 17:03:59
|
||||
Table Los Angeles XV
|
||||
Seat 2 is the button
|
||||
Total number of players: 8
|
||||
Seat 1: zetnik ( $ 0.98 USD )
|
||||
Seat 2: Nadiy1981 ( $ 1.95 USD )
|
||||
Seat 3: rcgott4 ( $ 0.94 USD )
|
||||
Seat 4: MDKILLER69 ( $ 1.80 USD )
|
||||
Seat 5: Serg2407 ( $ 0.40 USD )
|
||||
Seat 8: lenchik_1984 ( $ 1.51 USD )
|
||||
Seat 9: xxx47 ( $ 0.03 USD )
|
||||
Seat 10: maluo ( $ 4.19 USD )
|
||||
rcgott4: posts small blind [$ 0.01 USD]
|
||||
MDKILLER69: posts big blind [$ 0.02 USD]
|
||||
** Dealing down cards **
|
||||
Serg2407 calls [$ 0.02 USD]
|
||||
lenchik_1984 folds
|
||||
xxx47 calls [$ 0.02 USD]
|
||||
maluo folds
|
||||
zetnik calls [$ 0.02 USD]
|
||||
Nadiy1981 folds
|
||||
rcgott4 calls [$ 0.01 USD]
|
||||
MDKILLER69 raises [$ 0.18 USD]
|
||||
Serg2407 folds
|
||||
xxx47 calls [$ 0.01 USD]
|
||||
zetnik raises [$ 0.96 USD]
|
||||
rcgott4 folds
|
||||
MDKILLER69 calls [$ 0.78 USD]
|
||||
** Dealing Flop ** [ 6d, Jc, Js ]
|
||||
** Dealing Turn ** [ 3d ]
|
||||
** Dealing River ** [ 9d ]
|
||||
zetnik shows [ 4c, 4d ] two pairs, jacks and fours
|
||||
MDKILLER69 shows [ 8c, 8h ] two pairs, jacks and eights
|
||||
xxx47 shows [ 5s, Td ] a pair of jacks
|
||||
MDKILLER69 wins $ 0.13 USD from main pot with two pairs, jacks and
|
||||
eights [ Jc, Js, 9d, 8c, 8h ]
|
||||
MDKILLER69 wins $ 1.81 USD from side pot with two pairs, jacks and
|
||||
eights [ Jc, Js, 9d, 8c, 8h ]
|
||||
|
||||
|
|
@ -47,8 +47,8 @@ def testSQLiteVarianceFunction():
|
|||
cur.execute("SELECT variance(i) from test")
|
||||
result = cur.fetchone()[0]
|
||||
|
||||
print (_("DEBUG: ") + _("Testing variance function"))
|
||||
print (_("DEBUG: ") + _("result: %s expecting: 0.666666 (result-expecting ~= 0.0): %s") % (result, (result - 0.66666)))
|
||||
print (_("DEBUG:") + " " + _("Testing variance function"))
|
||||
print (_("DEBUG:") + " " + _("result: %s expecting: 0.666666 (result-expecting ~= 0.0): %s") % (result, (result - 0.66666)))
|
||||
cur.execute("DROP TABLE test")
|
||||
assert (result - 0.66666) <= 0.0001
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user