From 93e5233b00b9a2fd88490116c944f0e5e385dd00 Mon Sep 17 00:00:00 2001 From: Steffen Schaumburg Date: Wed, 6 Apr 2011 22:43:14 +0200 Subject: [PATCH] add site preferences dialogue --- pyfpdb/Configuration.py | 9 ++++-- pyfpdb/Database.py | 6 ++-- pyfpdb/HUD_config.xml.example | 2 +- pyfpdb/fpdb.pyw | 57 +++++++++++++++++++++++++++++++++-- 4 files changed, 65 insertions(+), 9 deletions(-) diff --git a/pyfpdb/Configuration.py b/pyfpdb/Configuration.py index 409c289f..1d1fa960 100644 --- a/pyfpdb/Configuration.py +++ b/pyfpdb/Configuration.py @@ -991,7 +991,12 @@ class Config: location_node.setAttribute("x", str( locations[i-1][0] )) location_node.setAttribute("y", str( locations[i-1][1] )) self.supported_sites[site_name].layout[max].location[i] = ( locations[i-1][0], locations[i-1][1] ) - + + def edit_site(self, site_name, enabled, screen_name): + site_node = self.get_site_node(site_name) + site_node.setAttribute("enabled", enabled) + site_node.setAttribute("screen_name", screen_name) + def editStats(self, gameName, statArray): """replaces stat selection for the given gameName with the given statArray""" gameNode = self.getGameNode(gameName) @@ -1032,7 +1037,7 @@ class Config: newStat.setAttribute("tip", "tip1") gameNode.appendChild(newStat) - statNodes = gameNode.getElementsByTagName("stat") + statNodes = gameNode.getElementsByTagName("stat") #TODO remove this line? #end def editStats def edit_aux_layout(self, aux_name, max, width = None, height = None, locations = None): diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 41b970a4..16bc054d 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -495,9 +495,9 @@ class Database: self.check_version(database=database, create=create) def get_sites(self): - self.cursor.execute("SELECT name,id FROM Sites") - sites = self.cursor.fetchall() - self.config.set_site_ids(sites) + self.cursor.execute("SELECT name,id FROM Sites") + sites = self.cursor.fetchall() + self.config.set_site_ids(sites) def add_site(self, site, site_code): self.cursor.execute("INSERT INTO Sites " diff --git a/pyfpdb/HUD_config.xml.example b/pyfpdb/HUD_config.xml.example index 2a8a77cf..6ce6c64d 100644 --- a/pyfpdb/HUD_config.xml.example +++ b/pyfpdb/HUD_config.xml.example @@ -259,7 +259,7 @@ Left-Drag to Move" - + @@ -816,8 +866,9 @@ class fpdb: # Create actions actiongroup.add_actions([('main', None, _('_Main')), ('Quit', gtk.STOCK_QUIT, _('_Quit'), None, 'Quit the Program', self.quit), - ('SaveProf', None, _('Save Profile (todo)'), _('S'), 'Save your profile', self.dia_save_profile), - ('advanced_preferences', None, _('_Advanced Preferences'), _('F'), 'Edit your preferences', self.dia_preferences), + ('SaveProf', None, _('Save Profile (todo)'), None, 'Save your profile', self.dia_save_profile), + ('site_preferences', None, _('_Site Preferences'), None, 'Site Preferences', self.dia_site_preferences), + ('advanced_preferences', None, _('_Advanced Preferences'), _('F'), 'Edit your preferences', self.dia_advanced_preferences), ('import', None, _('_Import')), ('bulkimp', None, _('_Bulk Import'), _('B'), 'Bulk Import', self.tab_bulk_import), ('tourneyimp', None, _('Tournament _Results Import'), _('R'), 'Tournament Results Import', self.tab_tourney_import),