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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2183 by jan, Fri Apr 16 07:57:13 2004 UTC revision 2700 by dpinte, Mon Sep 18 14:27:02 2006 UTC
# Line 9  __version__ = "$Revision$" Line 9  __version__ = "$Revision$"
9    
10  import sys  import sys
11    
12  from wxPython.wx import *  import wx
13    
14  from Thuban import _  from Thuban import _
15    
16  class ExceptionDialog(wxDialog):  class ExceptionDialog(wx.Dialog):
17    
18      """The exception dialog shows the exception message and then allows      """The exception dialog shows the exception message and then allows
19      to either proceed with the application or to exit it. In the      to either proceed with the application or to exit it. In the
# Line 21  class ExceptionDialog(wxDialog): Line 21  class ExceptionDialog(wxDialog):
21      """      """
22    
23      def __init__(self, parent, message, title = _('Thuban: Internal Error')):      def __init__(self, parent, message, title = _('Thuban: Internal Error')):
24          wxDialog.__init__(self, parent, -1, title,          wx.Dialog.__init__(self, parent, -1, title,
25                            wxDefaultPosition,                            wx.DefaultPosition,
26                            style = wxRESIZE_BORDER|wxCAPTION|wxDIALOG_MODAL)                            style = wx.RESIZE_BORDER|wx.CAPTION|wx.DIALOG_MODAL)
27    
28          self.parent = parent          self.parent = parent
29          self.dialog_layout(message)          self.dialog_layout(message)
30            
31      def dialog_layout(self, message):      def dialog_layout(self, message):
32          top_box = wxBoxSizer(wxVERTICAL)          top_box = wx.BoxSizer(wx.VERTICAL)
33    
34          textBox = wxTextCtrl(self, -1, message,          textBox = wx.TextCtrl(self, -1, message,
35              style=wxTE_READONLY|wxTE_MULTILINE|wxTE_LINEWRAP)              style=wx.TE_READONLY|wx.TE_MULTILINE|wx.TE_LINEWRAP)
36          w, h = (500, 300)          w, h = (500, 300)
37          textBox.SetSizeHints(w, h)          textBox.SetSizeHints(w, h)
38          textBox.SetSize((w, h))          textBox.SetSize((w, h))
39    
40          top_box.Add(textBox, 1, wxEXPAND|wxALL, 10)          top_box.Add(textBox, 1, wx.EXPAND|wx.ALL, 10)
41    
42          box = wxBoxSizer(wxHORIZONTAL)          box = wx.BoxSizer(wx.HORIZONTAL)
43          box.Add(wxButton(self, wxID_OK, _("Proceed")), 0, wxALL, 4)          box.Add(wx.Button(self, wx.ID_OK, _("Proceed")), 0, wx.ALL, 4)
44          box.Add(wxButton(self, wxID_CANCEL, _("Exit Thuban now")), 0, wxALL, 4)          box.Add(wx.Button(self, wx.ID_CANCEL, _("Exit Thuban now")), 0, wx.ALL, 4)
45          top_box.Add(box, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 10)          top_box.Add(box, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 10)
46    
47          EVT_BUTTON(self, wxID_OK, self.OnOK)          self.Bind(wx.EVT_BUTTON, self.OnOK, id=wx.ID_OK)
48          EVT_BUTTON(self, wxID_CANCEL, self.OnExit)          self.Bind(wx.EVT_BUTTON, self.OnExit, id=wx.ID_CANCEL)
49    
50          self.SetAutoLayout(True)          self.SetAutoLayout(True)
51          self.SetSizer(top_box)          self.SetSizer(top_box)
# Line 53  class ExceptionDialog(wxDialog): Line 53  class ExceptionDialog(wxDialog):
53          top_box.SetSizeHints(self)          top_box.SetSizeHints(self)
54    
55      def OnOK(self, event):      def OnOK(self, event):
56          self.EndModal(wxID_OK)          self.EndModal(wx.ID_OK)
57    
58      def OnExit(self, event):      def OnExit(self, event):
59          sys.exit(1)          sys.exit(1)

Legend:
Removed from v.2183  
changed lines
  Added in v.2700

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26