/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/exceptiondialog.py
ViewVC logotype

Contents of /branches/WIP-pyshapelib-bramz/Thuban/UI/exceptiondialog.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2734 - (show annotations)
Thu Mar 1 12:42:59 2007 UTC (18 years ago) by bramz
File MIME type: text/x-python
File size: 1975 byte(s)
made a copy
1 # Copyright (c) 2003 by Intevation GmbH
2 # Authors:
3 # Jan-Oliver Wagnber <[email protected]>
4 #
5 # This program is free software under the GPL (>=v2)
6 # Read the file COPYING coming with Thuban for details.
7
8 __version__ = "$Revision$"
9
10 import sys
11
12 import wx
13
14 from Thuban import _
15
16 class ExceptionDialog(wx.Dialog):
17
18 """The exception dialog shows the exception message and then allows
19 to either proceed with the application or to exit it. In the
20 latter case, sys.exit(1) is applied immediately.
21 """
22
23 def __init__(self, parent, message, title = _('Thuban: Internal Error')):
24 wx.Dialog.__init__(self, parent, -1, title,
25 wx.DefaultPosition,
26 style = wx.RESIZE_BORDER|wx.CAPTION|wx.DIALOG_MODAL)
27
28 self.parent = parent
29 self.dialog_layout(message)
30
31 def dialog_layout(self, message):
32 top_box = wx.BoxSizer(wx.VERTICAL)
33
34 textBox = wx.TextCtrl(self, -1, message,
35 style=wx.TE_READONLY|wx.TE_MULTILINE|wx.TE_LINEWRAP)
36 w, h = (500, 300)
37 textBox.SetSizeHints(w, h)
38 textBox.SetSize((w, h))
39
40 top_box.Add(textBox, 1, wx.EXPAND|wx.ALL, 10)
41
42 box = wx.BoxSizer(wx.HORIZONTAL)
43 box.Add(wx.Button(self, wx.ID_OK, _("Proceed")), 0, wx.ALL, 4)
44 box.Add(wx.Button(self, wx.ID_CANCEL, _("Exit Thuban now")), 0, wx.ALL, 4)
45 top_box.Add(box, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 10)
46
47 self.Bind(wx.EVT_BUTTON, self.OnOK, id=wx.ID_OK)
48 self.Bind(wx.EVT_BUTTON, self.OnExit, id=wx.ID_CANCEL)
49
50 self.SetAutoLayout(True)
51 self.SetSizer(top_box)
52 top_box.Fit(self)
53 top_box.SetSizeHints(self)
54
55 def OnOK(self, event):
56 self.EndModal(wx.ID_OK)
57
58 def OnExit(self, event):
59 sys.exit(1)
60
61 def run_exception_dialog(parent, message, title = _('Thuban: Internal Error')):
62 dialog = ExceptionDialog(parent, message, title)
63 dialog.ShowModal()
64 dialog.Destroy()

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26