From ef6252bf4bc95e77b06eaf39cda73b2545d6c86a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 5 Mar 2017 10:02:22 +0000 Subject: [PATCH] FTW working and UI Strings --- openlp/core/api/tab.py | 4 ++-- openlp/core/common/uistrings.py | 1 + openlp/core/ui/firsttimeform.py | 9 ++++----- openlp/core/ui/firsttimewizard.py | 3 ++- openlp/plugins/remotes/remoteplugin.py | 17 ++++++----------- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/openlp/core/api/tab.py b/openlp/core/api/tab.py index 93b22c04b..74b1d59f1 100644 --- a/openlp/core/api/tab.py +++ b/openlp/core/api/tab.py @@ -22,7 +22,7 @@ from PyQt5 import QtCore, QtGui, QtNetwork, QtWidgets -from openlp.core.common import Settings, translate +from openlp.core.common import UiStrings, Settings, translate from openlp.core.lib import SettingsTab ZERO_URL = '0.0.0.0' @@ -188,7 +188,7 @@ class ApiTab(SettingsTab): 'Scan the QR code or click download to install the iOS app from the App ' 'Store.').format(qr='https://itunes.apple.com/app/id1096218725')) self.user_login_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'User Authentication')) - self.update_site_group_box.setTitle(translate('RemotePlugin.RemoteTab', 'Download latest web site')) + self.update_site_group_box.setTitle(str(UiStrings().WebDownloadText)) self.user_id_label.setText(translate('RemotePlugin.RemoteTab', 'User id:')) self.password_label.setText(translate('RemotePlugin.RemoteTab', 'Password:')) diff --git a/openlp/core/common/uistrings.py b/openlp/core/common/uistrings.py index c14fcec87..c3157592c 100644 --- a/openlp/core/common/uistrings.py +++ b/openlp/core/common/uistrings.py @@ -167,6 +167,7 @@ class UiStrings(object): self.View = translate('OpenLP.Ui', 'View') self.ViewMode = translate('OpenLP.Ui', 'View Mode') self.Video = translate('OpenLP.Ui', 'Video') + self.WebDownloadText = translate('OpenLP.Ui', 'Web Interface – Download and Install latest Version'), book_chapter = translate('OpenLP.Ui', 'Book Chapter') chapter = translate('OpenLP.Ui', 'Chapter') verse = translate('OpenLP.Ui', 'Verse') diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 22c5b8c95..b317df9dd 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -34,6 +34,7 @@ from configparser import ConfigParser, MissingSectionHeaderError, NoSectionError from PyQt5 import QtCore, QtWidgets +from openlp.core.api.deploy import download_and_check from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, \ translate, clean_button_text, trace_error_handler from openlp.core.lib import PluginStatus, build_icon @@ -555,7 +556,6 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): songs_destination = os.path.join(gettempdir(), 'openlp') bibles_destination = AppLocation.get_section_data_path('bibles') themes_destination = AppLocation.get_section_data_path('themes') - remote_destination = AppLocation.get_section_data_path('remotes') missed_files = [] # Download songs for i in range(self.songs_list_widget.count()): @@ -596,11 +596,10 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties): sha256): missed_files.append('Theme: {name}'.format(name=theme)) if self.remote_check_box.isChecked(): - self._increment_progress_bar(self.downloading.format(name='AA'), 0) + self._increment_progress_bar(self.downloading.format( + name=translate('OpenLP.FirstTimeWizard', 'Downloading Web Application')), 0) self.previous_size = 0 - url_get_file(self, 'https://get.openlp.org/webclient', 'download.cfg', - os.path.join(remote_destination, theme), - sha256) + download_and_check(self) if missed_files: file_list = '' for entry in missed_files: diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 4b9ff91b8..d7f81372e 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -24,6 +24,7 @@ The UI widgets for the first time wizard. """ from PyQt5 import QtCore, QtGui, QtWidgets +from openlp.core.common.uistrings import UiStrings from openlp.core.common import translate, is_macosx, clean_button_text, Settings from openlp.core.lib import build_icon from openlp.core.lib.ui import add_welcome_page @@ -254,7 +255,7 @@ class UiFirstTimeWizard(object): self.presentation_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Presentations – Show .ppt, .odp and .pdf files')) self.media_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Media – Playback of Audio and Video files')) - self.remote_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Remote – Download latest Web Pages')) + self.remote_check_box.setText(str(UiStrings().WebDownloadText)) self.song_usage_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Song Usage Monitor')) self.alert_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Alerts – Display informative messages while showing other slides')) diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 97fcc3b7e..e46429c0e 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -34,7 +34,7 @@ log = logging.getLogger(__name__) class RemotesPlugin(Plugin, OpenLPMixin): - log.info('Remote Plugin loaded') + log.info('Remotes Plugin loaded') def __init__(self): """ @@ -47,7 +47,12 @@ class RemotesPlugin(Plugin, OpenLPMixin): self.live_cache = None self.stage_cache = None register_endpoint(remote_endpoint) + print("AAAAAA") Registry().register_function('download_website', self.manage_download) + check_directory_exists(os.path.join(AppLocation.get_section_data_path('remotes'), 'assets')) + check_directory_exists(os.path.join(AppLocation.get_section_data_path('remotes'), 'images')) + check_directory_exists(os.path.join(AppLocation.get_section_data_path('remotes'), 'static')) + check_directory_exists(os.path.join(AppLocation.get_section_data_path('remotes'), 'templates')) @staticmethod def about(): @@ -60,16 +65,6 @@ class RemotesPlugin(Plugin, OpenLPMixin): 'download as well as custom developed interfaces') return about_text - def initialise(self): - """ - Create the internal file structure if it does not exist - :return: - """ - check_directory_exists(os.path.join(AppLocation.get_section_data_path('remotes'), 'assets')) - check_directory_exists(os.path.join(AppLocation.get_section_data_path('remotes'), 'images')) - check_directory_exists(os.path.join(AppLocation.get_section_data_path('remotes'), 'static')) - check_directory_exists(os.path.join(AppLocation.get_section_data_path('remotes'), 'templates')) - def set_plugin_text_strings(self): """ Called to define all translatable texts of the plugin