summaryrefslogtreecommitdiff
path: root/DistUpgrade
diff options
context:
space:
mode:
authorMichael Vogt <egon@top>2005-12-06 13:17:11 +0100
committerMichael Vogt <egon@top>2005-12-06 13:17:11 +0100
commit5551d6d2364b1db2c4180ed5f882020019604eb5 (patch)
tree0ea3b3c019ea68b7be9aa56aa823bbaae8211268 /DistUpgrade
parent80a5b5749d1cb3dae6763f6b3556dbc4db64fe56 (diff)
downloadpython-apt-5551d6d2364b1db2c4180ed5f882020019604eb5.tar.gz
* started with the dist-upgrade confirm dialog
Diffstat (limited to 'DistUpgrade')
-rw-r--r--DistUpgrade/DistUpgrade.glade121
-rw-r--r--DistUpgrade/DistUpgrade.py44
2 files changed, 162 insertions, 3 deletions
diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade
index 0235edcc..7651d2cd 100644
--- a/DistUpgrade/DistUpgrade.glade
+++ b/DistUpgrade/DistUpgrade.glade
@@ -98,4 +98,125 @@
</child>
</widget>
+<widget class="GtkDialog" id="dialog_details">
+ <property name="title" translatable="yes">Details</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="default_width">400</property>
+ <property name="default_height">200</property>
+ <property name="resizable">True</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="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>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="button_changes_ok">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</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">-5</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="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Required 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="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>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTreeView" id="treeview_details">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">False</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ <property name="fixed_height_mode">False</property>
+ <property name="hover_selection">False</property>
+ <property name="hover_expand">False</property>
+ </widget>
+ </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>
diff --git a/DistUpgrade/DistUpgrade.py b/DistUpgrade/DistUpgrade.py
index 262229a6..0897104b 100644
--- a/DistUpgrade/DistUpgrade.py
+++ b/DistUpgrade/DistUpgrade.py
@@ -37,6 +37,18 @@ class DistUpgradeView(object):
on the current view
"""
pass
+ def confirmChanges(self, changes):
+ """ display the list of changed packages (apt.Package) and
+ return if the user confirms them
+ """
+ self.toInstall = []
+ self.toUpgrade = []
+ self.toRemove = []
+ for pkg in changes:
+ if pkg.markedUpgrade: toUpgrade.append(pkg)
+ elif pkg.markedInstall: toInstall.append(pkg)
+ elif pkg.markedRemove: toRemove.append(pkg)
+ assert(len(self.toInstall)+len(self.toUpgrade)+len(self.toRemove) == len(changes))
def askYesNoQuestion(self, summary, msg):
pass
def error(self, summary, msg):
@@ -83,6 +95,15 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
None, domain="update-manager")
self._opCacheProgress = GtkOpProgress(self.progressbar_cache)
self._fetchProgress = self.GtkFetchProgressAdapter(self)
+ # details dialog
+ self.details_list = gtk.ListStore(gobject.TYPE_STRING)
+ column = gtk.TreeViewColumn("")
+ render = gtk.CellRendererText()
+ column.pack_start(render, True)
+ column.add_attribute(render, "markup", 0)
+ self.treeview_details.append_column(column)
+ self.treeview_details.set_model(self.details_list)
+
def getFetchProgress(self):
return self._fetchProgress
def getOpCacheProgress(self):
@@ -98,6 +119,18 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
dialog.run()
dialog.destroy()
return False
+ def confirmChanges(self, changes):
+ DistUpgradeView.cnfirmChanges(self, changes)
+ self.details_list.clear()
+ for rm in toRemove:
+ self.details_list.append([_("<b>To be removed: %s</b>" % rm)])
+ for inst in toInstall:
+ self.details_list.append([_("To be installed: %s" % inst)])
+ for up in toUpgrade:
+ self.details_list.append([_("To be upgraded: %s" % up)])
+ res = self.dialog_details.run()
+ self.dialog_details.hide()
+ return True
def askYesNoQuestion(self, summary, msg):
msg = "<big><b>%s</b></big>\n\n%s" % (summary,msg)
dialog = gtk.MessageDialog(parent=self.window_main,
@@ -202,6 +235,8 @@ class DistUpgradeControler(object):
return True
def doPreUpgrade(self):
+ # FIXME: check out what packages are downloadable etc to
+ # compare the list after the update again
pass
def doUpdate(self):
@@ -210,8 +245,10 @@ class DistUpgradeControler(object):
self._cache.update(progress)
def doDistUpgrade(self):
- self._view.askYesNoQuestion(_("Do the upgrade"),
- _("lala lala"))
+ self._cache.upgrade(True)
+ changes = self._cache.getChanges()
+ res = self._view.confirmChanges(changes)
+ return res
def breezyUpgrade(self):
# sanity check (check for ubuntu-desktop, brokenCache etc)
@@ -235,7 +272,8 @@ class DistUpgradeControler(object):
# calc the dist-upgrade and see if the removals are ok/expected
# do the dist-upgrade
- self.doDistUpgrade()
+ if not self.doDistUpgrade():
+ sys.exit(1)
# do post-upgrade stuff