load settings on display

This commit is contained in:
Tim Bentley 2017-06-17 09:51:01 +01:00
parent 33fe52cae1
commit 8a2d043862
7 changed files with 72 additions and 15 deletions

View File

@ -57,6 +57,7 @@ def controller_text(request):
item['tag'] = str(frame['verseTag'])
else:
item['tag'] = str(index + 1)
item['chords_text'] = str(frame['chords_text'])
item['text'] = str(frame['text'])
item['html'] = str(frame['html'])
# Handle images, unless a custom thumbnail is given or if thumbnails is disabled
@ -114,7 +115,6 @@ def controller_set(request):
return {'results': {'success': True}}
@api_controller_endpoint.route('controller/{controller}/{action:next|previous}')
@controller_endpoint.route('{action:next|previous}')
@requires_auth
def controller_direction(request, controller, action):
@ -128,4 +128,17 @@ def controller_direction(request, controller, action):
event = getattr(Registry().get('live_controller'), 'slidecontroller_{controller}_{action}'.
format(controller=controller, action=action))
event.emit()
return {'results': {'success': True}}
@api_controller_endpoint.route('controller/{controller}/{action:next|previous}')
@requires_auth
def controller_direction_api(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.
"""
controller_direction(request, controller, action)
return {'results': {'success': True}}

View File

@ -52,11 +52,13 @@ FILE_TYPES = {
remote = translate('RemotePlugin.Mobile', 'Remote')
stage = translate('RemotePlugin.Mobile', 'Stage View')
live = translate('RemotePlugin.Mobile', 'Live View')
chords = translate('RemotePlugin.Mobile', 'Chords View')
TRANSLATED_STRINGS = {
'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),
'chords_title': "{main} {chords}".format(main=UiStrings().OLP, chords=chords),
'service_manager': translate('RemotePlugin.Mobile', 'Service Manager'),
'slide_controller': translate('RemotePlugin.Mobile', 'Slide Controller'),
'alerts': translate('RemotePlugin.Mobile', 'Alerts'),

View File

@ -37,6 +37,7 @@ class Poller(RegistryProperties):
super(Poller, self).__init__()
self.live_cache = None
self.stage_cache = None
self.chords_cache = None
def raw_poll(self):
return {
@ -50,8 +51,10 @@ class Poller(RegistryProperties):
'version': 3,
'isSecure': Settings().value('api/authentication enabled'),
'isAuthorised': False,
'chordNotation': Settings().value('songs/chord notation'),
'isStagedActive': self.is_stage_active(),
'isLiveActive': self.is_live_active()
'isLiveActive': self.is_live_active(),
'isChordsActive': self.is_chords_active()
}
def poll(self):
@ -76,6 +79,7 @@ class Poller(RegistryProperties):
"""
self.stage_cache = None
self.live_cache = None
self.chords.cache = None
def is_stage_active(self):
"""
@ -108,3 +112,19 @@ class Poller(RegistryProperties):
else:
self.live_cache = False
return self.live_cache
def is_chords_active(self):
"""
Is chords active - call it and see but only once
:return: if live is active or not
"""
if self.chords_cache is None:
try:
page = get_web_page("http://localhost:4316/chords")
except:
page = None
if page:
self.chords_cache = True
else:
self.chords_cache = False
return self.chords_cache

View File

@ -38,7 +38,6 @@ class ApiTab(SettingsTab):
super(ApiTab, self).__init__(parent, 'api', advanced_translated)
self.define_main_window_icon()
self.generate_icon()
Registry().register_function('set_website_version', self.set_website_version)
def setupUi(self):
self.setObjectName('ApiTab')
@ -83,6 +82,12 @@ class ApiTab(SettingsTab):
self.stage_url.setObjectName('stage_url')
self.stage_url.setOpenExternalLinks(True)
self.http_setting_layout.addRow(self.stage_url_label, self.stage_url)
self.chords_url_label = QtWidgets.QLabel(self.http_settings_group_box)
self.chords_url_label.setObjectName('chords_url_label')
self.chords_url = QtWidgets.QLabel(self.http_settings_group_box)
self.chords_url.setObjectName('chords_url')
self.chords_url.setOpenExternalLinks(True)
self.http_setting_layout.addRow(self.chords_url_label, self.chords_url)
self.live_url_label = QtWidgets.QLabel(self.http_settings_group_box)
self.live_url_label.setObjectName('live_url_label')
self.live_url = QtWidgets.QLabel(self.http_settings_group_box)
@ -186,6 +191,7 @@ class ApiTab(SettingsTab):
self.remote_url_label.setText(translate('RemotePlugin.RemoteTab', 'Remote URL:'))
self.stage_url_label.setText(translate('RemotePlugin.RemoteTab', 'Stage view URL:'))
self.live_url_label.setText(translate('RemotePlugin.RemoteTab', 'Live view URL:'))
self.chords_url_label.setText(translate('RemotePlugin.RemoteTab', 'Chords view URL:'))
self.twelve_hour_check_box.setText(translate('RemotePlugin.RemoteTab', 'Display stage time in 12h format'))
self.thumbnails_check_box.setText(translate('RemotePlugin.RemoteTab',
'Show thumbnails of non-text slides in remote and stage view.'))
@ -308,10 +314,3 @@ class ApiTab(SettingsTab):
painter.end()
self.remote_server_icon.setPixmap(QtGui.QPixmap.fromImage(icon))
self.remote_server_icon.show()
def set_website_version(self):
"""
Update the website version when it has been downloaded
:return:
"""
self.load()

View File

@ -1,3 +1,27 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
The :mod:`openlp.core.common` module downloads the version details for OpenLP.
"""
import logging
import os
import platform

View File

@ -63,7 +63,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties):
"""
Execute the form
"""
# load all the
# load all the widgets
self.setting_list_widget.blockSignals(True)
self.setting_list_widget.clear()
while self.stacked_layout.count():
@ -96,6 +96,7 @@ class SettingsForm(QtWidgets.QDialog, Ui_SettingsDialog, RegistryProperties):
list_item = QtWidgets.QListWidgetItem(build_icon(tab_widget.icon_path), tab_widget.tab_title_visible)
list_item.setData(QtCore.Qt.UserRole, tab_widget.tab_title)
self.setting_list_widget.addItem(list_item)
tab_widget.load()
def accept(self):
"""

View File

@ -99,8 +99,7 @@ class RemotesPlugin(Plugin, OpenLPMixin):
download_and_check(progress)
self.application.process_events()
progress.close()
Settings().setValue('remotes/download version', Registry().set_flag('website_version'))
Registry().execute('set_website_version')
Settings().setValue('remotes/download version', Registry().get('website_version'))
def website_version(self):
"""
@ -110,7 +109,6 @@ class RemotesPlugin(Plugin, OpenLPMixin):
sha256, version = download_sha256()
Registry().set_flag('website_sha256', sha256)
Registry().set_flag('website_version', version)
Registry().execute('set_website_version')
class Progress(QtWidgets.QProgressDialog):