From: Robin Dunn Date: Mon, 23 Feb 2004 21:23:26 +0000 (+0000) Subject: Can't use NameError to check for NotIMplemented anymore. Just X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/08b89fa8685fcdbe3c173afbe838fb645c8da4ae?ds=sidebyside Can't use NameError to check for NotIMplemented anymore. Just explicitly check platforms until I figure out a better way to do it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25931 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/demo/Joystick.py b/wxPython/demo/Joystick.py index f3bdcd7b33..857ec2d83b 100644 --- a/wxPython/demo/Joystick.py +++ b/wxPython/demo/Joystick.py @@ -5,7 +5,7 @@ # Author: Jeff Grimmett (grimmtoo@softhome.net), adapted from original # .wdr-derived demo # -# Created: 01/02/04 +# Created: 02-Jan-2004 # RCS-ID: $Id$ # Copyright: # Licence: wxWindows license @@ -15,6 +15,10 @@ import math import wx +haveJoystick = True +if wx.Platform == "__WXMAC__": + haveJoystick = False + #---------------------------------------------------------------------------- # Once all supported versions of Python support 32-bit integers on all @@ -963,8 +967,17 @@ class JoystickDemoPanel(wx.Panel): #---------------------------------------------------------------------------- def runTest(frame, nb, log): - win = JoystickDemoPanel(nb, log) - return win + if haveJoystick: + win = JoystickDemoPanel(nb, log) + return win + else: + dlg = wx.MessageDialog( + frame, 'wx.Joystick is not available on this platform.', + 'Sorry', wx.OK | wx.ICON_INFORMATION + ) + dlg.ShowModal() + dlg.Destroy() + #---------------------------------------------------------------------------- diff --git a/wxPython/demo/PopupWindow.py b/wxPython/demo/PopupWindow.py index daea319286..83d7056a6e 100644 --- a/wxPython/demo/PopupWindow.py +++ b/wxPython/demo/PopupWindow.py @@ -9,9 +9,7 @@ import wx havePopupWindow = 1 -try: - wx.PopupWindow -except NameError: +if wx.Platform == '__WXMAC__': havePopupWindow = 0 wx.PopupWindow = wx.PopupTransientWindow = wx.Window @@ -199,7 +197,6 @@ def runTest(frame, nb, log): frame, 'wx.PopupWindow is not available on this platform.', 'Sorry', wx.OK | wx.ICON_INFORMATION ) - dlg.ShowModal() dlg.Destroy() diff --git a/wxPython/demo/ToggleButton.py b/wxPython/demo/ToggleButton.py index 43a7d0a370..d69b015067 100644 --- a/wxPython/demo/ToggleButton.py +++ b/wxPython/demo/ToggleButton.py @@ -2,10 +2,7 @@ import wx haveToggleBtn = 1 - -try: - wx.ToggleButton -except NameError: +if wx.Platform == "__WXX11__": haveToggleBtn = 0 #----------------------------------------------------------------------