summaryrefslogtreecommitdiff
path: root/portato/gui
diff options
context:
space:
mode:
Diffstat (limited to 'portato/gui')
-rw-r--r--portato/gui/gtk/windows.py16
-rw-r--r--portato/gui/gui_helper.py79
2 files changed, 14 insertions, 81 deletions
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index 3c684ad..329b848 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -251,9 +251,9 @@ class PreferenceWindow (AbstractDialog):
"deepCheck" : "deep",
"newUseCheck" : "newuse",
"maskPerVersionCheck" : "maskPerVersion",
- "minimizeCheck" : ("minimize", "GUI"),
- "systrayCheck" : ("systray", "GUI"),
- "testPerVersionCheck" : "testingPerVersion",
+ "minimizeCheck" : ("hideOnMinimize", "GUI"),
+ "systrayCheck" : ("showSystray", "GUI"),
+ "testPerVersionCheck" : "keywordPerVersion",
"titleUpdateCheck" : ("updateTitle", "GUI"),
"usePerVersionCheck" : "usePerVersion"
}
@@ -262,9 +262,9 @@ class PreferenceWindow (AbstractDialog):
# widget name -> option name
edits = {
"maskFileEdit" : "maskFile",
- "testFileEdit" : "testingFile",
+ "testFileEdit" : "keywordFile",
"useFileEdit" : "useFile",
- "syncCommandEdit" : "syncCmd",
+ "syncCommandEdit" : "syncCommand",
"browserEdit" : ("browserCmd", "GUI")
}
@@ -973,7 +973,7 @@ class MainWindow (Window):
self.pauseItems[k] = (v, v.connect_after("activate", self.cb_pause_emerge(k)))
# systray
- if self.cfg.get_boolean("systray", "GUI"):
+ if self.cfg.get_boolean("showSystray", "GUI"):
self.tray = gtk.status_icon_new_from_file(APP_ICON)
self.tray.connect("activate", self.cb_systray_activated)
self.tray.connect("popup-menu", lambda icon, btn, time: self.trayPopup.popup(None, None, None, btn, time))
@@ -1316,7 +1316,7 @@ class MainWindow (Window):
def cb_sync_clicked (self, action):
self.notebook.set_current_page(self.CONSOLE_PAGE)
- cmd = self.cfg.get("syncCmd")
+ cmd = self.cfg.get("syncCommand")
if cmd != "emerge --sync":
cmd = cmd.split()
@@ -1487,7 +1487,7 @@ class MainWindow (Window):
return False
def cb_minimized (self, window, event):
- if self.tray and self.cfg.get_boolean("minimize", "GUI"):
+ if self.tray and self.cfg.get_boolean("hideOnMinimize", "GUI"):
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
self.window.hide()
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: