diff options
Diffstat (limited to 'geneticone/gui')
-rw-r--r-- | geneticone/gui/gui_helper.py | 27 | ||||
-rw-r--r-- | geneticone/gui/windows.py | 24 |
2 files changed, 42 insertions, 9 deletions
diff --git a/geneticone/gui/gui_helper.py b/geneticone/gui/gui_helper.py index 32dd56f..b5683d2 100644 --- a/geneticone/gui/gui_helper.py +++ b/geneticone/gui/gui_helper.py @@ -25,7 +25,8 @@ class Config: const = { "main_sec" : "Main", "usePerVersion_opt" : "usePerVersion", - "useFile_opt" : "usefile" + "useFile_opt" : "usefile", + "maskFile_opt" : "maskfile" } def __init__ (self, cfgFile): @@ -47,7 +48,10 @@ class Config: return self._cfg.getboolean(section, name) def modify_flags_config (self): - flagCfg = {"usefile": self.get(self.const["useFile_opt"]), "usePerVersion" : self.get_boolean(self.const["usePerVersion_opt"])} + flagCfg = { + "usefile": self.get(self.const["useFile_opt"]), + "usePerVersion" : self.get_boolean(self.const["usePerVersion_opt"]), + "maskfile" : self.get(self.const["maskFile_opt"])} flags.set_config(flagCfg) def set(self, name, val, section=const["main_sec"]): @@ -143,7 +147,17 @@ class EmergeQueue: if cpv in self.deps: return # in list already else: - deps = backend.find_packages("="+cpv)[0].get_dep_packages() + if flags.new_masking_status(cpv) == "unmasked": + masked = True + else: + masked = False + pkg = backend.find_packages("="+cpv, masked = masked) + if pkg: + pkg = pkg[0] + else: + raise backend.PackageNotFoundException(cpv) + + deps = pkg.get_dep_packages() self.deps.update({cpv : deps}) subIt = self.tree.append(it, [cpv]) @@ -162,7 +176,6 @@ class EmergeQueue: self.remove_children(subIt) raise e - def append (self, cpv, unmerge = False, update = False): """Appends a cpv either to the merge queue or to the unmerge-queue. Also updates the tree-view. @@ -178,7 +191,11 @@ class EmergeQueue: if not unmerge: try: # insert dependencies - pkg = backend.find_packages("="+cpv) + if flags.new_masking_status(cpv) == "unmasked": + masked = True + else: + masked = False + pkg = backend.find_packages("="+cpv, masked = masked) if pkg: pkg = pkg[0] else: diff --git a/geneticone/gui/windows.py b/geneticone/gui/windows.py index 1238a5e..9bdc771 100644 --- a/geneticone/gui/windows.py +++ b/geneticone/gui/windows.py @@ -9,8 +9,6 @@ # # Written by Necoro d.M. <necoro@necoro.net> -# our backend stuff - VERSION = "0.3.4" CONFIG_LOCATION = "/etc/geneticone/geneticone.cfg" MENU_EMERGE = 1 @@ -22,6 +20,7 @@ pygtk.require("2.0") import gtk import gobject +#our backend stuff from geneticone.helper import * from geneticone import backend from geneticone.backend import flags @@ -126,6 +125,7 @@ class PreferenceWindow (AbstractDialog): def __init__ (self, parent, cfg): AbstractDialog.__init__(self, parent, "Preferences") + self.window.set_resizable(True) self.cfg = cfg @@ -137,7 +137,8 @@ class PreferenceWindow (AbstractDialog): box.pack_start(self.perVersionCb, True, True) hBox = gtk.HBox() - label = gtk.Label("File name to use if package.use is a directory:") + label = gtk.Label("File name to use if package.use is a directory:\n<small><b>$(cat)</b> = category\n<b>$(pkg)</b> = package-name\n<b>$(cat-1)</b>/<b>$(cat-2)</b> = first/second part of the category</small>") + label.set_use_markup(True) self.editUsefile = gtk.Entry() self.editUsefile.set_text(cfg.get(cfg.const["useFile_opt"])) hBox.pack_start(label, False) @@ -218,7 +219,7 @@ class PackageWindow (AbstractDialog): checkHB.pack_start(self.installedCheck, True, False) self.maskedCheck = gtk.CheckButton() - self.maskedCheck.connect("button-press-event", self.cb_button_pressed) + self.maskedCheck.connect("toggled", self.cb_masked_toggled) self.maskedCheck.set_label("Masked") checkHB.pack_start(self.maskedCheck, True, False) @@ -366,6 +367,7 @@ class PackageWindow (AbstractDialog): def cb_cancel_clicked (self, button, data = None): if self.delOnClose: self.actual_package().remove_new_use_flags() + self.actual_package().remove_new_masked() elif self.flagChanged: if self.queue: self.queue.append(self.actual_package().get_cpv(), update = True) @@ -397,6 +399,13 @@ class PackageWindow (AbstractDialog): self.window.destroy() return True + def cb_masked_toggled (self, button): + status = button.get_active() + debug("status: ",status) + self.actual_package().set_masked(status) + self.flagChanged = True + return True + def cb_use_flag_toggled (self, cell, path, store, data = None): store[path][0] = not store[path][0] prefix = "" @@ -652,6 +661,13 @@ class MainWindow: hintMB.run() hintMB.destroy() flags.write_use_flags() + if len(flags.new_masked)>0 or len(flags.new_unmasked)>0: + hintMB = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, + "You have changed masking keywords. Genetic/One will write these changes into the appropriate files. Please backup them if you think it is necessairy.") + hintMB.run() + hintMB.destroy() + flags.write_masked() + backend.reload_settings() self.queue.emerge(force=True) elif button == self.unmergeBtn or button == MENU_UNEMERGE: self.queue.unmerge(force=True) |