X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e4a197e4c60e461b8068b0619692ea083e30b8b..312cca179a996f6d056bb71dab241356f4207d1c:/wxPython/demo/ErrorDialogs.py diff --git a/wxPython/demo/ErrorDialogs.py b/wxPython/demo/ErrorDialogs.py index db24853b82..f264f8f92f 100644 --- a/wxPython/demo/ErrorDialogs.py +++ b/wxPython/demo/ErrorDialogs.py @@ -2,10 +2,25 @@ # usual wxWindows license stuff here. # by Chris Fama, with thanks to Robin Dunn, and others on the wxPython-users # mailing list. +# +# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o Updated for wx namespace +# +# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o Looks like we have issues until the library is updated. +# - Had to rename back to wx* naming conventions +# - Getting unusual failures in the library itself when that is done. +# + +import sys + +import wx +import wx.lib.ErrorDialogs as edlg -from wxPython.wx import * -from wxPython.lib.ErrorDialogs import * _debug = 0 + ID_TEXT = 10000 ID_BUTTON_wxPyNonFatalError = 10001 ID_BUTTON_wxPyFatalError = 10002 @@ -15,44 +30,54 @@ ID_BUTTON_wxPyFatalErrorDialogWithTraceback = 10005 ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback = 10006 def ErrorDialogsDemoPanelFunc( parent, call_fit = True, set_sizer = True ): - item0 = wxBoxSizer( wxVERTICAL ) + item0 = wx.BoxSizer( wx.VERTICAL ) - item1 = wxStaticText( parent, ID_TEXT, "Please select one of the buttons below for an example using explicit errors...", wxDefaultPosition, wxDefaultSize, 0 ) - item0.AddWindow( item1, 0, wxALIGN_CENTRE|wxALL, 5 ) + item1 = wx.StaticText( + parent, ID_TEXT, + "Please select one of the buttons below for an example using explicit errors..." + ) + + item0.AddWindow( item1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item2 = wxFlexGridSizer( 0, 2, 0, 0 ) + item2 = wx.FlexGridSizer( 0, 2, 0, 0 ) - item3 = wxButton( parent, ID_BUTTON_wxPyNonFatalError, "wxPyNonFatalError", wxDefaultPosition, wxDefaultSize, 0 ) - item2.AddWindow( item3, 0, wxALIGN_CENTRE|wxALL, 5 ) + item3 = wx.Button( parent, ID_BUTTON_wxPyNonFatalError, "wxPyNonFatalError") + item2.AddWindow( item3, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item4 = wxButton( parent, ID_BUTTON_wxPyFatalError, "wxPyFatalError", wxDefaultPosition, wxDefaultSize, 0 ) - item2.AddWindow( item4, 0, wxALIGN_CENTRE|wxALL, 5 ) + item4 = wx.Button( parent, ID_BUTTON_wxPyFatalError, "wxPyFatalError") + item2.AddWindow( item4, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item0.AddSizer( item2, 0, wxALIGN_CENTRE|wxALL, 5 ) + item0.AddSizer( item2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item5 = wxStaticText( parent, ID_TEXT, "Please select one of the buttons below for interpreter errors...", wxDefaultPosition, wxDefaultSize, 0 ) - item0.AddWindow( item5, 0, wxALIGN_CENTRE|wxALL, 5 ) + item5 = wx.StaticText( parent, ID_TEXT, "Please select one of the buttons below for interpreter errors...") + item0.AddWindow( item5, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item6 = wxFlexGridSizer( 0, 2, 0, 0 ) + item6 = wx.FlexGridSizer( 0, 2, 0, 0 ) - item7 = wxButton( parent, ID_BUTTON_wxPyFatalErrorDialog, "wxPyFatalErrorDialog", wxDefaultPosition, wxDefaultSize, 0 ) - item6.AddWindow( item7, 0, wxALIGN_CENTRE|wxALL, 5 ) + item7 = wx.Button( parent, ID_BUTTON_wxPyFatalErrorDialog, "wxPyFatalErrorDialog") + item6.AddWindow( item7, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item8 = wxButton( parent, ID_BUTTON_wxPyNonFatalErrorDialog, "wxPyNonFatalErrorDialog", wxDefaultPosition, wxDefaultSize, 0 ) - item6.AddWindow( item8, 0, wxALIGN_CENTRE|wxALL, 5 ) + item8 = wx.Button( parent, ID_BUTTON_wxPyNonFatalErrorDialog, "wxPyNonFatalErrorDialog") + item6.AddWindow( item8, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item9 = wxButton( parent, ID_BUTTON_wxPyFatalErrorDialogWithTraceback, "wxPyFatalErrorDialogWithTraceback", wxDefaultPosition, wxDefaultSize, 0 ) - item6.AddWindow( item9, 0, wxALIGN_CENTRE|wxALL, 5 ) + item9 = wx.Button( + parent, ID_BUTTON_wxPyFatalErrorDialogWithTraceback, + "wxPyFatalErrorDialogWithTraceback" + ) + item6.AddWindow( item9, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item10 = wxButton( parent, ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback, "wxPyNonFatalErrorDialogWithTraceback", wxDefaultPosition, wxDefaultSize, 0 ) + item10 = wx.Button( + parent, ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback, + "wxPyNonFatalErrorDialogWithTraceback" + ) item10.SetDefault() - item6.AddWindow( item10, 0, wxALIGN_CENTRE|wxALL, 5 ) + item6.AddWindow( item10, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item0.AddSizer( item6, 0, wxALIGN_CENTRE|wxALL, 5 ) + item0.AddSizer( item6, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - item11 = wxFlexGridSizer( 0, 2, 0, 0 ) + item11 = wx.FlexGridSizer( 0, 2, 0, 0 ) - item0.AddSizer( item11, 0, wxALIGN_CENTRE|wxALL, 5 ) + item0.AddSizer( item11, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) if set_sizer == True: parent.SetAutoLayout( True ) @@ -70,42 +95,35 @@ def ErrorDialogsDemoPanelFunc( parent, call_fit = True, set_sizer = True ): # End of generated file -class MyPanel(wxPanel): +class MyPanel(wx.Panel): def __init__(self,parent=None): - wxPanel.__init__(self,parent,-1) + wx.Panel.__init__(self,parent,-1) + args = (None, -1) kwargs = { 'programname': "sumthing", 'mailto': "me@sumwear", - 'whendismissed': "from wxPython.wx import * ; wxBell()"} + 'whendismissed': "from wxPython.wx import * ; wxBell()" + } + self.dialogs = map(apply, - [wxPyNonFatalErrorDialogWithTraceback, - wxPyNonFatalErrorDialog,#WithTraceback - wxPyFatalErrorDialogWithTraceback, - wxPyFatalErrorDialog],#WithTraceback + [edlg.wxPyNonFatalErrorDialogWithTraceback, + edlg.wxPyNonFatalErrorDialog,#WithTraceback + edlg.wxPyFatalErrorDialogWithTraceback, + edlg.wxPyFatalErrorDialog #WithTraceback + ], (args,) * 4, - (kwargs,) * 4) - ErrorDialogsDemoPanelFunc(self) + (kwargs,) * 4 + ) - EVT_BUTTON(self, - ID_BUTTON_wxPyFatalErrorDialog, - self.DoDialog) - EVT_BUTTON(self, - ID_BUTTON_wxPyNonFatalError, - self.DoDialog) - EVT_BUTTON(self, - ID_BUTTON_wxPyFatalError, - self.DoDialog) - EVT_BUTTON(self, - ID_BUTTON_wxPyFatalErrorDialogWithTraceback, - self.DoDialog) - EVT_BUTTON(self, - ID_BUTTON_wxPyNonFatalErrorDialog, - self.DoDialog) - EVT_BUTTON(self, - ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback, - self.DoDialog) + ErrorDialogsDemoPanelFunc(self) + self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyFatalErrorDialog) + self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyNonFatalError) + self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyFatalError) + self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyFatalErrorDialogWithTraceback) + self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyNonFatalErrorDialog) + self.Bind(wx.EVT_BUTTON, self.DoDialog, id=ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback) IndexFromID = { ID_BUTTON_wxPyFatalErrorDialog: 3, @@ -116,11 +134,12 @@ class MyPanel(wxPanel): def DoDialog(self,event): id = event.GetId() + if id in [ID_BUTTON_wxPyFatalError,ID_BUTTON_wxPyNonFatalError]: if id == ID_BUTTON_wxPyFatalError: print "%s.DoDialog(): testing explicit wxPyFatalError..."\ % self - wxPyFatalError(self,"Test Non-fatal error.
" + edlg.wxPyFatalError(self,"Test Non-fatal error.
" "Nearly arbitrary HTML (i.e., that which is" " understood by wxHtmlWindow)." "
This | is |
This | is |