[quote="PGriffith, post:8, topic:98898"]
for window in Window.getWindows():
ptas = getAllComponentsOfClass(window, 'PythonTextArea')
for pta in ptas:
pta.textArea.insertPairedCharacters
[/quote]
I actually did this per your instruction originally, and I couldn't find the attribute. The pta.textarea
call doesn't retrieve a pure RSyntaxTextArea. It gets a PythonTextArea$textArea$1'. However, even when I approached it reflectively to get at the raw class, .gerClass().getSuperclass().getSuperclass()
, in this case, I didn't see that attribute on the RSyntaxTextArea.
Update: After updating my test gateway to 8.1.44, I noticed an extra '
get added whenever I would create a comment block using '''
. I hadn't seen that behavior before, and I remembered this post. Running the test again, the attribute is there, so the fact that I couldn't find it was because I wasn't using the latest version.
Here is an updated version of the script based on the feedback above:
from java.awt import Window
def getAllComponentsOfClass(container, className):
for component in container.components:
if component.__class__.__name__ == className:
yield component
else:
for c in getAllComponentsOfClass(component, className):
yield c
for window in Window.getWindows():
if window.visible:
scriptEditors = getAllComponentsOfClass(window, 'PythonTextArea$textArea$1')
# Use this for Perspective's advanced style sheet:
# scriptEditors = getAllComponentsOfClass(window, 'RSyntaxTextArea')
for editor in scriptEditors:
editor.insertPairedCharacters = False
I've tested it and it works
One interesting observation I made while subsequently testing was in the Perspective style sheet—which is the only pure RSyntaxTextArea I'm aware of in Ignition. It does auto complete the '
on the first press, but it deletes the auto completion if the apostrophe is pressed a second time, and the quadruple apostrophe doesn't occur, so perhaps the key to fixing the PythonTextArea$textArea$1
nuisance duplications is in the style sheet's implementation.