summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglatzor@ubuntu.com <>2006-07-21 17:11:10 +0200
committerglatzor@ubuntu.com <>2006-07-21 17:11:10 +0200
commitea2c5c8a8ea54060b7292775d9e8ceb7085235af (patch)
treeed05a33784e77dc6886573f36a92b216419074e4
parent880b57ed3239de18b942945aead95d18844c715e (diff)
downloadpython-apt-ea2c5c8a8ea54060b7292775d9e8ceb7085235af.tar.gz
* rearrange download section in the user interface
* fix some bugs because of the cdrom /download sources separation
-rw-r--r--SoftwareProperties/SoftwareProperties.py31
-rw-r--r--SoftwareProperties/aptsources.py2
-rw-r--r--data/SoftwareProperties.glade204
3 files changed, 102 insertions, 135 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py
index ec02edb3..9bc19cdd 100644
--- a/SoftwareProperties/SoftwareProperties.py
+++ b/SoftwareProperties/SoftwareProperties.py
@@ -118,7 +118,9 @@ class Distribution:
self.main_sources = []
self.disabled_sources = []
self.cdrom_sources = []
+ self.download_comps = []
self.enabled_comps = []
+ self.cdrom_comps = []
self.used_media = []
self.get_source_code = False
self.source_code_sources = []
@@ -144,6 +146,8 @@ class Distribution:
# find main and child sources
media = []
comps = []
+ cdrom_comps = []
+ enabled_comps = []
source_code = []
for source in sources_list.list:
if source.invalid == False and\
@@ -154,7 +158,8 @@ class Distribution:
# cdroms need do be handled differently
if source.uri.startswith("cdrom:"):
self.cdrom_sources.append(source)
- if source.type == "deb" and source.disabled == False:
+ cdrom_comps.extend(source.comps)
+ elif source.type == "deb" and source.disabled == False:
self.main_sources.append(source)
comps.extend(source.comps)
media.append(source.uri)
@@ -170,7 +175,11 @@ class Distribution:
self.child_sources.append(source)
elif source.type == "deb-src":
self.source_code_sources.append(source)
- self.enabled_comps = set(comps)
+ self.download_comps = set(comps)
+ self.cdrom_comps = set(cdrom_comps)
+ enabled_comps.extend(comps)
+ enabled_comps.extend(cdrom_comps)
+ self.enabled_comps = set(enabled_comps)
self.used_media = set(media)
self.get_mirrors()
@@ -271,8 +280,6 @@ class SoftwareProperties(SimpleGladeApp):
self.window_main.show()
- # internet update setings
-
# this maps the key (combo-box-index) to the auto-update-interval value
# where (-1) means, no key
self.combobox_interval_mapping = { 0 : 1,
@@ -384,7 +391,7 @@ class SoftwareProperties(SimpleGladeApp):
Represent the distro information in the user interface
"""
# TRANS: %s stands for the distribution name e.g. Debian or Ubuntu
- self.label_updates.set_label("<b>%s</b>" % (_("%s Updates") %\
+ self.label_updates.set_label("<b>%s</b>" % (_("%s updates") %\
self.distribution.id))
# TRANS: %s stands for the distribution name e.g. Debian or Ubuntu
self.label_dist_name.set_label("%s" % self.distribution.description)
@@ -396,7 +403,7 @@ class SoftwareProperties(SimpleGladeApp):
checkbox = gtk.CheckButton(label=self.distribution.source_template.components[comp][2])
# check if the comp is enabled
# FIXME: use inconsistence if there are main sources with not all comps
- if comp in self.distribution.enabled_comps:
+ if comp in self.distribution.download_comps:
checkbox.set_active(True)
# setup the callback and show the checkbutton
checkbox.connect("toggled", self.on_component_toggled, comp)
@@ -486,7 +493,6 @@ class SoftwareProperties(SimpleGladeApp):
templates[source.template] = set(source.comps)
# add fake http sources for the cdrom, since the sources
# for the cdrom are only available in the internet
- pdb.set_trace()
for source in self.distribution.cdrom_sources:
# FIXME: produces a key error
if templates.has_key(self.distribution.source_template):
@@ -533,6 +539,7 @@ class SoftwareProperties(SimpleGladeApp):
sources = []
sources.extend(self.distribution.main_sources)
sources.extend(self.distribution.child_sources)
+ sources.extend(self.distribution.source_code_sources)
if checkbutton.get_active() == True:
# check if there is a main source at all
if len(self.distribution.main_sources) < 1:
@@ -547,6 +554,10 @@ class SoftwareProperties(SimpleGladeApp):
for source in self.distribution.source_code_sources:
if comp not in source.comps: source.comps.append(comp)
else:
+ if comp in self.distribution.cdrom_comps:
+ sources = []
+ sources.extend(self.distribution.main_sources)
+
for source in sources:
if comp in source.comps:
source.comps.remove(comp)
@@ -562,8 +573,6 @@ class SoftwareProperties(SimpleGladeApp):
for source in self.sourceslist:
print source.str()
print "END SOURCES.LIST\n"
- self.distribution.get_sources(self.sourceslist)
- self.distro_to_widgets()
def on_checkbutton_child_toggled(self, checkbutton, template):
"""
@@ -712,6 +721,7 @@ class SoftwareProperties(SimpleGladeApp):
def on_channel_toggled(self, cell_toggle, path, store):
"""Enable or disable the selected channel"""
+ #FIXME cdroms need to disable the comps in the childs and sources
iter = store.get_iter((int(path),))
source_entry = store.get_value(iter, STORE_SOURCE)
source_entry.disabled = not source_entry.disabled
@@ -744,6 +754,8 @@ class SoftwareProperties(SimpleGladeApp):
#self.save_sourceslist()
#self.reload_sourceslist()
self.modified = True
+ self.distribution.get_sources(self.sourceslist)
+ self.distro_to_widgets()
def render_source(self, source):
"""Render a nice output to show the source in a treeview"""
@@ -812,6 +824,7 @@ class SoftwareProperties(SimpleGladeApp):
for source in self.sourceslist.list:
if not source.invalid and\
(source not in self.distribution.main_sources and\
+ source not in self.distribution.cdrom_sources and\
source not in self.distribution.child_sources and\
source not in self.distribution.disabled_sources) and\
source not in self.distribution.source_code_sources:
diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py
index f96bd959..4e76824d 100644
--- a/SoftwareProperties/aptsources.py
+++ b/SoftwareProperties/aptsources.py
@@ -264,7 +264,7 @@ class SourcesList:
new_entry.file = file
self.matcher.match(new_entry)
self.list.insert(pos, new_entry)
- return source
+ return new_entry
def remove(self, source_entry):
self.list.remove(source_entry)
diff --git a/data/SoftwareProperties.glade b/data/SoftwareProperties.glade
index b0ab7144..b541ab65 100644
--- a/data/SoftwareProperties.glade
+++ b/data/SoftwareProperties.glade
@@ -76,13 +76,45 @@
<property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="vbox_dist_comps">
+ <widget class="GtkVBox" id="vbox21">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
- <placeholder/>
+ <widget class="GtkVBox" id="vbox_dist_comps">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="checkbutton_source_code">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Source code</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
</child>
</widget>
<packing>
@@ -91,109 +123,50 @@
<property name="fill">True</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label_dist_name">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Downloadable software&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame8">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment9">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
- <property name="top_padding">6</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">12</property>
- <property name="right_padding">0</property>
-
- <child>
- <widget class="GtkVBox" id="vbox17">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
<child>
- <widget class="GtkLabel" id="label15">
+ <widget class="GtkHBox" id="hbox6">
<property name="visible">True</property>
- <property name="label" translatable="yes">Download from:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
- <child>
- <widget class="GtkComboBox" id="combobox_server">
- <property name="visible">True</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
+ <child>
+ <widget class="GtkLabel" id="label15">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Download from:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkComboBox" id="combobox_server">
+ <property name="visible">True</property>
+ <property name="add_tearoffs">False</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -204,38 +177,19 @@
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton_source_code">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Source code</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
</widget>
</child>
</widget>
</child>
<child>
- <widget class="GtkLabel" id="label17">
+ <widget class="GtkLabel" id="label_dist_name">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Download options&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Downloadable software&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -433,7 +387,7 @@
<child>
<widget class="GtkLabel" id="label_updates">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Internet Updates&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Internet updates&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -679,7 +633,7 @@
<child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Automatic Updates&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Automatic updates&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>