def startOooProcess(self): try: if os.name == u'nt': self.oooManager = Dispatch(u'com.sun.star.ServiceManager') self.oooManager._FlagAsMethod(u'Bridge_GetStruct') self.oooManager._FlagAsMethod(u'Bridge_GetValueObject') else: cmd = get_uno_command() process = QtCore.QProcess() process.startDetached(cmd) self.processStarted = True except: log.exception("startOooProcess failed")
def start_process(self): """ Loads a running version of OpenOffice in the background. It is not displayed to the user but is available to the UNO interface when required. """ log.debug('start process Openoffice') if is_win(): self.manager = self.get_com_servicemanager() self.manager._FlagAsMethod('Bridge_GetStruct') self.manager._FlagAsMethod('Bridge_GetValueObject') else: # -headless cmd = get_uno_command() self.process = QtCore.QProcess() self.process.startDetached(cmd)
def start_process(self): """ Loads a running version of OpenOffice in the background. It is not displayed to the user but is available to the UNO interface when required. """ log.debug('start process Openoffice') if os.name == 'nt': self.manager = self.get_com_servicemanager() self.manager._FlagAsMethod('Bridge_GetStruct') self.manager._FlagAsMethod('Bridge_GetValueObject') else: # -headless cmd = get_uno_command() self.process = QtCore.QProcess() self.process.startDetached(cmd)
def get_uno_command_connection_type_test(self): """ Test the ``get_uno_command`` function when the connection type is anything other than pipe. :return: """ # GIVEN: A patched 'which' method which returns 'libreoffice' with patch('openlp.core.utils.which', **{'return_value': 'libreoffice'}): # WHEN: Calling get_uno_command with a connection type other than pipe result = get_uno_command('socket') # THEN: The connection parameters should be set for socket self.assertEqual(result, 'libreoffice --nologo --norestore --minimized --nodefault --nofirststartwizard' ' "--accept=socket,host=localhost,port=2002;urp;"')
def start_ooo_process(self): """ Start the OO Process """ try: if is_win(): self.ooo_manager = Dispatch('com.sun.star.ServiceManager') self.ooo_manager._FlagAsMethod('Bridge_GetStruct') self.ooo_manager._FlagAsMethod('Bridge_GetValueObject') else: cmd = get_uno_command() process = QtCore.QProcess() process.startDetached(cmd) self.process_started = True except: log.exception("start_ooo_process failed")
def get_uno_command_libreoffice_command_exists_test(self): """ Test the ``get_uno_command`` function uses the libreoffice command when available. :return: """ # GIVEN: A patched 'which' method which returns a path when called with 'libreoffice' with patch('openlp.core.utils.which', **{'side_effect': lambda command: {'libreoffice': '/usr/bin/libreoffice'}[command]}): # WHEN: Calling get_uno_command result = get_uno_command() # THEN: The command 'libreoffice' should be called with the appropriate parameters self.assertEquals(result, 'libreoffice --nologo --norestore --minimized --nodefault --nofirststartwizard' ' "--accept=pipe,name=openlp_pipe;urp;"')
def get_uno_command_connection_type_test(self): """ Test the ``get_uno_command`` function when the connection type is anything other than pipe. :return: """ # GIVEN: A patched 'which' method which returns 'libreoffice' with patch('openlp.core.utils.which', **{'return_value': 'libreoffice'}): # WHEN: Calling get_uno_command with a connection type other than pipe result = get_uno_command('socket') # THEN: The connection parameters should be set for socket self.assertEqual( result, 'libreoffice --nologo --norestore --minimized --nodefault --nofirststartwizard' ' "--accept=socket,host=localhost,port=2002;urp;"')
def get_uno_command_libreoffice_command_exists_test(self): """ Test the ``get_uno_command`` function uses the libreoffice command when available. :return: """ # GIVEN: A patched 'which' method which returns a path when called with 'libreoffice' with patch( 'openlp.core.utils.which', **{ 'side_effect': lambda command: { 'libreoffice': '/usr/bin/libreoffice' }[command] }): # WHEN: Calling get_uno_command result = get_uno_command() # THEN: The command 'libreoffice' should be called with the appropriate parameters self.assertEquals( result, 'libreoffice --nologo --norestore --minimized --nodefault --nofirststartwizard' ' "--accept=pipe,name=openlp_pipe;urp;"')