diff options
| author | glatzor@ubuntu.com <> | 2006-09-11 17:16:38 +0200 |
|---|---|---|
| committer | glatzor@ubuntu.com <> | 2006-09-11 17:16:38 +0200 |
| commit | 2e2c637be425f7ecb4cbaeb8aa27e92c47c54fa0 (patch) | |
| tree | 8f1ac02bb27c00f7ced9ba356eef51707bd46ad5 | |
| parent | d37a18474fd00a9cb3e57f13517628095c15bba7 (diff) | |
| download | python-apt-2e2c637be425f7ecb4cbaeb8aa27e92c47c54fa0.tar.gz | |
* Move the "run full dit upgrade" dialog into the UpdateManager class -
to avoid spliting the UI stuff into several classes
* Use a glade based dialog with better buttons instead of yes/no
* Improved wording
| -rw-r--r-- | UpdateManager/UpdateManager.py | 46 | ||||
| -rw-r--r-- | data/glade/UpdateManager.glade | 163 |
2 files changed, 177 insertions, 32 deletions
diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 343dcd85..69308ec6 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -219,7 +219,7 @@ class UpdateList: self.importance = importance self.description = desc - def __init__(self, parent_window): + def __init__(self): # a map of packages under their origin pipe = os.popen("lsb_release -c -s") dist = pipe.read().strip() @@ -236,14 +236,12 @@ class UpdateList: self.pkgs = {} self.matcher = {} self.num_updates = 0 - self.parent_window = parent_window for (origin, archive, desc, importance) in templates: self.matcher[(origin, archive)] = self.UpdateOrigin(desc, importance) self.unknown_origin = self.UpdateOrigin(_("Other updates"), -1) def update(self, cache): held_back = [] - broken = [] # do the upgrade cache.saveDistUpgrade() @@ -268,34 +266,7 @@ class UpdateList: held_back.append(pkg.name) for l in self.pkgs.keys(): self.pkgs[l].sort(lambda x,y: cmp(x.name,y.name)) - - # check if we have held-back something - if cache._depcache.KeepCount > 0: - keepcount = cache._depcache.KeepCount - msg = ("<big><b>%s</b></big>\n\n%s" % \ - (_("Cannot install all available updates"), - _("Some of the updates require more extensive changes " - "than expected.\n\n" - "This usually means that you have enabled unoffical " - "repositories, that it is not " - "fully upgraded from the last distribution release or " - "that you run a development release " - "of the distribution.\n\n" - "Would you like to perform a full distribution upgrade " - "now?"))) - dialog = gtk.MessageDialog(self.parent_window, 0, - gtk.MESSAGE_QUESTION, - gtk.BUTTONS_YES_NO,"") - dialog.set_default_response(gtk.RESPONSE_NO) - dialog.set_markup(msg) - dialog.set_title("") - dialog.vbox.set_spacing(6) - res = dialog.run() - if res == gtk.RESPONSE_YES: - os.execl("/usr/bin/gksu", - "/usr/bin/gksu", - "/usr/bin/update-manager --dist-upgrade") - dialog.destroy() + self.keepcount = cache._depcache.KeepCount class UpdateManagerDbusControler(dbus.service.Object): @@ -811,7 +782,7 @@ class UpdateManager(SimpleGladeApp): self.dl_size = 0 self.store.clear() self.initCache() - self.list = UpdateList(self.window_main) + self.list = UpdateList() # fill them again self.list.update(self.cache) @@ -929,6 +900,16 @@ class UpdateManager(SimpleGladeApp): if res == gtk.RESPONSE_YES: self.on_button_reload_clicked(None) + def check_all_updates_installable(self): + """ Check if all available updates can be installed and suggest + to run a distribution upgrade if not """ + if self.list.keepcount > 0: + self.dialog_dist_upgrade.set_transient_for(self.window_main) + res = self.dialog_dist_upgrade.run() + if res == gtk.RESPONSE_YES: + os.execl("/usr/bin/gksu", + "/usr/bin/gksu", + "/usr/bin/update-manager --dist-upgrade") def main(self, options): gconfclient = gconf.client_get_default() @@ -945,5 +926,6 @@ class UpdateManager(SimpleGladeApp): gtk.main_iteration() self.fillstore() + self.check_all_updates_installable() self.check_auto_update() gtk.main() diff --git a/data/glade/UpdateManager.glade b/data/glade/UpdateManager.glade index bb78008c..e9fd6bfc 100644 --- a/data/glade/UpdateManager.glade +++ b/data/glade/UpdateManager.glade @@ -1453,4 +1453,167 @@ Software updates correct errors, eliminate security vulnerabilities and provide </child> </widget> +<widget class="GtkDialog" id="dialog_dist_upgrade"> + <property name="border_width">6</property> + <property name="title" translatable="yes"></property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property> + <property name="modal">True</property> + <property name="resizable">False</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">True</property> + <property name="skip_pager_hint">True</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">True</property> + <property name="has_separator">False</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox5"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">12</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area5"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="cancelbutton2"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Distribution Upgrade</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-8</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="okbutton3"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-close</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-7</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox20"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">12</property> + + <child> + <widget class="GtkImage" id="image15"> + <property name="visible">True</property> + <property name="stock">gtk-dialog-warning</property> + <property name="icon_size">6</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox18"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">12</property> + + <child> + <widget class="GtkLabel" id="label30"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes"><big><b>Not all updates can be installed</b></big></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">True</property> + <property name="xalign">0</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="GtkLabel" id="label31"> + <property name="visible">True</property> + <property name="label" translatable="yes">Run a distribution upgrade, to install as many updates as possible. + +This can be caused by an uncompleted upgrade, unofficial software packages or by running a development version.</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">True</property> + <property name="selectable">False</property> + <property name="xalign">0</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> + </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> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + </glade-interface> |
