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")
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(api_controller_endpoint)

View File

@ -54,9 +54,9 @@ stage = translate('RemotePlugin.Mobile', 'Stage View')
live = translate('RemotePlugin.Mobile', 'Live View')
TRANSLATED_STRINGS = {
'app_title': "{main} {remote}".format(main=UiStrings().OLPV2x, remote=remote),
'stage_title': "{main} {stage}".format(main=UiStrings().OLPV2x, stage=stage),
'live_title': "{main} {live}".format(main=UiStrings().OLPV2x, live=live),
'app_title': "{main} {remote}".format(main=UiStrings().OLP, remote=remote),
'stage_title': "{main} {stage}".format(main=UiStrings().OLP, stage=stage),
'live_title': "{main} {live}".format(main=UiStrings().OLP, live=live),
'service_manager': translate('RemotePlugin.Mobile', 'Service Manager'),
'slide_controller': translate('RemotePlugin.Mobile', 'Slide Controller'),
'alerts': translate('RemotePlugin.Mobile', 'Alerts'),
@ -116,6 +116,7 @@ def poll(request):
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}')
@requires_auth
def toggle_display(request, display):
@ -128,13 +129,12 @@ def toggle_display(request, display):
return {'results': {'success': True}}
@blank_endpoint.route('api/plugin/{search:search}')
@blank_endpoint.route('plugin/{search:search}')
def plugin_search(request, search):
@blank_endpoint.route('api/plugin/search')
@blank_endpoint.route('plugin/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 search: the display function to be triggered
"""
searches = []
for plugin in Registry().get('plugin_manager').plugins:

View File

@ -63,6 +63,21 @@ def service_set(request):
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():
"""
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.NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural')
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.OpenService = translate('OpenLP.Ui', 'Open service.')
self.PlaySlidesInLoop = translate('OpenLP.Ui', 'Play Slides in Loop')

View File

@ -387,7 +387,7 @@ class Ui_MainWindow(object):
"""
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_import_menu.setTitle(translate('OpenLP.MainWindow', '&Import'))
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.
"""
if modified:
title = '{title} - {name}*'.format(title=UiStrings().OLPV2x, name=file_name)
title = '{title} - {name}*'.format(title=UiStrings().OLP, name=file_name)
else:
title = '{title} - {name}'.format(title=UiStrings().OLPV2x, name=file_name)
title = '{title} - {name}'.format(title=UiStrings().OLP, name=file_name)
self.setWindowTitle(title)
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_spin_box.setSuffix(UiStrings().Seconds)
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):
"""

View File

@ -203,7 +203,7 @@ class SongFormat(object):
},
OpenLP2: {
'class': OpenLPSongImport,
'name': UiStrings().OLPV2,
'name': UiStrings().OLP,
'prefix': 'openLP2',
'selectMode': SongFormatSelect.SingleFile,
'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
# THEN the main window's title shoud be the same as the OLPV2x string in the UiStrings class
self.assertEqual(self.main_window.windowTitle(), UiStrings().OLPV2x,
'The main window\'s title should be the same as the OLPV2x string in 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().OLP,
'The main window\'s title should be the same as the OLP string in UiStrings class')
def set_service_modifed_test(self):
"""
@ -124,8 +124,8 @@ class TestMainWindow(TestCase, TestMixin):
self.main_window.set_service_modified(True, 'test.osz')
# THEN the main window's title should be set to the
self.assertEqual(self.main_window.windowTitle(), '%s - %s*' % (UiStrings().OLPV2x, 'test.osz'),
'The main window\'s title should be set to "<the contents of 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().OLP> - test.osz*"')
def set_service_unmodified_test(self):
"""
@ -137,8 +137,8 @@ class TestMainWindow(TestCase, TestMixin):
self.main_window.set_service_modified(False, 'test.osz')
# THEN the main window's title should be set to the
self.assertEqual(self.main_window.windowTitle(), '%s - %s' % (UiStrings().OLPV2x, 'test.osz'),
'The main window\'s title should be set to "<the contents of 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().OLP> - test.osz"')
def mainwindow_configuration_test(self):
"""