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

This commit is contained in:
Worros 2010-10-11 15:07:40 +08:00
commit 295cc25259
5 changed files with 48 additions and 49 deletions

View File

@ -1068,43 +1068,43 @@ class Database:
if cons: if cons:
pass pass
else: 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: try:
c.execute("alter table " + fk['fktab'] + " add foreign key (" c.execute("alter table " + fk['fktab'] + " add foreign key ("
+ fk['fkcol'] + ") references " + fk['rtab'] + "(" + fk['fkcol'] + ") references " + fk['rtab'] + "("
+ fk['rcol'] + ")") + fk['rcol'] + ")")
except: except:
print _(" create foreign key failed: ") + str(sys.exc_info()) print _("Create foreign key failed: ") + str(sys.exc_info())
elif self.backend == self.PGSQL: 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: try:
c.execute("alter table " + fk['fktab'] + " add constraint " c.execute("alter table " + fk['fktab'] + " add constraint "
+ fk['fktab'] + '_' + fk['fkcol'] + '_fkey' + fk['fktab'] + '_' + fk['fkcol'] + '_fkey'
+ " foreign key (" + fk['fkcol'] + " foreign key (" + fk['fkcol']
+ ") references " + fk['rtab'] + "(" + fk['rcol'] + ")") + ") references " + fk['rtab'] + "(" + fk['rcol'] + ")")
except: except:
print _(" create foreign key failed: ") + str(sys.exc_info()) print _("Create foreign key failed: ") + str(sys.exc_info())
else: else:
return -1 return -1
for idx in self.indexes[self.backend]: for idx in self.indexes[self.backend]:
if idx['drop'] == 1: if idx['drop'] == 1:
if self.backend == self.MYSQL_INNODB: if self.backend == self.MYSQL_INNODB:
print _("creating mysql index "), idx['tab'], idx['col'] print _("Creating mysql index %s %s") % (idx['tab'], idx['col'])
try: try:
s = "alter table %s add index %s(%s)" % (idx['tab'],idx['col'],idx['col']) s = "alter table %s add index %s(%s)" % (idx['tab'],idx['col'],idx['col'])
c.execute(s) c.execute(s)
except: except:
print _(" create foreign key failed: ") + str(sys.exc_info()) print _("Create foreign key failed: ") + str(sys.exc_info())
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
# pass # pass
# mod to use tab_col for index name? # mod to use tab_col for index name?
print _("creating pg index "), idx['tab'], idx['col'] print _("Creating pg index "), idx['tab'], idx['col']
try: try:
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col']) s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
c.execute(s) c.execute(s)
except: except:
print _(" create index failed: ") + str(sys.exc_info()) print _("Create index failed: ") + str(sys.exc_info())
else: else:
return -1 return -1
@ -1253,7 +1253,7 @@ class Database:
s = "create index %s on %s(%s)" % (idx['col'],idx['tab'],idx['col']) s = "create index %s on %s(%s)" % (idx['col'],idx['tab'],idx['col'])
self.get_cursor().execute(s) self.get_cursor().execute(s)
except: except:
print _(" create index failed: ") + str(sys.exc_info()) print _("Create index failed: ") + str(sys.exc_info())
elif self.backend == self.PGSQL: elif self.backend == self.PGSQL:
# mod to use tab_col for index name? # mod to use tab_col for index name?
print _("Creating pgsql index %s %s") %(idx['tab'], idx['col']) print _("Creating pgsql index %s %s") %(idx['tab'], idx['col'])
@ -1262,7 +1262,7 @@ class Database:
s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col']) s = "create index %s_%s_idx on %s(%s)" % (idx['tab'], idx['col'], idx['tab'], idx['col'])
self.get_cursor().execute(s) self.get_cursor().execute(s)
except: except:
print _(" create index failed: ") + str(sys.exc_info()) print _("Create index failed: ") + str(sys.exc_info())
elif self.backend == self.SQLITE: elif self.backend == self.SQLITE:
print _("Creating sqlite index %s %s") %(idx['tab'], idx['col']) print _("Creating sqlite index %s %s") %(idx['tab'], idx['col'])
log.debug(_("Creating sqlite index %s %s") %(idx['tab'], idx['col'])) log.debug(_("Creating sqlite index %s %s") %(idx['tab'], idx['col']))
@ -1278,7 +1278,7 @@ class Database:
self.connection.set_isolation_level(1) # go back to normal isolation level self.connection.set_isolation_level(1) # go back to normal isolation level
except: except:
print _("Error creating indexes: ") + str(sys.exc_value) print _("Error creating indexes: ") + str(sys.exc_value)
raise FpdbError( "Error creating indexes " + str(sys.exc_value) ) raise FpdbError("Error creating indexes: " + str(sys.exc_value) )
#end def createAllIndexes #end def createAllIndexes
def dropAllIndexes(self): def dropAllIndexes(self):

View File

@ -41,33 +41,33 @@ from TreeViewTooltips import TreeViewTooltips
#new order in config file: #new order in config file:
colalias,colheading,colshowsumm,colshowposn,colformat,coltype,colxalign = 0,1,2,3,4,5,6 colalias,colheading,colshowsumm,colshowposn,colformat,coltype,colxalign = 0,1,2,3,4,5,6
ranks = {'x':0, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'T':10, 'J':11, 'Q':12, 'K':13, 'A':14} ranks = {'x':0, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9, 'T':10, 'J':11, 'Q':12, 'K':13, 'A':14}
onlinehelp = {'Game':'Type of Game', onlinehelp = {'Game':_('Type of Game'),
'Hand':'Hole cards', 'Hand':_('Hole cards'),
'Posn':'Position', 'Posn':_('Position'),
'Name':'Name of the player', 'Name':_('Name of the player'),
'Hds':'Number of hands played', 'Hds':_('Number of hands played'),
'Seats':'Number of Seats', 'Seats':_('Number of Seats'),
'VPIP':'Voluntarily Putting In the pot\n(blinds excluded)', 'VPIP':_('Voluntarily Putting In the pot\n(blinds excluded)'),
'PFR':'% Pre Flop Raise', 'PFR':_('% Pre Flop Raise'),
'PF3':'% Pre Flop Re-Raise / 3Bet', 'PF3':_('% Pre Flop Re-Raise / 3Bet'),
'AggFac':'Aggression Factor\n', 'AggFac':_('Aggression Factor\n'),
'AggFreq':'Aggression Frequency\nBet or Raise vs Fold', 'AggFreq':_('Aggression Frequency\nBet or Raise vs Fold'),
'ContBet':'Continuation Bet on the flop', 'ContBet':_('Continuation Bet on the flop'),
'RFI':'% Raise First In\% Raise when first to bet', 'RFI':_('% Raise First In\% Raise when first to bet'),
'Steals':'% First to raise pre-flop\nand steal blinds', 'Steals':_('% First to raise pre-flop\nand steal blinds'),
'Saw_F':'% Saw Flop vs hands dealt', 'Saw_F':_('% Saw Flop vs hands dealt'),
'SawSD':'Saw Show Down / River', 'SawSD':_('Saw Show Down / River'),
'WtSDwsF':'Went To Show Down When Saw Flop', 'WtSDwsF':_('Went To Show Down When Saw Flop'),
'W$SD':'Amount Won when Show Down seen', 'W$SD':_('Amount Won when Show Down seen'),
'FlAFq':'Flop Aggression\n% Bet or Raise after seeing Flop', 'FlAFq':_('Flop Aggression\n% Bet or Raise after seeing Flop'),
'TuAFq':'Turn Aggression\n% Bet or Raise after seeing Turn', 'TuAFq':_('Turn Aggression\n% Bet or Raise after seeing Turn'),
'RvAFq':'River Aggression\n% Bet or Raise after seeing River', 'RvAFq':_('River Aggression\n% Bet or Raise after seeing River'),
'PoFAFq':'Coming Soon\nTotal % agression', 'PoFAFq':_('Coming Soon\nTotal % agression'),
'Net($)':'Amount won', 'Net($)':_('Amount won'),
'bb/100':'Number of Big Blinds won\nor lost per 100 hands', 'bb/100':_('Number of Big Blinds won\nor lost per 100 hands'),
'Rake($)':'Amount of rake paid', 'Rake($)':_('Amount of rake paid'),
'bbxr/100':'Number of Big Blinds won\nor lost per 100 hands\nwhen excluding rake', 'bbxr/100':_('Number of Big Blinds won\nor lost per 100 hands\nwhen excluding rake'),
'Variance':'Measure of uncertainty\nThe lower, the more stable the amounts won' 'Variance':_('Measure of uncertainty\nThe lower, the more stable the amounts won')
} }

View File

@ -3055,8 +3055,6 @@ class Sql:
order by stats.category, stats.limitType, stats.bigBlindDesc desc order by stats.category, stats.limitType, stats.bigBlindDesc desc
<orderbyseats>, cast(stats.PlPosition as smallint) <orderbyseats>, cast(stats.PlPosition as smallint)
""" """
#elif db_server == 'sqlite':
# self.query['playerStatsByPosition'] = """ """
#################################### ####################################
# Cash Game Graph query # Cash Game Graph query

View File

@ -24,6 +24,7 @@
# #
# dpopowich AT astro dot umass dot edu # dpopowich AT astro dot umass dot edu
# #
# This version of the file is part of fpdb, contact: fpdb-main@lists.sourceforge.net
''' '''
TreeViewTooltips.py TreeViewTooltips.py
@ -104,7 +105,7 @@ import gobject
if gtk.gtk_version < (2, 8): if gtk.gtk_version < (2, 8):
import warnings import warnings
msg = ('''This module was developed and tested with version 2.8.18 of gtk. You are using version %d.%d.%d. Your milage may vary.''' msg = (_('''This module was developed and tested with version 2.8.18 of gtk. You are using version %d.%d.%d. Your milage may vary.''')
% gtk.gtk_version) % gtk.gtk_version)
warnings.warn(msg) warnings.warn(msg)

View File

@ -213,7 +213,7 @@ class Winamax(HandHistoryConverter):
hand.mixed = None hand.mixed = None
def readPlayerStacks(self, hand): def readPlayerStacks(self, hand):
log.debug("readplayerstacks: re is '%s'" % self.re_PlayerInfo) log.debug(_("readplayerstacks: re is '%s'" % self.re_PlayerInfo))
m = self.re_PlayerInfo.finditer(hand.handText) m = self.re_PlayerInfo.finditer(hand.handText)
for a in m: for a in m:
hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH')) hand.addPlayer(int(a.group('SEAT')), a.group('PNAME'), a.group('CASH'))
@ -230,7 +230,7 @@ class Winamax(HandHistoryConverter):
# print "adding street", m.group(0) # print "adding street", m.group(0)
# print "---" # print "---"
except: except:
print ("Failed to add streets. handtext=%s") print (_("Failed to add streets. handtext=%s"))
#Needs to return a list in the format #Needs to return a list in the format
# ['player1name', 'player2name', ...] where player1name is the sb and player2name is bb, # ['player1name', 'player2name', ...] where player1name is the sb and player2name is bb,
@ -240,7 +240,7 @@ class Winamax(HandHistoryConverter):
m = self.re_Button.search(hand.handText) m = self.re_Button.search(hand.handText)
if m: if m:
hand.buttonpos = int(m.group('BUTTON')) hand.buttonpos = int(m.group('BUTTON'))
log.debug('readButton: button on pos %d'%hand.buttonpos) log.debug(_('readButton: button on pos %d'%hand.buttonpos))
else: else:
log.warning(_('readButton: not found')) log.warning(_('readButton: not found'))
@ -292,13 +292,13 @@ class Winamax(HandHistoryConverter):
if street in hand.streets.keys(): if street in hand.streets.keys():
m = self.re_HeroCards.finditer(hand.streets[street]) m = self.re_HeroCards.finditer(hand.streets[street])
if m == []: if m == []:
log.debug("No hole cards found for %s"%street) log.debug(_("No hole cards found for %s"%street))
for found in m: for found in m:
hand.hero = found.group('PNAME') hand.hero = found.group('PNAME')
newcards = found.group('CARDS').split(' ') newcards = found.group('CARDS').split(' ')
# print "DEBUG: addHoleCards(%s, %s, %s)" %(street, hand.hero, newcards) # print "DEBUG: addHoleCards(%s, %s, %s)" %(street, hand.hero, newcards)
hand.addHoleCards(street, hand.hero, closed=newcards, shown=False, mucked=False, dealt=True) hand.addHoleCards(street, hand.hero, closed=newcards, shown=False, mucked=False, dealt=True)
log.debug("Hero cards %s: %s"%(hand.hero, newcards)) log.debug(_("Hero cards %s: %s"%(hand.hero, newcards)))
def readAction(self, hand, street): def readAction(self, hand, street):
m = self.re_Action.finditer(hand.streets[street]) m = self.re_Action.finditer(hand.streets[street])
@ -319,13 +319,13 @@ class Winamax(HandHistoryConverter):
elif action.group('ATYPE') == ' stands pat': elif action.group('ATYPE') == ' stands pat':
hand.addStandsPat( street, action.group('PNAME')) hand.addStandsPat( street, action.group('PNAME'))
else: else:
log.fatal("DEBUG: unimplemented readAction: '%s' '%s'") %(action.group('PNAME'),action.group('ATYPE'),) log.fatal(_("DEBUG: unimplemented readAction: '%s' '%s'")) %(action.group('PNAME'),action.group('ATYPE'),)
# print "Processed %s"%acts # print "Processed %s"%acts
# print "committed=",hand.pot.committed # print "committed=",hand.pot.committed
def readShowdownActions(self, hand): def readShowdownActions(self, hand):
for shows in self.re_ShowdownAction.finditer(hand.handText): for shows in self.re_ShowdownAction.finditer(hand.handText):
log.debug("add show actions %s"%shows) log.debug(_("add show actions %s"%shows))
cards = shows.group('CARDS') cards = shows.group('CARDS')
cards = cards.split(' ') cards = cards.split(' ')
# print "DEBUG: addShownCards(%s, %s)" %(cards, shows.group('PNAME')) # print "DEBUG: addShownCards(%s, %s)" %(cards, shows.group('PNAME'))
@ -371,7 +371,7 @@ class Winamax(HandHistoryConverter):
def readShownCards(self,hand): def readShownCards(self,hand):
for m in self.re_ShownCards.finditer(hand.handText): for m in self.re_ShownCards.finditer(hand.handText):
log.debug("Read shown cards: %s"%m.group(0)) log.debug(_("Read shown cards: %s"%m.group(0)))
cards = m.group('CARDS') cards = m.group('CARDS')
cards = cards.split(' ') # needs to be a list, not a set--stud needs the order cards = cards.split(' ') # needs to be a list, not a set--stud needs the order
(shown, mucked) = (False, False) (shown, mucked) = (False, False)