get the service file handling right

This commit is contained in:
Tim Bentley 2018-03-29 15:50:08 +01:00
parent e828867f23
commit de8b731686
2 changed files with 10 additions and 11 deletions

View File

@ -383,10 +383,8 @@ def main(args=None):
# Check if an instance of OpenLP is already running. Quit if there is a running instance and the user only wants one
server = Server()
if server.is_another_instance_running():
if server.is_already_running():
server.post_to_server(qt_args)
server.close_server()
sys.exit()
server.post_to_server(qt_args)
sys.exit()
else:
server.start_server()
application.server = server

View File

@ -24,6 +24,7 @@
from PyQt5 import QtCore
from PyQt5 import QtNetwork
from openlp.core.common.registry import Registry
from openlp.core.common.mixins import LogMixin
@ -86,16 +87,16 @@ class Server(QtCore.QObject, LogMixin):
Read a record passed to the server and load a service
:return:
"""
while True:
msg = self._inStream.readLine()
if msg:
self.log_debug("socket msg = " + msg)
Registry().get('service_manager').on_load_service_clicked(msg)
msg = self._inStream.readLine()
if msg:
self.log_debug("socket msg = " + msg)
Registry().get('service_manager').on_load_service_clicked(msg)
def close_server(self):
"""
Shutdown to local socket server
Shutdown to local socket server and make sure the server is removed.
:return:
"""
if self._server:
self._server.close()
self._server.close()
QtNetwork.QLocalServer.removeServer(self._id)