next prev

This commit is contained in:
Tim Bentley 2016-07-17 08:12:42 +01:00
parent 70288c8ae1
commit 6e5070316c
8 changed files with 52 additions and 22 deletions

View File

@ -113,5 +113,22 @@ def controller_set(request):
log.error("Endpoint controller/live/set request id not found") log.error("Endpoint controller/live/set request id not found")
return {'results': {'success': True}} return {'results': {'success': True}}
@api_controller_endpoint.route('/controller/{controller}/{action:next|previous}')
@controller_endpoint.route('/{controller}/{action:next|previous}')
@requires_auth
def controller_direction(request, controller, action):
"""
Handles requests for setting service items in the slide controller
11
:param request: The http request object.
:param controller: the controller slides forward or backward.
:param action: the controller slides forward or backward.
"""
event = getattr(Registry().get('live_controller'), 'slidecontroller_{controller}_{action}'.
format(controller=controller, action=action))
event.emit()
return {'results': {'success': True}}
register_endpoint(controller_endpoint) register_endpoint(controller_endpoint)
register_endpoint(api_controller_endpoint) register_endpoint(api_controller_endpoint)

View File

@ -54,9 +54,9 @@ stage = translate('RemotePlugin.Mobile', 'Stage View')
live = translate('RemotePlugin.Mobile', 'Live View') live = translate('RemotePlugin.Mobile', 'Live View')
TRANSLATED_STRINGS = { TRANSLATED_STRINGS = {
'app_title': "{main} {remote}".format(main=UiStrings().OLPV2x, remote=remote), 'app_title': "{main} {remote}".format(main=UiStrings().OLP, remote=remote),
'stage_title': "{main} {stage}".format(main=UiStrings().OLPV2x, stage=stage), 'stage_title': "{main} {stage}".format(main=UiStrings().OLP, stage=stage),
'live_title': "{main} {live}".format(main=UiStrings().OLPV2x, live=live), 'live_title': "{main} {live}".format(main=UiStrings().OLP, live=live),
'service_manager': translate('RemotePlugin.Mobile', 'Service Manager'), 'service_manager': translate('RemotePlugin.Mobile', 'Service Manager'),
'slide_controller': translate('RemotePlugin.Mobile', 'Slide Controller'), 'slide_controller': translate('RemotePlugin.Mobile', 'Slide Controller'),
'alerts': translate('RemotePlugin.Mobile', 'Alerts'), 'alerts': translate('RemotePlugin.Mobile', 'Alerts'),
@ -116,6 +116,7 @@ def poll(request):
return Registry().get('poller').raw_poll() return Registry().get('poller').raw_poll()
@blank_endpoint.route('api/display/{display:hide|show|blank|theme|desktop}')
@blank_endpoint.route('display/{display:hide|show|blank|theme|desktop}') @blank_endpoint.route('display/{display:hide|show|blank|theme|desktop}')
@requires_auth @requires_auth
def toggle_display(request, display): def toggle_display(request, display):
@ -128,13 +129,12 @@ def toggle_display(request, display):
return {'results': {'success': True}} return {'results': {'success': True}}
@blank_endpoint.route('api/plugin/{search:search}') @blank_endpoint.route('api/plugin/search')
@blank_endpoint.route('plugin/{search:search}') @blank_endpoint.route('plugin/search')
def plugin_search(request, search): def plugin_search_list(request):
""" """
Deliver the functions for the /display url Deliver a list of active plugins that support search
:param request: the http request - not used :param request: the http request - not used
:param search: the display function to be triggered
""" """
searches = [] searches = []
for plugin in Registry().get('plugin_manager').plugins: for plugin in Registry().get('plugin_manager').plugins:

View File

@ -63,6 +63,21 @@ def service_set(request):
return {'results': {'success': True}} return {'results': {'success': True}}
@api_service_endpoint.route('{action:next|previous}')
@service_endpoint.route('{action:next|previous}')
@requires_auth
def service_direction(request, action):
"""
Handles requests for setting service items in the service manager
:param request: The http request object.
:param action: the the service slides forward or backward.
"""
event = getattr(Registry().get('service_manager'), 'servicemanager_{action}_item'.format(action=action))
event.emit(None)
return {'results': {'success': True}}
def get_service_items(): def get_service_items():
""" """
Read the service item in use and return the data as a json object Read the service item in use and return the data as a json object

View File

@ -111,8 +111,6 @@ class UiStrings(object):
self.NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular') self.NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular')
self.NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural') self.NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural')
self.OLP = translate('OpenLP.Ui', 'OpenLP') self.OLP = translate('OpenLP.Ui', 'OpenLP')
self.OLPV2 = "{name} {version}".format(name=self.OLP, version="2")
self.OLPV2x = "{name} {version}".format(name=self.OLP, version="2.4")
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?') self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?')
self.OpenService = translate('OpenLP.Ui', 'Open service.') self.OpenService = translate('OpenLP.Ui', 'Open service.')
self.PlaySlidesInLoop = translate('OpenLP.Ui', 'Play Slides in Loop') self.PlaySlidesInLoop = translate('OpenLP.Ui', 'Play Slides in Loop')

View File

@ -387,7 +387,7 @@ class Ui_MainWindow(object):
""" """
Set up the translation system Set up the translation system
""" """
main_window.setWindowTitle(UiStrings().OLPV2x) main_window.setWindowTitle(UiStrings().OLP)
self.file_menu.setTitle(translate('OpenLP.MainWindow', '&File')) self.file_menu.setTitle(translate('OpenLP.MainWindow', '&File'))
self.file_import_menu.setTitle(translate('OpenLP.MainWindow', '&Import')) self.file_import_menu.setTitle(translate('OpenLP.MainWindow', '&Import'))
self.file_export_menu.setTitle(translate('OpenLP.MainWindow', '&Export')) self.file_export_menu.setTitle(translate('OpenLP.MainWindow', '&Export'))
@ -1170,9 +1170,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties):
:param file_name: The file name of the service file. :param file_name: The file name of the service file.
""" """
if modified: if modified:
title = '{title} - {name}*'.format(title=UiStrings().OLPV2x, name=file_name) title = '{title} - {name}*'.format(title=UiStrings().OLP, name=file_name)
else: else:
title = '{title} - {name}'.format(title=UiStrings().OLPV2x, name=file_name) title = '{title} - {name}'.format(title=UiStrings().OLP, name=file_name)
self.setWindowTitle(title) self.setWindowTitle(title)
def show_status_message(self, message): def show_status_message(self, message):

View File

@ -105,7 +105,7 @@ class AlertsTab(SettingsTab):
self.timeout_label.setText(translate('AlertsPlugin.AlertsTab', 'Alert timeout:')) self.timeout_label.setText(translate('AlertsPlugin.AlertsTab', 'Alert timeout:'))
self.timeout_spin_box.setSuffix(UiStrings().Seconds) self.timeout_spin_box.setSuffix(UiStrings().Seconds)
self.preview_group_box.setTitle(UiStrings().Preview) self.preview_group_box.setTitle(UiStrings().Preview)
self.font_preview.setText(UiStrings().OLPV2x) self.font_preview.setText(UiStrings().OLP)
def on_background_color_changed(self, color): def on_background_color_changed(self, color):
""" """

View File

@ -203,7 +203,7 @@ class SongFormat(object):
}, },
OpenLP2: { OpenLP2: {
'class': OpenLPSongImport, 'class': OpenLPSongImport,
'name': UiStrings().OLPV2, 'name': UiStrings().OLP,
'prefix': 'openLP2', 'prefix': 'openLP2',
'selectMode': SongFormatSelect.SingleFile, 'selectMode': SongFormatSelect.SingleFile,
'filter': '{text} (*.sqlite)'.format(text=translate('SongsPlugin.ImportWizardForm', 'OpenLP 2 Databases')) 'filter': '{text} (*.sqlite)'.format(text=translate('SongsPlugin.ImportWizardForm', 'OpenLP 2 Databases'))

View File

@ -110,9 +110,9 @@ class TestMainWindow(TestCase, TestMixin):
# WHEN no changes are made to the service # WHEN no changes are made to the service
# THEN the main window's title shoud be the same as the OLPV2x string in the UiStrings class # THEN the main window's title shoud be the same as the OLP string in the UiStrings class
self.assertEqual(self.main_window.windowTitle(), UiStrings().OLPV2x, self.assertEqual(self.main_window.windowTitle(), UiStrings().OLP,
'The main window\'s title should be the same as the OLPV2x string in UiStrings class') 'The main window\'s title should be the same as the OLP string in UiStrings class')
def set_service_modifed_test(self): def set_service_modifed_test(self):
""" """
@ -124,8 +124,8 @@ class TestMainWindow(TestCase, TestMixin):
self.main_window.set_service_modified(True, 'test.osz') self.main_window.set_service_modified(True, 'test.osz')
# THEN the main window's title should be set to the # THEN the main window's title should be set to the
self.assertEqual(self.main_window.windowTitle(), '%s - %s*' % (UiStrings().OLPV2x, 'test.osz'), self.assertEqual(self.main_window.windowTitle(), '%s - %s*' % (UiStrings().OLP, 'test.osz'),
'The main window\'s title should be set to "<the contents of UiStrings().OLPV2x> - test.osz*"') 'The main window\'s title should be set to "<the contents of UiStrings().OLP> - test.osz*"')
def set_service_unmodified_test(self): def set_service_unmodified_test(self):
""" """
@ -137,8 +137,8 @@ class TestMainWindow(TestCase, TestMixin):
self.main_window.set_service_modified(False, 'test.osz') self.main_window.set_service_modified(False, 'test.osz')
# THEN the main window's title should be set to the # THEN the main window's title should be set to the
self.assertEqual(self.main_window.windowTitle(), '%s - %s' % (UiStrings().OLPV2x, 'test.osz'), self.assertEqual(self.main_window.windowTitle(), '%s - %s' % (UiStrings().OLP, 'test.osz'),
'The main window\'s title should be set to "<the contents of UiStrings().OLPV2x> - test.osz"') 'The main window\'s title should be set to "<the contents of UiStrings().OLP> - test.osz"')
def mainwindow_configuration_test(self): def mainwindow_configuration_test(self):
""" """