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

Jean-Pierre Ledure (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 2 14:21:34 UTC 2019


 wizards/source/access2base/Utils.xba |   53 +++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

New commits:
commit c27c94f8945bb3568c0075e0e49207814f6d08fc
Author:     Jean-Pierre Ledure <jp at ledure.be>
AuthorDate: Tue Jul 2 16:18:52 2019 +0200
Commit:     Jean-Pierre Ledure <jp at ledure.be>
CommitDate: Tue Jul 2 16:18:52 2019 +0200

    Access2Base - MsgBox and InputBox methods
    
    Convenient functions to be called from Python

diff --git a/wizards/source/access2base/Utils.xba b/wizards/source/access2base/Utils.xba
index 56a2e8a85dd3..65221aba3007 100644
--- a/wizards/source/access2base/Utils.xba
+++ b/wizards/source/access2base/Utils.xba
@@ -872,6 +872,59 @@ Dim lChar As Long, sByte1 As String, sByte2 As String, sByte3 As String
 End Function	'	_PercentEncode V1.4.0
 
 REM -----------------------------------------------------------------------------------------------------------------------
+Public Function _PyInputBox(ByVal pvText As Variant _
+									, ByVal pvTitle As Variant _
+									, ByVal pvDefault As Variant _
+									, ByVal pvXPos As Variant _
+									, ByVal pvYPos As Variant _
+									) As Variant
+'	Convenient function to open input box from Python
+
+	On Local Error GoTo Exit_Function
+	_PyInputBox = Null
+
+	If Not Utils._CheckArgument(pvText, 1, vbString) Then Goto Exit_Function
+	If IsEmpty(pvTitle) Then pvTitle = ""
+	If Not Utils._CheckArgument(pvTitle, 2, vbString) Then Goto Exit_Function
+	If IsEmpty(pvDefault) Then pvDefault = ""
+	If Not Utils._CheckArgument(pvDefault, 3, vbString) Then Goto Exit_Function
+	If IsEmpty(pvXPos) Or IsEmpty(pvYPos) Then
+		_PyInputBox = InputBox(pvText, pvTitle, pvDefault)
+	Else
+		If Not Utils._CheckArgument(pvXPos, 4, Utils._AddNumeric()) Then Goto Exit_Function
+		If Not Utils._CheckArgument(pvYPos, 5, Utils._AddNumeric()) Then Goto Exit_Function
+		_PyInputBox = InputBox(pvText, pvTitle, pvDefault, pvXPos, pvYPos)
+	End If
+
+Exit_Function:
+	Exit Function
+End Function	'	PyInputBox V6.4.0
+
+REM -----------------------------------------------------------------------------------------------------------------------
+Public Function _PyMsgBox(ByVal pvText As Variant _
+									, ByVal pvType As Variant _
+									, ByVal pvDialogTitle As Variant _
+									) As Variant
+'	Convenient function to open message box from Python
+
+	On Local Error GoTo Exit_Function
+	_PyMsgBox = Null
+
+	If Not Utils._CheckArgument(pvText, 1, vbString) Then Goto Exit_Function
+	If IsEmpty(pvType) Then pvType = 0
+	If Not Utils._CheckArgument(pvType, 2, Utils._AddNumeric()) Then Goto Exit_Function
+	If IsEmpty(pvDialogTitle) Then
+		_PyMsgBox = MsgBox(pvText, pvType)
+	Else
+		If Not Utils._CheckArgument(pvDialogTitle, 3, vbString) Then Goto Exit_Function
+		_PyMsgBox = MsgBox(pvText, pvType, pvDialogTitle)
+	End If
+
+Exit_Function:
+	Exit Function
+End Function	'	PyMsgBox V6.4.0
+
+REM -----------------------------------------------------------------------------------------------------------------------
 Public Function _ReadFileIntoArray(ByVal psFileName) As Variant
 '	Loads all lines of a text file into a variant array
 '	Any error reduces output to an empty array


More information about the Libreoffice-commits mailing list