mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 03:35:12 -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.showbase.ShowBase import ShowBase
|
||||
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__)
|
||||
|
||||
|
@ -9,25 +18,31 @@ loadPrcFile('dependencies/config/guieditor.prc')
|
|||
loadPrcFile('dependencies/config/general.prc')
|
||||
|
||||
defaultText = """from pandac.PandaModules import *
|
||||
from direct.gui import DirectGuiGlobals
|
||||
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(_):
|
||||
code = textbox.GetValue()
|
||||
exec(code, globals())
|
||||
exec(
|
||||
"from %s import %s as imported" % \
|
||||
(
|
||||
'.'.join(
|
||||
sys.argv[1].split('.')[:-1]
|
||||
),
|
||||
sys.argv[1].split('.')[-1]
|
||||
)
|
||||
)
|
||||
|
||||
app = wx.App(redirect=False)
|
||||
frame = wx.Frame(None, title="Injector", size=(640, 400), style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX)
|
||||
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()
|
||||
if hasattr(imported, 'GUI_EDITOR'):
|
||||
defaultText += imported.GUI_EDITOR
|
||||
|
||||
__builtin__.base = ShowBase()
|
||||
|
||||
exec(defaultText)
|
||||
|
||||
base.run()
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
@echo off
|
||||
|
||||
cd ../../../
|
||||
|
||||
title GUI Editor
|
||||
"dependencies/panda/python/ppython.exe" "dev/tools/gui/EditorStart.py"
|
||||
pause
|
||||
set GUI=
|
||||
|
||||
: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:
|
||||
self.callback(self.avatar, True)
|
||||
|
||||
# Use the following to run with the Gui Editor.
|
||||
"""
|
||||
from pandac.PandaModules import *
|
||||
from direct.gui import DirectGuiGlobals
|
||||
from direct.gui.DirectGui import *
|
||||
# The following is made for use with the GUI editor.
|
||||
GUI_EDITOR = """
|
||||
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)
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue