summaryrefslogtreecommitdiff
path: root/DistUpgrade
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-01-11 14:51:46 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-01-11 14:51:46 +0100
commit36181d34a93864336da6ccd22402ebab37f79778 (patch)
tree510145301639214d11f40ef1cd6fc3cd308cf9da /DistUpgrade
parent37bb800eeb2d1d80836392b1b2f3d832882e7b01 (diff)
downloadpython-apt-36181d34a93864336da6ccd22402ebab37f79778.tar.gz
* extended error reporting implemented
Diffstat (limited to 'DistUpgrade')
-rw-r--r--DistUpgrade/DistUpgradeControler.py30
-rw-r--r--DistUpgrade/DistUpgradeView.py2
-rw-r--r--DistUpgrade/DistUpgradeViewGtk.py17
3 files changed, 36 insertions, 13 deletions
diff --git a/DistUpgrade/DistUpgradeControler.py b/DistUpgrade/DistUpgradeControler.py
index 135b93aa..b27e3926 100644
--- a/DistUpgrade/DistUpgradeControler.py
+++ b/DistUpgrade/DistUpgradeControler.py
@@ -271,11 +271,15 @@ class DistUpgradeControler(object):
self.cache._list.ReadMainList()
progress = self._view.getFetchProgress()
try:
- self.cache.update(progress)
+ res = self.cache.update(progress)
except IOError, e:
- # FIXME: this can result in insanly big dialogs,
- # need to elpise/cut e
- self._view.error(_("Error during commit:"), e)
+ self._view.error(_("Error during update"),
+ _("A problem occured during the update. "
+ "This is usually some sort of network "
+ "problem, please check your network "
+ "connection and retry."), e)
+ return False
+ return res
def askDistUpgrade(self):
try:
@@ -302,7 +306,16 @@ class DistUpgradeControler(object):
def doDistUpgrade(self):
fprogress = self._view.getFetchProgress()
iprogress = self._view.getInstallProgress()
- self.cache.commit(fprogress,iprogress)
+ try:
+ res = self.cache.commit(fprogress,iprogress)
+ except IOError, e:
+ self._view.error(_("Error during commit"),
+ _("Some problem occured during the upgrade. "
+ "This is mostly a network problem, please "
+ "check the network and try again. "),
+ e)
+ return False
+ return res
def doPostUpgrade(self):
self.openCache()
@@ -323,12 +336,7 @@ class DistUpgradeControler(object):
self.cache.getChanges(), 0):
fprogress = self._view.getFetchProgress()
iprogress = self._view.getInstallProgress()
- try:
- self.cache.commit(fprogress,iprogress)
- except IOError, e:
- # FIXME: this can result in insanly big dialogs,
- # need to elpise/cut e
- self._view.error(_("Error during commit:"), e)
+ self.cache.commit(fprogress,iprogress)
def askForReboot(self):
return self._view.askYesNoQuestion(_("Reboot required"),
diff --git a/DistUpgrade/DistUpgradeView.py b/DistUpgrade/DistUpgradeView.py
index a36855d3..f45932f6 100644
--- a/DistUpgrade/DistUpgradeView.py
+++ b/DistUpgrade/DistUpgradeView.py
@@ -61,6 +61,6 @@ class DistUpgradeView(object):
def askYesNoQuestion(self, summary, msg):
" ask a Yes/No question and return True on 'Yes' "
pass
- def error(self, 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 fc4dfb11..6a9b32e6 100644
--- a/DistUpgrade/DistUpgradeViewGtk.py
+++ b/DistUpgrade/DistUpgradeViewGtk.py
@@ -202,12 +202,22 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
attrlist.insert(attr)
label.set_property("attributes",attrlist)
- def error(self, summary, msg):
+ def error(self, summary, msg, extended_msg=None):
dialog = gtk.MessageDialog(self.window_main, 0, gtk.MESSAGE_ERROR,
gtk.BUTTONS_OK,"")
msg="<big><b>%s</b></big>\n\n%s" % (summary,msg)
dialog.set_markup(msg)
dialog.vbox.set_spacing(6)
+ if extended_msg != None:
+ scroll = gtk.ScrolledWindow()
+ textview = gtk.TextView()
+ textview.set_cursor_visible(False)
+ textview.set_editable(False)
+ textview.get_buffer().set_text(extended_msg)
+ textview.show()
+ scroll.add(scroll)
+ scroll.show()
+ dialog.vbox.pack_end(textview)
dialog.run()
dialog.destroy()
return False
@@ -250,3 +260,8 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
if res == gtk.RESPONSE_YES:
return True
return False
+
+
+if __name__ == "__main__":
+ view = GtkDistUpgradeView()
+ view.error("short","long","extended")