From 04314c42545fa783b12c9c7b7ec88200afa5e3f2 Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Wed, 25 Jan 2006 11:44:07 +0100 Subject: DistUpgrade: * set position of main window to "center" and not "center always" Update Manager: * Hopefully fix the close/cancel issue #28932: - Move the install button next to the update treeview. So it is no longer a global action of the dialog and separated from the close button. - Use a close button instead of the cancel button * Check if automatic internet updates is disabled and show an information about the need of reloading as the case may be * unset sensitive of main window during caching * Do not set a title in the download dialog * Show only the time in the progress bar * Use "Downloading file X of Y with 122/s" in the status label * Do not set the update treeview unsensitive during the download of the package related changelog --- UpdateManager/GtkProgress.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'UpdateManager/GtkProgress.py') diff --git a/UpdateManager/GtkProgress.py b/UpdateManager/GtkProgress.py index d25149e4..025858e3 100644 --- a/UpdateManager/GtkProgress.py +++ b/UpdateManager/GtkProgress.py @@ -27,7 +27,7 @@ import apt_pkg from gettext import gettext as _ class GtkOpProgress(apt.OpProgress): - def __init__(self, window,progressbar, parent): + def __init__(self, window, progressbar, parent): self._parent = parent self._window = window self._progressbar = progressbar @@ -37,11 +37,13 @@ class GtkOpProgress(apt.OpProgress): #print self.Op #print self.SubOp self._window.show() + self._parent.set_sensitive(False) self._progressbar.set_text(self.op) self._progressbar.set_fraction(percent/100.0) while gtk.events_pending(): gtk.main_iteration() def done(self): + self._parent.set_sensitive(True) self._window.hide() class GtkFetchProgress(apt.progress.FetchProgress): @@ -59,7 +61,6 @@ class GtkFetchProgress(apt.progress.FetchProgress): if self.summary != "": self.summary.set_markup("%s \n\n%s" % (summary, descr)) - self.window_fetch.set_title(summary) def start(self): self.progress.set_fraction(0) self.window_fetch.show() @@ -69,15 +70,20 @@ class GtkFetchProgress(apt.progress.FetchProgress): self._continue = False def pulse(self): apt.progress.FetchProgress.pulse(self) - if self.currentCPS > 0: - self.status.set_text(_("Download rate: %s/s - %s remaining" % (apt_pkg.SizeToStr(self.currentCPS), apt_pkg.TimeToStr(self.eta)))) - else: - self.status.set_text(_("Download rate: unkown")) - self.progress.set_fraction(self.percent/100.0) currentItem = self.currentItems + 1 if currentItem > self.totalItems: currentItem = self.totalItems - self.progress.set_text(_("Downloading file %li of %li" % (currentItem, self.totalItems))) + if self.currentCPS > 0: + self.status.set_text(_("Downloading file %li of %li with %s/s" + % (currentItem, self.totalItems, + apt_pkg.SizeToStr(self.currentCPS)))) + else: + self.status.set_text(_("Downloading file %li of %li with unknown " + "speed") % (currentItem, self.totalItems)) + self.progress.set_fraction(self.percent/100.0) +# self.progress.set_text(_("Time remaining %s" % (apt_pkg.TimeToStr(self.eta)))) + self.progress.set_text(_("Time remaining")) + while gtk.events_pending(): gtk.main_iteration() return self._continue -- cgit v1.2.3 From fdb6f104af71f36f3e18c737acf91bb87a395687 Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Fri, 27 Jan 2006 20:22:23 +0100 Subject: * Use the label_status in GtkOpProgress and not the progress bar * Set the progress bar in GtkOpProgress to indeterminate - should be reverted * if apt doesn't resets the progress bar several times * Changed a lot of strings * Replaced many tabs by spaces (used python -tt) * Add additional error messages * Use ERROR and not INFO dialogs in case of an error * Use close button in alert dialogs * Unset title of alter dialogs * Changed the fetch dialog to a window, sinec we cannot hide the unused button box in a dialog --- UpdateManager/GtkProgress.py | 42 +++--- UpdateManager/UpdateManager.py | 150 ++++++++++++--------- data/UpdateManager.glade | 291 +++++++++++++++++++---------------------- 3 files changed, 256 insertions(+), 227 deletions(-) (limited to 'UpdateManager/GtkProgress.py') diff --git a/UpdateManager/GtkProgress.py b/UpdateManager/GtkProgress.py index 025858e3..9dd8d6f1 100644 --- a/UpdateManager/GtkProgress.py +++ b/UpdateManager/GtkProgress.py @@ -27,19 +27,28 @@ import apt_pkg from gettext import gettext as _ class GtkOpProgress(apt.OpProgress): - def __init__(self, window, progressbar, parent): + def __init__(self, window, progressbar, status, parent): self._parent = parent self._window = window + self._status = status self._progressbar = progressbar + self._progressbar.set_pulse_step(0.01) + self._progressbar.pulse() window.set_transient_for(parent) def update(self, percent): #print percent #print self.Op #print self.SubOp + # Use pulse until apt doesn't restarts the progress bar + # several times self._window.show() self._parent.set_sensitive(False) - self._progressbar.set_text(self.op) - self._progressbar.set_fraction(percent/100.0) + self._status.set_markup("%s" % self.op) + #self._progressbar.set_fraction(percent/100.0) + if percent > 99: + self._progressbar.set_fraction(1) + else: + self._progressbar.pulse() while gtk.events_pending(): gtk.main_iteration() def done(self): @@ -62,10 +71,10 @@ class GtkFetchProgress(apt.progress.FetchProgress): self.summary.set_markup("%s \n\n%s" % (summary, descr)) def start(self): - self.progress.set_fraction(0) + self.progress.set_fraction(0) self.window_fetch.show() def stop(self): - self.window_fetch.hide() + self.window_fetch.hide() def on_button_fetch_cancel_clicked(self, widget): self._continue = False def pulse(self): @@ -74,16 +83,19 @@ class GtkFetchProgress(apt.progress.FetchProgress): if currentItem > self.totalItems: currentItem = self.totalItems if self.currentCPS > 0: - self.status.set_text(_("Downloading file %li of %li with %s/s" - % (currentItem, self.totalItems, - apt_pkg.SizeToStr(self.currentCPS)))) + statusText = (_("Downloading file %li of %li with %s/s" + % (currentItem, self.totalItems, + apt_pkg.SizeToStr(self.currentCPS)))) else: - self.status.set_text(_("Downloading file %li of %li with unknown " - "speed") % (currentItem, self.totalItems)) - self.progress.set_fraction(self.percent/100.0) -# self.progress.set_text(_("Time remaining %s" % (apt_pkg.TimeToStr(self.eta)))) - self.progress.set_text(_("Time remaining")) + statusText = (_("Downloading file %li of %li with unknown " + "speed") % (currentItem, self.totalItems)) + self.progress.set_fraction(self.percent/100.0) + self.status.set_markup("%s" % statusText) + # TRANSLATORS: show the remaining time in a progress bar: + #self.progress.set_text(_("About %s left" % (apt_pkg.TimeToStr(self.eta)))) + # FIXME: show remaining time + self.progress.set_text("") - while gtk.events_pending(): - gtk.main_iteration() + while gtk.events_pending(): + gtk.main_iteration() return self._continue diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index a4f8ed48..71bbd351 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -142,10 +142,15 @@ class MyCache(apt.Cache): self.all_changes[name] = [alllines, srcpkg] except urllib2.HTTPError: if lock.locked(): - self.all_changes[name] = [_("Changes not found, the server may not be updated yet."), srcpkg] + self.all_changes[name] = [_("The list of changes is not " + "available yet. Please try again " + "later."), srcpkg] except IOError: if lock.locked(): - self.all_changes[name] = [_("Failed to download changes. Please check if there is an active internet connection."), srcpkg] + self.all_changes[name] = [_("Failed to download the list" + "of changes. Please " + "check your internet " + "connection."), srcpkg] if lock.locked(): lock.release() @@ -172,24 +177,19 @@ class UpdateList: self.pkgs.sort(lambda x,y: cmp(x.name,y.name)) if cache._depcache.KeepCount > 0: #print "WARNING, keeping packages" - msg=("%s\n\n%s"%(_("It is not possible to upgrade " - "all packages."), - _("This means that " - "besides the actual upgrade of the " - "packages some further action " - "(such as installing or removing " - "packages) " - "is required. Please use Synaptic " - "\"Smart Upgrade\" or " - "\"apt-get dist-upgrade\" to fix " - "the situation." - ))) + msg = ("%s\n\n%s" % \ + (_("Cannot install all available updates"), + _("Some updates require to install or remove further software. " + "Use the function \"Smart Upgrade\" of the package manager " + "\"Synaptic\" or run \"sudo apt-get dist-upgrade\" in a " + "terminal to update your system completely."))) dialog = gtk.MessageDialog(self.parent_window, 0, gtk.MESSAGE_INFO, - gtk.BUTTONS_OK,"") + gtk.BUTTONS_CLOSE,"") dialog.set_default_response(gtk.RESPONSE_OK) dialog.set_markup(msg) + dialog.set_title("") dialog.vbox.set_spacing(6) - label = gtk.Label(_("The following packages are not upgraded: ")) + label = gtk.Label(_("The following updates will be skipped:")) label.set_alignment(0.0,0.5) dialog.set_border_width(6) label.show() @@ -348,7 +348,7 @@ class UpdateManager(SimpleGladeApp): lock = thread.allocate_lock() lock.acquire() t=thread.start_new_thread(self.cache.get_changelog,(name,lock)) - changes_buffer.set_text(_("Downloading changes...")) + changes_buffer.set_text(_("Downloading the list of changes...")) button = self.button_cancel_dl_changelog button.show() id = button.connect("clicked", @@ -465,24 +465,25 @@ class UpdateManager(SimpleGladeApp): #print "on_button_reload_clicked" #self.invoke_manager(UPDATE) progress = GtkProgress.GtkFetchProgress(self, - _("Downloading package " - "information"), - _("The repositories will be " - "checked for new, removed " - "or upgraded software " - "packages.")) + _("Reloading the information about " + "latest updates"), + _("It is important to check " + "the software sources for " + "available upgrades reguarly.")) # FIXME: do a try/except here otherwise it may bomb try: self.cache.update(progress) except (IOError,SystemError), msg: dialog = gtk.MessageDialog(self.window_main, 0, gtk.MESSAGE_ERROR, - gtk.BUTTONS_OK,"") + gtk.BUTTONS_CLOSE,"") + # FIXME: wording dialog.set_markup("%s"%\ - _("Error reloading")) - dialog.format_secondary_text(_("A error occured during the package " - "list reload. Please see the below " - "information for details what went " - "wrong.")) + _("Could not reload the update information")) + #dialog.format_secondary_text(_("An error occured during the package " + # "list reload. Please see the below " + # "information for details what went " + # "wrong.")) + diaolg.set_title("") dialog.set_border_width(6) dialog.set_size_request(width=500,height=-1) scroll = gtk.ScrolledWindow() @@ -533,7 +534,7 @@ class UpdateManager(SimpleGladeApp): "at the same time. Please close " "this other application first."))); dialog = gtk.MessageDialog(self.window_main, 0, gtk.MESSAGE_ERROR, - gtk.BUTTONS_OK,"") + gtk.BUTTONS_CLOSE,"") dialog.set_markup(msg) dialog.run() dialog.destroy() @@ -548,7 +549,7 @@ class UpdateManager(SimpleGladeApp): win = gtk.Window() win.set_property("type-hint", gtk.gdk.WINDOW_TYPE_HINT_DIALOG) win.set_title("") - win.set_border_width(12) + win.set_border_width(6) win.set_transient_for(self.window_main) win.set_position(gtk.WIN_POS_CENTER_ON_PARENT) win.set_property("skip-taskbar-hint", True) @@ -646,7 +647,7 @@ class UpdateManager(SimpleGladeApp): secondary = _("You need to reload the package list from the servers " "for your changes to take effect. Do you want to do " "this now?") - dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, + dialog = gtk.MessageDialog(self.window_main, 0, gtk.MESSAGE_INFO,gtk.BUTTONS_YES_NO,"") dialog.set_markup(primary); dialog.format_secondary_text(secondary); @@ -691,10 +692,10 @@ class UpdateManager(SimpleGladeApp): name = xml.sax.saxutils.escape(pkg.name) summary = xml.sax.saxutils.escape(pkg.summary) contents = "%s\n%s\n\n" % (name, summary) - contents = contents + _("New version: %s (Size: %s)") % (pkg.candidateVersion,apt.SizeToStr(pkg.packageSize)) + "" + contents = contents + _("New version: %s (Size: %s)") % (pkg.candidateVersion,apt.SizeToStr(pkg.packageSize)) + "" iter = self.store.append([True, contents, pkg.name, pkg.summary, pkg.candidateVersion, pkg.description, pkg]) - self.add_update(pkg) + self.add_update(pkg) i = i + 1 @@ -702,9 +703,15 @@ class UpdateManager(SimpleGladeApp): return False def dist_no_longer_supported(self, meta_release): - msg = "%s\n\n%s" % (_("Your distribution is no longer supported"), _("Please upgrade to a newer version of Ubuntu Linux. The version you are running will no longer get security fixes or other critical updates. Please see http://www.ubuntulinux.org for upgrade information.")) + msg = "%s\n\n%s" % \ + (_("Your distribution is not supported anymore"), + _("You will not get any further security fixes or critical updates. " + "Upgrade to a later version of Ubuntu Linux. See " + "http://www.ubuntulinux.org for more information on " + "upgrading.")) dialog = gtk.MessageDialog(self.window_main, 0, gtk.MESSAGE_WARNING, - gtk.BUTTONS_OK,"") + gtk.BUTTONS_CLOSE,"") + dialog.set_title("") dialog.set_markup(msg) dialog.run() dialog.destroy() @@ -734,11 +741,26 @@ class UpdateManager(SimpleGladeApp): res = self.dialog_release_notes.run() self.dialog_release_notes.hide() except urllib2.HTTPError: - # FIXME: make proper error dialogs here - print _("Release notes not found on the server.") + primary = "%s" % \ + _("Could not find the release notes") + secondary = _("Please check your software sources. Only use " \ + "official Ubuntu servers and mirrors.") + dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, + gtk.MESSAGE_ERROR,gtk.BUTTONS_CLOSE,"") + dialog.set_title("") + dialog.set_markup(primary); + dialog.format_secondary_text(secondary); + dialog.run() except IOError: - print _("Failed to download Release Notes. Please " - "check if there is an active internet connection.") + primary = "%s" % \ + _("Could not download the release notes") + secondary = _("Please check your internet connection.") + dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, + gtk.MESSAGE_ERROR,gtk.BUTTONS_CLOSE,"") + dialog.set_title("") + dialog.set_markup(primary); + dialog.format_secondary_text(secondary); + dialog.run() self.window_main.set_sensitive(True) self.window_main.window.set_cursor(None) # user clicked cancel @@ -750,10 +772,11 @@ class UpdateManager(SimpleGladeApp): os.chdir(tmpdir) if self.new_dist.upgradeTool != None: progress = GtkProgress.GtkFetchProgress(self, - _("Downloading upgrade " - "informtion"), - _("The upgrade information " - "are downloaded")) + _("Downloading the upgrade " + "tool"), + _("The upgrade tool will " + "guide you through the " + "upgrade process.")) fetcher = apt_pkg.GetAcquire(progress) uri = self.new_dist.upgradeTool #print "Downloading %s to %s" % (uri, tmpdir) @@ -775,8 +798,17 @@ class UpdateManager(SimpleGladeApp): # see if we have a script file that we can run script = "%s/%s" % (tmpdir, self.new_dist.name) if not os.path.exists(script): - # FIXME: display a proper error message here - print "no script file found in extracted tarbal" + # no script file found in extracted tarbal + primary = "%s" % \ + _("Could not run the upgrade tool") + secondary = _("Please check your software sources. Only use " \ + "official Ubuntu servers and mirrors.") + dialog = gtk.MessageDialog(self.window_main,gtk.DIALOG_MODAL, + gtk.MESSAGE_ERROR,gtk.BUTTONS_CLOSE,"") + dialog.set_title("") + dialog.set_markup(primary); + dialog.format_secondary_text(secondary); + dialog.run() else: #print "runing: %s" % script os.execv(script,[]) @@ -825,13 +857,14 @@ class UpdateManager(SimpleGladeApp): d = gtk.MessageDialog(parent=self.window_main, flags=gtk.DIALOG_MODAL, type=gtk.MESSAGE_ERROR, - buttons=gtk.BUTTONS_OK) + buttons=gtk.BUTTONS_CLOSE) d.set_markup("%s\n\n%s" % ( - _("Unable to get exclusive lock"), - _("This usually means that another package management " - "application (like apt-get or aptitude) already running. " - "Please close that application first"))) + _("Only one software management tool is allowed to " + "run at the same time"), + _("Please close the other application e.g. \"aptitude\" " + "or \"Synaptic\" at first."))) print "error from apt: '%s'" % e + d.set_title("") res = d.run() d.destroy() sys.exit() @@ -839,20 +872,19 @@ class UpdateManager(SimpleGladeApp): try: self.cache = MyCache(GtkProgress.GtkOpProgress(self.dialog_cacheprogress, self.progressbar_cache, + self.label_cache, self.window_main)) except AssertionError: # we assert a clean cache msg=("%s\n\n%s"% \ - (_("Your system has broken packages!"), - _("This means that some dependencies " - "of the installed packages are not " - "satisfied. Please use \"Synaptic\" " - "or \"apt-get\" to fix the " - "situation." - ))) + (_("Software index is broken"), + _("It is impossible to install or remove any software. " + "Please use the package manager \"Synaptic\" or run " + "\"sudo apt-get install -f\" in a terminal to fix " + "this issue at first."))) dialog = gtk.MessageDialog(self.window_main, 0, gtk.MESSAGE_ERROR, - gtk.BUTTONS_OK,"") + gtk.BUTTONS_CLOSE,"") dialog.set_markup(msg) dialog.vbox.set_spacing(6) dialog.run() diff --git a/data/UpdateManager.glade b/data/UpdateManager.glade index 58413506..cd356791 100644 --- a/data/UpdateManager.glade +++ b/data/UpdateManager.glade @@ -66,7 +66,7 @@ True - <big><b>Install software updates</b></big> + <big><b>Keep your system up-to-date</b></big> True True GTK_JUSTIFY_LEFT @@ -489,7 +489,7 @@ True - Cancel downloading of the changelog + Cancel _Download True False GTK_JUSTIFY_LEFT @@ -1051,14 +1051,14 @@ Need to get the changes from the central server GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER_ON_PARENT - True - True + False + False False synaptic.xpm True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL + True + True + GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST True False @@ -1076,37 +1076,37 @@ Need to get the changes from the central server False 12 + + + True + + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + True False 6 - - - True - - False - True - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - True @@ -1265,127 +1265,6 @@ Need to get the changes from the central server - - 6 - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER_ON_PARENT - False - False - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - False - - - - True - False - 12 - - - - True - GTK_BUTTONBOX_END - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - False - 6 - - - - True - <big><b>Loading software information</b></big> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - False - False - GTK_JUSTIFY_LEFT - True - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - GTK_PROGRESS_LEFT_TO_RIGHT - 0 - 0.10000000149 - PANGO_ELLIPSIZE_NONE - - - 0 - False - False - - - - - - - - - 0 - True - True - - - - - - 6 @@ -1572,4 +1451,110 @@ Your system does not check for updates automatically. You can configure this beh + + 6 + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + True + True + True + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + + + + 6 + True + False + 12 + + + + True + <big><b>Checking for available updates</b></big> + +Software updates can fix possible security holes, fix possible errors, so called "bugs", or provide new features to you. + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + True + False + 6 + + + + True + GTK_PROGRESS_LEFT_TO_RIGHT + 0 + 0.10000000149 + PANGO_ELLIPSIZE_NONE + + + 0 + False + False + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 0 + False + False + + + + + + -- cgit v1.2.3