# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. #
import subprocess import time import traceback import uuid import os import platform import signal
try: import pyuno import uno except ImportError:
print("pyuno not found: try to set PYTHONPATH and URE_BOOTSTRAP variables", flush=True)
print("PYTHONPATH=/installation/opt/program", flush=True)
print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc", flush=True) raise
def signal_handler(signal_num, frame):
signal_name = signal.Signals(signal_num).name #print(f'Signal handler called with signal {signal_name} ({signal_num})', flush=True)
def setUp(self): """ Create a new connection to a LibreOffice process
If the connection method is path the instance will be created as a
new subprocess. If the connection method is connect the instance tries
to connect to an existing instance with the specified socket string """ if platform.system() != "Windows":
signal.signal(signal.SIGCHLD, signal_handler)
signal.signal(signal.SIGPIPE, signal_handler)
# connect to the soffice instance
success = False try:
self.xContext = self.connect(socket)
success = True finally: ifnot success and self.soffice:
self.soffice.terminate()
self.soffice.wait()
self.soffice = None
def bootstrap(self, soffice, userdir, socket): """ Creates a new LibreOffice process
@param soffice Path to the soffice installation
@param userdir Directory of the user profile, only one process per user
profile is possible
@param socket The socket string used for the PyUNO connection """
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.