added injector

This commit is contained in:
Zach 2015-03-06 06:08:02 -06:00
parent b0ee41b558
commit c5b3c0de09

View file

@ -18,9 +18,31 @@ from panda3d.core import loadPrcFile
if __debug__:
import wx, sys, threading
loadPrcFile('config/general.prc')
loadPrcFile('config/release/dev.prc')
defaultText = "print('I work!')"
def __inject_wx(_):
code = textbox.GetValue()
exec(code, globals())
def openInjector_wx():
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))
global textbox
textbox = wx.TextCtrl(parent=panel, id=-1, pos=(20, 22), size=(600, 340), style=wx.TE_MULTILINE)
frame.Bind(wx.EVT_BUTTON, __inject_wx, button)
frame.Show()
app.SetTopWindow(frame)
textbox.AppendText(defaultText)
threading.Thread(target=app.MainLoop).start()
openInjector_wx()
from direct.directnotify.DirectNotifyGlobal import directNotify