Auto-load certain symbols in REPL, add docs for REPL
This commit is contained in:
@@ -333,6 +333,13 @@ If you are a viewer developer, please put them in a viewer.
|
||||
apply the mesh to the local mesh target. It works on attachments too. Useful for testing rigs before a
|
||||
final, real upload.
|
||||
|
||||
## REPL
|
||||
|
||||
A quick and dirty REPL is also included for when you want to do ad-hoc introspection of proxy state.
|
||||
It can be launched at any time by typing `/524 spawn_repl` in chat.
|
||||
|
||||

|
||||
|
||||
## Potential Changes
|
||||
|
||||
* AISv3 wrapper?
|
||||
|
||||
@@ -58,6 +58,14 @@ class BaseInteractionManager:
|
||||
return None
|
||||
|
||||
|
||||
# Used to initialize a REPL environment with commonly desired helpers
|
||||
REPL_INITIALIZER = r"""
|
||||
from hippolyzer.lib.base.datatypes import *
|
||||
from hippolyzer.lib.base.message.message import Block, Message, Direction
|
||||
from hippolyzer.lib.proxy.addon_utils import send_chat, show_message
|
||||
"""
|
||||
|
||||
|
||||
class AddonManager:
|
||||
COMMAND_CHANNEL = 524
|
||||
|
||||
@@ -133,6 +141,9 @@ class AddonManager:
|
||||
if _locals is None:
|
||||
_locals = stack.frame.f_locals
|
||||
|
||||
_globals = dict(_globals)
|
||||
exec(REPL_INITIALIZER, _globals, None)
|
||||
|
||||
async def _wrapper():
|
||||
coro: Coroutine = ptpython.repl.embed( # noqa: the type signature lies
|
||||
globals=_globals,
|
||||
|
||||
BIN
static/repl_screenshot.png
Normal file
BIN
static/repl_screenshot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
Reference in New Issue
Block a user