]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wxaddons/__init__.py
Adding overview docs and a couple tweaks to the demo.
[wxWidgets.git] / wxPython / wxaddons / __init__.py
index bc0c26b451edcd4341fe087b63c7fc156d13e54e..3fe2dd97b88ad0631710b2950a12c33a89f0e4f8 100644 (file)
@@ -15,17 +15,32 @@ import xmlrpclib
 import __builtin__
 import wx
 
-domain = 'http://wxpyaddons.wxcommunity.com'
+# NB: For some reason that I haven't been able to track down, on Mac (at least)
+# calling xmlrpc methods no longer works after the wx.App is started. Therefore, 
+# we grab the package URL even before prompting the user if they want to install
+# the package in order for us to have the info we need before the wx.App is started.
+
+domain = 'http://wxaddons.wxcommunity.com'
 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,
@@ -88,7 +103,7 @@ def require_addon_version(name, version=[], canBeNewer=True):
             should_install = prompt_install(name, comp_version)
             
             if should_install:
-                dl_and_install_addon(name, comp_version)
+                dl_and_install_addon(name, comp_version, url)
 
 def get_url(name, version):
     url = ""
@@ -108,9 +123,6 @@ def dl_and_install_addon(name, version, url):
     tempdir = None
     cwd = os.getcwd()
     
-    # get the package URL
-    url = "http://wxpyaddons.wxcommunity.com/releases/sized_controls-0.5.tar.gz"
-    
     if use_gui:
         progress = wx.ProgressDialog("Installing Dependency", 
             "Preparing to install the %s addon module." % name, 
@@ -195,9 +207,10 @@ def import_hook(name, globals=None, locals=None, fromlist=None):
             raise
 
 def runTests():
-    import wxaddons.sized_controls
+    import wxaddons.persistence
     import wxaddons.foo_bar
     import googly
 
-__builtin__.__import__ = import_hook
+if checkImports:
+    __builtin__.__import__ = import_hook