From a018bea8d686418dc8cb5dc443a559b41c8eb4c2 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Dec 2005 14:18:54 +0100 Subject: * ui-polish for the step that are performed --- DistUpgrade/DistUpgrade.glade | 52 +++++++++++++++++++++---------------- DistUpgrade/DistUpgradeControler.py | 12 ++++----- DistUpgrade/DistUpgradeViewGtk.py | 24 +++++++++++------ DistUpgrade/dist-upgrade.py | 5 ++++ 4 files changed, 56 insertions(+), 37 deletions(-) (limited to 'DistUpgrade') diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade index 4773b007..05d6fe10 100644 --- a/DistUpgrade/DistUpgrade.glade +++ b/DistUpgrade/DistUpgrade.glade @@ -30,13 +30,13 @@ True - <big><b>Distribution upgrade</b></big> + <span weight="bold" size="x-large">Distribution upgrade</span> False True GTK_JUSTIFY_LEFT False False - 0.5 + 0 0.5 12 12 @@ -52,6 +52,10 @@ + + + + True @@ -60,7 +64,7 @@ 1 1 0 - 12 + 24 12 12 @@ -70,13 +74,13 @@ 4 2 False - 12 - 12 + 6 + 0 - 16 - 16 + 18 + 18 True 0.5 0.5 @@ -93,8 +97,8 @@ - 16 - 16 + 18 + 18 True 0.5 0.5 @@ -112,8 +116,8 @@ - 16 - 16 + 18 + 18 True 0.5 0.5 @@ -131,8 +135,8 @@ - 16 - 16 + 18 + 18 True 0.5 0.5 @@ -171,7 +175,7 @@ 2 0 1 - fill + expand|shrink|fill @@ -199,7 +203,7 @@ 2 1 2 - fill + expand|shrink|fill @@ -227,7 +231,7 @@ 2 2 3 - fill + expand|shrink|fill @@ -255,7 +259,7 @@ 2 3 4 - fill + expand|shrink|fill @@ -286,13 +290,13 @@ 0 0 12 - 0 + 12 True False - 0 + 6 @@ -301,9 +305,9 @@ False False GTK_JUSTIFY_LEFT - False + True False - 0.5 + 0 0.5 0 0 @@ -321,10 +325,12 @@ + 350 True GTK_PROGRESS_LEFT_TO_RIGHT 0 0.10000000149 + PANGO_ELLIPSIZE_NONE @@ -341,7 +347,7 @@ False False GTK_JUSTIFY_LEFT - False + True False 0 0.5 @@ -412,7 +418,7 @@ True - <b>Action</b> + <b>Current Step</b> False True GTK_JUSTIFY_LEFT diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py index a6fc4111..267cf939 100644 --- a/DistUpgrade/DistUpgradeControler.py +++ b/DistUpgrade/DistUpgradeControler.py @@ -35,12 +35,15 @@ class DistUpgradeControler(object): def __init__(self, distUpgradeView): self._view = distUpgradeView self._view.updateStatus(_("Reading cache")) - self._cache = MyCache(self._view.getOpCacheProgress()) + self._cache = None # some constants here self.fromDist = "hoary" self.toDist = "breezy" self.origin = "Ubuntu" + def openCache(self): + self._cache = MyCache(self._view.getOpCacheProgress()) + def sanityCheck(self): if self._cache._depcache.BrokenCount > 0: # FIXME: we more helpful here and offer to actually fix the @@ -197,6 +200,7 @@ class DistUpgradeControler(object): # sanity check (check for ubuntu-desktop, brokenCache etc) self._view.updateStatus(_("Checking the system")) self._view.setStep(1) + self.openCache() if not self.sanityCheck(): sys.exit(1) @@ -213,7 +217,7 @@ class DistUpgradeControler(object): # then open the cache (again) self._view.updateStatus(_("Reading cache")) - self._cache = MyCache(self._view.getOpCacheProgress()) + self.openCache() # calc the dist-upgrade and see if the removals are ok/expected # do the dist-upgrade @@ -235,7 +239,3 @@ class DistUpgradeControler(object): self.breezyUpgrade() -if __name__ == "__main__": - view = GtkDistUpgradeView() - app = DistUpgradeControler(view) - app.run() diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py index 4bf6e8e2..e78ed287 100644 --- a/DistUpgrade/DistUpgradeViewGtk.py +++ b/DistUpgrade/DistUpgradeViewGtk.py @@ -5,6 +5,7 @@ import gtk.gdk import gtk.glade import vte import gobject +import pango import apt import apt_pkg @@ -18,16 +19,16 @@ from gettext import gettext as _ class GtkOpProgress(apt.progress.OpProgress): def __init__(self, progressbar): - self._progressbar = progressbar + self.progressbar = progressbar def update(self, percent): #self._progressbar.show() - self._progressbar.set_text(self.op) - self._progressbar.set_fraction(percent/100.0) + self.progressbar.set_text(self.op) + self.progressbar.set_fraction(percent/100.0) while gtk.events_pending(): gtk.main_iteration() def done(self): - #self._progressbar.hide() - pass + #self.progressbar.hide() + self.progressbar.set_text(" ") class GtkFetchProgressAdapter(apt.progress.FetchProgress): @@ -44,6 +45,7 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress): self.status.show() def stop(self): #self.progress.hide() + self.progress.set_text(" ") self.status.set_text("") def pulse(self): # FIXME: move the status_str and progress_str into python-apt @@ -81,7 +83,7 @@ class GtkInstallProgressAdapter(InstallProgress): self.label_status.set_text(_("Installing updates ...")) #self.progress.show() self.progress.set_fraction(0.0) - self.progress.set_text("") + self.progress.set_text(" ") self.expander.show() self.term.show() self.env = ["VTE_PTY_KEEP_FD=%s"% self.writefd, @@ -148,15 +150,21 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp): def setStep(self, step): # first update the "last" step as completed size = gtk.ICON_SIZE_MENU + attrlist=pango.AttrList() if step > 1: image = getattr(self,"image_step%i" % (step-1)) label = getattr(self,"label_step%i" % (step-1)) image.set_from_stock(gtk.STOCK_APPLY, size) + label.set_property("attributes",attrlist) image = getattr(self,"image_step%i" % step) label = getattr(self,"label_step%i" % step) image.set_from_stock(gtk.STOCK_YES, size) - - + # we can't make it bold here without layout changes in the view :( + #attr = pango.AttrWeight(pango.WEIGHT_BOLD, 0, -1) + attr = pango.AttrStyle(pango.STYLE_ITALIC, 0, -1) + attrlist.insert(attr) + label.set_property("attributes",attrlist) + def error(self, summary, msg): dialog = gtk.MessageDialog(self.window_main, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,"") diff --git a/DistUpgrade/dist-upgrade.py b/DistUpgrade/dist-upgrade.py index 4ac8422b..022e87d2 100755 --- a/DistUpgrade/dist-upgrade.py +++ b/DistUpgrade/dist-upgrade.py @@ -7,3 +7,8 @@ if __name__ == "__main__": view = GtkDistUpgradeView() app = DistUpgradeControler(view) app.run() + + # testcode to see if the bullets look nice in the dialog + #for i in range(4): + # view.setStep(i+1) + # app.openCache() -- cgit v1.2.3