summaryrefslogtreecommitdiff
path: root/geneticone
diff options
context:
space:
mode:
authornecoro <>2006-10-16 15:01:55 +0000
committernecoro <>2006-10-16 15:01:55 +0000
commitc9fdcf782e7ad7f54a35ab5c156cf0a2fa84ad1e (patch)
tree5177f22e11c4a851e7f6adaaf60fa2bd975c6118 /geneticone
parente721b6e30776a75fe80a297572054cccc7962c07 (diff)
downloadportato-c9fdcf782e7ad7f54a35ab5c156cf0a2fa84ad1e.tar.gz
portato-c9fdcf782e7ad7f54a35ab5c156cf0a2fa84ad1e.tar.bz2
portato-c9fdcf782e7ad7f54a35ab5c156cf0a2fa84ad1e.zip
Introduced watch_cursor decorator
Diffstat (limited to 'geneticone')
-rw-r--r--geneticone/gui/gui_helper.py8
-rw-r--r--geneticone/gui/windows.py44
2 files changed, 31 insertions, 21 deletions
diff --git a/geneticone/gui/gui_helper.py b/geneticone/gui/gui_helper.py
index 5540570..cb32417 100644
--- a/geneticone/gui/gui_helper.py
+++ b/geneticone/gui/gui_helper.py
@@ -343,7 +343,7 @@ class EmergeQueue:
@param oneshot: True if this package should not be added to the world-file.
@type oneshot: boolean
@param options: additional options to get showed in tree
- @param options: string[]
+ @type options: string[]
@raises geneticone.backend.PackageNotFoundException: if trying to add a package which does not exist"""
@@ -387,7 +387,7 @@ class EmergeQueue:
@param cpv: cpv to add
@type cpv: string (cpv)
- @param onehost: True if this package should not be added to the world-file.
+ @param oneshot: True if this package should not be added to the world-file.
@type oneshot: boolean
@returns: options set
@@ -516,8 +516,8 @@ class EmergeQueue:
def remove_with_children (self, it, removeNewFlags = True):
"""Convenience function which removes all children of an iterator and than the iterator itself.
- @param parentIt: The iter which to remove.
- @type parentIt: gtk.TreeIter
+ @param it: The iter which to remove.
+ @type it: gtk.TreeIter
@param removeNewFlags: True if new flags should be removed; False otherwise. Default: True.
@type removeNewFlags: boolean"""
diff --git a/geneticone/gui/windows.py b/geneticone/gui/windows.py
index 9d4db62..ade3fa9 100644
--- a/geneticone/gui/windows.py
+++ b/geneticone/gui/windows.py
@@ -926,42 +926,52 @@ class MainWindow:
return True
- def cb_update_clicked (self, action):
- if not backend.am_i_root():
- not_root_dialog()
-
- else:
-
+ def watch_cursor (func):
+ """This is a decorator for functions being so time consuming, that it is appropriate to show the watch-cursor.
+ @attention: this function relies on the gtk.Window-Object being stored as self.window"""
+ def wrapper (self, *args, **kwargs):
+ ret = None
def cb_idle():
try:
- updating = backend.update_world(newuse = self.cfg.get_boolean(self.cfg.const["newuse_opt"]), deep = self.cfg.get_boolean(self.cfg.const["deep_opt"]))
-
- debug("updating list:", [(x.get_cpv(), y.get_cpv()) for x,y in updating])
- for pkg, old_pkg in updating:
- self.queue.append(pkg.get_cpv(), options=["update from "+old_pkg.get_version()])
-
- if len(updating): self.doUpdate = True
+ ret = func(self, *args, **kwargs)
finally:
self.window.window.set_cursor(None)
return False
-
+
watch = gtk.gdk.Cursor(gtk.gdk.WATCH)
self.window.window.set_cursor(watch)
-
gobject.idle_add(cb_idle)
+ return ret
+ return wrapper
+ @watch_cursor
+ def cb_update_clicked (self, action):
+ if not backend.am_i_root():
+ not_root_dialog()
+
+ else:
+ updating = backend.update_world(newuse = self.cfg.get_boolean(self.cfg.const["newuse_opt"]), deep = self.cfg.get_boolean(self.cfg.const["deep_opt"]))
+
+ debug("updating list:", [(x.get_cpv(), y.get_cpv()) for x,y in updating])
+ for pkg, old_pkg in updating:
+ self.queue.append(pkg.get_cpv(), options=["update from "+old_pkg.get_version()])
+
+ if len(updating): self.doUpdate = True
return True
def cb_sync_clicked (self, action):
self.notebook.set_current_page(1)
self.queue.sync()
-
+
+ @watch_cursor
def cb_reload_clicked (self, action):
+ """Reloads the portage settings and the database."""
backend.reload_settings()
del self.db
self.db = Database()
self.db.populate()
-
+
+ @watch_cursor
def cb_search_clicked (self, button, data = None):
"""Do a search."""
if self.searchEntry.get_text() != "":