From 2592b1a3ce1da07de5bd40798be04d60879a8a69 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 27 Mar 2006 14:55:05 +0200 Subject: * a decent conffile dialog added --- DistUpgrade/DistUpgrade.glade | 342 ++++++++++++++++++++++++++++++++++++++ DistUpgrade/DistUpgradeViewGtk.py | 34 +++- DistUpgrade/TODO | 3 +- 3 files changed, 376 insertions(+), 3 deletions(-) (limited to 'DistUpgrade') diff --git a/DistUpgrade/DistUpgrade.glade b/DistUpgrade/DistUpgrade.glade index 08b96a11..8d82b7c5 100644 --- a/DistUpgrade/DistUpgrade.glade +++ b/DistUpgrade/DistUpgrade.glade @@ -1441,4 +1441,346 @@ The system could be in an unusable state if you cancel the upgrade. You are stro + + 5 + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER_ON_PARENT + True + False + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + False + + + + True + False + 12 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + True + True + GTK_RELIEF_NORMAL + True + -9 + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-cancel + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Keep + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + GTK_RELIEF_NORMAL + True + -8 + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-ok + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Replace + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + + + 0 + False + True + GTK_PACK_END + + + + + + 6 + True + False + 12 + + + + True + gtk-dialog-question + 6 + 0 + 0 + 0 + 0 + + + 0 + False + False + + + + + + True + False + 12 + + + + True + + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + True + True + False + 0 + + + + True + False + 0 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + 300 + True + True + False + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + False + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + False + False + + + + + + + + True + Difference between the files + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + label_item + + + + + 0 + True + True + + + + + + diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py index a6847cc7..1e1edc67 100644 --- a/DistUpgrade/DistUpgradeViewGtk.py +++ b/DistUpgrade/DistUpgradeViewGtk.py @@ -30,6 +30,7 @@ import pango import sys import logging import time +import subprocess import apt import apt_pkg @@ -158,7 +159,31 @@ class GtkInstallProgressAdapter(InstallProgress): def conffile(self, current, new): logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current) - self.expander.set_expanded(True) + #self.expander.set_expanded(True) + prim = _("Replace configuration file\n'%s'?" % current) + sec = ("The configuration file %s was modified (by " + "you or by a script). An updated version is shipped " + "in this package. If you want to keep your current " + "version say 'Keep'. Do you want to replace the " + "current file and install the new package " + "maintainers version? " % current) + markup = "%s \n\n%s" % (prim, sec) + self.parent.label_conffile.set_markup(markup) + self.parent.dialog_conffile.set_transient_for(self.parent.window_main) + + # now get the diff + cmd = ["/usr/bin/diff", "-u", current, new] + diff = utf8(subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0]) + self.parent.textview_conffile.get_buffer().set_text(diff) + res = self.parent.dialog_conffile.run() + self.parent.dialog_conffile.hide() + # if replace, send this to the terminal + if res == gtk.RESPONSE_YES: + self.term.feed_child("y\n") + else: + self.term.feed_child("n\n") + + def fork(self): pid = self.term.forkpty(envv=self.env) return pid @@ -408,7 +433,11 @@ class DistUpgradeViewGtk(DistUpgradeView,SimpleGladeApp): return True if __name__ == "__main__": + view = DistUpgradeViewGtk() + ip = GtkInstallProgressAdapter(view) + ip.conffile("TODO","TODO~") + view.error("short","long", "asfds afsdj af asdf asdf asf dsa fadsf asdf as fasf sextended\n" "asfds afsdj af asdf asdf asf dsa fadsf asdf as fasf sextended\n" @@ -418,4 +447,5 @@ if __name__ == "__main__": "asfds afsdj af asdf asdf asf dsa fadsf asdf as fasf sextended\n" "asfds afsdj af asdf asdf asf dsa fadsf asdf as fasf sextended\n" ) - view.confirmChanges("xx",[], 100) + #view.confirmChanges("xx",[], 100) + diff --git a/DistUpgrade/TODO b/DistUpgrade/TODO index 04c507be..217eb6cb 100644 --- a/DistUpgrade/TODO +++ b/DistUpgrade/TODO @@ -1,10 +1,11 @@ MUSTFIX: -------- * debconf gnome dosn't work (can't connect to the session) + [ should be fixed with the bugfix on gksu ] * display a message that all applications should be closed for the dist-upgrade (and that strange things like a crashing panel can happen) - + [done in current dialog] breezy->dapper -- cgit v1.2.3