openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #32131
[Merge] lp:~trb143/openlp/webfixes into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/webfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~trb143/openlp/webfixes/+merge/331452
Fix the api errors found
Remove the remote plugin and move the code to core
Add the update of the web package date back in.
lp:~trb143/openlp/webfixes (revision 2783)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/2218/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/2121/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/2006/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Code_Analysis/1371/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Test_Coverage/1201/
[SUCCESS] https://ci.openlp.io/job/Branch-04c-Code_Analysis2/331/
[FAILURE] https://ci.openlp.io/job/Branch-05-AppVeyor-Tests/170/
--
Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/webfixes into lp:openlp.
=== added file 'openlp/core/api/deploy.py'
--- openlp/core/api/deploy.py 1970-01-01 00:00:00 +0000
+++ openlp/core/api/deploy.py 2017-09-27 19:38:20 +0000
@@ -0,0 +1,69 @@
+# -*- 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 #
+###############################################################################
+"""
+Download and "install" the remote web client
+"""
+import os
+from zipfile import ZipFile
+
+from openlp.core.common import AppLocation, Registry
+from openlp.core.common.httputils import url_get_file, get_web_page, get_url_file_size
+
+
+def deploy_zipfile(app_root, zip_name):
+ """
+ Process the downloaded zip file and add to the correct directory
+
+ :param zip_name: the zip file to be processed
+ :param app_root: the directory where the zip get expanded to
+
+ :return: None
+ """
+ zip_file = os.path.join(app_root, zip_name)
+ web_zip = ZipFile(zip_file)
+ web_zip.extractall(app_root)
+
+
+def download_sha256():
+ """
+ Download the config file to extract the sha256 and version number
+ """
+ user_agent = 'OpenLP/' + Registry().get('application').applicationVersion()
+ try:
+ web_config = get_web_page('https://get.openlp.org/webclient/download.cfg', headers={'User-Agent': user_agent})
+ except ConnectionError:
+ return False
+ file_bits = web_config.split()
+ return file_bits[0], file_bits[2]
+
+
+def download_and_check(callback=None):
+ """
+ Download the web site and deploy it.
+ """
+ sha256, version = download_sha256()
+ file_size = get_url_file_size('https://get.openlp.org/webclient/site.zip')
+ callback.setRange(0, file_size)
+ if url_get_file(callback, 'https://get.openlp.org/webclient/site.zip',
+ AppLocation.get_section_data_path('remotes') / 'site.zip',
+ sha256=sha256):
+ deploy_zipfile(str(AppLocation.get_section_data_path('remotes')), 'site.zip')
=== added file 'openlp/core/api/endpoint/remote.py'
--- openlp/core/api/endpoint/remote.py 1970-01-01 00:00:00 +0000
+++ openlp/core/api/endpoint/remote.py 2017-09-27 19:38:20 +0000
@@ -0,0 +1,41 @@
+# -*- 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 #
+###############################################################################
+import logging
+
+from openlp.core.api.http.endpoint import Endpoint
+from openlp.core.api.endpoint.core import TRANSLATED_STRINGS
+
+
+log = logging.getLogger(__name__)
+
+remote_endpoint = Endpoint('remote', template_dir='remotes', static_dir='remotes')
+
+
+@remote_endpoint.route('{view}')
+def index(request, view):
+ """
+ Handles requests for /remotes url
+
+ :param request: The http request object.
+ :param view: The view name to be servered.
+ """
+ return remote_endpoint.render_template('{view}.mako'.format(view=view), **TRANSLATED_STRINGS)
=== modified file 'openlp/core/api/endpoint/service.py'
--- openlp/core/api/endpoint/service.py 2017-03-04 19:17:59 +0000
+++ openlp/core/api/endpoint/service.py 2017-09-27 19:38:20 +0000
@@ -23,7 +23,7 @@
import json
from openlp.core.api.http.endpoint import Endpoint
-from openlp.core.api.http import register_endpoint, requires_auth
+from openlp.core.api.http import requires_auth
from openlp.core.common import Registry
=== modified file 'openlp/core/api/http/server.py'
--- openlp/core/api/http/server.py 2017-06-18 05:21:23 +0000
+++ openlp/core/api/http/server.py 2017-09-27 19:38:20 +0000
@@ -26,17 +26,24 @@
"""
import logging
+import time
-from PyQt5 import QtCore
+from PyQt5 import QtCore, QtWidgets
from waitress import serve
from openlp.core.api.http import register_endpoint
from openlp.core.api.http import application
-from openlp.core.common import RegistryMixin, RegistryProperties, OpenLPMixin, Settings, Registry
+from openlp.core.common import AppLocation, RegistryMixin, RegistryProperties, OpenLPMixin, \
+ Settings, Registry, UiStrings, check_directory_exists
+from openlp.core.lib import translate
+
+from openlp.core.api.deploy import download_and_check, download_sha256
from openlp.core.api.poll import Poller
from openlp.core.api.endpoint.controller import controller_endpoint, api_controller_endpoint
from openlp.core.api.endpoint.core import chords_endpoint, stage_endpoint, blank_endpoint, main_endpoint
from openlp.core.api.endpoint.service import service_endpoint, api_service_endpoint
+from openlp.core.api.endpoint.remote import remote_endpoint
+
log = logging.getLogger(__name__)
@@ -59,6 +66,7 @@
"""
address = Settings().value('api/ip address')
port = Settings().value('api/port')
+ Registry().execute('get_website_version')
serve(application, host=address, port=port)
def stop(self):
@@ -79,11 +87,15 @@
self.worker.moveToThread(self.thread)
self.thread.started.connect(self.worker.run)
self.thread.start()
+ Registry().register_function('download_website', self.first_time)
+ Registry().register_function('get_website_version', self.website_version)
+ Registry().set_flag('website_version', '0001_01_01')
def bootstrap_post_set_up(self):
"""
Register the poll return service and start the servers.
"""
+ self.initialise()
self.poller = Poller()
Registry().register('poller', self.poller)
application.initialise()
@@ -95,3 +107,79 @@
register_endpoint(main_endpoint)
register_endpoint(service_endpoint)
register_endpoint(api_service_endpoint)
+ register_endpoint(remote_endpoint)
+
+ @staticmethod
+ def initialise():
+ """
+ Create the internal file structure if it does not exist
+ :return:
+ """
+ check_directory_exists(AppLocation.get_section_data_path('remotes') / 'assets')
+ check_directory_exists(AppLocation.get_section_data_path('remotes') / 'images')
+ check_directory_exists(AppLocation.get_section_data_path('remotes') / 'static')
+ check_directory_exists(AppLocation.get_section_data_path('remotes') / 'static' / 'index')
+ check_directory_exists(AppLocation.get_section_data_path('remotes') / 'templates')
+
+ def first_time(self):
+ """
+ Import web site code if active
+ """
+ self.application.process_events()
+ progress = Progress(self)
+ progress.forceShow()
+ self.application.process_events()
+ time.sleep(1)
+ download_and_check(progress)
+ self.application.process_events()
+ time.sleep(1)
+ progress.close()
+ self.application.process_events()
+ Settings().setValue('remotes/download version', self.version)
+
+ def website_version(self):
+ """
+ Download and save the website version and sha256
+ :return: None
+ """
+ sha256, self.version = download_sha256()
+ Registry().set_flag('website_sha256', sha256)
+ Registry().set_flag('website_version', self.version)
+
+
+class Progress(QtWidgets.QProgressDialog):
+ """
+ Local class to handle download display based and supporting httputils:get_web_page
+ """
+ def __init__(self, parent):
+ super(Progress, self).__init__(parent.main_window)
+ self.parent = parent
+ self.setWindowModality(QtCore.Qt.WindowModal)
+ self.setWindowTitle(translate('RemotePlugin', 'Importing Website'))
+ self.setLabelText(UiStrings().StartingImport)
+ self.setCancelButton(None)
+ self.setRange(0, 1)
+ self.setMinimumDuration(0)
+ self.was_cancelled = False
+ self.previous_size = 0
+
+ def _download_progress(self, count, block_size):
+ """
+ Calculate and display the download progress.
+ """
+ increment = (count * block_size) - self.previous_size
+ self._increment_progress_bar(None, increment)
+ self.previous_size = count * block_size
+
+ def _increment_progress_bar(self, status_text, increment=1):
+ """
+ Update the wizard progress page.
+
+ :param status_text: Current status information to display.
+ :param increment: The value to increment the progress bar by.
+ """
+ if status_text:
+ self.setText(status_text)
+ if increment > 0:
+ self.setValue(self.value() + increment)
+ self.parent.application.process_events()
=== modified file 'openlp/core/common/settings.py'
--- openlp/core/common/settings.py 2017-09-09 20:00:48 +0000
+++ openlp/core/common/settings.py 2017-09-27 19:38:20 +0000
@@ -177,6 +177,7 @@
'images/background color': '#000000',
'media/players': 'system,webkit',
'media/override player': QtCore.Qt.Unchecked,
+ 'remotes/download version': '0000_00_00',
'players/background color': '#000000',
'servicemanager/last directory': None,
'servicemanager/last file': None,
=== modified file 'openlp/plugins/bibles/endpoint.py'
--- openlp/plugins/bibles/endpoint.py 2017-08-13 06:17:47 +0000
+++ openlp/plugins/bibles/endpoint.py 2017-09-27 19:38:20 +0000
@@ -62,7 +62,7 @@
:param request: The http request object.
"""
- service(request, 'bibles', log)
+ return service(request, 'bibles', log)
@api_bibles_endpoint.route('bibles/search')
@@ -95,6 +95,6 @@
:param request: The http request object.
"""
try:
- search(request, 'bibles', log)
+ return search(request, 'bibles', log)
except NotFound:
return {'results': {'items': []}}
=== modified file 'openlp/plugins/custom/endpoint.py'
--- openlp/plugins/custom/endpoint.py 2017-08-13 06:29:04 +0000
+++ openlp/plugins/custom/endpoint.py 2017-09-27 19:38:20 +0000
@@ -62,7 +62,7 @@
:param request: The http request object.
"""
- service(request, 'custom', log)
+ return service(request, 'custom', log)
@api_custom_endpoint.route('custom/search')
@@ -95,6 +95,6 @@
:param request: The http request object.
"""
try:
- search(request, 'custom', log)
+ return search(request, 'custom', log)
except NotFound:
return {'results': {'items': []}}
=== modified file 'openlp/plugins/images/endpoint.py'
--- openlp/plugins/images/endpoint.py 2017-08-13 06:17:47 +0000
+++ openlp/plugins/images/endpoint.py 2017-09-27 19:38:20 +0000
@@ -75,7 +75,7 @@
:param request: The http request object.
"""
- service(request, 'images', log)
+ return service(request, 'images', log)
@api_images_endpoint.route('images/search')
@@ -108,6 +108,6 @@
:param request: The http request object.
"""
try:
- search(request, 'images', log)
+ return search(request, 'images', log)
except NotFound:
return {'results': {'items': []}}
=== modified file 'openlp/plugins/media/endpoint.py'
--- openlp/plugins/media/endpoint.py 2017-08-13 06:17:47 +0000
+++ openlp/plugins/media/endpoint.py 2017-09-27 19:38:20 +0000
@@ -62,7 +62,7 @@
:param request: The http request object.
"""
- service(request, 'media', log)
+ return service(request, 'media', log)
@api_media_endpoint.route('media/search')
@@ -95,6 +95,6 @@
:param request: The http request object.
"""
try:
- search(request, 'media', log)
+ return search(request, 'media', log)
except NotFound:
return {'results': {'items': []}}
=== modified file 'openlp/plugins/presentations/endpoint.py'
--- openlp/plugins/presentations/endpoint.py 2017-08-13 06:17:47 +0000
+++ openlp/plugins/presentations/endpoint.py 2017-09-27 19:38:20 +0000
@@ -76,7 +76,7 @@
:param request: The http request object.
"""
- service(request, 'presentations', log)
+ return service(request, 'presentations', log)
@api_presentations_endpoint.route('presentations/search')
@@ -109,6 +109,6 @@
:param request: The http request object.
"""
try:
- search(request, 'presentations', log)
+ return search(request, 'presentations', log)
except NotFound:
return {'results': {'items': []}}
=== removed directory 'openlp/plugins/remotes'
=== removed file 'openlp/plugins/remotes/__init__.py'
--- openlp/plugins/remotes/__init__.py 2017-03-03 19:27:31 +0000
+++ openlp/plugins/remotes/__init__.py 1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
-# -*- 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 #
-###############################################################################
=== removed file 'openlp/plugins/remotes/deploy.py'
--- openlp/plugins/remotes/deploy.py 2017-09-23 04:04:41 +0000
+++ openlp/plugins/remotes/deploy.py 1970-01-01 00:00:00 +0000
@@ -1,69 +0,0 @@
-# -*- 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 #
-###############################################################################
-"""
-Download and "install" the remote web client
-"""
-import os
-from zipfile import ZipFile
-
-from openlp.core.common import AppLocation, Registry
-from openlp.core.common.httputils import url_get_file, get_web_page, get_url_file_size
-
-
-def deploy_zipfile(app_root, zip_name):
- """
- Process the downloaded zip file and add to the correct directory
-
- :param zip_name: the zip file to be processed
- :param app_root: the directory where the zip get expanded to
-
- :return: None
- """
- zip_file = os.path.join(app_root, zip_name)
- web_zip = ZipFile(zip_file)
- web_zip.extractall(app_root)
-
-
-def download_sha256():
- """
- Download the config file to extract the sha256 and version number
- """
- user_agent = 'OpenLP/' + Registry().get('application').applicationVersion()
- try:
- web_config = get_web_page('https://get.openlp.org/webclient/download.cfg', headers={'User-Agent': user_agent})
- except ConnectionError:
- return False
- file_bits = web_config.split()
- return file_bits[0], file_bits[2]
-
-
-def download_and_check(callback=None):
- """
- Download the web site and deploy it.
- """
- sha256, version = download_sha256()
- file_size = get_url_file_size('https://get.openlp.org/webclient/site.zip')
- callback.setRange(0, file_size)
- if url_get_file(callback, '{host}{name}'.format(host='https://get.openlp.org/webclient/', name='site.zip'),
- AppLocation.get_section_data_path('remotes') / 'site.zip',
- sha256=sha256):
- deploy_zipfile(str(AppLocation.get_section_data_path('remotes')), 'site.zip')
=== removed file 'openlp/plugins/remotes/endpoint.py'
--- openlp/plugins/remotes/endpoint.py 2017-08-13 05:44:10 +0000
+++ openlp/plugins/remotes/endpoint.py 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-# -*- 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 #
-###############################################################################
-import logging
-
-import os
-
-from openlp.core.api.http.endpoint import Endpoint
-from openlp.core.api.endpoint.core import TRANSLATED_STRINGS
-from openlp.core.common import AppLocation
-
-
-static_dir = os.path.join(str(AppLocation.get_section_data_path('remotes')))
-
-log = logging.getLogger(__name__)
-
-remote_endpoint = Endpoint('remote', template_dir=static_dir, static_dir=static_dir)
-
-
-@remote_endpoint.route('{view}')
-def index(request, view):
- """
- Handles requests for /remotes url
-
- :param request: The http request object.
- :param view: The view name to be servered.
- """
- return remote_endpoint.render_template('{view}.mako'.format(view=view), **TRANSLATED_STRINGS)
=== removed file 'openlp/plugins/remotes/remoteplugin.py'
--- openlp/plugins/remotes/remoteplugin.py 2017-08-24 19:53:55 +0000
+++ openlp/plugins/remotes/remoteplugin.py 1970-01-01 00:00:00 +0000
@@ -1,155 +0,0 @@
-# -*- 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 #
-###############################################################################
-
-import logging
-import os
-import time
-
-from PyQt5 import QtCore, QtWidgets
-
-from openlp.core.api.http import register_endpoint
-from openlp.core.common import AppLocation, Registry, Settings, OpenLPMixin, UiStrings, check_directory_exists
-from openlp.core.lib import Plugin, StringContent, translate, build_icon
-from openlp.plugins.remotes.endpoint import remote_endpoint
-from openlp.plugins.remotes.deploy import download_and_check, download_sha256
-
-log = logging.getLogger(__name__)
-__default_settings__ = {
- 'remotes/download version': '0000_00_00'
-}
-
-
-class RemotesPlugin(Plugin, OpenLPMixin):
- log.info('Remotes Plugin loaded')
-
- def __init__(self):
- """
- remotes constructor
- """
- super(RemotesPlugin, self).__init__('remotes', __default_settings__, {})
- self.icon_path = ':/plugins/plugin_remote.png'
- self.icon = build_icon(self.icon_path)
- self.weight = -1
- register_endpoint(remote_endpoint)
- Registry().register_function('download_website', self.first_time)
- Registry().register_function('get_website_version', self.website_version)
- Registry().set_flag('website_version', '0001_01_01')
-
- def initialise(self):
- """
- Create the internal file structure if it does not exist
- :return:
- """
- check_directory_exists(AppLocation.get_section_data_path('remotes') / 'assets')
- check_directory_exists(AppLocation.get_section_data_path('remotes') / 'images')
- check_directory_exists(AppLocation.get_section_data_path('remotes') / 'static')
- check_directory_exists(AppLocation.get_section_data_path('remotes') / 'static', 'index')
- check_directory_exists(AppLocation.get_section_data_path('remotes') / 'templates')
-
- @staticmethod
- def about():
- """
- Information about this plugin
- """
- about_text = translate(
- 'RemotePlugin',
- '<strong>Web Interface</strong>'
- '<br />The web interface plugin provides the ability to develop web based interfaces using OpenLP web '
- 'services.\nPredefined interfaces can be download as well as custom developed interfaces.')
- return about_text
-
- def set_plugin_text_strings(self):
- """
- Called to define all translatable texts of the plugin
- """
- # Name PluginList
- self.text_strings[StringContent.Name] = {
- 'singular': translate('RemotePlugin', 'Web Interface', 'name singular'),
- 'plural': translate('RemotePlugin', 'Web Interface', 'name plural')
- }
- # Name for MediaDockManager, SettingsManager
- self.text_strings[StringContent.VisibleName] = {
- 'title': translate('RemotePlugin', 'Web Remote', 'container title')
- }
-
- def first_time(self):
- """
- Import web site code if active
- """
- self.application.process_events()
- progress = Progress(self)
- progress.forceShow()
- self.application.process_events()
- time.sleep(1)
- download_and_check(progress)
- self.application.process_events()
- time.sleep(1)
- progress.close()
- self.application.process_events()
- Settings().setValue('remotes/download version', self.version)
-
- def website_version(self):
- """
- Download and save the website version and sha256
- :return: None
- """
- sha256, self.version = download_sha256()
- Registry().set_flag('website_sha256', sha256)
- Registry().set_flag('website_version', self.version)
-
-
-class Progress(QtWidgets.QProgressDialog):
- """
- Local class to handle download display based and supporting httputils:get_web_page
- """
- def __init__(self, parent):
- super(Progress, self).__init__(parent.main_window)
- self.parent = parent
- self.setWindowModality(QtCore.Qt.WindowModal)
- self.setWindowTitle(translate('RemotePlugin', 'Importing Website'))
- self.setLabelText(UiStrings().StartingImport)
- self.setCancelButton(None)
- self.setRange(0, 1)
- self.setMinimumDuration(0)
- self.was_cancelled = False
- self.previous_size = 0
-
- def _download_progress(self, count, block_size):
- """
- Calculate and display the download progress.
- """
- increment = (count * block_size) - self.previous_size
- self._increment_progress_bar(None, increment)
- self.previous_size = count * block_size
-
- def _increment_progress_bar(self, status_text, increment=1):
- """
- Update the wizard progress page.
-
- :param status_text: Current status information to display.
- :param increment: The value to increment the progress bar by.
- """
- if status_text:
- self.setText(status_text)
- if increment > 0:
- self.setValue(self.value() + increment)
- self.parent.application.process_events()
=== modified file 'openlp/plugins/songs/endpoint.py'
--- openlp/plugins/songs/endpoint.py 2017-08-13 06:17:47 +0000
+++ openlp/plugins/songs/endpoint.py 2017-09-27 19:38:20 +0000
@@ -62,7 +62,7 @@
:param request: The http request object.
"""
- service(request, 'songs', log)
+ return service(request, 'songs', log)
@api_songs_endpoint.route('songs/search')
@@ -95,6 +95,6 @@
:param request: The http request object.
"""
try:
- search(request, 'songs', log)
+ return service(request, 'songs', log)
except NotFound:
return {'results': {'items': []}}
=== added file 'tests/functional/openlp_core_api/test_deploy.py'
--- tests/functional/openlp_core_api/test_deploy.py 1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_core_api/test_deploy.py 2017-09-27 19:38:20 +0000
@@ -0,0 +1,63 @@
+# -*- 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 #
+###############################################################################
+
+import os
+import shutil
+from tempfile import mkdtemp
+from unittest import TestCase
+
+from openlp.core.api.deploy import deploy_zipfile
+
+TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources'))
+
+
+class TestRemoteDeploy(TestCase):
+ """
+ Test the Remote plugin deploy functions
+ """
+
+ def setUp(self):
+ """
+ Setup for tests
+ """
+ self.app_root = mkdtemp()
+
+ def tearDown(self):
+ """
+ Clean up after tests
+ """
+ shutil.rmtree(self.app_root)
+
+ def test_deploy_zipfile(self):
+ """
+ Remote Deploy tests - test the dummy zip file is processed correctly
+ """
+ # GIVEN: A new downloaded zip file
+ aa = TEST_PATH
+ zip_file = os.path.join(TEST_PATH, 'remotes', 'site.zip')
+ app_root = os.path.join(self.app_root, 'site.zip')
+ shutil.copyfile(zip_file, app_root)
+ # WHEN: I process the zipfile
+ deploy_zipfile(self.app_root, 'site.zip')
+
+ # THEN test if www directory has been created
+ self.assertTrue(os.path.isdir(os.path.join(self.app_root, 'www')), 'We should have a www directory')
=== removed directory 'tests/functional/openlp_plugins/remotes'
=== removed file 'tests/functional/openlp_plugins/remotes/__init__.py'
--- tests/functional/openlp_plugins/remotes/__init__.py 2017-03-05 17:07:21 +0000
+++ tests/functional/openlp_plugins/remotes/__init__.py 1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
-# -*- 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 #
-###############################################################################
=== removed file 'tests/functional/openlp_plugins/remotes/test_deploy.py'
--- tests/functional/openlp_plugins/remotes/test_deploy.py 2017-08-12 19:34:56 +0000
+++ tests/functional/openlp_plugins/remotes/test_deploy.py 1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
-# -*- 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 #
-###############################################################################
-
-import os
-import shutil
-
-from tempfile import mkdtemp
-from unittest import TestCase
-
-from openlp.plugins.remotes.deploy import deploy_zipfile
-
-
-TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources'))
-
-
-class TestRemoteDeploy(TestCase):
- """
- Test the Remote plugin deploy functions
- """
-
- def setUp(self):
- """
- Setup for tests
- """
- self.app_root = mkdtemp()
-
- def tearDown(self):
- """
- Clean up after tests
- """
- shutil.rmtree(self.app_root)
-
- def test_deploy_zipfile(self):
- """
- Remote Deploy tests - test the dummy zip file is processed correctly
- """
- # GIVEN: A new downloaded zip file
- zip_file = os.path.join(TEST_PATH, 'remotes', 'site.zip')
- app_root = os.path.join(self.app_root, 'site.zip')
- shutil.copyfile(zip_file, app_root)
- # WHEN: I process the zipfile
- deploy_zipfile(self.app_root, 'site.zip')
-
- # THEN test if www directory has been created
- self.assertTrue(os.path.isdir(os.path.join(self.app_root, 'www')), 'We should have a www directory')
=== modified file 'tests/interfaces/openlp_core_lib/test_pluginmanager.py'
--- tests/interfaces/openlp_core_lib/test_pluginmanager.py 2017-08-26 15:06:11 +0000
+++ tests/interfaces/openlp_core_lib/test_pluginmanager.py 2017-09-27 19:38:20 +0000
@@ -94,4 +94,3 @@
self.assertIn('custom', plugin_names, 'There should be a "custom" plugin')
self.assertIn('songusage', plugin_names, 'There should be a "songusage" plugin')
self.assertIn('alerts', plugin_names, 'There should be a "alerts" plugin')
- self.assertIn('remotes', plugin_names, 'There should be a "remotes" plugin')
Follow ups