From 98c82ddb9c6d4bb2e376bd7fc413649ab4a9951c Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 25 Apr 2020 14:33:39 +0200 Subject: [PATCH] wxwidgets: don't create ShowBase instance upon importing WxPandaShell --- direct/src/wxwidgets/WxPandaShell.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/direct/src/wxwidgets/WxPandaShell.py b/direct/src/wxwidgets/WxPandaShell.py index d6a1793684..4835f28e2b 100755 --- a/direct/src/wxwidgets/WxPandaShell.py +++ b/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 - -