Move to use the new is_macosx() method, and tweak the theme wizard a little more.

This commit is contained in:
Raoul Snyman 2014-09-02 23:15:58 +02:00
parent 184a397970
commit cf8f15964c
4 changed files with 26 additions and 30 deletions

View File

@ -31,9 +31,7 @@ The UI widgets for the first time wizard.
"""
from PyQt4 import QtCore, QtGui
import sys
from openlp.core.common import translate
from openlp.core.common import translate, is_macosx
from openlp.core.lib import build_icon
from openlp.core.lib.ui import add_welcome_page
@ -66,7 +64,7 @@ class Ui_FirstTimeWizard(object):
first_time_wizard.setModal(True)
first_time_wizard.setOptions(QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage | QtGui.QWizard.HaveCustomButton1)
if sys.platform == 'darwin':
if is_macosx():
first_time_wizard.setPixmap(QtGui.QWizard.BackgroundPixmap,
QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
first_time_wizard.resize(634, 386)

View File

@ -170,6 +170,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
else:
pixmap_width = int(pixmap_height * self.display_aspect_ratio + 0.5)
self.preview_box_label.setFixedSize(pixmap_width + 2 * frame_width, pixmap_height + 2 * frame_width)
print(self.size())
def validateCurrentPage(self):
"""

View File

@ -29,11 +29,9 @@
"""
The Create/Edit theme wizard
"""
import sys
from PyQt4 import QtCore, QtGui
from openlp.core.common import UiStrings, translate
from openlp.core.common import UiStrings, translate, is_macosx
from openlp.core.lib import build_icon
from openlp.core.lib.theme import HorizontalType, BackgroundType, BackgroundGradientType
from openlp.core.lib.ui import add_welcome_page, create_valign_selection_widgets
@ -43,21 +41,21 @@ class Ui_ThemeWizard(object):
"""
The Create/Edit theme wizard
"""
def setupUi(self, themeWizard):
def setupUi(self, theme_wizard):
"""
Set up the UI
"""
themeWizard.setObjectName('OpenLP.ThemeWizard')
themeWizard.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
themeWizard.setModal(True)
themeWizard.setOptions(QtGui.QWizard.IndependentPages |
theme_wizard.setObjectName('OpenLP.ThemeWizard')
theme_wizard.setWindowIcon(build_icon(u':/icon/openlp-logo.svg'))
theme_wizard.setModal(True)
theme_wizard.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.HaveCustomButton1)
if sys.platform == 'darwin':
themeWizard.setPixmap(QtGui.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
#themeWizard.resize(634, 386)
if is_macosx():
theme_wizard.setPixmap(QtGui.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
theme_wizard.resize(646, 386)
self.spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
# Welcome Page
add_welcome_page(themeWizard, ':/wizards/wizard_createtheme.bmp')
add_welcome_page(theme_wizard, ':/wizards/wizard_createtheme.bmp')
# Background Page
self.background_page = QtGui.QWizardPage()
self.background_page.setObjectName('background_page')
@ -141,7 +139,7 @@ class Ui_ThemeWizard(object):
self.transparent_layout.setObjectName('Transparent_layout')
self.background_stack.addWidget(self.transparent_widget)
self.background_layout.addLayout(self.background_stack)
themeWizard.addPage(self.background_page)
theme_wizard.addPage(self.background_page)
# Main Area Page
self.main_area_page = QtGui.QWizardPage()
self.main_area_page.setObjectName('main_area_page')
@ -222,7 +220,7 @@ class Ui_ThemeWizard(object):
self.shadow_size_spin_box.setObjectName('shadow_size_spin_box')
self.shadow_layout.addWidget(self.shadow_size_spin_box)
self.main_area_layout.addRow(self.shadow_check_box, self.shadow_layout)
themeWizard.addPage(self.main_area_page)
theme_wizard.addPage(self.main_area_page)
# Footer Area Page
self.footer_area_page = QtGui.QWizardPage()
self.footer_area_page.setObjectName('footer_area_page')
@ -246,7 +244,7 @@ class Ui_ThemeWizard(object):
self.footer_size_spin_box.setObjectName('FooterSizeSpinBox')
self.footer_area_layout.addRow(self.footer_size_label, self.footer_size_spin_box)
self.footer_area_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
themeWizard.addPage(self.footer_area_page)
theme_wizard.addPage(self.footer_area_page)
# Alignment Page
self.alignment_page = QtGui.QWizardPage()
self.alignment_page.setObjectName('alignment_page')
@ -268,7 +266,7 @@ class Ui_ThemeWizard(object):
self.transitions_check_box.setObjectName('transitions_check_box')
self.alignment_layout.addRow(self.transitions_label, self.transitions_check_box)
self.alignment_layout.setItem(3, QtGui.QFormLayout.LabelRole, self.spacer)
themeWizard.addPage(self.alignment_page)
theme_wizard.addPage(self.alignment_page)
# Area Position Page
self.area_position_page = QtGui.QWizardPage()
self.area_position_page.setObjectName('area_position_page')
@ -338,7 +336,7 @@ class Ui_ThemeWizard(object):
self.footer_height_spin_box.setObjectName('footer_height_spin_box')
self.footer_position_layout.addRow(self.footer_height_label, self.footer_height_spin_box)
self.area_position_layout.addWidget(self.footer_position_group_box)
themeWizard.addPage(self.area_position_page)
theme_wizard.addPage(self.area_position_page)
# Preview Page
self.preview_page = QtGui.QWizardPage()
self.preview_page.setObjectName('preview_page')
@ -366,8 +364,8 @@ class Ui_ThemeWizard(object):
self.preview_box_label.setObjectName('preview_box_label')
self.preview_area_layout.addWidget(self.preview_box_label)
self.preview_layout.addWidget(self.preview_area)
themeWizard.addPage(self.preview_page)
self.retranslateUi(themeWizard)
theme_wizard.addPage(self.preview_page)
self.retranslateUi(theme_wizard)
QtCore.QObject.connect(self.background_combo_box, QtCore.SIGNAL('currentIndexChanged(int)'),
self.background_stack, QtCore.SLOT('setCurrentIndex(int)'))
QtCore.QObject.connect(self.outline_check_box, QtCore.SIGNAL('toggled(bool)'), self.outline_color_button,
@ -395,11 +393,11 @@ class Ui_ThemeWizard(object):
QtCore.QObject.connect(self.footer_position_check_box, QtCore.SIGNAL('toggled(bool)'),
self.footer_height_spin_box, QtCore.SLOT('setDisabled(bool)'))
def retranslateUi(self, themeWizard):
def retranslateUi(self, theme_wizard):
"""
Translate the UI on the fly
"""
themeWizard.setWindowTitle(translate('OpenLP.ThemeWizard', 'Theme Wizard'))
theme_wizard.setWindowTitle(translate('OpenLP.ThemeWizard', 'Theme Wizard'))
self.title_label.setText('<span style="font-size:14pt; font-weight:600;">%s</span>' %
translate('OpenLP.ThemeWizard', 'Welcome to the Theme Wizard'))
self.information_label.setText(
@ -488,8 +486,8 @@ class Ui_ThemeWizard(object):
self.footer_height_label.setText(translate('OpenLP.ThemeWizard', 'Height:'))
self.footer_height_spin_box.setSuffix(translate('OpenLP.ThemeWizard', 'px'))
self.footer_position_check_box.setText(translate('OpenLP.ThemeWizard', 'Use default location'))
themeWizard.setOption(QtGui.QWizard.HaveCustomButton1, False)
themeWizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.ThemeWizard', 'Layout Preview'))
theme_wizard.setOption(QtGui.QWizard.HaveCustomButton1, False)
theme_wizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.ThemeWizard', 'Layout Preview'))
self.preview_page.setTitle(translate('OpenLP.ThemeWizard', 'Preview and Save'))
self.preview_page.setSubTitle(translate('OpenLP.ThemeWizard', 'Preview the theme and save it.'))
self.theme_name_label.setText(translate('OpenLP.ThemeWizard', 'Theme name:'))

View File

@ -31,11 +31,10 @@ The :mod:``wizard`` module provides generic wizard tools for OpenLP.
"""
import logging
import os
import sys
from PyQt4 import QtGui
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate, is_macosx
from openlp.core.lib import build_icon
from openlp.core.lib.ui import add_welcome_page
@ -124,7 +123,7 @@ class OpenLPWizard(QtGui.QWizard, RegistryProperties):
self.setModal(True)
self.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage)
if sys.platform == 'darwin':
if is_macosx():
self.setPixmap(QtGui.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png'))
#self.resize(634, 386)
add_welcome_page(self, image)