Added gu editor and removed unused debug lines from injector

This commit is contained in:
DenialMC 2015-04-10 20:06:17 +03:00
parent 7d82aedce8
commit aa011d98a3
5 changed files with 42 additions and 9 deletions

1
config/guieditor.prc Normal file
View file

@ -0,0 +1 @@
model-path ../resources/

7
guieditor.bat Normal file
View file

@ -0,0 +1,7 @@
@echo off
title GUI Editor
set /P PPYTHON_PATH=<PPYTHON_PATH
:main
%PPYTHON_PATH% -m guieditor.EditorStart
goto main

33
guieditor/EditorStart.py Normal file
View file

@ -0,0 +1,33 @@
from direct.stdpy import threading
from direct.showbase.ShowBase import ShowBase
from panda3d.core import VirtualFileSystem
import __builtin__, wx, os
__builtin__.__dict__.update(__import__('pandac.PandaModules', fromlist=['*']).__dict__)
loadPrcFile('config/guieditor.prc')
loadPrcFile('config/general.prc')
defaultText = """from pandac.PandaModules import *
from direct.gui.DirectGui import *
"""
def inject():
code = textbox.GetValue()
exec(code, globals())
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()
__builtin__.base = ShowBase()
base.run()

0
guieditor/__init__.py Normal file
View file

View file

@ -24,15 +24,7 @@ if __debug__:
loadPrcFile('config/general.prc')
loadPrcFile('config/release/dev.prc')
defaultText = '''door = base.cr.doFind('tedHouseDoor')
doorTrigger = door.getBuilding().find('**/door_trigger*')
doorTrigger.show()
doorTrigger.node().setName(door.getTriggerName())
print doorTrigger
print door.getEnterTriggerEvent()
print messenger.whoAccepts(door.getEnterTriggerEvent())'''
defaultText = ""
def __inject_wx(_):
code = textbox.GetValue()