Forráskód Böngészése

PythonQt - Do not print import exception associated with qt/ctk package

Jean-Christophe Fillion-Robin 14 éve
szülő
commit
6b86e441bc

+ 1 - 0
Applications/ctkSimplePythonShell/Python/ctkSimplePythonShell.py

@@ -1,3 +1,4 @@
+import qt, ctk
 
 def app():
   return _ctkSimplePythonShellInstance

+ 6 - 1
Libs/Scripting/Python/Core/Python/ctk/__init__.py.in

@@ -3,11 +3,16 @@ its namespace."""
 
 __kits_to_load = [ @CTK_PYTHON_WRAPPED_LIBRARIES@ ]
 
+# Set to True when debugging
+CTK_VERBOSE_IMPORT = False
+
 for kit in __kits_to_load:
   try:
     exec "from PythonQt.CTK%s import *" % (kit)
   except ImportError as detail:
-    print detail
+    global CTK_VERBOSE_IMPORT
+    if CTK_VERBOSE_IMPORT: 
+      print detail
    
 # Removing things the user shouldn't have to see.
 del __kits_to_load

+ 6 - 1
Libs/Scripting/Python/Core/Python/qt/__init__.py

@@ -14,11 +14,16 @@ __kits_to_load = [
 'XmlPatterns'
 ]
 
+# Set to True when debugging
+CTK_VERBOSE_IMPORT = False
+
 for kit in __kits_to_load:
    try:
      exec "from PythonQt.Qt%s import *" % (kit)
    except ImportError as detail:
-     print detail
+     global CTK_VERBOSE_IMPORT
+     if CTK_VERBOSE_IMPORT:
+       print detail
    
 # Removing things the user shouldn't have to see.
 del __kits_to_load