summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-01-23 22:54:41 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-01-23 22:54:41 +0100
commit4614765fb73d85f350f4f525a216386f01cbec0d (patch)
tree09b2334e2e7b8e000ba1533e17ed8dea8c841638
parent39915e9f6f204c2ded4d976621b6a1a37b6c3548 (diff)
parent5d73a0332e39db8a773b1c3af989ed268c1f99e2 (diff)
downloadpython-apt-4614765fb73d85f350f4f525a216386f01cbec0d.tar.gz
* merged sebastians changes
* minor changes to them
-rw-r--r--DistUpgrade/DistUpgrade.glade261
-rw-r--r--DistUpgrade/DistUpgradeControler.py18
-rw-r--r--DistUpgrade/DistUpgradeView.py8
-rw-r--r--DistUpgrade/DistUpgradeViewGtk.py44
4 files changed, 240 insertions, 91 deletions
diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade
index 7ad420da..7df9503e 100644
--- a/DistUpgrade/DistUpgrade.glade
+++ b/DistUpgrade/DistUpgrade.glade
@@ -8,7 +8,7 @@
<property name="visible">True</property>
<property name="title" translatable="yes">Upgrading Ubuntu</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="window_position">GTK_WIN_POS_CENTER</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
@@ -18,7 +18,7 @@
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
- <property name="urgency_hint">False</property>
+ <property name="urgency_hint">True</property>
<signal name="delete_event" handler="on_window_main_delete_event" last_modification_time="Mon, 23 Jan 2006 15:30:09 GMT"/>
<signal name="destroy_event" handler="on_window_main_destroy_event" last_modification_time="Mon, 23 Jan 2006 15:30:19 GMT"/>
@@ -349,30 +349,6 @@
<property name="fill">False</property>
</packing>
</child>
-
- <child>
- <widget class="GtkLabel" id="label_extra_status">
- <property name="label" translatable="yes"></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>
@@ -383,9 +359,11 @@
<child>
<widget class="GtkExpander" id="expander_terminal">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="expanded">False</property>
- <property name="spacing">0</property>
+ <property name="spacing">4</property>
<child>
<widget class="GtkHBox" id="hbox1">
@@ -502,7 +480,8 @@
</widget>
<widget class="GtkDialog" id="dialog_changes">
- <property name="title" translatable="yes">Changes</property>
+ <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">False</property>
@@ -511,13 +490,13 @@
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</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">False</property>
- <property name="has_separator">True</property>
+ <property name="urgency_hint">True</property>
+ <property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="vbox2">
@@ -535,11 +514,11 @@
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
- <property name="label">gtk-no</property>
+ <property name="label">gtk-cancel</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">-9</property>
+ <property name="response_id">-6</property>
</widget>
</child>
@@ -548,8 +527,8 @@
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
- <property name="label">gtk-yes</property>
- <property name="use_stock">True</property>
+ <property name="label">_Continue</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>
@@ -576,34 +555,9 @@
<property name="visible">True</property>
<property name="label" translatable="yes"></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="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Confirm changes:&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="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
@@ -720,4 +674,187 @@
</child>
</widget>
+<widget class="GtkDialog" id="dialog_restart">
+ <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">False</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-vbox1">
+ <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_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button_restart">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="response_id">-8</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-refresh</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</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">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label20">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Restart Now</property>
+ <property name="use_underline">True</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>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="button_restart">
+ <property name="visible">True</property>
+ <property name="can_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="hbox5">
+ <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="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-dialog-info</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="GtkLabel" id="label19">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;&lt;big&gt;Restart the system to complete the upgrade&lt;/big&gt;&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</property>
+ <property name="yalign">0</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>
+ </child>
+</widget>
+
</glade-interface>
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py
index 6689b4d0..46ad948e 100644
--- a/DistUpgrade/DistUpgradeControler.py
+++ b/DistUpgrade/DistUpgradeControler.py
@@ -232,13 +232,6 @@ class DistUpgradeControler(object):
"%s" % e)
self.cache.commit(fprogress,iprogress)
- def askForReboot(self):
- return self._view.askYesNoQuestion(_("Reboot required"),
- _("The upgrade is finished now. "
- "A reboot is required to "
- "now, do you want to do this "
- "now?"))
-
def abort(self):
""" abort the upgrade, cleanup (as much as possible) """
self.sources.restoreBackup(self.sources_backup_ext)
@@ -248,7 +241,7 @@ class DistUpgradeControler(object):
# this is the core
def dapperUpgrade(self):
# sanity check (check for ubuntu-desktop, brokenCache etc)
- self._view.updateStatus(_("Checking the system"))
+ self._view.updateStatus(_("Checking update system"))
self._view.setStep(1)
self.openCache()
if not self.cache.sanityCheck(self._view):
@@ -267,16 +260,17 @@ class DistUpgradeControler(object):
self.abort()
# then open the cache (again)
- self._view.updateStatus(_("Reading cache"))
+ self._view.updateStatus(_("Checking update system"))
self.openCache()
# calc the dist-upgrade and see if the removals are ok/expected
# do the dist-upgrade
self._view.setStep(3)
- self._view.updateStatus(_("Performing the upgrade"))
+ self._view.updateStatus(_("Asking for confirmation"))
if not self.askDistUpgrade():
self.abort()
-
+
+ self._view.updateStatus(_("Performing the upgrade"))
if not self.doDistUpgrade():
self.abort()
@@ -285,7 +279,7 @@ class DistUpgradeControler(object):
self.doPostUpgrade()
# done, ask for reboot
- if self.askForReboot():
+ if self._view.confirmRestart():
subprocess.call(["reboot"])
def run(self):
diff --git a/DistUpgrade/DistUpgradeView.py b/DistUpgrade/DistUpgradeView.py
index ba223a1b..abc5b340 100644
--- a/DistUpgrade/DistUpgradeView.py
+++ b/DistUpgrade/DistUpgradeView.py
@@ -61,6 +61,14 @@ class DistUpgradeView(object):
def askYesNoQuestion(self, summary, msg):
" ask a Yes/No question and return True on 'Yes' "
pass
+ def confirmRestart(self):
+ " generic ask about the restart, can be overriden "
+ summary = _("Reboot required")
+ msg = _("The upgrade is finished now. "
+ "A reboot is required to "
+ "now, do you want to do this "
+ "now?")
+ return self.askYesNoQuestion(summary, msg)
def error(self, summary, msg, extended_msg=None):
" display a error "
pass
diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py
index a313ce4f..fe002b15 100644
--- a/DistUpgrade/DistUpgradeViewGtk.py
+++ b/DistUpgrade/DistUpgradeViewGtk.py
@@ -44,7 +44,7 @@ class GtkOpProgress(apt.progress.OpProgress):
self.progressbar = progressbar
def update(self, percent):
#self._progressbar.show()
- self.progressbar.set_text(self.op)
+ #self.progressbar.set_text(self.op)
self.progressbar.set_fraction(percent/100.0)
while gtk.events_pending():
gtk.main_iteration()
@@ -59,7 +59,7 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress):
# FIXME2: we need to thing about mediaCheck here too
def __init__(self, parent):
# if this is set to false the download will cancel
- self.status = parent.label_extra_status
+ self.status = parent.label_status
self.progress = parent.progressbar_cache
def mediaChange(self, medium, drive):
#print "mediaChange %s %s" % (medium, drive)
@@ -87,15 +87,18 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress):
# FIXME: move the status_str and progress_str into python-apt
# (python-apt need i18n first for this)
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))))
+ self.progress.set_text(_("%s remaining" % apt_pkg.TimeToStr(self.eta)))
+ else:
+ self.status.set_text(_("Downloading file %li of %li with unknown speed" % (currentItem, self.totalItems)))
+ self.progress.set_text(" ")
+
while gtk.events_pending():
gtk.main_iteration()
return True
@@ -103,7 +106,7 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress):
class GtkInstallProgressAdapter(InstallProgress):
def __init__(self,parent):
InstallProgress.__init__(self)
- self.label_status = parent.label_extra_status
+ self.label_status = parent.label_status
self.progress = parent.progressbar_cache
self.expander = parent.expander_terminal
self.term = parent._term
@@ -121,11 +124,11 @@ class GtkInstallProgressAdapter(InstallProgress):
#self.progress.show()
self.progress.set_fraction(0.0)
self.progress.set_text(" ")
- self.expander.show()
+ self.expander.set_sensitive(True)
self.term.show()
self.env = ["VTE_PTY_KEEP_FD=%s"% self.writefd,
"DEBIAN_FRONTEND=gnome",
- "APT_LISTCHANGES_FRONTEND=gtk"]
+ "APT_LISTCHANGES_FRONTEND=none"]
def error(self, pkg, errormsg):
dialog = gtk.MessageDialog(self.parent.window_main, 0,
gtk.MESSAGE_ERROR,
@@ -182,7 +185,8 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
def __init__(self):
# FIXME: i18n must be somewhere relative do this dir
SimpleGladeApp.__init__(self, "DistUpgrade.glade",
- None, domain="update-manager")
+ None, domain="update-manager",
+ position="gtk.WIN_POS_CENTER")
self._opCacheProgress = GtkOpProgress(self.progressbar_cache)
self._fetchProgress = GtkFetchProgressAdapter(self)
self._installProgress = GtkInstallProgressAdapter(self)
@@ -195,16 +199,12 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
self.treeview_details.append_column(column)
self.treeview_details.set_model(self.details_list)
self.vscrollbar_terminal.set_adjustment(self._term.get_adjustment())
- # Use italic style in the status labels
+ # Use italic style in the status labels
attrlist=pango.AttrList()
attr = pango.AttrStyle(pango.STYLE_ITALIC, 0, -1)
attrlist.insert(attr)
-
-
self.label_status.set_property("attributes", attrlist)
- self.label_extra_status.set_property("attributes", attrlist)
- #self.label_status_extra.set_property("attributes", pango.AttrStyle(pango.STYLE_ITALIC, 0, -1))
def create_terminal(self, arg1,arg2,arg3,arg4):
" helper to create a vte terminal "
@@ -257,10 +257,11 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
dialog.run()
dialog.destroy()
return False
+
def confirmChanges(self, summary, changes, downloadSize):
# FIXME: add a whitelist here for packages that we expect to be
# removed (how to calc this automatically?)
- DistUpgradeView.confirmChanges(self, summary, changes,downloadSize)
+ DistUpgradeView.confirmChanges(self, summary, changes, downloadSize)
self.label_summary.set_markup("<big><b>%s</b></big>" % summary)
msg = _("%s packages are going to be removed.\n"
"%s packages are going to be newly installed.\n"
@@ -284,6 +285,7 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
if res == gtk.RESPONSE_YES:
return True
return False
+
def askYesNoQuestion(self, summary, msg):
msg = "<big><b>%s</b></big>\n\n%s" % (summary,msg)
dialog = gtk.MessageDialog(parent=self.window_main,
@@ -296,6 +298,14 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
if res == gtk.RESPONSE_YES:
return True
return False
+
+ def confirmRestart(self):
+ self.dialog_restart.set_transient_for(self.window_main)
+ res = self.dialog_restart.run()
+ self.dialog_restart.hide()
+ if res == gtk.RESPONSE_YES:
+ return True
+ return False
def on_window_main_delete_event(self, widget, event):
#print "on_window_main_delete_event()"