[Libreoffice-commits] core.git: wizards/source

Jean-Pierre Ledure (via logerrit) logerrit at kemper.freedesktop.org
Sat May 15 07:53:06 UTC 2021


 wizards/source/scriptforge/python/scriptforge.py |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 1054cad056cc4f8f1823c81ec340b468024eb78c
Author:     Jean-Pierre Ledure <jp at ledure.be>
AuthorDate: Fri May 14 18:21:35 2021 +0200
Commit:     Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Sat May 15 09:52:26 2021 +0200

    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 at ledure.be>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <jp at ledure.be>

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):


More information about the Libreoffice-commits mailing list