Open cxbrooks opened 16 years ago
Ian Brown said:
Editing python scripts in the python actor leaves a lot to be desired. This is low priority.
ptolemy/actor/gui/TextEffigy.java includes support for editing a file using emacs if the Java property ptolemy.user.texteditor is set to emacs. Something similar could be done to ptolemy.actor.gui.TextEditor so that we invoked an external editor.
The way to run with the property set is: export JAVAFLAGS=-Dptolemy.user.texteditor=emacs $PTII/bin/vergil -v ptolemy/actor/lib/python/test/PythonReadFile.xml
However, this does not work because TextEditorTableauFactory does not use TextEffigy, it uses vergil.toolbox.TextEditorForStringAttributes which uses TextEditor.
BTW - the way that the Python determines which editor to open is that actor/lib/python/python.xml includes:
<property name="_tableauFactory"
class="ptolemy.vergil.toolbox.TextEditorTableauFactory">
Also, it is not clear if invoking a separate editor is the right thing. Emacs has pretty good support for this, but a 100% Java editor might make more sense.
The issue is with the handling of syntax errors rather than the actual editing itself. Consider a 100 line script with an error on line 65. When you try to close the text effigy, the script will be syntax checked and you will be informed via an exception report that there is an error somewhere in it. This is not really very helpful. A line number report of where the error is and then some feedback in the editor of the current line number would be a minimum requirement.
One possibility would be to extend the stack trace display so that it had a hyperlink that would jump to the appropriate line. We could encode the line number in the URL. I've often wanted this for Java bugs. It would be nice if this feature was smart enough to work within Eclipse or other IDEs and jump to the proper line in the file. We might have to handle Python stack traces specially.
The hard problem is that give just a Java class name it can be difficult to map that back to a file.
Note: the issue was created automatically with bugzilla2github tool
Original bug ID: BZ#138 From: @cxbrooks Reported version: 7.0.beta CC: ian.brown@hsbcib.com, pt-dev@chess.eecs.berkeley.edu