wizards/source/scriptforge/python/scriptforge.py  |    6 +++---
 wizards/source/scriptforge/python/scriptforge.pyi |   14 ++++++++------
 2 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit d2d14c36d1820da2290d13fb668533269a976743
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Thu Sep 5 13:40:17 2024 +0200
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Thu Sep 5 15:21:53 2024 +0200

    ScriptForge (Database) DMin, DMax return strings or dates
    
    Python only:
    
    Reset a flag in SF_Database.DMin and DMax methods
    to allow dates to be returned.
    
    Review typing hints to accept strings and dates
    
    Integration of remarks from Microsoft/VSCode
    about minor syntax issues in scriptforge.pyi
    (syntax was accepted by PyCharm).
    Now, syntax commonly accepted by both IDE's.
    
    Change-Id: I752d9f1d7a5293222d81748f8fb2e8f46f4317de
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172912
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>
    Tested-by: Jenkins

diff --git a/wizards/source/scriptforge/python/scriptforge.py 
b/wizards/source/scriptforge/python/scriptforge.py
index ad1d027068e1..e30c36bbb7ae 100644
--- a/wizards/source/scriptforge/python/scriptforge.py
+++ b/wizards/source/scriptforge/python/scriptforge.py
@@ -156,7 +156,7 @@ class ScriptForge(object, metaclass = _Singleton):
         ScriptForge.port = port
         # Determine main pyuno entry points
         ScriptForge.componentcontext = self.ConnectToLOProcess(hostname, port) 
 # com.sun.star.uno.XComponentContext
-        ScriptForge.scriptprovider = 
self.ScriptProvider(self.componentcontext)  # ...script.provider.XScriptProvider
+        ScriptForge.scriptprovider = 
self.ScriptProvider(ScriptForge.componentcontext)  # 
...script.provider.XScriptProvider
         #
         # Establish a list of the available services as a dictionary 
(servicename, serviceclass)
         ScriptForge.serviceslist = dict((cls.servicename, cls) for cls in 
SFServices.__subclasses__())
@@ -1807,10 +1807,10 @@ class SFDatabases:
             return self.ExecMethod(self.vbMethod, 'DLookup', expression, 
tablename, criteria, orderclause)
 
         def DMax(self, expression, tablename, criteria = ''):
-            return self.ExecMethod(self.vbMethod, 'DMax', expression, 
tablename, criteria)
+            return self.ExecMethod(self.vbMethod + self.flgDateRet, 'DMax', 
expression, tablename, criteria)
 
         def DMin(self, expression, tablename, criteria = ''):
-            return self.ExecMethod(self.vbMethod, 'DMin', expression, 
tablename, criteria)
+            return self.ExecMethod(self.vbMethod + self.flgDateRet, 'DMin', 
expression, tablename, criteria)
 
         def DSum(self, expression, tablename, criteria = ''):
             return self.ExecMethod(self.vbMethod, 'DSum', expression, 
tablename, criteria)
diff --git a/wizards/source/scriptforge/python/scriptforge.pyi 
b/wizards/source/scriptforge/python/scriptforge.pyi
index e4f596661416..98ca1e3d78be 100644
--- a/wizards/source/scriptforge/python/scriptforge.pyi
+++ b/wizards/source/scriptforge/python/scriptforge.pyi
@@ -2639,7 +2639,7 @@ class SFDatabases:
                 """
             ...
 
-        def DAvg(self, expression: str, tablename: str, criteria: str = ...) 
-> Optional[float, int]:
+        def DAvg(self, expression: str, tablename: str, criteria: str = ...) 
-> Optional[Union[float, int]]:
             """
                 Compute the aggregate function ``AVG()`` on a  field or 
expression belonging to a table
                 filtered by a ``WHERE``-clause.
@@ -2692,7 +2692,8 @@ class SFDatabases:
                 """
             ...
 
-        def DMax(self, expression: str, tablename: str, criteria: str = ...) 
-> Optional[float, int]:
+        def DMax(self, expression: str, tablename: str, criteria: str = ...) \
+                -> Optional[Union[float, int, str, datetime.datetime]]:
             """
                 Compute the aggregate function ``MAX()`` on a  field or 
expression belonging to a table
                 filtered by a ``WHERE``-clause.
@@ -2707,7 +2708,8 @@ class SFDatabases:
                 """
             ...
 
-        def DMin(self, expression: str, tablename: str, criteria: str = ...) 
-> Optional[float, int]:
+        def DMin(self, expression: str, tablename: str, criteria: str = ...) \
+                -> Optional[Union[float, int, str, datetime.datetime]]:
             """
                 Compute the aggregate function ``MIN()`` on a  field or 
expression belonging to a table
                 filtered by a ``WHERE``-clause.
@@ -2722,7 +2724,7 @@ class SFDatabases:
                 """
             ...
 
-        def DSum(self, expression: str, tablename: str, criteria: str = ...) 
-> Optional[float, int]:
+        def DSum(self, expression: str, tablename: str, criteria: str = ...) 
-> Optional[Union[float, int]]:
             """
                 Compute the aggregate function ``SUM()`` on a  field or 
expression belonging to a table
                 filtered by a ``WHERE``-clause.
@@ -5494,7 +5496,7 @@ class SFDocuments:
                 """
             ...
 
-        def GetFormula(self, range: RANGE) -> Union[str, Tuple[str, ...], 
Tuple[Tuple[str, ...]], ...]:
+        def GetFormula(self, range: RANGE) -> Union[str, Tuple[str, ...], 
Tuple[Tuple[str, ...]]]:
             """
                 Get the formula(s) stored in the given range of cells as a 
single string, a tuple of strings,
                 or a tuple of tuples of strings.
@@ -7320,7 +7322,7 @@ def CreateScriptService(service: Literal['newdialog', 
'NewDialog', 'SFDialogs.Ne
                         place: Tuple[int, int, int, int]) -> Optional[DIALOG]: 
...
 @overload
 def CreateScriptService(service: Literal['dialogevent', 'DialogEvent', 
'SFDialogs.DialogEvent'],
-                        event: Optional[UNO] = None) -> Optional[DIALOG, 
DIALOGCONTROL]: ...
+                        event: Optional[UNO] = None) -> Optional[Union[DIALOG, 
DIALOGCONTROL]]: ...
 @overload
 def CreateScriptService(service: Literal['document', 'Document', 
'SFDocuments.Document'],
                         windowname: Union[UNO, str] = '') -> 
Optional[DOCUMENT]: ...

Reply via email to