From dfd47cfbfbfff72076c8f0a05a49888a172edace Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sat, 9 Oct 2010 14:02:39 +0200 Subject: [PATCH 1/4] unify some strings and remove misleading comment --- pyfpdb/Database.py | 22 +++++++++++----------- pyfpdb/SQL.py | 2 -- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index dcb178e4..68f2a462 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1068,43 +1068,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 "), idx['tab'], idx['col'] + print _("Creating mysql 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 pg index "), idx['tab'], idx['col'] + print _("Creating pg index "), 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 @@ -1253,7 +1253,7 @@ class Database: 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']) @@ -1262,7 +1262,7 @@ class Database: 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'])) @@ -1278,7 +1278,7 @@ class Database: 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) ) + raise FpdbError("Error creating indexes: " + str(sys.exc_value) ) #end def createAllIndexes def dropAllIndexes(self): diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index 7d2931a7..d77e3e79 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -3055,8 +3055,6 @@ class Sql: order by stats.category, stats.limitType, stats.bigBlindDesc desc , cast(stats.PlPosition as smallint) """ - #elif db_server == 'sqlite': - # self.query['playerStatsByPosition'] = """ """ #################################### # Cash Game Graph query From b0dd8cb36fceccdc0d32d7c749a8a82e3ed1af26 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 10 Oct 2010 17:29:52 +0200 Subject: [PATCH 2/4] l10n: some missing gettexts in winamax --- pyfpdb/WinamaxToFpdb.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pyfpdb/WinamaxToFpdb.py b/pyfpdb/WinamaxToFpdb.py index 77202167..c49f4e09 100644 --- a/pyfpdb/WinamaxToFpdb.py +++ b/pyfpdb/WinamaxToFpdb.py @@ -213,7 +213,7 @@ class Winamax(HandHistoryConverter): hand.mixed = None 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) for a in m: 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 "---" except: - print ("Failed to add streets. handtext=%s") + print (_("Failed to add streets. handtext=%s")) #Needs to return a list in the format # ['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) if m: 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: log.warning(_('readButton: not found')) @@ -292,13 +292,13 @@ class Winamax(HandHistoryConverter): if street in hand.streets.keys(): m = self.re_HeroCards.finditer(hand.streets[street]) if m == []: - log.debug("No hole cards found for %s"%street) + log.debug(_("No hole cards found for %s"%street)) for found in m: hand.hero = found.group('PNAME') newcards = found.group('CARDS').split(' ') # print "DEBUG: addHoleCards(%s, %s, %s)" %(street, hand.hero, newcards) 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): m = self.re_Action.finditer(hand.streets[street]) @@ -319,13 +319,13 @@ 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 readAction: '%s' '%s'")) %(action.group('PNAME'),action.group('ATYPE'),) # print "Processed %s"%acts # print "committed=",hand.pot.committed def readShowdownActions(self, hand): 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 = cards.split(' ') # print "DEBUG: addShownCards(%s, %s)" %(cards, shows.group('PNAME')) @@ -371,7 +371,7 @@ class Winamax(HandHistoryConverter): def readShownCards(self,hand): 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 = cards.split(' ') # needs to be a list, not a set--stud needs the order (shown, mucked) = (False, False) From f642a1cf030de10e8902b380e9868c6efbf1adb5 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 10 Oct 2010 17:42:06 +0200 Subject: [PATCH 3/4] gettextify new tooltips --- pyfpdb/GuiRingPlayerStats.py | 54 ++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pyfpdb/GuiRingPlayerStats.py b/pyfpdb/GuiRingPlayerStats.py index 3d1bcb21..d601e0d2 100644 --- a/pyfpdb/GuiRingPlayerStats.py +++ b/pyfpdb/GuiRingPlayerStats.py @@ -41,33 +41,33 @@ from TreeViewTooltips import TreeViewTooltips #new order in config file: 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} -onlinehelp = {'Game':'Type of Game', - 'Hand':'Hole cards', - 'Posn':'Position', - 'Name':'Name of the player', - 'Hds':'Number of hands played', - 'Seats':'Number of Seats', - 'VPIP':'Voluntarily Putting In the pot\n(blinds excluded)', - 'PFR':'% Pre Flop Raise', - 'PF3':'% Pre Flop Re-Raise / 3Bet', - 'AggFac':'Aggression Factor\n', - 'AggFreq':'Aggression Frequency\nBet or Raise vs Fold', - 'ContBet':'Continuation Bet on the flop', - 'RFI':'% Raise First In\% Raise when first to bet', - 'Steals':'% First to raise pre-flop\nand steal blinds', - 'Saw_F':'% Saw Flop vs hands dealt', - 'SawSD':'Saw Show Down / River', - 'WtSDwsF':'Went To Show Down When Saw Flop', - 'W$SD':'Amount Won when Show Down seen', - 'FlAFq':'Flop Aggression\n% Bet or Raise after seeing Flop', - 'TuAFq':'Turn Aggression\n% Bet or Raise after seeing Turn', - 'RvAFq':'River Aggression\n% Bet or Raise after seeing River', - 'PoFAFq':'Coming Soon\nTotal % agression', - 'Net($)':'Amount won', - 'bb/100':'Number of Big Blinds won\nor lost per 100 hands', - 'Rake($)':'Amount of rake paid', - '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' +onlinehelp = {'Game':_('Type of Game'), + 'Hand':_('Hole cards'), + 'Posn':_('Position'), + 'Name':_('Name of the player'), + 'Hds':_('Number of hands played'), + 'Seats':_('Number of Seats'), + 'VPIP':_('Voluntarily Putting In the pot\n(blinds excluded)'), + 'PFR':_('% Pre Flop Raise'), + 'PF3':_('% Pre Flop Re-Raise / 3Bet'), + 'AggFac':_('Aggression Factor\n'), + 'AggFreq':_('Aggression Frequency\nBet or Raise vs Fold'), + 'ContBet':_('Continuation Bet on the flop'), + 'RFI':_('% Raise First In\% Raise when first to bet'), + 'Steals':_('% First to raise pre-flop\nand steal blinds'), + 'Saw_F':_('% Saw Flop vs hands dealt'), + 'SawSD':_('Saw Show Down / River'), + 'WtSDwsF':_('Went To Show Down When Saw Flop'), + 'W$SD':_('Amount Won when Show Down seen'), + 'FlAFq':_('Flop Aggression\n% Bet or Raise after seeing Flop'), + 'TuAFq':_('Turn Aggression\n% Bet or Raise after seeing Turn'), + 'RvAFq':_('River Aggression\n% Bet or Raise after seeing River'), + 'PoFAFq':_('Coming Soon\nTotal % agression'), + 'Net($)':_('Amount won'), + 'bb/100':_('Number of Big Blinds won\nor lost per 100 hands'), + 'Rake($)':_('Amount of rake paid'), + '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') } From 6b0b9cbf5173c74a360c36557160f83a32586d3b Mon Sep 17 00:00:00 2001 From: steffen123 Date: Sun, 10 Oct 2010 17:48:23 +0200 Subject: [PATCH 4/4] gettextify treeviewtooltips and add fpdb notice --- pyfpdb/TreeViewTooltips.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfpdb/TreeViewTooltips.py b/pyfpdb/TreeViewTooltips.py index 1112d3e4..9b891708 100644 --- a/pyfpdb/TreeViewTooltips.py +++ b/pyfpdb/TreeViewTooltips.py @@ -24,6 +24,7 @@ # # dpopowich AT astro dot umass dot edu # +# This version of the file is part of fpdb, contact: fpdb-main@lists.sourceforge.net ''' TreeViewTooltips.py @@ -104,7 +105,7 @@ import gobject if gtk.gtk_version < (2, 8): 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) warnings.warn(msg)