summaryrefslogtreecommitdiff
path: root/portato/gui
diff options
context:
space:
mode:
authorNecoro <>2008-01-20 01:55:36 +0000
committerNecoro <>2008-01-20 01:55:36 +0000
commit6647e99ec83e2a934346bb4ca58e93a2e216a831 (patch)
treea40ca9933e589db43595846adad58e0cefe86724 /portato/gui
parent7281cbcb12c40aa8335c2dbf0a4781ff799761a4 (diff)
downloadportato-6647e99ec83e2a934346bb4ca58e93a2e216a831.tar.gz
portato-6647e99ec83e2a934346bb4ca58e93a2e216a831.tar.bz2
portato-6647e99ec83e2a934346bb4ca58e93a2e216a831.zip
r680@Devoty: necoro | 2008-01-20 02:53:30 +0100
Fixed flag handling
Diffstat (limited to 'portato/gui')
-rw-r--r--portato/gui/gtk/dialogs.py2
-rw-r--r--portato/gui/gtk/windows.py61
-rw-r--r--portato/gui/gui_helper.py4
-rw-r--r--portato/gui/templates/portato.glade2
4 files changed, 49 insertions, 20 deletions
diff --git a/portato/gui/gtk/dialogs.py b/portato/gui/gtk/dialogs.py
index 7a1f28d..c26835c 100644
--- a/portato/gui/gtk/dialogs.py
+++ b/portato/gui/gtk/dialogs.py
@@ -11,6 +11,7 @@
# Written by René 'Necoro' Neumann <necoro@necoro.net>
import gtk
+from ...helper import error
from gettext import lgettext as _
def queue_not_empty_dialog():
@@ -26,6 +27,7 @@ def io_ex_dialog (io_ex):
if io_ex.filename:
string = string+": "+io_ex.filename
+ error(string)
dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, string)
ret = dialog.run()
dialog.destroy()
diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py
index 8b5c895..bf3c274 100644
--- a/portato/gui/gtk/windows.py
+++ b/portato/gui/gtk/windows.py
@@ -478,7 +478,7 @@ class PackageTable:
self.changelogView = self.tree.get_widget("changelogScroll").get_child()
self.filesView = self.tree.get_widget("filesScroll").get_child()
- def update (self, cp, queue = None, version = None, doEmerge = True, instantChange = False):
+ def update (self, cp, queue = None, version = None, doEmerge = True, instantChange = False, type = None):
"""Updates the table to show the contents for the package.
@param cp: the selected package
@@ -490,13 +490,16 @@ class PackageTable:
@param doEmerge: if False, the emerge buttons are disabled
@type doEmerge: boolean
@param instantChange: if True the changed keywords are updated instantly
- @type instantChange: boolean"""
+ @type instantChange: boolean
+ @param type: the type of the queue this package is in; if None there is no queue :)
+ @type type: string"""
self.cp = cp # category/package
self.version = version # version - if not None this is used
self.queue = queue
self.doEmerge = doEmerge
self.instantChange = instantChange
+ self.type = type
# packages and installed packages
if not self.doEmerge:
@@ -679,12 +682,13 @@ class PackageTable:
def _update_keywords (self, emerge, update = False):
if emerge:
+ type = "install" if not self.type else self.type
try:
try:
- self.queue.append(self.actual_package().get_cpv(), type = "install", update = update)
+ self.queue.append(self.actual_package().get_cpv(), type = type, update = update)
except PackageNotFoundException, e:
if unmask_dialog(e[0]) == gtk.RESPONSE_YES:
- self.queue.append(self.actual_package().get_cpv(), type = "install", unmask = True, update = update)
+ self.queue.append(self.actual_package().get_cpv(), type = type, unmask = True, update = update)
except BlockedException, e:
blocked_dialog(e[0], e[1])
else:
@@ -881,7 +885,7 @@ class PackageTable:
flag = store[path][2]
pkg = self.actual_package()
- if flag in pkg.get_global_settings("USE_EXPAND").split(): # ignore expanded flags
+ if pkg.use_expanded(flag): # ignore expanded flags
return False
store[path][0] = not store[path][0]
@@ -996,8 +1000,11 @@ class MainWindow (Window):
changelogScroll.add(HighlightView(lambda p: os.path.join(p.get_package_path(), "ChangeLog"), ["changelog"]))
def show_files (p):
- for f in p.get_files():
- yield " %s\n" % f
+ try:
+ for f in p.get_files():
+ yield " %s\n" % f
+ except IOError, e:
+ yield _("Error: %s") % e.strerror
filesScroll = self.tree.get_widget("filesScroll")
filesScroll.add(InstalledOnlyView(show_files))
@@ -1150,7 +1157,7 @@ class MainWindow (Window):
self.session = Session("gtk_session.cfg")
except (OSError, IOError), e:
io_ex_dialog(e)
- raise
+ return
def load_queue (merge, unmerge, oneshot):
def _load(q, **kwargs):
@@ -1291,7 +1298,7 @@ class MainWindow (Window):
self.fill_pkg_store(self.pkgList.get_model(), self.selCatName)
return True
- def cb_row_activated (self, view, path, *args):
+ def cb_queue_row_activated (self, view, path, *args):
"""Callback for an activated row in the emergeQueue. Opens a package window."""
store = self.queueTree
if len(path) > 1:
@@ -1300,7 +1307,15 @@ class MainWindow (Window):
package = store.get_value(iterator, store.get_cpv_column())
cat, name, vers, rev = system.split_cpv(package)
if rev != "r0": vers = vers+"-"+rev
- self.show_package(cat+"/"+name, queue = self.queue, version = vers, instantChange = True, doEmerge = False)
+
+ if store.is_in_emerge(iterator):
+ type = "install"
+ elif store.is_in_unmerge(iterator):
+ type = "uninstall"
+ elif store.is_in_update(iterator):
+ type = "update"
+
+ self.show_package(cat+"/"+name, queue = self.queue, version = vers, instantChange = True, doEmerge = False, type = type)
return True
def cb_queue_tooltip_queried (self, view, x, y, is_keyboard, tooltip):
@@ -1372,16 +1387,25 @@ class MainWindow (Window):
if len(flags.newUseFlags) > 0:
changed_flags_dialog(_("use flags"))
- flags.write_use_flags()
+ try:
+ flags.write_use_flags()
+ except IOError, e:
+ io_ex_dialog(e)
+ return True
if len(flags.new_masked)>0 or len(flags.new_unmasked)>0 or len(flags.newTesting)>0:
debug("new masked: %s",flags.new_masked)
debug("new unmasked: %s", flags.new_unmasked)
debug("new testing: %s", flags.newTesting)
changed_flags_dialog(_("masking keywords"))
- flags.write_masked()
- flags.write_testing()
- system.reload_settings()
+ try:
+ flags.write_masked()
+ flags.write_testing()
+ except IOError, e:
+ io_ex_dialog(e)
+ return True
+ else:
+ system.reload_settings()
model, iter = self.queueList.get_selection().get_selected()
@@ -1475,9 +1499,12 @@ class MainWindow (Window):
self.queue.sync()
def cb_save_flags_clicked (self, action):
- flags.write_use_flags()
- flags.write_testing()
- flags.write_masked()
+ try:
+ flags.write_use_flags()
+ flags.write_testing()
+ flags.write_masked()
+ except IOError, e:
+ io_ex_dialog(e)
@Window.watch_cursor
def cb_reload_clicked (self, action):
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index 5d171d6..9c16892 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -388,7 +388,7 @@ class EmergeQueue:
# recursive call
for d in deps:
try:
- self.update_tree(subIt, d, unmask)
+ self.update_tree(subIt, d, unmask, type = type)
except backend.BlockedException, e: # BlockedException occured -> delete current tree and re-raise exception
debug("Something blocked: %s", e[0])
self.remove_with_children(subIt)
@@ -431,7 +431,7 @@ class EmergeQueue:
if hasBeenInQueue: # package has been in queue before
self._queue_append(cpv, oneshot)
- self.update_tree(parentIt, cpv, unmask, oneshot = oneshot)
+ self.update_tree(parentIt, cpv, unmask, oneshot = oneshot, type = type)
else: # not update
if type == "install":
self._queue_append(cpv, oneshot)
diff --git a/portato/gui/templates/portato.glade b/portato/gui/templates/portato.glade
index d937b78..836261b 100644
--- a/portato/gui/templates/portato.glade
+++ b/portato/gui/templates/portato.glade
@@ -1040,7 +1040,7 @@
<property name="enable_search">False</property>
<signal name="button_press_event" handler="cb_right_click"/>
<signal name="query_tooltip" handler="cb_queue_tooltip_queried"/>
- <signal name="row_activated" handler="cb_row_activated"/>
+ <signal name="row_activated" handler="cb_queue_row_activated"/>
</widget>
</child>
</widget>