diff options
| author | glatzor@ubuntu.com <> | 2006-08-07 10:31:09 +0200 |
|---|---|---|
| committer | glatzor@ubuntu.com <> | 2006-08-07 10:31:09 +0200 |
| commit | e1ed65110380161f42eb0e3090197efeee012446 (patch) | |
| tree | 67b4ef267613a378a024321493662bc4d73dcadc | |
| parent | a2a922ef65c22f37b9738fe98537e7928485fc5d (diff) | |
| download | python-apt-e1ed65110380161f42eb0e3090197efeee012446.tar.gz | |
* Allow to select all or none update - fixes #42296
* Do not set the cursor by default in the treeview sources -
fixes #54046
| -rw-r--r-- | SoftwareProperties/SoftwareProperties.py | 5 | ||||
| -rw-r--r-- | UpdateManager/UpdateManager.py | 48 |
2 files changed, 49 insertions, 4 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 18e5d260..8ae98b55 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -720,11 +720,10 @@ class SoftwareProperties(SimpleGladeApp): self.source_store.append([not source.disabled, contents, source, False, True]) - if len(self.source_store) < 1: + (path_x, path_y) = self.treeview_sources.get_cursor() + if len(self.source_store) < 1 or path_x <0: self.button_remove.set_sensitive(False) self.button_edit.set_sensitive(False) - else: - self.treeview_sources.set_cursor(0) self.distro.get_sources(self.sourceslist) self.distro_to_widgets() diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 0962c6c8..7ba9f934 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -363,7 +363,8 @@ class UpdateManager(SimpleGladeApp): self.treeview_update.append_column(column_install) column_install.set_visible(True) self.treeview_update.append_column(column) - self.treeview_update.set_search_column(LIST_NAME) + self.treeview_update.set_search_column(LIST_NAME) + self.treeview_update.connect("button-press-event", self.show_context_menu) # proxy stuff @@ -543,6 +544,51 @@ class UpdateManager(SimpleGladeApp): changes = self.cache.all_changes[name] self.set_changes_buffer(changes_buffer, changes[0], name, changes[1]) + def show_context_menu(self, widget, event): + """ + Show a context menu if a right click was performed on an update entry + """ + if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: + menu = gtk.Menu() + item_select_none = gtk.MenuItem(_("Select _None")) + item_select_none.connect("activate", self.select_none_updgrades) + menu.add(item_select_none) + if self.list.num_updates == 0 or len(self.packages) == 0: + item_select_none.set_property("sensitive", False) + item_select_all = gtk.MenuItem(_("Select _All")) + item_select_all.connect("activate", self.select_all_updgrades) + menu.add(item_select_all) + if self.list.num_updates == len(self.packages) or\ + self.list.num_updates == 0: + item_select_all.set_property("sensitive", False) + menu.popup(None, None, None, 0, event.time) + menu.show_all() + return True + + def select_all_updgrades(self, widget): + """ + Select all updates + """ + iter = self.store.get_iter_first() + while iter != None: + pkg = self.store.get_value(iter, LIST_PKG) + if pkg != None: + self.store.set_value(iter, LIST_INSTALL, True) + self.add_update(pkg) + iter = self.store.iter_next(iter) + + def select_none_updgrades(self, widget): + """ + Select none updates + """ + iter = self.store.get_iter_first() + while iter != None: + pkg = self.store.get_value(iter, LIST_PKG) + if pkg != None: + self.store.set_value(iter, LIST_INSTALL, False) + self.remove_update(pkg) + iter = self.store.iter_next(iter) + def remove_update(self, pkg): name = pkg.name if name in self.packages: |
