mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 19:52:37 -06:00
created an awesome GUI editor
This commit is contained in:
parent
6bb564c2f5
commit
e560829a14
3 changed files with 45 additions and 28 deletions
|
@ -1,7 +1,16 @@
|
||||||
from direct.stdpy import threading
|
from direct.stdpy import threading
|
||||||
from direct.showbase.ShowBase import ShowBase
|
from direct.showbase.ShowBase import ShowBase
|
||||||
from panda3d.core import VirtualFileSystem
|
from panda3d.core import VirtualFileSystem
|
||||||
import __builtin__, wx, os
|
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__)
|
__builtin__.__dict__.update(__import__('pandac.PandaModules', fromlist=['*']).__dict__)
|
||||||
|
|
||||||
|
@ -9,25 +18,31 @@ loadPrcFile('dependencies/config/guieditor.prc')
|
||||||
loadPrcFile('dependencies/config/general.prc')
|
loadPrcFile('dependencies/config/general.prc')
|
||||||
|
|
||||||
defaultText = """from pandac.PandaModules import *
|
defaultText = """from pandac.PandaModules import *
|
||||||
|
from direct.gui import DirectGuiGlobals
|
||||||
from direct.gui.DirectGui import *
|
from direct.gui.DirectGui import *
|
||||||
|
from toontown.toonbase import ToontownGlobals
|
||||||
|
|
||||||
|
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'))
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def inject(_):
|
exec(
|
||||||
code = textbox.GetValue()
|
"from %s import %s as imported" % \
|
||||||
exec(code, globals())
|
(
|
||||||
|
'.'.join(
|
||||||
|
sys.argv[1].split('.')[:-1]
|
||||||
|
),
|
||||||
|
sys.argv[1].split('.')[-1]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
app = wx.App(redirect=False)
|
if hasattr(imported, 'GUI_EDITOR'):
|
||||||
frame = wx.Frame(None, title="Injector", size=(640, 400), style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX)
|
defaultText += imported.GUI_EDITOR
|
||||||
panel = wx.Panel(frame)
|
|
||||||
button = wx.Button(parent=panel, id=-1, label="Inject", size=(50, 20), pos=(295, 0))
|
|
||||||
textbox = wx.TextCtrl(parent=panel, id=-1, pos=(20, 22), size=(600, 340), style=wx.TE_MULTILINE)
|
|
||||||
|
|
||||||
frame.Bind(wx.EVT_BUTTON, inject, button)
|
|
||||||
frame.Show()
|
|
||||||
app.SetTopWindow(frame)
|
|
||||||
textbox.AppendText(defaultText)
|
|
||||||
threading.Thread(target=app.MainLoop).start()
|
|
||||||
|
|
||||||
__builtin__.base = ShowBase()
|
__builtin__.base = ShowBase()
|
||||||
|
|
||||||
|
exec(defaultText)
|
||||||
|
|
||||||
base.run()
|
base.run()
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
cd ../../../
|
cd ../../../
|
||||||
|
|
||||||
title GUI Editor
|
title GUI Editor
|
||||||
"dependencies/panda/python/ppython.exe" "dev/tools/gui/EditorStart.py"
|
set GUI=
|
||||||
pause
|
|
||||||
|
:main
|
||||||
|
|
||||||
|
set /P GUI="File: %gui%"
|
||||||
|
"dependencies/panda/python/ppython.exe" "dev/tools/gui/EditorStart.py" %GUI%
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
|
||||||
|
goto main
|
|
@ -120,18 +120,9 @@ class BossLobbyGui(DirectFrame):
|
||||||
elif lobby == 1:
|
elif lobby == 1:
|
||||||
self.callback(self.avatar, True)
|
self.callback(self.avatar, True)
|
||||||
|
|
||||||
# Use the following to run with the Gui Editor.
|
# The following is made for use with the GUI editor.
|
||||||
"""
|
GUI_EDITOR = """
|
||||||
from pandac.PandaModules import *
|
|
||||||
from direct.gui import DirectGuiGlobals
|
|
||||||
from direct.gui.DirectGui import *
|
|
||||||
from toontown.coghq.BossLobbyGui import BossLobbyGui
|
from toontown.coghq.BossLobbyGui import BossLobbyGui
|
||||||
from toontown.toonbase import ToontownGlobals
|
|
||||||
|
|
||||||
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'))
|
|
||||||
|
|
||||||
test = BossLobbyGui(None, None)
|
test = BossLobbyGui(None, None)
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue