diff options
-rw-r--r-- | etc/portato.cfg | 99 | ||||
-rw-r--r-- | portato/db/__init__.py | 2 | ||||
-rw-r--r-- | portato/gui/utils.py | 12 | ||||
-rw-r--r-- | portato/gui/windows/main.py | 12 | ||||
-rw-r--r-- | portato/gui/windows/preference.py | 42 |
5 files changed, 80 insertions, 87 deletions
diff --git a/etc/portato.cfg b/etc/portato.cfg index 10f5445..d25f0a3 100644 --- a/etc/portato.cfg +++ b/etc/portato.cfg @@ -8,7 +8,7 @@ # true <-> false # 1 <-> 0 # -# Comments are single-line only and are started with a '#' or a ';'. +# Comments are single-line only and are started with a '#'. # # Values can be assigned to options via a '=' # @@ -18,39 +18,44 @@ # [MAIN] -; controls the backend system to use -; allowed values: -; - portage +# controls the backend system to use +# allowed values: +# - portage system = portage -; controls debug output - boolean value +# controls debug output - boolean value debug = True -; the command used for syncing portage - string value +# +# Backend section +# +[BACKEND] + +# the command used for syncing portage - string value synccommand = emerge --sync -; control the same-named "emerge --update" options - boolean values +# control the same-named "emerge --update" options - boolean values newuse = true -deep = true - -; control the name of the particular file if package.* is a directory - string values -; allowed placeholders: -; - $(pkg) : package name -; - $(cat) : category -; - $(cat-1)/$(cat-2) : first/second part of the category -; - $(version) : version of the package +deep = False + +# control the name of the particular file if package.* is a directory - string values +# allowed placeholders: +# - $(pkg) : package name +# - $(cat) : category +# - $(cat-1)/$(cat-2) : first/second part of the category +# - $(version) : version of the package usefile = portato maskfile = portato keywordfile = portato -; control whether the option is inserted into package.* with a specific version or not - boolean values +# control whether the option is inserted into package.* with a specific version or not - boolean values keywordperversion = True maskperversion = True useperversion = False -; the sets which are going to be updated on "update world" -; this is only important for >=portage-2.2 -; values: comma-speparated set-names +# the sets which are going to be updated on "update world" +# this is only important for >=portage-2.2 +# values: comma-speparated set-names updatesets = system, world # @@ -58,50 +63,50 @@ updatesets = system, world # [GUI] -; show emerge progress in window title - boolean value +# show emerge progress in window title - boolean value updatetitle = on -; show emerge process in console title - boolean value +# show emerge process in console title - boolean value updateconsole = on -; show the systray icon?- boolean value +# show the systray icon?- boolean value showsystray = true -; control whether to completely hide on minimization - boolean value +# control whether to completely hide on minimization - boolean value hideonminimize = true -; the browser to use - string value +# the browser to use - string value browserCmd = firefox -; search the packages while you are typing -; disable this if you own a slow machine -; - boolean value +# search the packages while you are typing +# disable this if you own a slow machine +# - boolean value searchontype = true -; show slots in the version list - boolean value +# show slots in the version list - boolean value showslots = true -; sets the font of the console - string value +# sets the font of the console - string value consolefont = Monospace 11 -; controls the maximum length of the console title - integer value +# controls the maximum length of the console title - integer value titlelength = 60 -; collapse categories with the same prefix - boolean value +# collapse categories with the same prefix - boolean value collapsecats = true -; sets the position of the tabs of the two notebooks -; allowed positions: -; - 1 : top -; - 2 : bottom -; - 3 : left -; - 4 : right +# sets the position of the tabs of the two notebooks +# allowed positions: +# - 1 : top +# - 2 : bottom +# - 3 : left +# - 4 : right packagetabpos = 2 systemtabpos = 2 -; the maximum number of lines the terminal keeps in history -; note that a higher value also means a higher memory consumption -; integer value +# the maximum number of lines the terminal keeps in history +# note that a higher value also means a higher memory consumption +# integer value scrollbacklines = 1000 # @@ -109,10 +114,10 @@ scrollbacklines = 1000 # [COLORS] -; background color of the table showing package infos - hex value +# background color of the table showing package infos - hex value packagetable = ffffff -; background color of the hint box in the preferences - hex value +# background color of the hint box in the preferences - hex value prefhint = f3f785 # @@ -120,11 +125,11 @@ prefhint = f3f785 # [DATABASE] -; the type of the database to use - string value -; allowed values: -; - sql : SQLite Database -; - dict : Hashmap in Memory -; - eixsql: Eix + SQLite Database +# the type of the database to use - string value +# allowed values: +# - sql : SQLite Database +# - dict : Hashmap in Memory +# - eixsql: Eix + SQLite Database type = eixsql # vim:ts=4:sw=4:noexpandtab:ft=cfg diff --git a/portato/db/__init__.py b/portato/db/__init__.py index 850a84e..41bd017 100644 --- a/portato/db/__init__.py +++ b/portato/db/__init__.py @@ -74,4 +74,4 @@ class Database(db.Database): @classmethod def _get_session(cls): - return SectionDict(Session("db.cfg", name = "DB"), cls.DB_TYPE) + return SectionDict(Session("db.session", name = "DB", oldfiles = ["db.cfg"]), cls.DB_TYPE) diff --git a/portato/gui/utils.py b/portato/gui/utils.py index ce5971e..e3611af 100644 --- a/portato/gui/utils.py +++ b/portato/gui/utils.py @@ -73,12 +73,12 @@ class Config (ConfigParser): @see: L{flags.set_config()}""" flagCfg = { - "usefile": self.get("useFile"), - "usePerVersion" : self.get_boolean("usePerVersion"), - "maskfile" : self.get("maskFile"), - "maskPerVersion" : self.get_boolean("maskPerVersion"), - "testingfile" : self.get("keywordFile"), - "testingPerVersion" : self.get_boolean("keywordPerVersion")} + "usefile": self.get("useFile", "backend"), + "usePerVersion" : self.get_boolean("usePerVersion", "backend"), + "maskfile" : self.get("maskFile", "backend"), + "maskPerVersion" : self.get_boolean("maskPerVersion", "backend"), + "testingfile" : self.get("keywordFile", "backend"), + "testingPerVersion" : self.get_boolean("keywordPerVersion", "backend")} flags.set_config(flagCfg) def modify_debug_config (self): diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 0ec35a2..2f5b48e 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -914,7 +914,7 @@ class MainWindow (Window): Loads the session data. """ try: - self.session = Session("gui.cfg", name="GUI", oldfiles=["gtk_session.cfg"]) + self.session = Session("gui.session", name="GUI", oldfiles=["gtk_session.cfg", "gui.cfg"]) except (OSError, IOError), e: dialogs.io_ex_dialog(e) return @@ -1473,7 +1473,7 @@ class MainWindow (Window): elif self.queueTree.is_in_unmerge(iter): self.queue.unmerge(force = True) else: - self.queue.update_world(sets = self.updateSets, force=True, newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep")) + self.queue.update_world(sets = self.updateSets, force=True, newuse = self.cfg.get_boolean("newuse", "backend"), deep = self.cfg.get_boolean("deep", "backend")) return True @@ -1500,11 +1500,11 @@ class MainWindow (Window): self.window.window.set_cursor(watch) try: if system.has_set_support(): - confsets = [x.strip() for x in self.cfg.get("updatesets").split(",")] + confsets = [x.strip() for x in self.cfg.get("updatesets", "backend").split(",")] self.updateSets = [s for s in confsets if s in system.get_sets()] - updating = system.update_world(sets = self.updateSets, newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep")) + updating = system.update_world(sets = self.updateSets, newuse = self.cfg.get_boolean("newuse", "backend"), deep = self.cfg.get_boolean("deep", "backend")) else: - updating = system.update_world(newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep")) + updating = system.update_world(newuse = self.cfg.get_boolean("newuse"), deep = self.cfg.get_boolean("deep", "backend")) self.updateSets = ("world",) debug("updating list: %s --> length: %s", [(x.get_cpv(), y.get_cpv()) for x,y in updating], len(updating)) @@ -1554,7 +1554,7 @@ class MainWindow (Window): def cb_sync_clicked (self, action): self.sysNotebook.set_current_page(self.CONSOLE_PAGE) - cmd = self.cfg.get("syncCommand") + cmd = self.cfg.get("syncCommand", "backend") if cmd != "emerge --sync": cmd = cmd.split() diff --git a/portato/gui/windows/preference.py b/portato/gui/windows/preference.py index 021788c..5d1d388 100644 --- a/portato/gui/windows/preference.py +++ b/portato/gui/windows/preference.py @@ -30,26 +30,26 @@ class PreferenceWindow (AbstractDialog): checkboxes = { "collapseCatCheck" : ("collapseCats", "GUI"), "consoleUpdateCheck" : ("updateConsole", "GUI"), - "debugCheck" : "debug", - "deepCheck" : "deep", - "newUseCheck" : "newuse", - "maskPerVersionCheck" : "maskPerVersion", + "debugCheck" : ("debug", "MAIN"), + "deepCheck" : ("deep", "backend"), + "newUseCheck" : ("newuse", "backend"), + "maskPerVersionCheck" : ("maskPerVersion", "backend"), "minimizeCheck" : ("hideOnMinimize", "GUI"), "searchOnTypeCheck" : ("searchOnType", "GUI"), "showSlotsCheck" : ("showSlots", "GUI"), "systrayCheck" : ("showSystray", "GUI"), - "testPerVersionCheck" : "keywordPerVersion", + "testPerVersionCheck" : ("keywordPerVersion", "backend"), "titleUpdateCheck" : ("updateTitle", "GUI"), - "usePerVersionCheck" : "usePerVersion" + "usePerVersionCheck" : ("usePerVersion", "backend") } # all edits in the window # widget name -> option name edits = { - "maskFileEdit" : "maskFile", - "testFileEdit" : "keywordFile", - "useFileEdit" : "useFile", - "syncCommandEdit" : "syncCommand", + "maskFileEdit" : ("maskFile", "backend"), + "testFileEdit" : ("keywordFile", "backend"), + "useFileEdit" : ("useFile", "backend"), + "syncCommandEdit" : ("syncCommand", "backend"), "browserEdit" : ("browserCmd", "GUI") } @@ -112,17 +112,11 @@ class PreferenceWindow (AbstractDialog): # the checkboxes for box, val in self.checkboxes.iteritems(): - if isinstance(val, tuple): - self.tree.get_widget(box).set_active(self.cfg.get_boolean(val[0], section = val[1])) - else: - self.tree.get_widget(box).set_active(self.cfg.get_boolean(val)) + self.tree.get_widget(box).set_active(self.cfg.get_boolean(val[0], section = val[1])) # the edits for edit, val in self.edits.iteritems(): - if isinstance(val,tuple): - self.tree.get_widget(edit).set_text(self.cfg.get(val[0], section = val[1])) - else: - self.tree.get_widget(edit).set_text(self.cfg.get(val)) + self.tree.get_widget(edit).set_text(self.cfg.get(val[0], section = val[1])) # the set list self.setList = self.tree.get_widget("setList") @@ -192,16 +186,10 @@ class PreferenceWindow (AbstractDialog): """Sets all options in the Config-instance.""" for box, val in self.checkboxes.iteritems(): - if isinstance(val, tuple): - self.cfg.set(val[0], self.tree.get_widget(box).get_active(), section = val[1]) - else: - self.cfg.set(val, self.tree.get_widget(box).get_active()) + self.cfg.set(val[0], self.tree.get_widget(box).get_active(), section = val[1]) for edit, val in self.edits.iteritems(): - if isinstance(val,tuple): - self.cfg.set(val[0], self.tree.get_widget(edit).get_text(), section = val[1]) - else: - self.cfg.set(val,self.tree.get_widget(edit).get_text()) + self.cfg.set(val[0], self.tree.get_widget(edit).get_text(), section = val[1]) if system.has_set_support(): self.cfg.set("updatesets", ", ".join(sorted(name for enabled, markup, descr, name in self.setList.get_model() if enabled))) @@ -240,7 +228,7 @@ class PreferenceWindow (AbstractDialog): def fill_setlist (self): store = gtk.ListStore(bool, str, str, str) - enabled = [x.strip() for x in self.cfg.get("updatesets").split(",")] + enabled = [x.strip() for x in self.cfg.get("updatesets", section = "backend").split(",")] for set, descr in system.get_sets(description = True): store.append([set in enabled, "<i>%s</i>" % set, descr, set]) |