various gettextifications and skipping of new non-stat fields in HUD configurator

This commit is contained in:
Steffen Schaumburg 2011-03-10 02:26:42 +01:00
parent c654beee03
commit 8bec7644ef
9 changed files with 81 additions and 79 deletions

View File

@ -313,7 +313,7 @@ class GuiAutoImport (threading.Thread):
#enabling and disabling sites from this interface not possible
#expects a box to layout the line horizontally
def createSiteLine(self, hbox1, hbox2, site, iconpath, hhpath, filter_name, active = True):
label = gtk.Label("%s auto-import:" % site)
label = gtk.Label(_("%s auto-import:") % site)
hbox1.pack_start(label, False, False, 3)
label.show()

View File

@ -203,7 +203,7 @@ class GuiBulkImport():
if not self.allowThreads:
self.spin_threads.set_sensitive(False)
# checkbox - fail on error?
# checkbox - archive file?
self.is_archive = gtk.CheckButton(_('Archive File'))
self.table.attach(self.is_archive, 0, 1, 1, 2, xpadding=10, ypadding=0, yoptions=gtk.SHRINK)
self.is_archive.show()

View File

@ -35,10 +35,10 @@ log = logging.getLogger("logview")
MAX_LINES = 100000 # max lines to display in window
EST_CHARS_PER_LINE = 150 # used to guesstimate number of lines in log file
LOGFILES = [ [ 'Fpdb Errors', 'fpdb-errors.txt', False ] # label, filename, start value
, [ 'Fpdb Log', 'fpdb-log.txt', True ]
, [ 'HUD Errors', 'HUD-errors.txt', False ]
, [ 'HUD Log', 'HUD-log.txt', False ]
LOGFILES = [ [ _('Fpdb Errors'), 'fpdb-errors.txt', False ] # label, filename, start value
, [ _('Fpdb Log'), 'fpdb-log.txt', True ]
, [ _('HUD Errors'), 'HUD-errors.txt', False ]
, [ _('HUD Log'), 'HUD-log.txt', False ]
]
class GuiLogView:
@ -95,10 +95,10 @@ class GuiLogView:
self.vbox.show()
self.dia.set_focus(self.listview)
col = self.addColumn("Date/Time", 0)
col = self.addColumn("Module", 1)
col = self.addColumn("Level", 2)
col = self.addColumn("Text", 3)
col = self.addColumn(_("Date/Time"), 0)
col = self.addColumn(_("Module"), 1)
col = self.addColumn(_("Level"), 2)
col = self.addColumn(_("Text"), 3)
self.loadLog()
self.vbox.show_all()

View File

@ -60,7 +60,7 @@ class GuiPositionalStats (threading.Thread):
}
self.filters = Filters.Filters(self.db, self.conf, self.sql, display = filters_display)
self.filters.registerButton1Name("Refresh")
self.filters.registerButton1Name(_("Refresh"))
self.filters.registerButton1Callback(self.refreshStats)
# ToDo: store in config

View File

@ -28,18 +28,18 @@ import gobject
import Configuration
rewrite = { 'general' : 'General', 'supported_databases' : 'Databases'
, 'import' : 'Import', 'hud_ui' : 'HUD'
, 'supported_sites' : 'Sites', 'supported_games' : 'Games'
, 'popup_windows' : 'Popup Windows', 'pu' : 'Window'
, 'pu_name' : 'Popup Name', 'pu_stat' : 'Stat'
, 'pu_stat_name' : 'Stat Name'
, 'aux_windows' : 'Auxiliary Windows', 'aw stud_mucked' : 'stud_mucked'
, 'aw mucked' : 'mucked', 'hhcs' : 'Hand History Converters'
, 'gui_cash_stats' : 'Ring Player Stats', 'field_type' : 'Field Type'
, 'col_title' : 'Column Heading', 'xalignment' : 'Left/Right Align'
, 'disp_all' : 'Show in Summaries', 'disp_posn' : 'Show in Position Stats'
, 'col_name' : 'Stat Name', 'field_format' : 'Format'
rewrite = { 'general' : _('General'), 'supported_databases' : _('Databases')
, 'import' : _('Import'), 'hud_ui' : _('HUD')
, 'supported_sites' : _('Sites'), 'supported_games' : _('Games')
, 'popup_windows' : _('Popup Windows'), 'pu' : _('Window')
, 'pu_name' : _('Popup Name'), 'pu_stat' : _('Stat')
, 'pu_stat_name' : _('Stat Name')
, 'aux_windows' : _('Auxiliary Windows'), 'aw stud_mucked' : _('stud_mucked')
, 'aw mucked' : _('mucked'), 'hhcs' : _('Hand History Converters')
, 'gui_cash_stats' : _('Ring Player Stats'), 'field_type' : _('Field Type')
, 'col_title' : _('Column Heading'), 'xalignment' : _('Left/Right Align')
, 'disp_all' : _('Show in Summaries'), 'disp_posn' : _('Show in Position Stats')
, 'col_name' : _('Stat Name'), 'field_format' : _('Format')
}
class GuiPrefs:

View File

@ -94,14 +94,14 @@ class GuiStove():
return combobox
def createDrawTab(self):
tab_title = "Draw"
tab_title = _("Draw")
label = gtk.Label(tab_title)
ddbox = gtk.VBox(False, 0)
self.notebook.append_page(ddbox, label)
def createStudTab(self):
tab_title = "Stud"
tab_title = _("Stud")
label = gtk.Label(tab_title)
ddbox = gtk.VBox(False, 0)
@ -112,7 +112,7 @@ class GuiStove():
# / gamehbox / in_frame / table /
# / out_frame
tab_title = "Flop"
tab_title = _("Flop")
label = gtk.Label(tab_title)
ddbox = gtk.VBox(False, 0)
@ -131,17 +131,17 @@ class GuiStove():
flop_games_cb = self.create_combo_box(games)
players_cb = self.create_combo_box(players)
label = gtk.Label("Gametype:")
label = gtk.Label(_("Gametype:"))
ddhbox.add(label)
ddhbox.add(flop_games_cb)
label = gtk.Label("Players:")
label = gtk.Label(_("Players:"))
ddhbox.add(label)
ddhbox.add(players_cb)
# Frames for Stove input and output
in_frame = gtk.Frame("Input:")
out_frame = gtk.Frame("Output:")
in_frame = gtk.Frame(_("Input:"))
out_frame = gtk.Frame(_("Output:"))
gamehbox.add(in_frame)
gamehbox.add(out_frame)
@ -167,7 +167,7 @@ Against the range: {
# Input Frame
table = gtk.Table(4, 5, True)
label = gtk.Label("Board:")
label = gtk.Label(_("Board:"))
board = gtk.Entry()
board.connect("changed", self.set_board_flop, board)
@ -179,7 +179,7 @@ Against the range: {
table.attach(btn1, 2, 3, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
label = gtk.Label("Player1:")
label = gtk.Label(_("Player1:"))
board = gtk.Entry()
board.connect("changed", self.set_hero_cards_flop, board)
btn2 = gtk.Button()
@ -194,7 +194,7 @@ Against the range: {
table.attach(btn3, 3, 4, 1, 2, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
label = gtk.Label("Player2:")
label = gtk.Label(_("Player2:"))
board = gtk.Entry()
board.connect("changed", self.set_villain_cards_flop, board)
btn4 = gtk.Button()
@ -208,7 +208,7 @@ Against the range: {
table.attach(btn4, 2, 3, 2, 3, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
table.attach(btn5, 3, 4, 2, 3, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
btn6 = gtk.Button("Results")
btn6 = gtk.Button(_("Results"))
btn6.connect("pressed", self.update_flop_output_pane, btn6)
table.attach(btn6, 0, 1, 3, 4, xoptions=gtk.SHRINK, yoptions=gtk.SHRINK)
@ -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)

View File

@ -70,7 +70,7 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
self.main_hbox = gtk.HPaned()
self.filters = TourneyFilters.TourneyFilters(self.db, self.conf, self.sql, display = filters_display)
#self.filters.registerButton1Name("_Filters")
#self.filters.registerButton1Name(_("_Filters"))
#self.filters.registerButton1Callback(self.showDetailFilter)
self.filters.registerButton2Name(_("_Refresh Stats"))
self.filters.registerButton2Callback(self.refreshStats)
@ -79,24 +79,24 @@ class GuiTourneyPlayerStats (GuiPlayerStats.GuiPlayerStats):
# ToDo: create popup to adjust column config
# columns to display, keys match column name returned by sql, values in tuple are:
# is column displayed, column heading, xalignment, formatting, celltype
self.columns = [ ["siteName", True, "Site", 0.0, "%s", "str"]
#,["tourney", False, "Tourney", 0.0, "%s", "str"] # true not allowed for this line
, ["category", True, "Cat.", 0.0, "%s", "str"]
, ["limitType", True, "Limit", 0.0, "%s", "str"]
, ["currency", True, "Curr.", 0.0, "%s", "str"]
, ["buyIn", True, "BuyIn", 1.0, "%3.2f", "str"]
, ["fee", True, "Fee", 1.0, "%3.2f", "str"]
, ["playerName", False, "Name", 0.0, "%s", "str"] # true not allowed for this line (set in code)
, ["tourneyCount", True, "#", 1.0, "%1.0f", "str"]
, ["itm", True, "ITM%", 1.0, "%3.2f", "str"]
, ["_1st", False, "1st", 1.0, "%1.0f", "str"]
, ["_2nd", True, "2nd", 1.0, "%1.0f", "str"]
, ["_3rd", True, "3rd", 1.0, "%1.0f", "str"]
, ["unknownRank", True, "Rank?", 1.0, "%1.0f", "str"]
, ["spent", True, "Spent", 1.0, "%3.2f", "str"]
, ["won", True, "Won", 1.0, "%3.2f", "str"]
, ["roi", True, "ROI%", 1.0, "%3.0f", "str"]
, ["profitPerTourney", True,"$/Tour", 1.0, "%3.2f", "str"]]
self.columns = [ ["siteName", True, _("Site"), 0.0, "%s", "str"]
#,["tourney", False, _("Tourney"), 0.0, "%s", "str"] # true not allowed for this line
, ["category", True, _("Cat."), 0.0, "%s", "str"]
, ["limitType", True, _("Limit"), 0.0, "%s", "str"]
, ["currency", True, _("Curr."), 0.0, "%s", "str"]
, ["buyIn", True, _("BuyIn"), 1.0, "%3.2f", "str"]
, ["fee", True, _("Fee"), 1.0, "%3.2f", "str"]
, ["playerName", False, _("Name"), 0.0, "%s", "str"] # true not allowed for this line (set in code)
, ["tourneyCount", True, _("#"), 1.0, "%1.0f", "str"]
, ["itm", True, _("ITM%"), 1.0, "%3.2f", "str"]
, ["_1st", False, _("1st"), 1.0, "%1.0f", "str"]
, ["_2nd", True, _("2nd"), 1.0, "%1.0f", "str"]
, ["_3rd", True, _("3rd"), 1.0, "%1.0f", "str"]
, ["unknownRank", True, _("Rank?"), 1.0, "%1.0f", "str"]
, ["spent", True, _("Spent"), 1.0, "%3.2f", "str"]
, ["won", True, _("Won"), 1.0, "%3.2f", "str"]
, ["roi", True, _("ROI%"), 1.0, "%3.0f", "str"]
, ["profitPerTourney", True,_("$/Tour"), 1.0, "%3.2f", "str"]]
self.stats_frame = gtk.Frame()
self.stats_frame.show()

View File

@ -66,16 +66,16 @@ class HUD_main(object):
def __init__(self, db_name='fpdb'):
self.db_name = db_name
self.config = c
log.info("HUD_main starting: using db name = %s" % (db_name))
log.info(_("HUD_main starting: using db name = %s") % (db_name))
try:
if not options.errorsToConsole:
fileName = os.path.join(self.config.dir_log, 'HUD-errors.txt')
log.info("Note: error output is being diverted to:" + fileName)
log.info("Any major error will be reported there _only_.")
log.info(_("Note: error output is being diverted to:") + fileName)
log.info(_("Any major error will be reported there _only_."))
errorFile = open(fileName, 'w', 0)
sys.stderr = errorFile
sys.stderr.write("HUD_main: starting ...\n")
log.info(_("HUD_main: starting ...\n"))
self.hud_dict = {}
self.hud_params = self.config.get_hud_ui_parameters()
@ -104,7 +104,7 @@ class HUD_main(object):
self.main_window.connect("table_changed", self.table_changed)
self.main_window.connect("destroy", self.destroy)
self.vb = gtk.VBox()
self.label = gtk.Label('Closing this window will exit from the HUD.')
self.label = gtk.Label(_('Closing this window will exit from the HUD.'))
self.vb.add(self.label)
self.main_window.add(self.vb)
self.main_window.set_title("HUD Main Window")
@ -135,13 +135,13 @@ class HUD_main(object):
self.kill_hud(None, hud.table.key)
def game_changed(self, widget, hud):
print "hud_main: Game changed."
print _("hud_main: Game changed.")
def table_changed(self, widget, hud):
self.kill_hud(None, hud.table.key)
def destroy(self, *args): # call back for terminating the main eventloop
log.info("Terminating normally.")
log.info(_("Terminating normally."))
gtk.main_quit()
def kill_hud(self, event, table):
@ -202,7 +202,7 @@ class HUD_main(object):
while 1: # wait for a new hand number on stdin
new_hand_id = sys.stdin.readline()
new_hand_id = string.rstrip(new_hand_id)
log.debug("Received hand no %s" % new_hand_id)
log.debug(_("Received hand no %s") % new_hand_id)
if new_hand_id == "": # blank line means quit
self.destroy()
break # this thread is not always killed immediately with gtk.main_quit()
@ -226,12 +226,12 @@ class HUD_main(object):
# get basic info about the new hand from the db
# if there is a db error, complain, skip hand, and proceed
log.info("HUD_main.read_stdin: hand processing starting ...")
log.info(_("HUD_main.read_stdin: hand processing starting ..."))
try:
(table_name, max, poker_game, type, site_id, site_name, num_seats, tour_number, tab_number) = \
self.db_connection.get_table_info(new_hand_id)
except Exception:
log.exception("db error: skipping %s" % new_hand_id)
log.exception(_("db error: skipping %s") % new_hand_id)
continue
if type == "tour": # hand is from a tournament
@ -250,8 +250,8 @@ class HUD_main(object):
try:
self.hud_dict[temp_key].stat_dict = stat_dict
except KeyError: # HUD instance has been killed off, key is stale
log.error('hud_dict[%s] was not found\n' % temp_key)
log.error('will not send hand\n')
log.error(_('hud_dict[%s] was not found\n') % temp_key)
log.error(_('will not send hand\n'))
# Unlocks table, copied from end of function
self.db_connection.connection.rollback()
return
@ -273,7 +273,7 @@ class HUD_main(object):
# If no client window is found on the screen, complain and continue
if type == "tour":
table_name = "%s %s" % (tour_number, tab_number)
log.error("HUD create: table name %s not found, skipping." % table_name)
log.error(_("HUD create: table name %s not found, skipping.") % table_name)
else:
tablewindow.key = temp_key
tablewindow.max = max

View File

@ -362,7 +362,9 @@ class fpdb:
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
label=gtk.Label(_("Please select the game category for which you want to configure HUD stats:"))
label=gtk.Label(_("Note that this dialogue will overwrite an existing config if one has been made already. ") +
_("Abort now if you don't want that.") + "\n" +
_("Please select the game category for which you want to configure HUD stats and the number of rows and columns:"))
diaSelections.vbox.add(label)
label.show()
@ -379,7 +381,7 @@ class fpdb:
comboRows.connect("changed", self.hudConfiguratorComboSelection)
diaSelections.vbox.add(comboRows)
for i in range(1,8):
comboRows.append_text(str(i)+" rows")
comboRows.append_text(_("%d rows") % i)
comboRows.set_active(0)
comboRows.show()
@ -387,7 +389,7 @@ class fpdb:
comboColumns.connect("changed", self.hudConfiguratorComboSelection)
diaSelections.vbox.add(comboColumns)
for i in range(1,8):
comboColumns.append_text(str(i)+" columns")
comboColumns.append_text("%d columns" % i)
comboColumns.set_active(0)
comboColumns.show()
@ -445,7 +447,7 @@ class fpdb:
if attr.startswith('__'): continue
if attr in ("Charset", "Configuration", "Database", "GInitiallyUnowned", "gtk", "pygtk",
"player", "c", "db_connection", "do_stat", "do_tip", "stat_dict",
"h", "re", "re_Percent", "re_Places", ): continue
"h", "re", "re_Percent", "re_Places", "L10n", "log", "encoder", "codecs", "_", "sys", "logging"): continue
statDict[attr]=eval("Stats.%s.__doc__" % (attr))
for rowNumber in range(self.hudConfiguratorRows+1):
@ -455,11 +457,11 @@ class fpdb:
if columnNumber==0:
pass
else:
label=gtk.Label("column "+str(columnNumber))
label=gtk.Label(_("column %d" % columnNumber))
table.attach(child=label, left_attach=columnNumber, right_attach=columnNumber+1, top_attach=rowNumber, bottom_attach=rowNumber+1)
label.show()
elif columnNumber==0:
label=gtk.Label("row "+str(rowNumber))
label=gtk.Label(_("row %d" % rowNumber))
table.attach(child=label, left_attach=columnNumber, right_attach=columnNumber+1, top_attach=rowNumber, bottom_attach=rowNumber+1)
label.show()
else:
@ -573,7 +575,7 @@ class fpdb:
def dia_recreate_hudcache(self, widget, data=None):
if self.obtain_global_lock("dia_recreate_hudcache"):
self.dia_confirm = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format="Confirm recreating HUD cache")
self.dia_confirm = gtk.MessageDialog(parent=self.window, flags=gtk.DIALOG_DESTROY_WITH_PARENT, type=gtk.MESSAGE_WARNING, buttons=(gtk.BUTTONS_YES_NO), message_format=_("Confirm recreating HUD cache"))
diastring = _("Please confirm that you want to re-create the HUD cache.")
self.dia_confirm.format_secondary_text(diastring)
# disable windowclose, do not want the the underlying processing interrupted mid-process