From 5001057213afeb3695f809d22c5b6376e7e23b81 Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Thu, 23 Nov 2006 05:54:01 +0000 Subject: [PATCH 1/1] Allow import checks to be turned off via preference. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/wxaddons/__init__.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/wxPython/wxaddons/__init__.py b/wxPython/wxaddons/__init__.py index bc0c26b451..80c2385471 100644 --- a/wxPython/wxaddons/__init__.py +++ b/wxPython/wxaddons/__init__.py @@ -20,12 +20,22 @@ builtin_import = __builtin__.__import__ debug = False use_gui = True +checkImports = True +config = wx.Config("wxaddons") +if config.Read("PerformChecks", "true") != "true": + checkImports = False if use_gui and not wx.App.IsDisplayAvailable(): use_gui = False s = xmlrpclib.Server('%s/xmlrpc-server.php' % domain, verbose=(debug == True)) - + +def check_imports(check): + if check: + config.Write("PerformChecks", "true") + else: + config.Write("PerformChecks", "false") + def version_greater_than_or_equal(version1, version2): """ Checks if version1 >= version2, returning true if so, @@ -167,6 +177,7 @@ def import_hook(name, globals=None, locals=None, fromlist=None): try: return builtin_import(name, globals, locals, fromlist) except: + print "Check imports is: " + `check_imports` if name.startswith("wxaddons"): print "Querying %s for module." % domain try: @@ -199,5 +210,6 @@ def runTests(): import wxaddons.foo_bar import googly -__builtin__.__import__ = import_hook +if checkImports: + __builtin__.__import__ = import_hook -- 2.45.2