mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
fixes for control cv rebinding
This commit is contained in:
parent
b34f7efeec
commit
553814fad3
@ -3501,9 +3501,9 @@ comint believe the user typed this string so that
|
||||
`kill-output-from-shell' does The Right Thing."
|
||||
(interactive)
|
||||
(let ((procbuf (process-buffer proc))
|
||||
(cmd (format "from direct.showbase import Finder; Finder.rebindClass(__builtins__.globals(), r'%s')\n" filename))
|
||||
)
|
||||
(cmd (format "from direct.showbase import Finder; Finder.rebindClass(r'%s')\n" filename))
|
||||
|
||||
)
|
||||
;; Goto the python buffer
|
||||
(set-buffer procbuf)
|
||||
(goto-char (point-max))
|
||||
@ -3511,15 +3511,21 @@ comint believe the user typed this string so that
|
||||
(goto-char (- current 4))
|
||||
;; Look for the python prompt
|
||||
(if (or (search-forward ">>> " current t)
|
||||
(search-forward "... " current t))
|
||||
(let ()
|
||||
;; We are already at a prompt, no need to interrupt
|
||||
(process-send-string proc cmd)
|
||||
)
|
||||
(search-forward "... " current t)
|
||||
;; This is the (Pdb) case, but we are only looking at the last 4 chars
|
||||
(search-forward "db) " current t)
|
||||
)
|
||||
(let ()
|
||||
;; We are already at a prompt, no need to interrupt
|
||||
(process-send-string proc cmd)
|
||||
)
|
||||
(let ()
|
||||
;; This is the else clause
|
||||
;; Interrupt the task loop
|
||||
(interrupt-process procbuf nil)
|
||||
(process-send-string proc cmd)
|
||||
;; Since we started running, let's return to running
|
||||
(python-resume proc)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -30,7 +30,7 @@ def findClass(className):
|
||||
return [classObj, module.__dict__]
|
||||
return None
|
||||
|
||||
def rebindClass(builtinGlobals, filename):
|
||||
def rebindClass(filename):
|
||||
file = open(filename, 'r')
|
||||
lines = file.readlines()
|
||||
for i in xrange(len(lines)):
|
||||
@ -101,8 +101,29 @@ def copyFuncs(fromClass, toClass):
|
||||
# See if we already have a function with this name
|
||||
oldFunc = toClass.__dict__.get(funcName)
|
||||
if oldFunc:
|
||||
# Give the new function code the same filename as the old function
|
||||
# Perhaps there is a cleaner way to do this? This is my best idea.
|
||||
newCode = new.code(newFunc.func_code.co_argcount,
|
||||
newFunc.func_code.co_nlocals,
|
||||
newFunc.func_code.co_stacksize,
|
||||
newFunc.func_code.co_flags,
|
||||
newFunc.func_code.co_code,
|
||||
newFunc.func_code.co_consts,
|
||||
newFunc.func_code.co_names,
|
||||
newFunc.func_code.co_varnames,
|
||||
# Use the oldFunc's filename here. Tricky!
|
||||
oldFunc.func_code.co_filename,
|
||||
newFunc.func_code.co_name,
|
||||
newFunc.func_code.co_firstlineno,
|
||||
newFunc.func_code.co_lnotab)
|
||||
newFunc = new.function(newCode,
|
||||
oldFunc.func_globals,
|
||||
oldFunc.func_name,
|
||||
oldFunc.func_defaults)
|
||||
# oldFunc.func_closure)
|
||||
replaceFuncList.append((oldFunc, funcName, newFunc))
|
||||
else:
|
||||
# TODO: give these new functions a proper code filename
|
||||
newFuncList.append((funcName, newFunc))
|
||||
|
||||
# Look in the messenger, taskMgr, and other globals that store func
|
||||
|
Loading…
x
Reference in New Issue
Block a user