rename hud configurator to hud preferences

This commit is contained in:
Steffen Schaumburg 2011-04-06 19:53:59 +02:00
parent bf22c051e1
commit 056b5d9399

View File

@ -371,13 +371,14 @@ class fpdb:
diatitle=_("Database Statistics")) diatitle=_("Database Statistics"))
#end def dia_database_stats #end def dia_database_stats
def diaHudConfigurator(self, widget, data=None): def dia_hud_preferences(self, widget, data=None):
"""Opens dialog to set parameters (game category, row count, column count for HUD stat configurator""" """Opens dialog to set parameters (game category, row count, column count) for HUD preferences"""
self.hudConfiguratorRows = None #Note: No point in working on this until the new HUD configuration system is in place
self.hudConfiguratorColumns = None self.hud_preferences_rows = None
self.hudConfiguratorGame = 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, self.window,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT, (gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
@ -388,7 +389,7 @@ class fpdb:
label.show() label.show()
comboGame = gtk.combo_box_new_text() comboGame = gtk.combo_box_new_text()
comboGame.connect("changed", self.hudConfiguratorComboSelection) comboGame.connect("changed", self.hud_preferences_combo_selection)
diaSelections.vbox.add(comboGame) diaSelections.vbox.add(comboGame)
games = self.config.get_supported_games() games = self.config.get_supported_games()
for game in games: for game in games:
@ -397,7 +398,7 @@ class fpdb:
comboGame.show() comboGame.show()
comboRows = gtk.combo_box_new_text() comboRows = gtk.combo_box_new_text()
comboRows.connect("changed", self.hudConfiguratorComboSelection) comboRows.connect("changed", self.hud_preferences_combo_selection)
diaSelections.vbox.add(comboRows) diaSelections.vbox.add(comboRows)
for i in range(1, 8): for i in range(1, 8):
comboRows.append_text(str(i) + " rows") comboRows.append_text(str(i) + " rows")
@ -405,7 +406,7 @@ class fpdb:
comboRows.show() comboRows.show()
comboColumns = gtk.combo_box_new_text() comboColumns = gtk.combo_box_new_text()
comboColumns.connect("changed", self.hudConfiguratorComboSelection) comboColumns.connect("changed", self.hud_preferences_combo_selection)
diaSelections.vbox.add(comboColumns) diaSelections.vbox.add(comboColumns)
for i in range(1, 8): for i in range(1, 8):
comboColumns.append_text(str(i) + " columns") comboColumns.append_text(str(i) + " columns")
@ -416,29 +417,27 @@ class fpdb:
diaSelections.destroy() diaSelections.destroy()
if (response == gtk.RESPONSE_ACCEPT and if (response == gtk.RESPONSE_ACCEPT and
self.hudConfiguratorRows != None and self.hud_preferences_rows != None and
self.hudConfiguratorColumns != None and self.hud_preferences_columns != None and
self.hudConfiguratorGame != None): self.hud_preferences_game != None):
#print "clicked ok and selected:", self.hudConfiguratorGame,"with", str(self.hudConfiguratorRows), "rows and", str(self.hudConfiguratorColumns), "columns" self.dia_hud_preferences_table()
self.diaHudConfiguratorTable() #end def dia_hud_preferences
#end def diaHudConfigurator
def hudConfiguratorComboSelection(self, widget): def hud_preferences_combo_selection(self, widget):
#TODO: remove this and handle it directly in diaHudConfigurator #TODO: remove this and handle it directly in dia_hud_preferences
result = widget.get_active_text() result = widget.get_active_text()
if result.endswith(" rows"): if result.endswith(" rows"):
self.hudConfiguratorRows = int(result[0]) self.hud_preferences_rows = int(result[0])
elif result.endswith(" columns"): elif result.endswith(" columns"):
self.hudConfiguratorColumns = int(result[0]) self.hud_preferences_columns = int(result[0])
else: else:
self.hudConfiguratorGame = result self.hud_preferences_game = result
#end def hudConfiguratorComboSelection #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""" """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 #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, self.window,
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT, (gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT,
@ -460,8 +459,8 @@ class fpdb:
diaHudTable.vbox.add(label) diaHudTable.vbox.add(label)
label.show() label.show()
self.hudConfiguratorTableContents = [] self.hud_preferences_table_contents = []
table = gtk.Table(rows=self.hudConfiguratorRows + 1, columns=self.hudConfiguratorColumns + 1, homogeneous=True) table = gtk.Table(rows=self.hud_preferences_rows + 1, columns=self.hud_preferences_columns + 1, homogeneous=True)
statDir = dir(Stats) statDir = dir(Stats)
statDict = {} statDict = {}
@ -474,9 +473,9 @@ class fpdb:
continue continue
statDict[attr] = eval("Stats.%s.__doc__" % (attr)) statDict[attr] = eval("Stats.%s.__doc__" % (attr))
for rowNumber in range(self.hudConfiguratorRows + 1): for rowNumber in range(self.hud_preferences_rows + 1):
newRow = [] newRow = []
for columnNumber in range(self.hudConfiguratorColumns + 1): for columnNumber in range(self.hud_preferences_columns + 1):
if rowNumber == 0: if rowNumber == 0:
if columnNumber == 0: if columnNumber == 0:
pass pass
@ -509,7 +508,7 @@ class fpdb:
comboBox.show() comboBox.show()
if rowNumber != 0: if rowNumber != 0:
self.hudConfiguratorTableContents.append(newRow) self.hud_preferences_table_contents.append(newRow)
diaHudTable.vbox.add(table) diaHudTable.vbox.add(table)
table.show() table.show()
@ -518,20 +517,20 @@ class fpdb:
if response == gtk.RESPONSE_ACCEPT: if response == gtk.RESPONSE_ACCEPT:
self.storeNewHudStatConfig() self.storeNewHudStatConfig()
#end def diaHudConfiguratorTable #end def dia_hud_preferences_table
def storeNewHudStatConfig(self): def storeNewHudStatConfig(self):
"""stores selections made in diaHudConfiguratorTable""" """stores selections made in dia_hud_preferences_table"""
self.obtain_global_lock("diaHudConfiguratorTable") self.obtain_global_lock("dia_hud_preferences")
statTable = [] statTable = []
for row in self.hudConfiguratorTableContents: for row in self.hud_preferences_table_contents:
newRow = [] newRow = []
for column in row: for column in row:
newField = column.get_active_text() newField = column.get_active_text()
newRow.append(newField) newRow.append(newField)
statTable.append(newRow) 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.config.save() # TODO: make it not store in horrible formatting
self.release_global_lock() self.release_global_lock()
#end def storeNewHudStatConfig #end def storeNewHudStatConfig
@ -794,7 +793,7 @@ class fpdb:
<menu action="main"> <menu action="main">
<menuitem action="LoadProf"/> <menuitem action="LoadProf"/>
<menuitem action="SaveProf"/> <menuitem action="SaveProf"/>
<menuitem action="hudConfigurator"/> <menuitem action="hud_preferences"/>
<menuitem action="advanced_preferences"/> <menuitem action="advanced_preferences"/>
<separator/> <separator/>
<menuitem action="Quit"/> <menuitem action="Quit"/>
@ -807,7 +806,7 @@ class fpdb:
</menu> </menu>
<menu action="viewers"> <menu action="viewers">
<menuitem action="autoimp"/> <menuitem action="autoimp"/>
<menuitem action="hudConfigurator"/> <menuitem action="hud_preferences"/>
<menuitem action="graphs"/> <menuitem action="graphs"/>
<menuitem action="tourneygraphs"/> <menuitem action="tourneygraphs"/>
<menuitem action="ringplayerstats"/> <menuitem action="ringplayerstats"/>
@ -850,7 +849,7 @@ class fpdb:
('imapimport', None, _('_Import through eMail/IMAP'), _('<control>I'), 'Import through eMail/IMAP', self.tab_imap_import), ('imapimport', None, _('_Import through eMail/IMAP'), _('<control>I'), 'Import through eMail/IMAP', self.tab_imap_import),
('viewers', None, _('_Viewers')), ('viewers', None, _('_Viewers')),
('autoimp', None, _('_Auto Import and HUD'), _('<control>A'), 'Auto Import and HUD', self.tab_auto_import), ('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), ('graphs', None, _('_Graphs'), _('<control>G'), 'Graphs', self.tabGraphViewer),
('tourneygraphs', None, _('Tourney Graphs'), None, 'TourneyGraphs', self.tabTourneyGraphViewer), ('tourneygraphs', None, _('Tourney Graphs'), None, 'TourneyGraphs', self.tabTourneyGraphViewer),
('stove', None, _('Stove (preview)'), None, 'Stove', self.tabStove), ('stove', None, _('Stove (preview)'), None, 'Stove', self.tabStove),