From 9451e4def6038dce8b500fe5f09b8de83bc374d9 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 5 Mar 2017 17:43:18 +0000 Subject: [PATCH] add switch to turn off servers --- openlp/core/__init__.py | 3 +++ openlp/core/ui/mainwindow.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index e035c6dda..8192f206d 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -338,6 +338,8 @@ def parse_options(args): parser.add_argument('-d', '--dev-version', dest='dev_version', action='store_true', help='Ignore the version file and pull the version directly from Bazaar') parser.add_argument('-s', '--style', dest='style', help='Set the Qt5 style (passed directly to Qt5).') + parser.add_argument('-w', '--webServer', dest='webServer', action='store_false', + help='Turn off the Web and Socket Server ') parser.add_argument('rargs', nargs='?', default=[]) # Parse command line options and deal with them. Use args supplied pragmatically if possible. return parser.parse_args(args) if args else parser.parse_args() @@ -411,6 +413,7 @@ def main(args=None): set_up_logging(AppLocation.get_directory(AppLocation.CacheDir)) Registry.create() Registry().register('application', application) + Registry().set_flag('webServer', args.webServer) application.setApplicationVersion(get_application_version()['version']) # Check if an instance of OpenLP is already running. Quit if there is a running instance and the user only wants one if application.is_already_running(): diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index e01620932..db21f2f56 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -516,8 +516,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties): Settings().set_up_default_values() self.about_form = AboutForm(self) MediaController() - # websockets.WebSocketServer() - # server.HttpServer() + if Registry().get_flag('webServer'): + websockets.WebSocketServer() + server.HttpServer() SettingsForm(self) self.formatting_tag_form = FormattingTagForm(self) self.shortcut_form = ShortcutListForm(self)