add switch to turn off servers

This commit is contained in:
Tim Bentley 2017-03-05 17:43:18 +00:00
parent 699342c89d
commit 9451e4def6
2 changed files with 6 additions and 2 deletions

View File

@ -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():

View File

@ -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)