Age | Commit message (Collapse) | Author |
|
Basic use ProperCased arguments, Python lowercased ones.
The error messages always displayed the ProperCase notation.
Example:
BEFORE: called both from Basic or Python:
Library : ScriptForge
Service : FileSystem
Method : OpenTextFile
Arguments: FileName, [IOMode=1], [Create=False], [Encoding="UTF-8"]
A serious error has been detected in your code on argument : FileName
The given file could not be found on your system.
FileName = /...
AFTER: called from Basic, as above, and from Python:
Library : ScriptForge
Service : FileSystem
Method : OpenTextFile
Arguments: filename, [iomode=1], [create=False], [encoding="UTF-8"]
A serious error has been detected in your code on argument : filename
The given file could not be found on your system.
filename = /...
Minor user visibility. No need to cherry-pick to 7.2 branch.
Change-Id: I6938c3149fe883ded97051897c19aca23eadcc58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117501
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The last 2 arguments have resp. XPosTwips and YPosTwips
as names.
The signature in Python is correct.
The signature in Basic still used the XPos and YPos names.
No visibility towards users.
No need to cherry-pick to the 7.2 branch.
Change-Id: Id93de702cbcb0f3ae72a1f95247189299cb7cf30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117482
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
SF_UI.GetDocument() has 1 argument.
Before, must be a string designating an open window
Now, also a UNO object of types
com.sun.star.lang.XComponent or
com.sun.star.comp.dba.ODatabaseDocument
Typical usage: pass ThisComponent or ThisDatabaseDocument
as argument to create a new SFDocuments.Document/Base/Calc service.
Change-Id: Id9e0a40425dc3ce5e83953af5da4fb7ef8dd6f63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117442
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
For Python scripts only:
the CreateScriptService() method accepts now both positional
(as before) and keyword arguments.
The impacted services are:
- database
- dialog
- document
- base
- calc
Done with the ReviewServiceArgs() class method that returns the
input arguments as a tuple in the correct sequence. This method
is inserted in each of the impacted service definitions.
Change-Id: I545ca5ef0a4e7946d598eed07a2122885e4f864a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117387
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Insert in each service module a pointer to the
help page on https://help.libreoffice.org
containing the user documentation of the given
service.
Example:
SF_Array.xba contains a pointer to next help page
https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_array.html?DbPAR=BASIC
Only addition of comments lines.
No code change.
Change-Id: I83899d9fab247d23e2d5123378e2fb3fd0ade60e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117370
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Increment the versioning constants from 7.2 to 7.3 in next files
modified: wizards/source/scriptforge/SF_Utils.xba
modified: wizards/source/scriptforge/po/ScriptForge.pot
modified: wizards/source/scriptforge/po/en.po
modified: wizards/source/scriptforge/python/scriptforge.py
Change-Id: Iba78215cea9c16f3e7dd9302b84c90815c7a9e68
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117258
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: I68ec6c53bbf9f6631f33192776b154936c1b721e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117065
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Addition to the Basic service for Python scripts
of 2 Basic builtin objects:
- ThisComponent
returning the current component
- ThisDatabaseDocument
returning the main Base component when a subcomponent is active
Both are implemented as properties of SF_Basic.
The behaviour can be slightly different versus native Basic when
the Basic IDE is involved. Read comments in code.
Change-Id: I5d59b0ae0bae026f9b7e4c1d7068e84958aab56d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116674
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
GetSystemTicks() and GetPathSeparator() are inverted
Change-Id: I7e5c14041d6c70fe0a47519c93a24360ccc2d162
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116048
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The CDate() method replicates in Python the behavior of the Basic
builtin function with the same name, except that it returns
its unique input argument when it could not be recognized as
a valid date, while Basic raises an DataType error.
The method is introduced to make it easy to Python devs to
convert numbers stored in Calc cells and representing dates
to their corresponding datetime.datetime instance.
Change-Id: Ifd8fbd4bf7a97bf6b91cf481c09d75ec14159916
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115989
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Previous behavior:
After a PythonShell() statement that opened the APSO shell console,
subsequent print() statements executed in the same macro
run were not displayed in the console.
They were only from a next macro run.
Solution:
Force a brief suspension of the Python process by inserting
a call to a Basic routine (IPC) immediately after the launch
of the shell console.
Result: The redirection of STDOUT and STDERR happens normally inside
the APSO code, as expected.
Change-Id: Ifbf267a898d45a97c346f0f3ea824edd4e6045ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115930
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
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>
|
|
In the SFDialogs.SF_Dialog class:
- Fix the comments describing the behaviour of non-modal dialogs
- Add the OKBUTTON and CANCELBUTTON definitions
Change-Id: I2d3abc1c610b0c60949987feb1a9d66e21abfdc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115152
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Error was announced with a message box.
Error message was not translatable.
Managed with standard exception handling.
Change-Id: I10d67985ec4bdebce5bda9123caddb4134646b48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115095
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Strings in CSV file recognized as dates are passed via
their ISO format, not in the default com.sun.star.util.DateTime
format. This required a fix in Basic ImportFromCSVFile().
Errors in user scripts can be announced to users from Python
with the same interface as from Basic: SF_Exception.RaiseFatal().
Error messages become translatable.
Used by SF_Exception.PythonShell(), display of APSO console,
when the APSO extension is not present.
Addition of the PYTHONSHELL error message in the po files.
Review of typos.
Change-Id: I52a19faa3773904bd37505fee780d517436485f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115032
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: Id54e8fd6803c3a6c0d924338d1781679ed0b1bfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115025
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
In replacement of the ISO format, to avoid any
misinterpretation of strings containing accidentally
a date,
from now on, dates are exchanged between Basic and Python
as com.sun.star.util.DateTime structures.
The year boundaries are [1900 - 9999].
The code managing the Python-Basic protocol has been changed
on both sides.
The Basic service receives the
- CDateFromUnoDateTime()
- CDateToUnoDateTime()
methods, equivalent with their Basic homonyms.
Change-Id: Ib6ded20c24ff71d3349d242f72bd7b88f69a2661
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114815
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
When launching a dialog from a Python script while the
dialog is contained in a document, the DialogProvider setup
from that context was built by the wrong method.
Use createInstanceWithArguments()
i.o. createInstanceWithContext()
This caused a LibreOffice crash.
Change-Id: I3615c55068134085579662004f5bb085de008cbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114677
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
cfr. https://gerrit.libreoffice.org/c/core/+/114659
Change-Id: I1638ee3f523e685b324201cc9916a743db0ecb7e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114662
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The PythonShell() method invokes the console() method
of the APSO extension.
It accepts 1 argument, which is a dictionary of variables
that the user wants transferred to the console to become part
of the Python context there.
Typical usage:
exc.PythonShell( {**globals(), **locals()} )
Subsequent print() statements executed in the user script
are displayed in the console.
An (untranslated - english) error message is raised when
the APSO extension is not installed.
Change-Id: I1b620bc041e1293234ddfd789e0ce8892dc87169
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114561
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: I83e1fb153601106d028641db3c9a636813b928e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114348
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
|
|
A number of methods were defined implicitly as
instance methods.
Where apropriate they are replaced by class methods:
- insertion of the @classmethod decorator
- self replaced with cls
1 line in SF_PythonHelper.xba uncommented:
it was so far commented in for debugging
Change-Id: Ie8c3dd740f0129511295877ef947b1db35475c48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114440
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: I85f7f1f870078aa18f28402e24b55422a10eea0a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114338
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
New classes to manage Basic dialogs and their controls from
Python.
The use of UNO interfaces has been reviewed in Basic:
replacement of
CreateUnoDialog()
by
XDialogProvider.createDialog()
The latter allows to run dialogs in non-modal mode.
SF_UI.ShowProgressBar() and SF_Console() have been reviewed
to incorporate the XSCRIPTCONTEXT shipped with Python
Now the console and the progress bar are able to run
in non-modal mode.
Change-Id: I49b09aa41ee6f50e6d205f44fc329f91bce76beb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114296
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
When a Base form is:
1. opened with OpenFormDocument(), then closed
2. Opened manually in Edit mode, then closed
3. Reopened with OpenFormDocument() in normal mode
- it again gets opened in Edit mode
- its closure is not executed, neither by program nor manually
The OpenFormDocument() method is simplified:
the invoked loadComponent method may be executed even when
the form is already open. It simply activates the form which
is exactly the expected bahaviour.
Additionally:
- the opening mode is checked after the open and, if not
matching the expected DesignMode argument, reset.
- the alive check of a form (IsStillAlive()) does not require
a database connection anymore
Change-Id: I5f55e45b246867d19e514e0d820f164790dec300
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114092
Tested-by: Jenkins
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
New class to run from Python DDL + DML SQL commands
on databases embedded in or connected to Base documents.
GetRows() is hardcoded as an exception (cfr. bug #138155) in
_PythonDispatcher() - SF_PythonHelper.xba
to be able to return 2D arrays to Python.
Fix returned empty arrays in the Basic-Python engine:
the standard bridge ignores them and returns a null byte
sequence instead of an empty tuple.
Change-Id: I336ea0b585b759b998af0871d25bfd384a2e66ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113953
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
New class to manage controls in forms and subforms
from Python, essentially thru the use of Properties
Required a review of SF_FormControl.Getproperty()
Indeed, the IDE debugger computes all the properties
of a Basic object when expanded in the watch window.
This can cause errors.
This class makes use of default values for properties
when irrelevant for the actual control type
Error were detected on date/time conversions of date/timefield
controls and corrected.
SF_String etc shortcuts have been removed (see previous commit)
because not applicable in every scenario.
The only entry point to the API from a user Python script
is via CreateScriptService().
Change-Id: Ia87c7281c3fcf39ab0c3528f00114c9b1e067bcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113920
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Completion of the SFDocuments.SF_Base
and addition of the SFDocuments.SF_Form classes
Config of properties and methods
Some methods require an hardcoded processing in
_PythonDispatcher() - SF_PythonHelper.xba
because they potentially may return arrays (cfr. bug #138155)
Addition of SF_String etc shortcuts in Python
for compatibility with Basic
Change-Id: Id9852c214618e863b2fdf60aa5f80e36b3547a36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113739
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: I41f5c964a289a88b3f6fc637797fe77d17aaab38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113737
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
|
|
Previously, all of the README files have been renamed to README.md
and now, the contents of these files were changed to use Markdown
format. Other than format inconsistency, some README.md files lacked
information about modules, or were out of date. By using LibreOffice
/ OpenOffice wiki and other documentation websites, these files were
updated. Now every README.md file has a title, and some description.
The top-level README.md file is changed to add links to the modules.
The result of processing the Markdown format README.md files can be
seen at: https://docs.libreoffice.org/
Change-Id: Ic3b0c3c064a2498d6a435253b041df010cd7797a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113424
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
|
|
Change-Id: I64d32773984a3ab06e809fcaeff8f95b910e127b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113700
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
|
|
To make the access to services more close to Python habits
and to better attract Basic users to Python, the convention
for attributes naming has been defined as:
- property names may be ProperCased, camelCased or lowercased
- method names may be ProperCased, camelCased or lowercased
Their arguments are always lowercased
In documentation examples, the camelCased notation will be privileged
Synonyms for properties and methods are computed
with a generic function: SCriptForge.SetAttributeSynonyms()
The generic getter and setter have been reviewed accordingly.
Method synonyms are NOT HARDCODED anymore.
Change-Id: I528820fe195d6b67e02035e589deee2b61c056ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113666
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: Ida5172f860303fa9493dd3477a970d29f87444de
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113596
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
|
|
Changes in the Basic-Python engine:
- arguments of methods may be 2D arrays
- 1st argument of method may be a Basic object
- properties starting with 'X' may contain UNO objects
- GetProperty may contain 1 argument
Calc class is a subclass of the Document class in Python
(in Basic it is simulated)
A CalcReference class is also created to contain
Range and Sheet objects
Many comments have been reviewed for consistency in SF_Calc,
SF_Form and SF_FormControl.xba
Conversion to DataArrays is improved to process input
arrays of arrays. Date conversions are supported.
Change-Id: Id6254d668ec981b00555e7e277c4d31982c00092
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113568
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Full support of the session class methods from Python
The InvokeSimpleScript() python method has been
extended to support broader scopes (extensions and user documents)
and ParamArray arguments in Basic.
Indeed the SF_Session.ExecuteBasicScript() and
SF_Session.ExecuteCalcFunction() require a varying number
of arguments.
No regression found in unit tests
Change-Id: I0899bc6535b00340ed82b46336d60a7bb23b2098
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113154
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Only a subset of the available methods is implemented:
HashStr, IsADate, IsEmail, IsFileName, IsIBAN,
IsIPv4, IsLike, IsSheetName, IsUrl,
SplitNotQuoted, Wrap
The other methods are better replaced by Python builtin
functions.
The flgDateArg flag has been introduced to distinguish
a date argument passed as a string that does not require
conversion from a date passed in iso-format that
requires a conversion to a Basic variable of type Date
Change-Id: I80f7e816dfeaee793862f3c3d35488da7c573c8f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113002
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Renaming all README files for all top level modules to README.md,
applying no content change at this stage to be able to track history
of the files. These files should be edited to use correct Markdown
syntax later.
Change-Id: I542fa3f3d32072156f16eaad2211a397cc212665
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112977
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
|
|
SF_String.IsIBAN() returns True if the given string is a valid
International Bank Account Number
https: //en.wikipedia.org/wiki/International_Bank_Account_Number
Change-Id: I7d1257c6a8f8728c523e578e9150fbffa424e5e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112815
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The signatures of standard Basic built-in functions were
derived from the Help documentation.
They appeared to be inexact.
They now comply with
core/basic/source/runtime/stdobj.cxx
Change-Id: I343fb553f5fad5236d75f6b72910714d47b6a289
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112669
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The SF_Array (Basic) class is highly redundant with the
Python tuple/list classes.
Hence only 1 method is implemented in Python:
ImportFromCSVFile()
to have the same csv files imported identically
in both environments.
The returned value is a tuple of tuples.
Restriction: dates are recognized but converted to their ISO format.
Up to the user to interpret them correctly.
Change-Id: I6611964a8083a9d7c6f9622b2aef64fe8b1491ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112585
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The SF_Exception class is not intended to replace or complement
the builtin Python exception handling.
Hence it implements only a subset of the corresponding
Basic service.
- no properties: they are fully related to Basic error trapping
- next methods are available: Console, ConsoleClear, ConsoleToFile,
DebugPrint and RaiseFatal (reserved for internal use)
Restriction: Console() does not work in non-modal mode.
DebugPrint formats its messages by using the repr() builtin method.
DebugPrint outputs from Basic or from Python are mixed within
the same console.
The other methods call their Basic counterpart.
A new method has been added both in Python and Basic: DebugDisplay
It combines DebugPrint with a display in a message box of the
arguments.
Change-Id: Iba94ab951b95b409c881ac17560476d6e9bc2fc2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112570
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
The new SF_Dictionary class subclasses the dict native Python class
and implements 2 methods:
- ConvertToPropertyValues()
- ImportFromPropertyValues()
Usage:
dico = dict(A = 1, B = 2, C = 3)
myDict = CreateScriptService('Dictionary', dico) # Initialize myDict with the content of dico
myDict['D'] = 4
print(myDict) # {'A': 1, 'B': 2, 'C': 3, 'D': 4}
propval = myDict.ConvertToPropertyValues()
or, alternatively:
dico = dict(A = 1, B = 2, C = 3)
myDict = CreateScriptService('Dictionary') # Initialize myDict as an empty dict object
myDict.update(dico) # Load the values of dico into myDict
myDict['D'] = 4
print(myDict) # {'A': 1, 'B': 2, 'C': 3, 'D': 4}
propval = myDict.ConvertToPropertyValues()
Change-Id: I932e899062c39f3fe8ab05dcf3cd02acf2f060a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112488
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: Ied3445430ffefbf27674f103c879a606909c9b3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112478
Tested-by: Jenkins
Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
|
|
To make the access to services more close to Python habits
and to better attract Basic users to Python, the convention
for attributes naming has been enhanced:
- property names may be ProperCased, camelCased or lowercased
- method names may be ProperCased, camelCased or lowercased
Their arguments are always lowercased
In documentation examples, the camelCased notation will be privileged
Synonyms for properties are managed with generic functions.
The generic getter and setter has been reviewed accordingly.
Method synonyms are hardcoded.
The management of synonyms for servicenames have also been
reviewed to be defined in each class i.o. centrally and hardcoded
in CreateScriptService()
Change-Id: Id8d3181118b1e61937e2412109bd0d1eedd6f5e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112470
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Addition of SF_Platform class
Most properties are provided by a direct call to
ScriptForgeHelper.py
Others result from an interaction with the Basic-Python machinery
Addition of STarDesktop() method in the SF_Basic class
Change-Id: If1c03fe8e0ad36b6a665c8c44b477eca7cbc24bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112393
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Addition of SF_L10N class
Correction in Languages() property:
selection of file based on *.po filter i.o. ??-??.po
Change-Id: I5c57d1973265f2aeb7a3cfb4f507ffd50a28785a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112211
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Addition of SF_FileSystem and SF_TextStream classes
Machinery tuning:
- freeze a predefined list of standard modules
in the python persistent storage
- error management reviewed to mimic Basic behaviour on wrong
arguments
Standard modules are predefined in scriptforge.py as well
Both lists must be synchronized on a hardcoded entry number
Basic has minor revisions:
- complex boolean expressions return -1 and 0 to Python
i.o. True and False => Add a CBool() function
- [User]TemplatesFolder properties of FileSystem omitted the final "/"
Change-Id: Ice138de956f5f87269557cdb3db023849081b99d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112199
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Change-Id: I0a6b74356bd689b54883efc4608a06fb9446e828
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112024
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
Python scripts can now invoke usual Basic builtin functions
Example:
from ScriptForge import CreateScriptService
bas = CreateScriptService('Basic')
bas.MsgBox('This is the text to be displayed', bas.MB_ICONEXCLAMATION)
Python scripts can use most ScriptForge services written in Basic
Example:
from scriptforge import CreateScriptService
FSO = CreateScriptService('FileSystem')
a = FSO.BuildPath('/tmp', 'xyz')
Syntax and semantic are as close as possible to the Basic syntax
Implemented are a SFServices class and its subclasses representing each
a ScriptForge service and where the interfaces are defined (properties,
methods and arguments)
Their execution goes through the "machinery", i.e. a set of python
and basic routines that manage the call from the python process to
the appropriate service in an as much agnostic and generic way
Only a limited set of services are implemented so far: SF_FileSystem
(partially) and SF_Timer: they served as prototypes and initial tests
Change-Id: I0b383b59359c12710e7165139e498cca5a7856bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111971
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|
|
- 'Locale' returns a la-CO (language-COUNTRY) string
derived from com.sun.star.lang.Locale
- 'PythonVersion' returns Python major.minor.patchlevel
supplied by ScriptForgeHelper.py platform class
Change-Id: I2b8495c03253b17c5e4ba14765b1f359eee67813
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111284
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
|