summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2021-05-14 18:21:35 +0200
committerJean-Pierre Ledure <jp@ledure.be>2021-05-15 09:52:26 +0200
commit1054cad056cc4f8f1823c81ec340b468024eb78c (patch)
tree18ddbb0410d9591ccfdb61742195a9c8fad65957 /wizards
parentd7bc3b5d3a55f621ee7eea2bc89ce1234b0b9db4 (diff)
ScriptForge - (scriptforge.py) None as default value
CreateScriptService() does not accept keyword arguments. In Basic positional arguments may be skipped, not in Python. This makes CreateScriptSevice('Dialog', '', '', 'myDialog') rather inelegant. Only for the Dialog service, None is accepted as default value i.o. '' for the Container and Library arguments. Change-Id: Ib96e23373140264c7100f174c7704ed32351f124 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115629 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/scriptforge/python/scriptforge.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/wizards/source/scriptforge/python/scriptforge.py b/wizards/source/scriptforge/python/scriptforge.py
index 048caf97d2e5..359db7a42ec1 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -1548,9 +1548,17 @@ class SFDialogs:
def PreProcessArgs(cls, args):
"""
Review the arguments of the creation of the Basic service (must be a class method)
- Add the XComponentContext as last argument
+ - accept None as default values for Container and Library arguments
+ - add the XComponentContext as last argument
"""
- newargs = (*args, ScriptForge.componentcontext)
+ listargs = list(args) # Make a mutable list because args is an immutable tuple
+ if len(listargs) >= 1:
+ if listargs[0] is None: # Container
+ listargs[0] = ''
+ if len(listargs) >= 2:
+ if listargs[1] is None:
+ listargs[1] = 'Standard' # Library
+ newargs = (*listargs, ScriptForge.componentcontext)
return newargs
def Activate(self):