openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #32143
Re: [Merge] lp:~trb143/openlp/webfixes into lp:openlp
Review: Needs Fixing
Please rename the dialog, and let's talk about version numbers.
Diff comments:
>
> === 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
> @@ -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):
Please call this "DownloadProgressDialog", the current name doesn't actually tell us what it is.
> + """
> + 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',
Personally, I think we should use version numbers, not dates. We can default to "0.0" :-)
> 'players/background color': '#000000',
> 'servicemanager/last directory': None,
> 'servicemanager/last file': None,
--
https://code.launchpad.net/~trb143/openlp/webfixes/+merge/331452
Your team OpenLP Core is subscribed to branch lp:openlp.
References