openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #05965
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/48330
Deduplication, naming and various cleanups
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/48330
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/searchedit.py'
--- openlp/core/lib/searchedit.py 2011-01-06 20:48:22 +0000
+++ openlp/core/lib/searchedit.py 2011-02-02 16:05:17 +0000
@@ -93,15 +93,15 @@
``event``
The event that happened.
"""
- sz = self.clearButton.size()
+ size = self.clearButton.size()
frameWidth = self.style().pixelMetric(
QtGui.QStyle.PM_DefaultFrameWidth)
- self.clearButton.move(self.rect().right() - frameWidth - sz.width(),
- (self.rect().bottom() + 1 - sz.height()) / 2)
+ self.clearButton.move(self.rect().right() - frameWidth - size.width(),
+ (self.rect().bottom() + 1 - size.height()) / 2)
if hasattr(self, u'menuButton'):
- sz = self.menuButton.size()
+ size = self.menuButton.size()
self.menuButton.move(self.rect().left() + frameWidth + 2,
- (self.rect().bottom() + 1 - sz.height()) / 2)
+ (self.rect().bottom() + 1 - size.height()) / 2)
def currentSearchType(self):
"""
=== modified file 'openlp/core/lib/theme.py'
--- openlp/core/lib/theme.py 2011-02-01 06:04:49 +0000
+++ openlp/core/lib/theme.py 2011-02-02 16:05:17 +0000
@@ -91,21 +91,30 @@
Song = 3
class BackgroundType(object):
+ """
+ Type enumeration for backgrounds.
+ """
Solid = 0
Gradient = 1
Image = 2
@staticmethod
- def to_string(type):
- if type == BackgroundType.Solid:
+ def to_string(background_type):
+ """
+ Return a string representation of a background type.
+ """
+ if background_type == BackgroundType.Solid:
return u'solid'
- elif type == BackgroundType.Gradient:
+ elif background_type == BackgroundType.Gradient:
return u'gradient'
- elif type == BackgroundType.Image:
+ elif background_type == BackgroundType.Image:
return u'image'
@staticmethod
def from_string(type_string):
+ """
+ Return a background type for the given string.
+ """
if type_string == u'solid':
return BackgroundType.Solid
elif type_string == u'gradient':
@@ -114,6 +123,9 @@
return BackgroundType.Image
class BackgroundGradientType(object):
+ """
+ Type enumeration for background gradients.
+ """
Horizontal = 0
Vertical = 1
Circular = 2
@@ -121,20 +133,26 @@
LeftBottom = 4
@staticmethod
- def to_string(type):
- if type == BackgroundGradientType.Horizontal:
+ def to_string(gradient_type):
+ """
+ Return a string representation of a background gradient type.
+ """
+ if gradient_type == BackgroundGradientType.Horizontal:
return u'horizontal'
- elif type == BackgroundGradientType.Vertical:
+ elif gradient_type == BackgroundGradientType.Vertical:
return u'vertical'
- elif type == BackgroundGradientType.Circular:
+ elif gradient_type == BackgroundGradientType.Circular:
return u'circular'
- elif type == BackgroundGradientType.LeftTop:
+ elif gradient_type == BackgroundGradientType.LeftTop:
return u'leftTop'
- elif type == BackgroundGradientType.LeftBottom:
+ elif gradient_type == BackgroundGradientType.LeftBottom:
return u'leftBottom'
@staticmethod
def from_string(type_string):
+ """
+ Return a background gradient type for the given string.
+ """
if type_string == u'horizontal':
return BackgroundGradientType.Horizontal
elif type_string == u'vertical':
@@ -147,19 +165,25 @@
return BackgroundGradientType.LeftBottom
class HorizontalType(object):
+ """
+ Type enumeration for horizontal alignment.
+ """
Left = 0
Center = 1
Right = 2
class VerticalType(object):
+ """
+ Type enumeration for vertical alignment.
+ """
Top = 0
Middle = 1
Bottom = 2
-boolean_list = [u'bold', u'italics', u'override', u'outline', u'shadow',
+BOOLEAN_LIST = [u'bold', u'italics', u'override', u'outline', u'shadow',
u'slide_transition']
-integer_list = [u'size', u'line_adjustment', u'x', u'height', u'y',
+INTEGER_LIST = [u'size', u'line_adjustment', u'x', u'height', u'y',
u'width', u'shadow_size', u'outline_size', u'horizontal_align',
u'vertical_align', u'wrap_style']
@@ -514,9 +538,9 @@
return
field = self._de_hump(element)
tag = master + u'_' + field
- if field in boolean_list:
+ if field in BOOLEAN_LIST:
setattr(self, tag, str_to_bool(value))
- elif field in integer_list:
+ elif field in INTEGER_LIST:
setattr(self, tag, int(value))
else:
# make string value unicode
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2011-02-01 10:06:56 +0000
+++ openlp/core/ui/advancedtab.py 2011-02-02 16:05:17 +0000
@@ -141,7 +141,8 @@
'Hide the mouse cursor when moved over the display window'))
self.serviceOrderGroupBox.setTitle(translate('OpenLP.AdvancedTab',
'Service Order Print'))
- self.detailedServicePrintCheckBox.setText(translate('OpenLP.AdvancedTab',
+ self.detailedServicePrintCheckBox.setText(
+ translate('OpenLP.AdvancedTab',
'Print slide texts and service item notes as well'))
# self.sharedDirGroupBox.setTitle(
# translate('AdvancedTab', 'Central Data Store'))
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2011-02-01 19:02:42 +0000
+++ openlp/core/ui/mainwindow.py 2011-02-02 16:05:17 +0000
@@ -771,34 +771,29 @@
"""
Put OpenLP into "Default" view mode.
"""
- settings = QtCore.QSettings()
- settings.setValue(u'%s/view mode' % self.generalSettingsSection,
- u'default')
- self.setViewMode(True, True, True, True, True)
+ self.setViewMode(True, True, True, True, True, u'default')
def onModeSetupItemClicked(self):
"""
Put OpenLP into "Setup" view mode.
"""
- settings = QtCore.QSettings()
- settings.setValue(u'%s/view mode' % self.generalSettingsSection,
- u'setup')
- self.setViewMode(True, True, False, True, False)
+ self.setViewMode(True, True, False, True, False, u'setup')
def onModeLiveItemClicked(self):
"""
Put OpenLP into "Live" view mode.
"""
- settings = QtCore.QSettings()
- settings.setValue(u'%s/view mode' % self.generalSettingsSection,
- u'live')
- self.setViewMode(False, True, False, False, True)
+ self.setViewMode(False, True, False, False, True, u'live')
def setViewMode(self, media=True, service=True, theme=True, preview=True,
- live=True):
+ live=True, mode=u''):
"""
Set OpenLP to a different view mode.
"""
+ if mode:
+ settings = QtCore.QSettings()
+ settings.setValue(u'%s/view mode' % self.generalSettingsSection,
+ mode)
self.MediaManagerDock.setVisible(media)
self.ServiceManagerDock.setVisible(service)
self.ThemeManagerDock.setVisible(theme)
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2011-02-01 10:06:56 +0000
+++ openlp/core/ui/servicemanager.py 2011-02-02 16:05:17 +0000
@@ -526,7 +526,7 @@
'File is not a valid service.'))
log.exception(u'File contains no service data')
except (IOError, NameError):
- log.exception(u'Problem loading a service file')
+ log.exception(u'Problem loading service file %s' % fileName)
finally:
if fileTo:
fileTo.close()
=== modified file 'openlp/core/ui/themewizard.py'
--- openlp/core/ui/themewizard.py 2011-02-01 18:05:59 +0000
+++ openlp/core/ui/themewizard.py 2011-02-02 16:05:17 +0000
@@ -27,6 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon
+from openlp.core.ui.wizard import addWelcomePage
class Ui_ThemeWizard(object):
def setupUi(self, themeWizard):
@@ -36,22 +37,7 @@
themeWizard.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage)
# Welcome Page
- self.welcomePage = QtGui.QWizardPage()
- self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
- QtGui.QPixmap(u':/wizards/wizard_createtheme.bmp'))
- self.welcomePage.setObjectName(u'WelcomePage')
- self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage)
- self.welcomeLayout.setObjectName(u'WelcomeLayout')
- self.titleLabel = QtGui.QLabel(self.welcomePage)
- self.titleLabel.setObjectName(u'TitleLabel')
- self.welcomeLayout.addWidget(self.titleLabel)
- self.welcomeLayout.addSpacing(40)
- self.informationLabel = QtGui.QLabel(self.welcomePage)
- self.informationLabel.setWordWrap(True)
- self.informationLabel.setObjectName(u'InformationLabel')
- self.welcomeLayout.addWidget(self.informationLabel)
- self.welcomeLayout.addStretch()
- themeWizard.addPage(self.welcomePage)
+ addWelcomePage(themeWizard, u':/wizards/wizard_createtheme.bmp')
# Background Page
self.backgroundPage = QtGui.QWizardPage()
self.backgroundPage.setObjectName(u'BackgroundPage')
=== modified file 'openlp/core/ui/wizard.py'
--- openlp/core/ui/wizard.py 2011-01-18 18:53:09 +0000
+++ openlp/core/ui/wizard.py 2011-02-02 16:05:17 +0000
@@ -63,36 +63,12 @@
self.setOptions(QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage)
- self.addWelcomePage(image)
+ addWelcomePage(self, image)
self.addCustomPages()
self.addProgressPage()
self.retranslateUi()
QtCore.QMetaObject.connectSlotsByName(self)
- def addWelcomePage(self, image):
- """
- Add the opening welcome page to the wizard.
-
- ``image``
- A splash image for the wizard
- """
- self.welcomePage = QtGui.QWizardPage()
- self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
- QtGui.QPixmap(image))
- self.welcomePage.setObjectName(u'WelcomePage')
- self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage)
- self.welcomeLayout.setObjectName(u'WelcomeLayout')
- self.titleLabel = QtGui.QLabel(self.welcomePage)
- self.titleLabel.setObjectName(u'TitleLabel')
- self.welcomeLayout.addWidget(self.titleLabel)
- self.welcomeLayout.addSpacing(40)
- self.informationLabel = QtGui.QLabel(self.welcomePage)
- self.informationLabel.setWordWrap(True)
- self.informationLabel.setObjectName(u'InformationLabel')
- self.welcomeLayout.addWidget(self.informationLabel)
- self.welcomeLayout.addStretch()
- self.addPage(self.welcomePage)
-
def addProgressPage(self):
"""
Add the progress page for the wizard. This page informs the user how
@@ -169,3 +145,27 @@
self.finishButton.setVisible(True)
self.cancelButton.setVisible(False)
Receiver.send_message(u'openlp_process_events')
+
+def addWelcomePage(parent, image):
+ """
+ Generate an opening welcome page for a wizard using a provided image.
+
+ ``image``
+ A splash image for the wizard.
+ """
+ parent.welcomePage = QtGui.QWizardPage()
+ parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
+ QtGui.QPixmap(image))
+ parent.welcomePage.setObjectName(u'WelcomePage')
+ parent.welcomeLayout = QtGui.QVBoxLayout(parent.welcomePage)
+ parent.welcomeLayout.setObjectName(u'WelcomeLayout')
+ parent.titleLabel = QtGui.QLabel(parent.welcomePage)
+ parent.titleLabel.setObjectName(u'TitleLabel')
+ parent.welcomeLayout.addWidget(parent.titleLabel)
+ parent.welcomeLayout.addSpacing(40)
+ parent.informationLabel = QtGui.QLabel(parent.welcomePage)
+ parent.informationLabel.setWordWrap(True)
+ parent.informationLabel.setObjectName(u'InformationLabel')
+ parent.welcomeLayout.addWidget(parent.informationLabel)
+ parent.welcomeLayout.addStretch()
+ parent.addPage(parent.welcomePage)
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2011-02-01 01:02:44 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2011-02-02 16:05:17 +0000
@@ -111,14 +111,8 @@
self.authorsLayout.setObjectName(u'authorsLayout')
self.authorAddLayout = QtGui.QHBoxLayout()
self.authorAddLayout.setObjectName(u'authorAddLayout')
- self.authorsComboBox = QtGui.QComboBox(self.authorsGroupBox)
- self.authorsComboBox.setSizeAdjustPolicy(
- QtGui.QComboBox.AdjustToMinimumContentsLength)
- self.authorsComboBox.setSizePolicy(
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
- self.authorsComboBox.setEditable(True)
- self.authorsComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
- self.authorsComboBox.setObjectName(u'authorsComboBox')
+ self.authorsComboBox = editSongDialogComboBox(
+ self.authorsGroupBox, u'authorsComboBox')
self.authorAddLayout.addWidget(self.authorsComboBox)
self.authorAddButton = QtGui.QPushButton(self.authorsGroupBox)
self.authorAddButton.setObjectName(u'authorAddButton')
@@ -152,14 +146,8 @@
self.topicsLayout.setObjectName(u'topicsLayout')
self.topicAddLayout = QtGui.QHBoxLayout()
self.topicAddLayout.setObjectName(u'topicAddLayout')
- self.topicsComboBox = QtGui.QComboBox(self.topicsGroupBox)
- self.topicsComboBox.setSizeAdjustPolicy(
- QtGui.QComboBox.AdjustToMinimumContentsLength)
- self.topicsComboBox.setSizePolicy(
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
- self.topicsComboBox.setEditable(True)
- self.topicsComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
- self.topicsComboBox.setObjectName(u'topicsComboBox')
+ self.topicsComboBox = editSongDialogComboBox(
+ self.topicsGroupBox, u'topicsComboBox')
self.topicAddLayout.addWidget(self.topicsComboBox)
self.topicAddButton = QtGui.QPushButton(self.topicsGroupBox)
self.topicAddButton.setObjectName(u'topicAddButton')
@@ -183,14 +171,8 @@
self.songBookLayout.setObjectName(u'songBookLayout')
self.songBookNameLabel = QtGui.QLabel(self.songBookGroupBox)
self.songBookNameLabel.setObjectName(u'songBookNameLabel')
- self.songBookComboBox = QtGui.QComboBox(self.songBookGroupBox)
- self.songBookComboBox.setSizeAdjustPolicy(
- QtGui.QComboBox.AdjustToMinimumContentsLength)
- self.songBookComboBox.setSizePolicy(
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
- self.songBookComboBox.setEditable(True)
- self.songBookComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
- self.songBookComboBox.setObjectName(u'songBookComboBox')
+ self.songBookComboBox = editSongDialogComboBox(
+ self.songBookGroupBox, u'songBookComboBox')
self.songBookNameLabel.setBuddy(self.songBookComboBox)
self.songBookLayout.addRow(self.songBookNameLabel,
self.songBookComboBox)
@@ -215,14 +197,8 @@
self.themeGroupBox.setObjectName(u'themeGroupBox')
self.themeLayout = QtGui.QHBoxLayout(self.themeGroupBox)
self.themeLayout.setObjectName(u'themeLayout')
- self.themeComboBox = QtGui.QComboBox(self.themeGroupBox)
- self.themeComboBox.setSizeAdjustPolicy(
- QtGui.QComboBox.AdjustToMinimumContentsLength)
- self.themeComboBox.setSizePolicy(
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
- self.themeComboBox.setEditable(True)
- self.themeComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
- self.themeComboBox.setObjectName(u'themeComboBox')
+ self.themeComboBox = editSongDialogComboBox(
+ self.themeGroupBox, u'themeComboBox')
self.themeLayout.addWidget(self.themeComboBox)
self.themeAddButton = QtGui.QPushButton(self.themeGroupBox)
self.themeAddButton.setObjectName(u'themeAddButton')
@@ -331,3 +307,15 @@
self.songTabWidget.indexOf(self.themeTab),
translate('SongsPlugin.EditSongForm',
'Theme, Copyright Info && Comments'))
+
+def editSongDialogComboBox(parent, name):
+ """
+ Utility method to generate a standard combo box for this dialog.
+ """
+ comboBox = QtGui.QComboBox(parent)
+ comboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
+ comboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
+ comboBox.setEditable(True)
+ comboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
+ comboBox.setObjectName(name)
+ return comboBox
=== modified file 'openlp/plugins/songs/forms/songimportform.py'
--- openlp/plugins/songs/forms/songimportform.py 2011-01-21 01:18:29 +0000
+++ openlp/plugins/songs/forms/songimportform.py 2011-02-02 16:05:17 +0000
@@ -165,29 +165,29 @@
self.formatStack = QtGui.QStackedLayout()
self.formatStack.setObjectName(u'FormatStack')
# OpenLP 2.0
- self.addSingleFileSelectItem(u'openLP2')
+ self.addFileSelectItem(u'openLP2', single_select=True)
# openlp.org 1.x
- self.addSingleFileSelectItem(u'openLP1', None, True)
+ self.addFileSelectItem(u'openLP1', None, True, True)
# OpenLyrics
- self.addMultiFileSelectItem(u'openLyrics', u'OpenLyrics', True)
+ self.addFileSelectItem(u'openLyrics', u'OpenLyrics', True)
# Open Song
- self.addMultiFileSelectItem(u'openSong', u'OpenSong')
+ self.addFileSelectItem(u'openSong', u'OpenSong')
# Words of Worship
- self.addMultiFileSelectItem(u'wordsOfWorship')
+ self.addFileSelectItem(u'wordsOfWorship')
# CCLI File import
- self.addMultiFileSelectItem(u'ccli')
+ self.addFileSelectItem(u'ccli')
# Songs of Fellowship
- self.addMultiFileSelectItem(u'songsOfFellowship', None, True)
+ self.addFileSelectItem(u'songsOfFellowship', None, True)
# Generic Document/Presentation import
- self.addMultiFileSelectItem(u'generic', None, True)
+ self.addFileSelectItem(u'generic', None, True)
# EasySlides
- self.addSingleFileSelectItem(u'easiSlides')
+ self.addFileSelectItem(u'easiSlides', single_select=True)
# EasyWorship
- self.addSingleFileSelectItem(u'ew')
+ self.addFileSelectItem(u'ew', single_select=True)
# Words of Worship
- self.addMultiFileSelectItem(u'songBeamer')
+ self.addFileSelectItem(u'songBeamer')
# Commented out for future use.
-# self.addSingleFileSelectItem(u'csv', u'CSV')
+# self.addFileSelectItem(u'csv', u'CSV', single_select=True)
self.sourceLayout.addLayout(self.formatStack)
self.addPage(self.sourcePage)
@@ -318,16 +318,6 @@
self.openLP2FilenameLabel.minimumSizeHint().width())
self.formatSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
QtGui.QSizePolicy.Fixed)
- self.openLP2FormLabelSpacer.changeSize(width, 0,
- QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- self.openLP1FormLabelSpacer.changeSize(width, 0,
- QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- self.easiSlidesFormLabelSpacer.changeSize(width, 0,
- QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
- self.ewFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
- QtGui.QSizePolicy.Fixed)
-# self.csvFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
-# QtGui.QSizePolicy.Fixed)
def validateCurrentPage(self):
"""
@@ -791,52 +781,8 @@
translate('SongsPlugin.SongImportForm',
'Your song import failed.'))
- def addSingleFileSelectItem(self, prefix, obj_prefix=None,
- can_disable=False):
- if not obj_prefix:
- obj_prefix = prefix
- page = QtGui.QWidget()
- page.setObjectName(obj_prefix + u'Page')
- if can_disable:
- importWidget = self.disablableWidget(page, prefix, obj_prefix)
- else:
- importWidget = page
- importLayout = QtGui.QFormLayout(importWidget)
- importLayout.setMargin(0)
- if can_disable:
- importLayout.setObjectName(obj_prefix + u'ImportLayout')
- else:
- importLayout.setObjectName(obj_prefix + u'Layout')
- filenameLabel = QtGui.QLabel(importWidget)
- filenameLabel.setObjectName(obj_prefix + u'FilenameLabel')
- fileLayout = QtGui.QHBoxLayout()
- fileLayout.setObjectName(obj_prefix + u'FileLayout')
- filenameEdit = QtGui.QLineEdit(importWidget)
- filenameEdit.setObjectName(obj_prefix + u'FilenameEdit')
- fileLayout.addWidget(filenameEdit)
- browseButton = QtGui.QToolButton(importWidget)
- browseButton.setIcon(self.openIcon)
- browseButton.setObjectName(obj_prefix + u'BrowseButton')
- fileLayout.addWidget(browseButton)
- importLayout.addRow(filenameLabel, fileLayout)
- formSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
- QtGui.QSizePolicy.Minimum)
- importLayout.setItem(1, QtGui.QFormLayout.LabelRole, formSpacer)
- self.formatStack.addWidget(page)
- setattr(self, prefix + u'Page', page)
- setattr(self, prefix + u'FilenameLabel', filenameLabel)
- setattr(self, prefix + u'FormLabelSpacer', formSpacer)
- setattr(self, prefix + u'FileLayout', fileLayout)
- setattr(self, prefix + u'FilenameEdit', filenameEdit)
- setattr(self, prefix + u'BrowseButton', browseButton)
- if can_disable:
- setattr(self, prefix + u'ImportLayout', importLayout)
- else:
- setattr(self, prefix + u'Layout', importLayout)
- self.formatComboBox.addItem(u'')
-
- def addMultiFileSelectItem(self, prefix, obj_prefix=None,
- can_disable=False):
+ def addFileSelectItem(self, prefix, obj_prefix=None, can_disable=False,
+ single_select=False):
if not obj_prefix:
obj_prefix = prefix
page = QtGui.QWidget()
@@ -847,37 +793,55 @@
importWidget = page
importLayout = QtGui.QVBoxLayout(importWidget)
importLayout.setMargin(0)
- if can_disable:
- importLayout.setObjectName(obj_prefix + u'ImportLayout')
+ importLayout.setObjectName(obj_prefix + u'ImportLayout')
+ if single_select:
+ fileLayout = QtGui.QHBoxLayout()
+ fileLayout.setObjectName(obj_prefix + u'FileLayout')
+ filenameLabel = QtGui.QLabel(importWidget)
+ filenameLabel.setObjectName(obj_prefix + u'FilenameLabel')
+ fileLayout.addWidget(filenameLabel)
+ filenameEdit = QtGui.QLineEdit(importWidget)
+ filenameEdit.setObjectName(obj_prefix + u'FilenameEdit')
+ fileLayout.addWidget(filenameEdit)
+ browseButton = QtGui.QToolButton(importWidget)
+ browseButton.setIcon(self.openIcon)
+ browseButton.setObjectName(obj_prefix + u'BrowseButton')
+ fileLayout.addWidget(browseButton)
+ formSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
+ QtGui.QSizePolicy.Expanding)
+ importLayout.addLayout(fileLayout)
+ importLayout.addSpacerItem(formSpacer)
else:
- importLayout.setObjectName(obj_prefix + u'Layout')
- fileListWidget = QtGui.QListWidget(importWidget)
- fileListWidget.setSelectionMode(
- QtGui.QAbstractItemView.ExtendedSelection)
- fileListWidget.setObjectName(obj_prefix + u'FileListWidget')
- importLayout.addWidget(fileListWidget)
- buttonLayout = QtGui.QHBoxLayout()
- buttonLayout.setObjectName(obj_prefix + u'ButtonLayout')
- addButton = QtGui.QPushButton(importWidget)
- addButton.setIcon(self.openIcon)
- addButton.setObjectName(obj_prefix + u'AddButton')
- buttonLayout.addWidget(addButton)
- buttonLayout.addStretch()
- removeButton = QtGui.QPushButton(importWidget)
- removeButton.setIcon(self.deleteIcon)
- removeButton.setObjectName(obj_prefix + u'RemoveButton')
- buttonLayout.addWidget(removeButton)
- importLayout.addLayout(buttonLayout)
+ fileListWidget = QtGui.QListWidget(importWidget)
+ fileListWidget.setSelectionMode(
+ QtGui.QAbstractItemView.ExtendedSelection)
+ fileListWidget.setObjectName(obj_prefix + u'FileListWidget')
+ importLayout.addWidget(fileListWidget)
+ buttonLayout = QtGui.QHBoxLayout()
+ buttonLayout.setObjectName(obj_prefix + u'ButtonLayout')
+ addButton = QtGui.QPushButton(importWidget)
+ addButton.setIcon(self.openIcon)
+ addButton.setObjectName(obj_prefix + u'AddButton')
+ buttonLayout.addWidget(addButton)
+ buttonLayout.addStretch()
+ removeButton = QtGui.QPushButton(importWidget)
+ removeButton.setIcon(self.deleteIcon)
+ removeButton.setObjectName(obj_prefix + u'RemoveButton')
+ buttonLayout.addWidget(removeButton)
+ importLayout.addLayout(buttonLayout)
self.formatStack.addWidget(page)
setattr(self, prefix + u'Page', page)
- setattr(self, prefix + u'FileListWidget', fileListWidget)
- setattr(self, prefix + u'ButtonLayout', buttonLayout)
- setattr(self, prefix + u'AddButton', addButton)
- setattr(self, prefix + u'RemoveButton', removeButton)
- if can_disable:
- setattr(self, prefix + u'ImportLayout', importLayout)
+ if single_select:
+ setattr(self, prefix + u'FilenameLabel', filenameLabel)
+ setattr(self, prefix + u'FileLayout', fileLayout)
+ setattr(self, prefix + u'FilenameEdit', filenameEdit)
+ setattr(self, prefix + u'BrowseButton', browseButton)
else:
- setattr(self, prefix + u'Layout', importLayout)
+ setattr(self, prefix + u'FileListWidget', fileListWidget)
+ setattr(self, prefix + u'ButtonLayout', buttonLayout)
+ setattr(self, prefix + u'AddButton', addButton)
+ setattr(self, prefix + u'RemoveButton', removeButton)
+ setattr(self, prefix + u'ImportLayout', importLayout)
self.formatComboBox.addItem(u'')
def disablableWidget(self, page, prefix, obj_prefix):
Follow ups