This commit is contained in:
Edwin Lunando 2012-05-16 20:14:32 +07:00
parent 49dbda7476
commit a251522ef3
3 changed files with 22 additions and 9 deletions

View File

@ -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

View File

@ -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):
"""

View File

@ -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_()