Even though it has quite a high version number consider this alpha state!
I do test, but you might get up with something i do not. If you find any bugs or have other questions feel free to post them here or send me an email.
How to use it in your own application:
from src.interactiveConsole import pandaConsole, INPUT_CONSOLE, INPUT_GUI, OUTPUT_PYTHON, OUTPUT_IRC
# INPUT_CONSOLE: enables the commandline text input
# INPUT_GUI: create the panda3d interface for the console
# OUTPUT_PYTHON: enables the python code executer
# OUTPUT_IRC: enables the irc backend
console = pandaConsole( INPUT_CONSOLE|INPUT_GUI|OUTPUT_PYTHON|OUTPUT_IRC, locals() )
# you should disable all not used interfaces, as some of them use tasks to poll informations (from keyboard, network port etc.)
# to have it hidden, toggle with escape
console.toggle()
last changes:
some small fixes i encountered when adding a sample main.py (06.12.2010)
fixed bugs causing a crash when using the help (F1) (05.10.07)
changed the help function to show the doc string, if no doc is found, the first 5 lines of inspect.getsourcelines is printed
fixed some linux clipboard bugs, thanks to Laurens (5.08.07)
added pydcop module to clipboard (4.08.07)
fixed multiline pasting (2.08.07)
added autohelp for python code (2.08.07)
fixed some problems occuring under windows (2.08.07)
added autocompletion for python code
added autocompletion for some irc commands (2.08.07)
added scrolling for inputs (1.08.07)
added scrolling for output (1.08.07)
added copy/cut & paste (1.08.07)
added colored output for the panda3d output (31.07.07)
added a basic IRC backend (31.07.07)
fixed some bugs (30.07.07)
fixed some bugs / and maybe introduced some new (29.07.07)
improved the functionality (29.07.07)
improved the visuals (29.07.07)
changed to have the read command called as task (23.01.07)
added more documentations (23.01.07)
changed oldterm to self.oldterm (15.11.06)
changed oldflags to self.oldflags (15.11.06)
moved to the correct forum (15.11.06)
Idea’s for the coming versions (they might come or might not):
Tabs: for irc channels (would require quite a lot of changes)
Extended autocompletion for irc (for example usernames)
Single word coloring (instead of lines)
Extended help (changing from lines of code to doc) ?
nice. whoever adds that to direct.gui with a entry field/text field for usage directly in a Panda3D application (without the need for a console) will get a beer (or any drink) payed by me at the first Panda3D conference.
or a free t-shirt “Panda3D - too good to be true!”.
— THIS IS OUTDATED, look at the first & the last post for current informations —
Hi,
Im bit late with my reply. However i would be happy if you include the code snipplet into panda3d, putting it into a task should work afaik. However i have not testet that. As it redirects stdout in this class it may cause problems…
There is one problem i know about. Under linux it’s changing the console behavior, which requires resetting (“reset” in bash) of the console to be functioning properly again (on a crash). The appropiate code is in the pandaInteractiveConsole.del function, (have found a problem in the code and fixed it in the online version). But i have not tested it…
— THIS IS OUTDATED, look at the first & the last post for current informations —
Another thing i wanted to mention. Running blocking scripts using this method will interrupt panda. (for example a “while True: pass”) The main purpose of the current implementation is for a dedicated server (without a 3d interface). If you want to change it to a panda3d interface, you can remove a lot of stuff from the input handling. ( setting non blocking console, platform depending stuff etc.)
If you want to write the output from the InteractiveConsole to a panda3d interface you have to add this in the write function. (aka label.setText( string ) )
In this class no print functions will work, use self.stdout.write to output info to a console.
If i find the time ill write a class to be used directly in panda3d.
— THIS IS OUTDATED, look at the first & the last post for current informations —
I have updated the console to have a console (ala quake etc) within panda3d. The text (cmd, bash) entry should still work if you call use the way described above. Please note that everything printed from you application will be output here as well…
I only tested it on windows, just tell me if any problem arises on a linux box and i’ll fix it.
i added a parameter that gives the possibility to enable gui and/or console input. The read call (as described above) is only required when using the console input (not panda3d gui). F1 is currently setup to toggle the console visibility on/off.
(get the code from the first post)
edit: added 2 parameters for vertical size setting of the console & added some documentation.
Just integrated this into my technical demo. It looks very FPS’ish, they way you get it
The text was slightly off (on multiline output the commandline lighter background overlaps with the output), but it works
Hope it serves you well.
I know about the overlapping background part of the directentry into the OnscreenText, however i havent figured out how to change this by now.
Thanks David. I just need to read the script to see what this is supposed to do. I just downloaded it because I wanted to study the code and the title of the thread looked goo.
I will get back to you when I actually read the thread all the way thru and if I end up having questions. Right now all I get is a grey panda3d screen.
you may try out to use different scaling for the text. First I had also only a gray screen - if you start entering text suddenly text appears from the bottom of the screen…
I got lucky with:
# vertical space from top
V_SPACE = 0
# vertical size of console
V_SIZE = 1.5
# size of the text
SCALE = 0.1
# when changing scale change this as well
LINELENGTH = 80