This implements the Editable invoke action on ScriptBrowseNode and FileBrowseNode using a shared mixin class so that when the user selects a file or a macro in the dialog for organising macros the edit button will be clickable. When clicked the default app for .py files will be opened. On Windows it seems that installing a Python interpreter makes that the default application for Python files. In order to avoid just running the script instead of editing it, the code tries to determine what program is the default by calling AssocQueryString via ctypes. If it looks like a Python interpreter the python file will be opened with notepad instead. Otherwise the document is opened with the “open” verb via os.startfile. On all other platforms the file is opened with SystemShellExecute. On my Mac this ends up opening it in XCode. On my default Fedora install this ends up opening the script in gedit which is probably quite a good default. Hopefully there are no distros that default to executing Python scripts when passed to xdg-open. For some reason SystemShellExecute doesn’t seem to do anything on Windows which is why os.startfile is used instead. Change-Id: If37ee13aea0200cd6b20230bd92a77aa6a0d3273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202852 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
Scripting Framework
This module provides the source code for the Scripting Framework.
For more information on the Scripting Framework, see the project web page: https://framework.openoffice.org/scripting/
This module uses astyle to keep consistent java coding style. Please run
./Format_java_code.sh
before committing.
Source Code Structure
The following directories contain the source code currently used by the Scripting Framework:
source/provider
C++ source for the implementations of the com.sun.star.script.provider.*
and com.sun.star.script.browse.* UNO types. These types are used for
browsing and executing scripts.
source/protocolhandler
C++ for a ProtocolHandler implementation that handles vnd.sun.star.script
URIs and dispatches them for execution to the Scripting Framework.
source/basprov
C++ implementation of the LanguageScriptProvider UNO service for Basic
source/dlgprov
C++ implementation of the DialogProvider UNO service used for loading
UNO dialogs from various languages
source/pyprov
LanguageScriptProvider for Python
java/com/sun/star/script/framework/provider
Implementation of an abstract base class ScriptProvider which provides
core methods for implementing Java based LanguageScriptProvider implementations
java/com/sun/star/script/framework/provider/*
BeanShell, JavaScript and Java LanguageScriptProvider implementations
java/com/sun/star/script/framework/browse/*
BrowseNode implementations for the Java based LanguageScriptProviders
java/com/sun/star/script/framework/iojava/com/sun/star/script/framework/container
Classes for performing script IO
examples
Example scripts in BeanShell, JavaScript, Java and Python
Deprecated Code
java/org/openoffice/*
Support for developing scripts in IDEs such as NetBeans.