Minor changes
This commit is contained in:
parent
e84518ccca
commit
9190dbb687
|
@ -30,13 +30,9 @@ IBAN: BE60 9671 0556 5870
|
|||
SWIFT / BIC: TRWIBEB1XXX
|
||||
```
|
||||
|
||||
* G1: `A5DdXxCKPw3QKWVdDVs7CzkNugNUW1sHu5zDJFWxCU2h`
|
||||
* BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`
|
||||
|
||||
* ETH: `0x61a4f614a30ff686445751ed8328b82b77ecfc69`
|
||||
* XRP: `rLSn6Z3T8uCxbcd1oxwfGQN1Fdn5CyGujK` Tag: `6643162`
|
||||
* LTC: `MBcgQ3LQJA4W2wsXknTdm2fxRSysLaBJHS`
|
||||
* BTC: `3FhiXcXmAesmQzrNEngjHFnvaJRhU1AGWV`
|
||||
|
||||
|
||||
## Extensions develop with ZAZ
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Calc
|
||||
----
|
||||
====
|
||||
|
||||
Remember, always import library.
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ IS_MAC = OS == 'Darwin'
|
|||
USER = getpass.getuser()
|
||||
PC = platform.node()
|
||||
DESKTOP = os.environ.get('DESKTOP_SESSION', '')
|
||||
INFO_DEBUG = f"{sys.version}\n\n{platform.platform()}\n\n" + '\n'.join(sys.path)
|
||||
INFO_DEBUG = f"Python: {sys.version}\n\n{platform.platform()}\n\n" + '\n'.join(sys.path)
|
||||
|
||||
PYTHON = 'python'
|
||||
if IS_WIN:
|
||||
|
|
|
@ -5646,74 +5646,3 @@ def install_locales(path, domain='base', dir_locales=DIR['locales']):
|
|||
from gettext import gettext as _
|
||||
error(e)
|
||||
return _
|
||||
|
||||
|
||||
class LIBOServer(object):
|
||||
HOST = 'localhost'
|
||||
PORT = '8100'
|
||||
ARG = 'socket,host={},port={};urp;StarOffice.ComponentContext'.format(HOST, PORT)
|
||||
CMD = ['soffice',
|
||||
'-env:SingleAppInstance=false',
|
||||
'-env:UserInstallation=file:///tmp/LIBO_Process8100',
|
||||
'--headless', '--norestore', '--invisible',
|
||||
'--accept={}'.format(ARG)]
|
||||
|
||||
def __init__(self):
|
||||
self._server = None
|
||||
self._ctx = None
|
||||
self._sm = None
|
||||
self._start_server()
|
||||
self._init_values()
|
||||
|
||||
def _init_values(self):
|
||||
global CTX
|
||||
global SM
|
||||
|
||||
if not self.is_running:
|
||||
return
|
||||
|
||||
ctx = uno.getComponentContext()
|
||||
service = 'com.sun.star.bridge.UnoUrlResolver'
|
||||
resolver = ctx.ServiceManager.createInstanceWithContext(service, ctx)
|
||||
self._ctx = resolver.resolve('uno:{}'.format(self.ARG))
|
||||
self._sm = self._ctx.getServiceManager()
|
||||
CTX = self._ctx
|
||||
SM = self._sm
|
||||
return
|
||||
|
||||
@property
|
||||
def is_running(self):
|
||||
try:
|
||||
s = socket.create_connection((self.HOST, self.PORT), 5.0)
|
||||
s.close()
|
||||
debug('LibreOffice is running...')
|
||||
return True
|
||||
except ConnectionRefusedError:
|
||||
return False
|
||||
|
||||
def _start_server(self):
|
||||
if self.is_running:
|
||||
return
|
||||
|
||||
for i in range(3):
|
||||
self._server = subprocess.Popen(self.CMD,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
time.sleep(3)
|
||||
if self.is_running:
|
||||
break
|
||||
return
|
||||
|
||||
def stop(self):
|
||||
if self._server is None:
|
||||
print('Search pgrep soffice')
|
||||
else:
|
||||
self._server.terminate()
|
||||
debug('LibreOffice is stop...')
|
||||
return
|
||||
|
||||
def create_instance(self, name, with_context=True):
|
||||
if with_context:
|
||||
instance = self._sm.createInstanceWithContext(name, self._ctx)
|
||||
else:
|
||||
instance = self._sm.createInstance(name)
|
||||
return instance
|
||||
|
|
|
@ -74,15 +74,23 @@ class LiboXML(object):
|
|||
'manifest': 'urn:oasis:names:tc:opendocument:xmlns:manifest:1.0',
|
||||
'xmlns:loext': 'urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0',
|
||||
}
|
||||
|
||||
xmlns = 'http://openoffice.org/extensions/description/2006'
|
||||
xmlns_xlink = 'http://www.w3.org/1999/xlink'
|
||||
xmlns_l = 'http://libreoffice.org/extensions/description/2011'
|
||||
|
||||
NS_DESCRIPTION = {
|
||||
'xmlns': 'http://openoffice.org/extensions/description/2006',
|
||||
'xmlns:xlink': 'http://www.w3.org/1999/xlink',
|
||||
'xmlns:d': 'http://openoffice.org/extensions/description/2006',
|
||||
'xmlns': xmlns,
|
||||
'xmlns:xlink': xmlns_xlink,
|
||||
'xmlns:d': xmlns,
|
||||
'xmlns:l': xmlns_l,
|
||||
}
|
||||
|
||||
NS_ADDONS = {
|
||||
'xmlns:xs': 'http://www.w3.org/2001/XMLSchema',
|
||||
'xmlns:oor': 'http://openoffice.org/2001/registry',
|
||||
}
|
||||
|
||||
NS_UPDATE = {
|
||||
'xmlns': 'http://openoffice.org/extensions/update/2006',
|
||||
'xmlns:d': 'http://openoffice.org/extensions/description/2006',
|
||||
|
@ -157,6 +165,12 @@ class LiboXML(object):
|
|||
key = 'version'
|
||||
ET.SubElement(doc, key, data[key])
|
||||
|
||||
key = 'minimal'
|
||||
if data[key]:
|
||||
node = ET.SubElement(doc, 'dependencies')
|
||||
attr = {'value': data[key], 'l:name': f'LibreOffice {data[key]}'}
|
||||
ET.SubElement(node, 'LibreOffice-minimal-version', attr)
|
||||
|
||||
key = 'display-name'
|
||||
node = ET.SubElement(doc, key)
|
||||
for k, v in data[key].items():
|
||||
|
|
Loading…
Reference in New Issue