summaryrefslogtreecommitdiff
path: root/portato/gui/gui_helper.py
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui/gui_helper.py')
-rw-r--r--portato/gui/gui_helper.py79
1 files changed, 6 insertions, 73 deletions
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index 462e749..67cae70 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -31,19 +31,7 @@ from ..config_parser import ConfigParser
# the wrapper
from .wrapper import Console, Tree
-class Config:
- """Wrapper around a ConfigParser and for additional local configurations."""
- # this const-dict holds all the values which are named differently in the sourcecode and in the cfg-file
- # note: the keys are lowered before being looked up
- const = {
- "minimize" : "hideonminimize",
- "pkgicons" : "packageIcons",
- "synccmd" : "synccommand",
- "systray" : "showsystray",
- "testingfile" : "keywordfile",
- "testingperversion" : "keywordperversion",
- "usetips" : "showusetips"
- }
+class Config (ConfigParser):
def __init__ (self, cfgFile):
"""Constructor.
@@ -51,45 +39,14 @@ class Config:
@param cfgFile: path to config file
@type cfgFile: string"""
- # init ConfigParser
- self._cfg = ConfigParser(cfgFile)
+ ConfigParser.__init__(self, cfgFile)
# read config
- self._cfg.parse()
+ self.parse()
# local configs
self.local = {}
- def __get_val (self, name):
- try:
- return self.const[name.lower()]
- except KeyError:
- return name
-
- def get(self, name, section="MAIN"):
- """Gets an option.
-
- @param name: name of the option
- @type name: string
- @param section: section to look in; default is Main-Section
- @type section: string
- @return: the option's value
- @rtype: string"""
-
- return self._cfg.get(self.__get_val(name), self.__get_val(section))
-
- def get_boolean(self, name, section="MAIN"):
- """Gets a boolean option.
-
- @param name: name of the option
- @type name: string
- @param section: section to look in; default is Main-Section
- @type section: string
- @return: the option's value
- @rtype: boolean"""
-
- return self._cfg.get_boolean(self.__get_val(name), self.__get_val(section))
-
def modify_flags_config (self):
"""Sets the internal config of the L{flags}-module.
@see: L{flags.set_config()}"""
@@ -99,8 +56,8 @@ class Config:
"usePerVersion" : self.get_boolean("usePerVersion"),
"maskfile" : self.get("maskFile"),
"maskPerVersion" : self.get_boolean("maskPerVersion"),
- "testingfile" : self.get("testingFile"),
- "testingPerVersion" : self.get_boolean("testingPerVersion")}
+ "testingfile" : self.get("keywordFile"),
+ "testingPerVersion" : self.get_boolean("keywordPerVersion")}
flags.set_config(flagCfg)
def modify_debug_config (self):
@@ -155,33 +112,9 @@ class Config:
return self.local[cpv][name]
- def set(self, name, val, section = "MAIN"):
- """Sets an option.
-
- @param name: name of the option
- @type name: string
- @param val: value to set the option to
- @type val: string
- @param section: section to look in; default is Main-Section
- @type section: string"""
-
- self._cfg.set(self.__get_val(name), val, self.__get_val(section))
-
- def set_boolean (self, name, val, section = "MAIN"):
- """Sets a boolean option.
-
- @param name: name of the option
- @type name: string
- @param val: value to set the option to
- @type val: boolean
- @param section: section to look in; default is Main-Section
- @type section: string"""
-
- self._cfg.set_boolean(self.__get_val(name), val, self.__get_val(section))
-
def write(self):
"""Writes to the config file and modify any external configs."""
- self._cfg.write()
+ ConfigParser.write(self)
self.modify_external_configs()
class Database:
c ui cleanupsLars Hjemli9-19/+140 2006-12-15Add a common commit parserLars Hjemli3-63/+75 2006-12-14Add simple pager to log pageLars Hjemli4-6/+37 2006-12-13Add separate makefile-rule to clear current cacheLars Hjemli1-2/+4 2006-12-13Remove implementation details from READMELars Hjemli1-53/+34 2006-12-13Small layout adjustments to summary and blob viewLars Hjemli3-5/+13 2006-12-13Add display of tree content w/ui-tree.cLars Hjemli9-8/+113 2006-12-12cache_lock: do xstrdup/free on lockfileLars Hjemli1-1/+2 2006-12-11Don't truncate valid cachefilesLars Hjemli3-4/+16 2006-12-11Move global variables + callback functions into shared.cLars Hjemli4-82/+86 2006-12-11Move functions for generic object output into ui-view.cLars Hjemli4-34/+43 2006-12-11Move log-functions into ui-log.cLars Hjemli5-111/+121 2006-12-11Move repo summary functions into ui-summary.cLars Hjemli4-47/+59 2006-12-11Move functions for repolist output into ui-repolist.cLars Hjemli5-70/+90 2006-12-11Move common output-functions into ui-shared.cLars Hjemli4-82/+99 2006-12-11Rename config.c to parsing.c + move cgit_parse_query from cgit.c to parsing.cLars Hjemli4-28/+29 2006-12-11Avoid infinite loops in caching layerLars Hjemli3-14/+31 2006-12-11Let 'make install' clear all cachefilesLars Hjemli1-0/+2 2006-12-11Fix cache algorithm loopholeLars Hjemli3-11/+16 2006-12-10Add version identifier in generated filesLars Hjemli2-9/+14 2006-12-10Add license file and copyright noticesLars Hjemli5-0/+372 2006-12-10Add caching infrastructureLars Hjemli9-28/+353