From f56a003242455d0b064e2c4e9709e0a5db5402b3 Mon Sep 17 00:00:00 2001 From: steffen123 Date: Thu, 15 Jul 2010 03:32:10 +0200 Subject: [PATCH] GUI: start of HUD stat configurator: select parameters --- pyfpdb/Configuration.py | 4 +-- pyfpdb/fpdb.pyw | 59 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index ea2a8a78..7af32d03 100755 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -1069,8 +1069,8 @@ class Config: def get_supported_games(self): """Get the list of supported games.""" sg = [] - for game in c.supported_games.keys(): - sg.append(c.supported_games[game].game_name) + for game in self.supported_games.keys(): + sg.append(self.supported_games[game].game_name) return sg def execution_path(self, filename): diff --git a/pyfpdb/fpdb.pyw b/pyfpdb/fpdb.pyw index 898b6ec5..24df913b 100755 --- a/pyfpdb/fpdb.pyw +++ b/pyfpdb/fpdb.pyw @@ -337,6 +337,62 @@ class fpdb: diatitle="Database Statistics") #end def dia_database_stats + def diaHudConfigurator(self, widget, data=None): + self.obtain_global_lock("diaHudConfigurator") + diaSelections = gtk.Dialog("HUD Configurator - 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("Please select the game category for which you want to configure HUD stats:") + diaSelections.vbox.add(label) + label.show() + + #combo=gtk.ComboBox() + + comboGame = gtk.combo_box_new_text() + comboGame.connect("changed", self.hudConfiguratorComboSelection) + diaSelections.vbox.add(comboGame) + games=self.config.get_supported_games() + for game in games: + comboGame.append_text(game) + comboGame.show() + + comboRows = gtk.combo_box_new_text() + comboRows.connect("changed", self.hudConfiguratorComboSelection) + diaSelections.vbox.add(comboRows) + for i in range(1,8): + comboRows.append_text(str(i)+" rows") + comboRows.show() + + comboColumns = gtk.combo_box_new_text() + comboColumns.connect("changed", self.hudConfiguratorComboSelection) + diaSelections.vbox.add(comboColumns) + for i in range(1,8): + comboColumns.append_text(str(i)+" columns") + comboColumns.show() + + response=diaSelections.run() + if response == gtk.RESPONSE_ACCEPT: + print "clicked ok and selected:", self.hudConfiguratorGame,"with", str(self.hudConfiguratorRows), "rows and", str(self.hudConfiguratorColumns), "columns" + diaSelections.destroy() + + #TODO: bring up dialogue to actually select stats + #TODO: show explanation of what each stat means + self.release_global_lock() + #end def diaHudConfigurator + + def hudConfiguratorComboSelection(self, widget): + result=widget.get_active_text() + if result.endswith(" rows"): + self.hudConfiguratorRows=int(result[0]) + elif result.endswith(" columns"): + self.hudConfiguratorColumns=int(result[0]) + else: + self.hudConfiguratorGame=result + #end def hudConfiguratorComboSelection + def dia_dump_db(self, widget, data=None): self.db.dumpDatabase("database-dump.sql") #end def dia_database_stats @@ -640,6 +696,7 @@ class fpdb: + @@ -652,6 +709,7 @@ class fpdb: + @@ -692,6 +750,7 @@ class fpdb: ('imapsummaries', None, '_Import Tourney Summaries through eMail/IMAP', 'I', 'Auto Import and HUD', self.import_imap_summaries), ('viewers', None, '_Viewers'), ('autoimp', None, '_Auto Import and HUD', 'A', 'Auto Import and HUD', self.tab_auto_import), + ('hudConfigurator', None, '_HUD Configurator', 'H', 'HUD Configurator', self.diaHudConfigurator), ('graphs', None, '_Graphs', 'G', 'Graphs', self.tabGraphViewer), ('ringplayerstats', None, 'Ring _Player Stats (tabulated view)', 'P', 'Ring Player Stats (tabulated view)', self.tab_ring_player_stats), ('tourneyplayerstats', None, '_Tourney Player Stats (tabulated view)', 'T', 'Tourney Player Stats (tabulated view)', self.tab_tourney_player_stats),