forked from openlp/openlp
cleanup up the code
This commit is contained in:
parent
de8b731686
commit
be5de55e0b
|
@ -86,7 +86,6 @@ class OpenLP(QtWidgets.QApplication):
|
|||
# On Linux and FreeBSD, in order to set the WM_CLASS property for X11, we pass "OpenLP" in as a command line
|
||||
# argument. This interferes with files being passed in as command line arguments, so we remove it from the list.
|
||||
if 'OpenLP' in args:
|
||||
print("remove2")
|
||||
args.remove('OpenLP')
|
||||
self.args.extend(args)
|
||||
# Decide how many screens we have and their size
|
||||
|
@ -139,15 +138,10 @@ class OpenLP(QtWidgets.QApplication):
|
|||
@staticmethod
|
||||
def is_already_running():
|
||||
"""
|
||||
Look to see if OpenLP is already running and ask if a 2nd instance is to be started.
|
||||
Tell the user there is a 2nd instance running.
|
||||
"""
|
||||
status = QtWidgets.QMessageBox.critical(None, UiStrings().Error, UiStrings().OpenLPStart,
|
||||
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
|
||||
QtWidgets.QMessageBox.No))
|
||||
if status == QtWidgets.QMessageBox.No:
|
||||
return True
|
||||
return False
|
||||
|
||||
QtWidgets.QMessageBox.critical(None, UiStrings().Error, UiStrings().OpenLPStart,
|
||||
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok))
|
||||
@staticmethod
|
||||
def is_data_path_missing():
|
||||
"""
|
||||
|
@ -383,6 +377,7 @@ 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():
|
||||
application.is_already_running()
|
||||
server.post_to_server(qt_args)
|
||||
sys.exit()
|
||||
else:
|
||||
|
|
|
@ -415,7 +415,7 @@ class UiStrings(object):
|
|||
self.NoResults = translate('OpenLP.Ui', 'No Search Results')
|
||||
self.OpenLP = translate('OpenLP.Ui', 'OpenLP')
|
||||
self.OpenLPv2AndUp = translate('OpenLP.Ui', 'OpenLP 2.0 and up')
|
||||
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?')
|
||||
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running on this machine. \nClosing this instance')
|
||||
self.OpenService = translate('OpenLP.Ui', 'Open service.')
|
||||
self.OptionalShowInFooter = translate('OpenLP.Ui', 'Optional, this will be displayed in footer.')
|
||||
self.OptionalHideInFooter = translate('OpenLP.Ui', 'Optional, this won\'t be displayed in footer.')
|
||||
|
|
|
@ -42,12 +42,9 @@ class Server(QtCore.QObject, LogMixin):
|
|||
return self._outSocket.waitForConnected()
|
||||
|
||||
def post_to_server(self, args):
|
||||
print(args)
|
||||
if 'OpenLP' in args:
|
||||
print("remove1")
|
||||
args.remove('OpenLP')
|
||||
# Yes, there is.
|
||||
print("isRunning")
|
||||
self._outStream = QtCore.QTextStream(self._outSocket)
|
||||
self._outStream.setCodec('UTF-8')
|
||||
self._outSocket.write(str.encode("".join(args)))
|
||||
|
@ -58,7 +55,6 @@ class Server(QtCore.QObject, LogMixin):
|
|||
|
||||
def start_server(self):
|
||||
# No, there isn't.
|
||||
print("No it is not")
|
||||
self._outSocket = None
|
||||
self._outStream = None
|
||||
self._inSocket = None
|
||||
|
@ -99,4 +95,5 @@ class Server(QtCore.QObject, LogMixin):
|
|||
"""
|
||||
if self._server:
|
||||
self._server.close()
|
||||
# Make sure the server file is removed.
|
||||
QtNetwork.QLocalServer.removeServer(self._id)
|
||||
|
|
|
@ -434,7 +434,6 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
|
|||
|
||||
:param load_file: The service file to the loaded. Will be None is from menu so selection will be required.
|
||||
"""
|
||||
print(load_file)
|
||||
if self.is_modified():
|
||||
result = self.save_modified_service()
|
||||
if result == QtWidgets.QMessageBox.Cancel:
|
||||
|
|
Loading…
Reference in New Issue