From 49dbda7476683fc99bec60cebb5aaba2efe5686d Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sun, 25 Mar 2012 19:37:22 +0700 Subject: [PATCH 1/9] 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 2/9] #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 3/9] #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 4/9] 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 5/9] 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 6/9] 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 7/9] 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 32ee1ec343ebeaace481b945f084d599c5658a3a Mon Sep 17 00:00:00 2001 From: Edwin Lunando Date: Sun, 27 May 2012 16:41:53 +0700 Subject: [PATCH 8/9] 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 9/9] 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