Class LoSocketStart
Class that makes a connection to LibreOffice via socket.
- Example:
from ooodev.conn.connect import LoSocketStart from ooodev.conn.connectors import ConnectSocket conn = LoSocketStart(ConnectSocket()) conn.connect() # may take a few seconds smgr = conn.ctx.getServiceManager() desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", conn.ctx) # do some work ... conn.kill_soffice()
Generally speaking this class will not be called directly. It is used internally by Lo
.
Lo Connect Example:
from ooodev.loader.lo import Lo from ooodev.office.calc import Calc loader = Lo.load_office(connector=Lo.ConnectSocket()) doc = Calc.create_doc(loader) # do work ... Lo.close_doc(doc=doc) Lo.close_office()
See also
- class ooodev.conn.connect.LoSocketStart(connector=None, cache_obj=None)[source]
Bases:
LoBridgeCommon
Socket Start
- Parameters:
connector (connectors.ConnectSocket | None) –
cache_obj (cache.Cache | None) –
- __init__(connector=None, cache_obj=None)[source]
- Parameters:
connector (connectors.ConnectSocket | None) –
cache_obj (cache.Cache | None) –
- Return type:
None
- connect()[source]
Connects to office using a pipe
- Raises:
NoConnectException – If unable to connect
- Return type:
None
- del_working_dir()
Deletes the current working directory of instance.
This is only applied when caching is used.
- get_soffice_pid()
Gets the pid of soffice
- Returns:
of pid if found; Otherwise, None
- Return type:
int
- kill_soffice()
Attempts to kill instance of soffice created by this instance
- Return type:
None
- property bridge_component: XComponent
Gets Bridge Component
- Return type:
XComponent
- property cache: Cache
Gets cache value
This will always be a Cache instance. If no Cache instance is passed into constructor then a default instance is created with
Cache.use_cache
set to false.- Return type:
- property connector: ConnectSocket
Gets the current Connector
- Return type:
- property ctx: com.sun.star.uno.XComponentContext
Gets instance Component Context
- Return type:
XComponentContext
- property has_connection: bool
Returns
True
if a connection to soffice has been established- Return type:
bool
- property headless: bool
Gets/Sets if the connection is made using headless option. Default is False
- Return type:
bool
- property invisible: bool
Gets if office is started with invisible option. Default is True
- Return type:
bool
- property is_remote: bool
Gets if the connection is remote
- Return type:
bool
- property log: NamedLogger
Gets the logger
- Return type:
- property no_first_start_wizard: bool
Gets if office is started with nofirststartwizard option. Default is True
- Return type:
bool
- property no_logo: bool
Gets if office is started with nologo option. Default is True
- Return type:
bool
- property no_restore: bool
Gets if office is started with norestore Option. Default is True
- Return type:
bool
- property soffice: Path
Get Path to LibreOffice soffice. Default is auto discovered.
- Return type:
Path
- property start_as_service: bool
Gets if office is started as service (StarOffice.Service). Default is False
- Return type:
bool
- property start_office: bool
Gets if office is to be started. Default is True
- Return type:
bool