LibreOffice Module wizards (master) 1
|
Public Member Functions | |
def | __init__ (self, hostname='', port=0) |
def | ConnectToLOProcess (cls, hostname='', port=0) |
def | ScriptProvider (cls, context=None) |
def | InvokeSimpleScript (cls, script, *args) |
def | InvokeBasicService (cls, basicobject, flags, method, *args) |
![]() | |
def | __call__ (cls, *args, **kwargs) |
Static Public Member Functions | |
def | SetAttributeSynonyms () |
def | unpack_args (kwargs) |
Public Attributes | |
servicesdispatcher | |
Static Public Attributes | |
string | hostname = '' |
int | port = 0 |
componentcontext = None | |
scriptprovider = None | |
bool | SCRIPTFORGEINITDONE = False |
string | library = 'ScriptForge' |
string | Version = '7.6' |
string | basicdispatcher = '@application#ScriptForge.SF_PythonHelper._PythonDispatcher' |
string | pythonhelpermodule = 'ScriptForgeHelper.py' |
V_EMPTY | |
V_NULL | |
V_INTEGER | |
V_LONG | |
V_SINGLE | |
V_DOUBLE | |
V_CURRENCY | |
V_DATE | |
V_STRING | |
V_OBJECT | |
V_BOOLEAN | |
V_VARIANT | |
V_ARRAY | |
V_ERROR | |
V_UNO | |
objMODULE | |
objCLASS | |
objUNO | |
cstSymEmpty | |
cstSymNull | |
cstSymMissing | |
servicesmodules | |
![]() | |
dictionary | instances = {} |
The ScriptForge (singleton) class encapsulates the core of the ScriptForge run-time - Bridge with the LibreOffice process - Implementation of the inter-language protocol with the Basic libraries - Identification of the available services interfaces - Dispatching of services - Coexistence with UNO It embeds the Service class that manages the protocol with Basic
Definition at line 81 of file scriptforge.py.
def scriptforge.ScriptForge.__init__ | ( | self, | |
hostname = '' , |
|||
port = 0 |
|||
) |
Because singleton, constructor is executed only once while Python active Arguments are mandatory when Python and LibreOffice run in separate processes :param hostname: probably 'localhost' :param port: port number
Definition at line 132 of file scriptforge.py.
References scriptforge.ScriptForge.componentcontext, scriptforge.ScriptForge.ConnectToLOProcess(), scriptforge.ScriptForge.ScriptProvider(), scriptforge.SFScriptForge.SF_Array.servicename, scriptforge.SFScriptForge.SF_Basic.servicename, scriptforge.SFScriptForge.SF_Dictionary.servicename, scriptforge.SFScriptForge.SF_Exception.servicename, scriptforge.SFScriptForge.SF_FileSystem.servicename, scriptforge.SFScriptForge.SF_L10N.servicename, scriptforge.SFScriptForge.SF_Platform.servicename, scriptforge.SFScriptForge.SF_Region.servicename, scriptforge.SFScriptForge.SF_Session.servicename, scriptforge.SFScriptForge.SF_String.servicename, scriptforge.SFScriptForge.SF_TextStream.servicename, scriptforge.SFScriptForge.SF_Timer.servicename, scriptforge.SFScriptForge.SF_UI.servicename, scriptforge.SFDatabases.SF_Database.servicename, scriptforge.SFDatabases.SF_Datasheet.servicename, scriptforge.SFDialogs.SF_Dialog.servicename, scriptforge.SFDialogs.SF_NewDialog.servicename, scriptforge.SFDialogs.SF_DialogControl.servicename, scriptforge.SFDocuments.SF_Document.servicename, scriptforge.SFDocuments.SF_Base.servicename, scriptforge.SFDocuments.SF_Calc.servicename, scriptforge.SFDocuments.SF_CalcReference.servicename, scriptforge.SFDocuments.SF_Chart.servicename, scriptforge.SFDocuments.SF_Form.servicename, scriptforge.SFDocuments.SF_FormControl.servicename, scriptforge.SFDocuments.SF_FormDocument.servicename, scriptforge.SFDocuments.SF_Writer.servicename, scriptforge.SFWidgets.SF_Menu.servicename, scriptforge.SFWidgets.SF_PopupMenu.servicename, scriptforge.SFWidgets.SF_Toolbar.servicename, and scriptforge.SFWidgets.SF_ToolbarButton.servicename.
def scriptforge.ScriptForge.ConnectToLOProcess | ( | cls, | |
hostname = '' , |
|||
port = 0 |
|||
) |
Called by the ScriptForge class constructor to establish the connection with the requested LibreOffice instance The default arguments are for the usual interactive mode :param hostname: probably 'localhost' or '' :param port: port number or 0 :return: the derived component context
Definition at line 156 of file scriptforge.py.
References uno.getComponentContext().
Referenced by scriptforge.ScriptForge.__init__().
def scriptforge.ScriptForge.InvokeBasicService | ( | cls, | |
basicobject, | |||
flags, | |||
method, | |||
* | args | ||
) |
Execute a given Basic script and interpret its result This method has as counterpart the ScriptForge.SF_PythonHelper._PythonDispatcher() Basic method :param basicobject: a Service subclass :param flags: see the vb* and flg* constants in the SFServices class :param method: the name of the method or property to invoke, as a string :param args: the arguments of the method. Symbolic cst* constants may be necessary :return: The invoked Basic counterpart script (with InvokeSimpleScript()) will return a tuple [0] The returned value - scalar, object reference or a tuple [1] The Basic VarType() of the returned value Null, Empty and Nothing have different vartypes but return all None to Python Additionally, when [0] is a tuple: [2] Number of dimensions in Basic Additionally, when [0] is a UNO or Basic object: [2] Module (1), Class instance (2) or UNO (3) [3] The object's ObjectType [4] The object's ServiceName [5] The object's name When an error occurs Python receives None as a scalar. This determines the occurrence of a failure The method returns either - the 0th element of the tuple when scalar, tuple or UNO object - a new Service() object or one of its subclasses otherwise
Definition at line 266 of file scriptforge.py.
References scriptforge.ScriptForge.InvokeSimpleScript().
def scriptforge.ScriptForge.InvokeSimpleScript | ( | cls, | |
script, | |||
* | args | ||
) |
Create a UNO object corresponding with the given Python or Basic script The execution is done with the invoke() method applied on the created object Implicit scope: Either "application" a shared library (BASIC) "share" a library of LibreOffice Macros (PYTHON) :param script: Either [@][scope#][library.]module.method - Must not be a class module or method [@] means that the targeted method accepts ParamArray arguments (Basic only) [scope#][directory/]module.py$method - Must be a method defined at module level :return: the value returned by the invoked script, or an error if the script was not found
Definition at line 195 of file scriptforge.py.
References scriptforge.ScriptForge.library, scriptforge.ScriptForge.pythonhelpermodule, scriptforge.ScriptForge.scriptprovider, and scriptforge.ScriptForge.servicesdispatcher.
Referenced by scriptforge.ScriptForge.InvokeBasicService().
def scriptforge.ScriptForge.ScriptProvider | ( | cls, | |
context = None |
|||
) |
Returns the general script provider
Definition at line 185 of file scriptforge.py.
Referenced by scriptforge.ScriptForge.__init__().
|
static |
A synonym of an attribute is either the lowercase or the camelCase form of its original ProperCase name. In every subclass of SFServices: 1) Fill the propertysynonyms dictionary with the synonyms of the properties listed in serviceproperties Example: serviceproperties = dict(ConfigFolder = False, InstallFolder = False) propertysynonyms = dict(configfolder = 'ConfigFolder', installfolder = 'InstallFolder', configFolder = 'ConfigFolder', installFolder = 'InstallFolder') 2) Define new method attributes synonyms of the original methods Example: def CopyFile(...): # etc ... copyFile, copyfile = CopyFile, CopyFile
Definition at line 335 of file scriptforge.py.
|
static |
Convert a dictionary passed as argument to a list alternating keys and values Example: dict(A = 'a', B = 2) => 'A', 'a', 'B', 2
Definition at line 376 of file scriptforge.py.
|
static |
Definition at line 109 of file scriptforge.py.
|
static |
Definition at line 98 of file scriptforge.py.
Referenced by scriptforge.ScriptForge.__init__().
|
static |
Definition at line 120 of file scriptforge.py.
|
static |
Definition at line 120 of file scriptforge.py.
|
static |
Definition at line 120 of file scriptforge.py.
|
static |
Definition at line 96 of file scriptforge.py.
|
static |
Definition at line 105 of file scriptforge.py.
Referenced by scriptforge.ScriptForge.InvokeSimpleScript().
|
static |
Definition at line 118 of file scriptforge.py.
|
static |
Definition at line 118 of file scriptforge.py.
|
static |
Definition at line 118 of file scriptforge.py.
|
static |
Definition at line 97 of file scriptforge.py.
|
static |
Definition at line 111 of file scriptforge.py.
Referenced by scriptforge.ScriptForge.InvokeSimpleScript().
|
static |
Definition at line 100 of file scriptforge.py.
|
static |
Definition at line 99 of file scriptforge.py.
Referenced by scriptforge.ScriptForge.InvokeSimpleScript().
scriptforge.ScriptForge.servicesdispatcher |
Definition at line 253 of file scriptforge.py.
Referenced by scriptforge.ScriptForge.InvokeSimpleScript().
|
static |
Definition at line 122 of file scriptforge.py.
|
static |
Definition at line 116 of file scriptforge.py.
|
static |
Definition at line 115 of file scriptforge.py.
|
static |
Definition at line 115 of file scriptforge.py.
|
static |
Definition at line 115 of file scriptforge.py.
|
static |
Definition at line 114 of file scriptforge.py.
|
static |
Definition at line 114 of file scriptforge.py.
|
static |
Definition at line 116 of file scriptforge.py.
|
static |
Definition at line 114 of file scriptforge.py.
|
static |
Definition at line 114 of file scriptforge.py.
|
static |
Definition at line 114 of file scriptforge.py.
|
static |
Definition at line 115 of file scriptforge.py.
|
static |
Definition at line 114 of file scriptforge.py.
|
static |
Definition at line 115 of file scriptforge.py.
|
static |
Definition at line 116 of file scriptforge.py.
|
static |
Definition at line 116 of file scriptforge.py.
|
static |
Definition at line 106 of file scriptforge.py.