2
0
Эх сурвалжийг харах

wxwidgets: don't create ShowBase instance upon importing WxPandaShell

rdb 5 жил өмнө
parent
commit
98c82ddb9c

+ 6 - 7
direct/src/wxwidgets/WxPandaShell.py

@@ -3,13 +3,9 @@ from wx.lib.agw import fourwaysplitter as FWS
 
 from panda3d.core import *
 from direct.showbase.ShowBase import *
+from direct.showbase import ShowBaseGlobal
 from direct.directtools.DirectGlobals import *
 
-try:
-    base
-except NameError:
-    base = ShowBase(False, windowType = 'none')
-
 from .WxAppShell import *
 from .ViewPort import *
 
@@ -19,6 +15,7 @@ ID_FRONT_VIEW = 403
 ID_LEFT_VIEW = 404
 ID_PERSP_VIEW = 405
 
+
 class WxPandaShell(WxAppShell):
     """ Class for Panda3D LevelEditor """
     frameWidth = 800
@@ -37,6 +34,10 @@ class WxPandaShell(WxAppShell):
         }
 
     def __init__(self, fStartDirect = False):
+        base = getattr(ShowBaseGlobal, 'base', None)
+        if not base:
+            base = ShowBase(False, windowType='none')
+
         fDirect = (base.config.GetBool('want-directtools', 0) or
                    (base.config.GetString("cluster-mode", '') != ''))
 
@@ -237,5 +238,3 @@ class WxPandaShell(WxAppShell):
             self.currentView = self.perspView
 
         return self.currentView
-
-