]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow import checks to be turned off via preference.
authorKevin Ollivier <kevino@theolliviers.com>
Thu, 23 Nov 2006 05:54:01 +0000 (05:54 +0000)
committerKevin Ollivier <kevino@theolliviers.com>
Thu, 23 Nov 2006 05:54:01 +0000 (05:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43610 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/wxaddons/__init__.py

index bc0c26b451edcd4341fe087b63c7fc156d13e54e..80c2385471d5143151260e95a9b7749114c087c6 100644 (file)
@@ -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