Poodletooth-iLand/dev/tools/gui/EditorStart.py

49 lines
1.3 KiB
Python
Raw Normal View History

from direct.stdpy import threading
from direct.showbase.ShowBase import ShowBase
from panda3d.core import VirtualFileSystem
2015-05-29 21:49:55 -05:00
import __builtin__, wx, os, sys
sys.path.append(
os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"../../../"
)
)
)
__builtin__.__dict__.update(__import__('pandac.PandaModules', fromlist=['*']).__dict__)
2015-05-29 05:03:48 -05:00
loadPrcFile('dependencies/config/guieditor.prc')
loadPrcFile('dependencies/config/general.prc')
defaultText = """from pandac.PandaModules import *
2015-05-29 21:49:55 -05:00
from direct.gui import DirectGuiGlobals
from direct.gui.DirectGui import *
2015-05-29 21:49:55 -05:00
from toontown.toonbase import ToontownGlobals
2015-05-29 21:49:55 -05:00
DirectGuiGlobals.setDefaultFontFunc(ToontownGlobals.getInterfaceFont)
DirectGuiGlobals.setDefaultRolloverSound(base.loadSfx('phase_3/audio/sfx/GUI_rollover.ogg'))
DirectGuiGlobals.setDefaultClickSound(base.loadSfx('phase_3/audio/sfx/GUI_create_toon_fwd.ogg'))
DirectGuiGlobals.setDefaultDialogGeom(loader.loadModel('phase_3/models/gui/dialog_box_gui'))
"""
2015-05-29 21:49:55 -05:00
exec(
"from %s import %s as imported" % \
(
'.'.join(
sys.argv[1].split('.')[:-1]
),
sys.argv[1].split('.')[-1]
)
)
2015-05-29 21:49:55 -05:00
if hasattr(imported, 'GUI_EDITOR'):
defaultText += imported.GUI_EDITOR
__builtin__.base = ShowBase()
2015-05-29 21:49:55 -05:00
exec(defaultText)
base.run()