summaryrefslogtreecommitdiff
path: root/DistUpgrade/DistUpgradeViewGtk.py
diff options
context:
space:
mode:
authorSebastian Heinlein <sebastian.heinlein@web.de>2006-01-26 15:53:46 +0100
committerSebastian Heinlein <sebastian.heinlein@web.de>2006-01-26 15:53:46 +0100
commit5c7cce315d65d96a744c91d4cec10a3a135b3a51 (patch)
tree5a7507f50990b902dbed751bd5c055a52238277b /DistUpgrade/DistUpgradeViewGtk.py
parent7e1b71667312232f492fe8288be6da68c4400e59 (diff)
parent52ba94d286981672f3b05c08911e19e633e48568 (diff)
downloadpython-apt-5c7cce315d65d96a744c91d4cec10a3a135b3a51.tar.gz
* merged from mvo
* remove the commented line about hiding the progress bar at the end of the installation. the full progress bar is importnat to indicate the end of the upgrade. so i don't see any need to perhaps uncomment this again in the future
Diffstat (limited to 'DistUpgrade/DistUpgradeViewGtk.py')
-rw-r--r--DistUpgrade/DistUpgradeViewGtk.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py
index 9ba1a04c..94090322 100644
--- a/DistUpgrade/DistUpgradeViewGtk.py
+++ b/DistUpgrade/DistUpgradeViewGtk.py
@@ -199,6 +199,8 @@ 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())
+ # work around bug in VteTerminal here
+ self._term.realize()
# Use italic style in the status labels
attrlist=pango.AttrList()
@@ -206,11 +208,42 @@ class GtkDistUpgradeView(DistUpgradeView,SimpleGladeApp):
attrlist.insert(attr)
self.label_status.set_property("attributes", attrlist)
+ # reasonable fault handler
+ sys.excepthook = self._handleException
+
+ def _handleException(self, type, value, tb):
+ import traceback
+ lines = traceback.format_exception(type, value, tb)
+ logging.error("not handled expection:\n%s" % "\n".join(lines))
+ self.error(_("A fatal error occured"),
+ _("During the operation a fatal error occured. "
+ "Please report this as a bug and include the "
+ "files ~/dist-upgrade.log and ~/dist-upgrade-apt.log "
+ "in your report. The upgrade will abort now. "),
+ "\n".join(lines))
+
def create_terminal(self, arg1,arg2,arg3,arg4):
" helper to create a vte terminal "
self._term = vte.Terminal()
self._term.set_font_from_string("monospace 10")
+ self._term.connect("contents-changed", self._term_content_changed)
+ self._terminal_lines = []
+ self._terminal_log = open(os.path.expanduser("~/dist-upgrade-term.log"),"w")
return self._term
+ def _term_content_changed(self, term):
+ " called when the *visible* part of the terminal changes "
+
+ # get the current visible text,
+ current_text = self._term.get_text(lambda a,b,c,d: True)
+ # see what we have currently and only print stuff that wasn't
+ # visible last time
+ new_lines = []
+ for line in current_text.split("\n"):
+ new_lines.append(line)
+ if not line in self._terminal_lines:
+ self._terminal_log.write(line+"\n")
+ self._terminal_log.flush()
+ self._terminal_lines = new_lines
def getFetchProgress(self):
return self._fetchProgress
def getInstallProgress(self):