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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1703 - (hide annotations)
Wed Sep 3 06:58:47 2003 UTC (21 years, 6 months ago) by jan
Original Path: trunk/thuban/Thuban/UI/exceptiondialog.py
File MIME type: text/x-python
File size: 1942 byte(s)
a special exception dialog.

1 jan 1703 # 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     from wxPython.wx import *
13    
14     from Thuban import _
15    
16     class ExceptionDialog(wxDialog):
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     wxDialog.__init__(self, parent, -1, title,
25     wxDefaultPosition,
26     style = wxRESIZE_BORDER|wxCAPTION|wxDIALOG_MODAL)
27    
28     self.parent = parent
29     self.dialog_layout(message)
30    
31     def dialog_layout(self, message):
32     top_box = wxBoxSizer(wxVERTICAL)
33    
34     textBox = wxTextCtrl(self, -1, message,
35     style=wxTE_READONLY|wxTE_MULTILINE|wxTE_LINEWRAP)
36     w, h = (500, 300)
37     textBox.SetSizeHints(w, h)
38     textBox.SetSize((w, h))
39    
40     top_box.Add(textBox, 1, wxEXPAND|wxALL, 10)
41    
42     box = wxBoxSizer(wxHORIZONTAL)
43     box.Add(wxButton(self, wxID_OK, _("Proceed")), 0, wxALL, 4)
44     box.Add(wxButton(self, wxID_CANCEL, _("Exit")), 0, wxALL, 4)
45     top_box.Add(box, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10)
46    
47     EVT_BUTTON(self, wxID_OK, self.OnOK)
48     EVT_BUTTON(self, wxID_CANCEL, self.OnExit)
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(wxID_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