summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-03-24 16:03:23 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-03-24 16:03:23 +0100
commit3d4f9a0c623acf75b7b9159c2a3f987deebee755 (patch)
tree9a3092fe2a291d9bb3f29aeab9248101c77f7aaf
parent8fc275dc1e0ba0bd54c564367f769d56ebfc2e30 (diff)
parentb151c61e5838fe08af8cc25c36c045a44ad0c98b (diff)
downloadpython-apt-3d4f9a0c623acf75b7b9159c2a3f987deebee755.tar.gz
* merged from glatzor
-rw-r--r--SoftwareProperties/SoftwareProperties.py43
-rw-r--r--UpdateManager/UpdateManager.py25
-rw-r--r--data/SoftwareProperties.glade2
-rw-r--r--data/SoftwarePropertiesDialogs.glade2
4 files changed, 43 insertions, 29 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py
index 5d39f5b1..9613b49e 100644
--- a/SoftwareProperties/SoftwareProperties.py
+++ b/SoftwareProperties/SoftwareProperties.py
@@ -224,15 +224,15 @@ class SoftwareProperties(SimpleGladeApp):
contents +="<big><b>%s </b></big> (%s) <small>\n%s</small>" % (dist,a_type, comps)
self.source_store.append([contents, not source.disabled, source])
- if len(self.source_store) < 1:
- self.button_remove.set_sensitive(False)
- self.button_edit.set_sensitive(False)
- else:
- if path_x == None or self.treeview_sources.set_cursor(path_x):
+ # try to reselect the latest selected channel or if it fails the first
+ # one
+ if len(self.source_store) > 0 and \
+ (path_x == None or self.treeview_sources.set_cursor(path_x)):
self.treeview_sources.set_cursor(0)
- self.button_remove.set_sensitive(True)
- self.button_edit.set_sensitive(True)
-
+ else:
+ # call the cursor_changed signal if no channel is selected
+ self.treeview_sources.emit("cursor_changed")
+
def reload_keyslist(self):
self.keys_store.clear()
for key in self.apt_key.list():
@@ -368,7 +368,32 @@ class SoftwareProperties(SimpleGladeApp):
if dialog.run() == gtk.RESPONSE_OK:
self.reload_sourceslist()
self.modified = True
-
+
+ def on_channel_activated(self, treeview, path, column):
+ """Open the edit dialog if a channel was double clicked"""
+ # check if the channel can be edited
+ if self.button_edit.get_property("sensitive") == True:
+ self.on_edit_clicked(treeview)
+
+ def on_treeview_sources_cursor_changed(self, treeview):
+ """set the sensitiveness of the edit and remove button
+ corresponding to the selected channel"""
+ sel = self.treeview_sources.get_selection()
+ (model, iter) = sel.get_selected()
+ if not iter:
+ # No channel is selected, so disable edit and remove
+ self.button_edit.set_sensitive(False)
+ self.button_remove.set_sensitive(False)
+ return
+ # allow to remove the selected channel
+ self.button_remove.set_sensitive(True)
+ # disable editing of cdrom sources
+ source_entry = model.get_value(iter, LIST_ENTRY_OBJ)
+ if source_entry.uri.startswith("cdrom:"):
+ self.button_edit.set_sensitive(False)
+ else:
+ self.button_edit.set_sensitive(True)
+
def on_remove_clicked(self, widget):
sel = self.treeview_sources.get_selection()
(model, iter) = sel.get_selected()
diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py
index 9b7b3e28..bdbfc20f 100644
--- a/UpdateManager/UpdateManager.py
+++ b/UpdateManager/UpdateManager.py
@@ -266,7 +266,7 @@ class UpdateManager(SimpleGladeApp):
#self.treeview_update.set_fixed_height_mode(True)
self.treeview_update.append_column(self.cb)
- self.cb.set_visible(False)
+ self.cb.set_visible(True)
self.treeview_update.append_column(c0)
self.treeview_update.set_search_column(LIST_NAME)
@@ -419,6 +419,8 @@ class UpdateManager(SimpleGladeApp):
self.button_install.set_sensitive(True)
def update_count(self):
+ """activate or disable widgets and show dialog texts correspoding to
+ the number of available updates"""
if self.list.num_updates == 0:
text_header= "<big><b>"+_("Your system is up-to-date")+"</b></big>"
text_download = ""
@@ -426,6 +428,8 @@ class UpdateManager(SimpleGladeApp):
self.treeview_update.set_sensitive(False)
self.label_downsize.set_text=""
self.button_close.grab_default()
+ self.textview_changes.get_buffer().set_text("")
+ self.textview_descr.get_buffer().set_text("")
else:
text_header = "<big><b>"+gettext.ngettext("You can install one update", "You can install %s updates" % len(self.store), len(self.store))+"</b></big>"
@@ -600,24 +604,7 @@ class UpdateManager(SimpleGladeApp):
# fill them again
self.list.update(self.cache)
- if self.list.num_updates < 1:
- # set the label and treeview and hide the checkbox column
- self.cb.set_visible(False)
- text = "<big><b>%s</b></big>\n\n%s" % (_("Your system is up-to-date"),
- _("There are no updates available."))
- self.label_header.set_markup(text)
- # make sure no install is possible
- self.button_install.set_sensitive(False)
- self.textview_changes.get_buffer().set_text("")
- self.textview_descr.get_buffer().set_text("")
- else:
- self.cb.set_visible(True)
- self.treeview_update.set_headers_visible(False)
- text = _("<big><b>Available Updates</b></big>\n"
- "\n"
- "The following packages are found to be upgradable. You can upgrade them by "
- "using the Install button.")
- self.label_header.set_markup(text)
+ if self.list.num_updates > 0:
i=0
for pkg in self.list.pkgs:
diff --git a/data/SoftwareProperties.glade b/data/SoftwareProperties.glade
index 5d55f68a..da164c23 100644
--- a/data/SoftwareProperties.glade
+++ b/data/SoftwareProperties.glade
@@ -93,6 +93,8 @@
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
+ <signal name="row_activated" handler="on_channel_activated" last_modification_time="Fri, 24 Mar 2006 12:56:00 GMT"/>
+ <signal name="cursor_changed" handler="on_treeview_sources_cursor_changed" last_modification_time="Fri, 24 Mar 2006 13:00:27 GMT"/>
</widget>
</child>
</widget>
diff --git a/data/SoftwarePropertiesDialogs.glade b/data/SoftwarePropertiesDialogs.glade
index a4d7ff41..7ff8d976 100644
--- a/data/SoftwarePropertiesDialogs.glade
+++ b/data/SoftwarePropertiesDialogs.glade
@@ -709,7 +709,7 @@ The APT line contains the type, location and sections of a channel, for example
<child>
<widget class="GtkLabel" id="label40">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Sections:&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Components:&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>