wizards/source/scriptforge/python/scriptforge.py | 4 ++++ 1 file changed, 4 insertions(+)
New commits: commit 992b393be8c33103cd18ca65dfc51cdfdb3fd618 Author: Jean-Pierre Ledure <j...@ledure.be> AuthorDate: Sun Sep 11 15:52:21 2022 +0200 Commit: Jean-Pierre Ledure <j...@ledure.be> CommitDate: Sun Sep 11 17:31:34 2022 +0200 ScriptForge - (scriptforge.py) ignore PythonShell in bridge mode Bridge mode = python dialogs with LO process via socket. Behaviour before actual patch: the exception.PythonShell() method gives a Python error on the from apso_utils import console statement, because the APSO libraries are not in the pythonpath. (They are set in the path by the exension in macro mode) New behaviour: the exception.PythonShell() method does nothing, the import statement is not executed, hence no error. The rationale behind is: - in bridge mode, the macro run is started in practice from either a Python console or an IDE console that receive evntual print() statements outputs - there is no need for an APSO console that, anyway, should not receive any output of print() statements, except if redirection of the output towards the APSO console (run in the [LO] process) was possible, quod non. - the same script may be executed in both bridge and macro modes without change Change-Id: Id7c8eb19cd074bf39f470d84b5eb48880e908f39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139772 Tested-by: Jean-Pierre Ledure <j...@ledure.be> Reviewed-by: Jean-Pierre Ledure <j...@ledure.be> diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py index e4a0aa5ea5b4..5535760445cd 100644 --- a/wizards/source/scriptforge/python/scriptforge.py +++ b/wizards/source/scriptforge/python/scriptforge.py @@ -1022,6 +1022,10 @@ class SFScriptForge: ext = ctx.getByName('/singletons/com.sun.star.deployment.PackageInformationProvider') apso = 'apso.python.script.organizer' if len(ext.getPackageLocation(apso)) > 0: + # APSO is available. However, PythonShell() is ignored in bridge mode + # because APSO library not in pythonpath + if ScriptForge.port > 0: + return None # Directly derived from apso.oxt|python|scripts|tools.py$console # we need to load apso before import statement ctx.ServiceManager.createInstance('apso.python.script.organizer.impl')