From 49dbda7476683fc99bec60cebb5aaba2efe5686d Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sun, 25 Mar 2012 19:37:22 +0700 Subject: [PATCH 01/14] themeform.py line 426 at function setPositionPageValues(self): added main and footer page width and height based on the screen size --- openlp/core/ui/themeform.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index face5938f..63df0ab8d 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -427,25 +427,28 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ Handle the display and state of the Position page. """ + # Get the QRect of a screen + screen = QtGui.QDesktopWidget().availableGeometry() # Main Area self.mainPositionCheckBox.setChecked(not self.theme.font_main_override) self.setField(u'mainPositionX', QtCore.QVariant(self.theme.font_main_x)) self.setField(u'mainPositionY', QtCore.QVariant(self.theme.font_main_y)) self.setField(u'mainPositionHeight', - QtCore.QVariant(self.theme.font_main_height)) + QtCore.QVariant(screen.height() - 110)) self.setField(u'mainPositionWidth', - QtCore.QVariant(self.theme.font_main_width)) + QtCore.QVariant(screen.width() - 20)) # Footer self.footerPositionCheckBox.setChecked( not self.theme.font_footer_override) self.setField(u'footerPositionX', QtCore.QVariant(self.theme.font_footer_x)) self.setField(u'footerPositionY', - QtCore.QVariant(self.theme.font_footer_y)) + QtCore.QVariant(screen.height() - 100)) self.setField(u'footerPositionHeight', - QtCore.QVariant(self.theme.font_footer_height)) + QtCore.QVariant(120)) + self.setField(u'footerPositionWidth', - QtCore.QVariant(self.theme.font_footer_width)) + QtCore.QVariant(screen.width() - 20)) def setAlignmentPageValues(self): """ From a251522ef37a0fb13991b6eafa7b80e90c7dcc30 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Wed, 16 May 2012 20:14:32 +0700 Subject: [PATCH 02/14] #902492 resolved --- openlp/core/lib/theme.py | 11 +++++++++++ openlp/core/ui/themeform.py | 13 +++++-------- openlp/core/ui/thememanager.py | 7 ++++++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 486f89b18..16ee1be37 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -444,6 +444,17 @@ class ThemeXML(object): element.appendChild(child) return child + def set_default_header_footer(self, main_width, main_height, footer_width, + footer_height): + """ + Set the header and footer size into the current primary screen + """ + self.font_main_width = main_width + self.font_main_height = main_height + self.font_footer_width = footer_width + self.font_footer_y = main_height+20 + self.font_footer_height = footer_height + def dump_xml(self): """ Dump the XML to file used for debugging diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 63df0ab8d..face5938f 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -427,28 +427,25 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ Handle the display and state of the Position page. """ - # Get the QRect of a screen - screen = QtGui.QDesktopWidget().availableGeometry() # Main Area self.mainPositionCheckBox.setChecked(not self.theme.font_main_override) self.setField(u'mainPositionX', QtCore.QVariant(self.theme.font_main_x)) self.setField(u'mainPositionY', QtCore.QVariant(self.theme.font_main_y)) self.setField(u'mainPositionHeight', - QtCore.QVariant(screen.height() - 110)) + QtCore.QVariant(self.theme.font_main_height)) self.setField(u'mainPositionWidth', - QtCore.QVariant(screen.width() - 20)) + QtCore.QVariant(self.theme.font_main_width)) # Footer self.footerPositionCheckBox.setChecked( not self.theme.font_footer_override) self.setField(u'footerPositionX', QtCore.QVariant(self.theme.font_footer_x)) self.setField(u'footerPositionY', - QtCore.QVariant(screen.height() - 100)) + QtCore.QVariant(self.theme.font_footer_y)) self.setField(u'footerPositionHeight', - QtCore.QVariant(120)) - + QtCore.QVariant(self.theme.font_footer_height)) self.setField(u'footerPositionWidth', - QtCore.QVariant(screen.width() - 20)) + QtCore.QVariant(self.theme.font_footer_width)) def setAlignmentPageValues(self): """ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 72a8b7e3b..4766e0693 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -43,7 +43,7 @@ from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ create_widget_action from openlp.core.theme import Theme -from openlp.core.ui import FileRenameForm, ThemeForm +from openlp.core.ui import FileRenameForm, ThemeForm, ScreenList from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding log = logging.getLogger(__name__) @@ -255,6 +255,11 @@ class ThemeManager(QtGui.QWidget): editing form for the user to make their customisations. """ theme = ThemeXML() + screens = ScreenList.get_instance() + primary_screen = screens.current + theme.set_default_header_footer(primary_screen[u'size'].width()-20, + primary_screen[u'size'].height() - 100, + primary_screen[u'size'].width()-20, 70) self.themeForm.theme = theme self.themeForm.exec_() From 81f0ff3870b64bef4ddfc9fcc7264fbea94153ea Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Fri, 18 May 2012 17:38:05 +0700 Subject: [PATCH 03/14] #902492 resolved. All the working code is a placed at theme.py. --- openlp/core/lib/theme.py | 13 ++++++------- openlp/core/ui/thememanager.py | 5 +---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 16ee1be37..afc217e79 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -444,16 +444,15 @@ class ThemeXML(object): element.appendChild(child) return child - def set_default_header_footer(self, main_width, main_height, footer_width, - footer_height): + def set_default_header_footer(self, current_screen): """ Set the header and footer size into the current primary screen """ - self.font_main_width = main_width - self.font_main_height = main_height - self.font_footer_width = footer_width - self.font_footer_y = main_height+20 - self.font_footer_height = footer_height + self.font_main_width = current_screen[u'size'].width()-20 + self.font_main_height = current_screen[u'size'].height()-100 + self.font_footer_width = current_screen[u'size'].width()-20 + self.font_footer_y = current_screen[u'size'].height()-80 + self.font_footer_height = 70 def dump_xml(self): """ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 4766e0693..38d568883 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -256,10 +256,7 @@ class ThemeManager(QtGui.QWidget): """ theme = ThemeXML() screens = ScreenList.get_instance() - primary_screen = screens.current - theme.set_default_header_footer(primary_screen[u'size'].width()-20, - primary_screen[u'size'].height() - 100, - primary_screen[u'size'].width()-20, 70) + theme.set_default_header_footer(screens.current) self.themeForm.theme = theme self.themeForm.exec_() From 3fdb3b2991f8faf3298274c5c21d87cf0c354fdd Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Fri, 18 May 2012 17:44:28 +0700 Subject: [PATCH 04/14] I've resolved the bug #902492 I got the primary screen resolution from the ScreenList class. --- openlp/core/ui/thememanager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 38d568883..18547042b 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -255,8 +255,7 @@ class ThemeManager(QtGui.QWidget): editing form for the user to make their customisations. """ theme = ThemeXML() - screens = ScreenList.get_instance() - theme.set_default_header_footer(screens.current) + theme.set_default_header_footer(ScreenList.get_instance().current) self.themeForm.theme = theme self.themeForm.exec_() From b9aaaf05f69bb2538ccdd7b70269d5d74541cfe5 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sat, 19 May 2012 15:46:22 +0700 Subject: [PATCH 05/14] Using the renderer.py calculation --- openlp/core/lib/theme.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index afc217e79..61e7cdcaf 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -448,11 +448,12 @@ class ThemeXML(object): """ Set the header and footer size into the current primary screen """ - self.font_main_width = current_screen[u'size'].width()-20 - self.font_main_height = current_screen[u'size'].height()-100 - self.font_footer_width = current_screen[u'size'].width()-20 - self.font_footer_y = current_screen[u'size'].height()-80 - self.font_footer_height = 70 + self.font_main_y = 0; + self.font_main_width = current_screen[u'size'].width() - 20 + self.font_main_height = current_screen[u'size'].height() * 9 / 10 + self.font_footer_width = current_screen[u'size'].width() - 20 + self.font_footer_y = current_screen[u'size'].height() * 9 / 10 + self.font_footer_height = current_screen[u'size'].height() / 10 def dump_xml(self): """ From 41d1ea359037c9f5cf62247b834919a5c00e40a3 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sat, 19 May 2012 23:50:45 +0700 Subject: [PATCH 06/14] added comment --- openlp/core/lib/theme.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 61e7cdcaf..8b701443a 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -448,6 +448,7 @@ class ThemeXML(object): """ Set the header and footer size into the current primary screen """ + #10 px border set round display self.font_main_y = 0; self.font_main_width = current_screen[u'size'].width() - 20 self.font_main_height = current_screen[u'size'].height() * 9 / 10 From fb8519694ef6a17244dd3d6fc8462d5dd920f290 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sun, 20 May 2012 21:05:06 +0700 Subject: [PATCH 07/14] updated the set_default_header_footer method on lib/theme.py all the works and the import is inside the method. --- openlp/core/lib/theme.py | 7 +++++-- openlp/core/ui/thememanager.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 8b701443a..dc701f6ad 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -36,6 +36,7 @@ from lxml import etree, objectify from openlp.core.lib import str_to_bool + log = logging.getLogger(__name__) BLANK_THEME_XML = \ @@ -444,12 +445,14 @@ class ThemeXML(object): element.appendChild(child) return child - def set_default_header_footer(self, current_screen): + def set_default_header_footer(self): """ Set the header and footer size into the current primary screen """ #10 px border set round display - self.font_main_y = 0; + from openlp.core.ui import ScreenList + current_screen = ScreenList.get_instance().current + self.font_main_y = 0 self.font_main_width = current_screen[u'size'].width() - 20 self.font_main_height = current_screen[u'size'].height() * 9 / 10 self.font_footer_width = current_screen[u'size'].width() - 20 diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 18547042b..f2d313fd7 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -43,7 +43,7 @@ from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ create_widget_action from openlp.core.theme import Theme -from openlp.core.ui import FileRenameForm, ThemeForm, ScreenList +from openlp.core.ui import FileRenameForm, ThemeForm from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding log = logging.getLogger(__name__) @@ -255,7 +255,7 @@ class ThemeManager(QtGui.QWidget): editing form for the user to make their customisations. """ theme = ThemeXML() - theme.set_default_header_footer(ScreenList.get_instance().current) + theme.set_default_header_footer() self.themeForm.theme = theme self.themeForm.exec_() From f96073000faa707fa508cedcb4f7ac3929ec9b43 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 26 May 2012 18:52:34 +0200 Subject: [PATCH 08/14] fixed crash on cancel when thread is still running --- openlp/core/ui/firsttimeform.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 5926733a8..c675312ef 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -56,6 +56,9 @@ class ThemeScreenshotThread(QtCore.QThread): themes = themes.split(u',') config = self.parent().config for theme in themes: + # Stop if the wizard has been cancelled. + if self.parent().downloadCancelled: + return title = config.get(u'theme_%s' % theme, u'title') filename = config.get(u'theme_%s' % theme, u'filename') screenshot = config.get(u'theme_%s' % theme, u'screenshot') @@ -86,7 +89,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): files = self.webAccess.read() self.config.readfp(io.BytesIO(files)) self.updateScreenListCombo() - self.downloadCanceled = False + self.downloadCancelled = False self.downloading = unicode(translate('OpenLP.FirstTimeWizard', 'Downloading %s...')) QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), @@ -242,11 +245,12 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): Process the triggering of the cancel button. """ if self.lastId == FirstTimePage.NoInternet or \ - (self.lastId <= FirstTimePage.Plugins and \ - not self.hasRunWizard): + (self.lastId <= FirstTimePage.Plugins and not self.hasRunWizard): QtCore.QCoreApplication.exit() sys.exit() - self.downloadCanceled = True + self.downloadCancelled = True + while self.themeScreenshotThread.isRunning(): + time.sleep(0.1) Receiver.send_message(u'cursor_normal') def onNoInternetFinishButtonClicked(self): @@ -272,7 +276,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): filesize = urlfile.headers["Content-Length"] filename = open(fpath, "wb") # Download until finished or canceled. - while not self.downloadCanceled: + while not self.downloadCancelled: data = urlfile.read(block_size) if not data: break @@ -280,8 +284,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): block_count += 1 self._downloadProgress(block_count, block_size, filesize) filename.close() - # Delete file if canceled, it may be a partial file. - if self.downloadCanceled: + # Delete file if cancelled, it may be a partial file. + if self.downloadCancelled: os.remove(fpath) def _buildThemeScreenshots(self): From 577e39bdeefca069c5eeb5642269868ec5e932eb Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 27 May 2012 06:46:08 +0100 Subject: [PATCH 09/14] Fix typing --- openlp/plugins/remotes/html/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/remotes/html/index.html b/openlp/plugins/remotes/html/index.html index c2aa38b05..fc8b37441 100644 --- a/openlp/plugins/remotes/html/index.html +++ b/openlp/plugins/remotes/html/index.html @@ -164,7 +164,7 @@ ${search} -
    +
      From 3bc0fc7de55da695546be77f9622951554782195 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 27 May 2012 07:06:18 +0100 Subject: [PATCH 10/14] cache images sooner --- openlp/core/lib/renderer.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index aa39e779b..62aa3c9c5 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -109,6 +109,8 @@ class Renderer(object): self.global_theme_data = \ self.themeManager.getThemeData(self.global_theme) self.theme_data = None + self._cache_background_image(self.global_theme_data) + def set_service_theme(self, service_theme): """ @@ -119,6 +121,23 @@ class Renderer(object): """ self.service_theme = service_theme self.theme_data = None + self._cache_background_image(self.themeManager.getThemeData + (service_theme)) + + + def _cache_background_image(self,temp_theme): + """ + Adds a background image to the image cache if necessary. + + ``temp_theme`` + The theme object containing the theme data. + """ + # if No file do not update cache + if temp_theme.background_filename: + self.imageManager.add_image(temp_theme.theme_name, + temp_theme.background_filename, u'theme', + QtGui.QColor(temp_theme.background_border_color)) + def set_override_theme(self, override_theme, override_levels=False): """ @@ -163,11 +182,7 @@ class Renderer(object): self.theme_data = self.themeManager.getThemeData(theme) self._calculate_default() self._build_text_rectangle(self.theme_data) - # if No file do not update cache - if self.theme_data.background_filename: - self.imageManager.add_image(self.theme_data.theme_name, - self.theme_data.background_filename, u'theme', - QtGui.QColor(self.theme_data.background_border_color)) + self._cache_background_image(self.theme_data) return self._rect, self._rect_footer def generate_preview(self, theme_data, force_page=False): From 32ee1ec343ebeaace481b945f084d599c5658a3a Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sun, 27 May 2012 16:41:53 +0700 Subject: [PATCH 11/14] refactor code --- openlp/core/lib/theme.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index dc701f6ad..18c01ee42 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -36,7 +36,6 @@ from lxml import etree, objectify from openlp.core.lib import str_to_bool - log = logging.getLogger(__name__) BLANK_THEME_XML = \ From faebbc1f5d5ecb3c45c1353f49a03555c8260646 Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Mon, 28 May 2012 09:43:00 +0700 Subject: [PATCH 12/14] comment reformatting --- openlp/core/lib/theme.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 99c51689d..686de4c6c 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -446,9 +446,9 @@ class ThemeXML(object): def set_default_header_footer(self): """ - #Set the header and footer size into the current primary screen + Set the header and footer size into the current primary screen. + 10 px on each side is removed to allow for a border. """ - #10 px border set round display from openlp.core.ui import ScreenList current_screen = ScreenList().current self.font_main_y = 0 From 14bdc5ca7a471ce34471d8f424359e7a8ca3b73a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 29 May 2012 20:13:02 +0100 Subject: [PATCH 13/14] Remove blank lines --- openlp/core/lib/renderer.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 62aa3c9c5..4e5746faa 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -111,7 +111,6 @@ class Renderer(object): self.theme_data = None self._cache_background_image(self.global_theme_data) - def set_service_theme(self, service_theme): """ Set the service-level theme. @@ -124,7 +123,6 @@ class Renderer(object): self._cache_background_image(self.themeManager.getThemeData (service_theme)) - def _cache_background_image(self,temp_theme): """ Adds a background image to the image cache if necessary. @@ -138,7 +136,6 @@ class Renderer(object): temp_theme.background_filename, u'theme', QtGui.QColor(temp_theme.background_border_color)) - def set_override_theme(self, override_theme, override_levels=False): """ Set the appropriate theme depending on the theme level. From cdb6859edf284dcd6ec3461b04dde8b768c43fc8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 30 May 2012 20:50:24 +0100 Subject: [PATCH 14/14] Add space --- openlp/core/lib/renderer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 4e5746faa..9705e13df 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -123,7 +123,7 @@ class Renderer(object): self._cache_background_image(self.themeManager.getThemeData (service_theme)) - def _cache_background_image(self,temp_theme): + def _cache_background_image(self, temp_theme): """ Adds a background image to the image cache if necessary.