Browse Source

wxwidgets: don't create ShowBase instance upon importing WxPandaShell

rdb 5 years ago
parent
commit
98c82ddb9c
1 changed files with 6 additions and 7 deletions
  1. 6 7
      direct/src/wxwidgets/WxPandaShell.py

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

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