openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #18470
[Merge] lp:~arjan-i/openlp/show_thumbs_onoff into lp:openlp
Arjan Schrijver has proposed merging lp:~arjan-i/openlp/show_thumbs_onoff into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~arjan-i/openlp/show_thumbs_onoff/+merge/141433
Added an on/off switch in the settings display for displaying thumbnails in the images plugin. This can be useful for the performance of setups that have huge amounts of images.
--
https://code.launchpad.net/~arjan-i/openlp/show_thumbs_onoff/+merge/141433
Your team OpenLP Core is requested to review the proposed merge of lp:~arjan-i/openlp/show_thumbs_onoff into lp:openlp.
=== modified file 'openlp/plugins/images/lib/imagetab.py'
--- openlp/plugins/images/lib/imagetab.py 2012-12-03 19:19:10 +0000
+++ openlp/plugins/images/lib/imagetab.py 2012-12-28 18:08:22 +0000
@@ -59,7 +59,15 @@
self.informationLabel.setObjectName(u'InformationLabel')
self.informationLabel.setWordWrap(True)
self.formLayout.addRow(self.informationLabel)
+ self.showThumbnailsGroupBox = QtGui.QGroupBox(self.leftColumn)
+ self.showThumbnailsGroupBox.setObjectName(u'ShowThumbnailsGroupBox')
+ self.thumbsLayout = QtGui.QFormLayout(self.showThumbnailsGroupBox)
+ self.thumbsLayout.setObjectName(u'ThumbsLayout')
+ self.showThumbnailsCheckBox = QtGui.QCheckBox(self.showThumbnailsGroupBox)
+ self.showThumbnailsCheckBox.setObjectName(u'ShowThumbnailsCheckBox')
+ self.thumbsLayout.addWidget(self.showThumbnailsCheckBox)
self.leftLayout.addWidget(self.bgColorGroupBox)
+ self.leftLayout.addWidget(self.showThumbnailsGroupBox)
self.leftLayout.addStretch()
self.rightColumn.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
@@ -67,6 +75,9 @@
# Signals and slots
QtCore.QObject.connect(self.backgroundColorButton,
QtCore.SIGNAL(u'clicked()'), self.onbackgroundColorButtonClicked)
+ QtCore.QObject.connect(self.showThumbnailsCheckBox,
+ QtCore.SIGNAL(u'stateChanged(int)'),
+ self.onShowThumbnailsCheckBoxChanged)
def retranslateUi(self):
self.bgColorGroupBox.setTitle(UiStrings().BackgroundColor)
@@ -74,6 +85,10 @@
self.informationLabel.setText(
translate('ImagesPlugin.ImageTab', 'Visible background for images '
'with aspect ratio different to screen.'))
+ self.showThumbnailsGroupBox.setTitle(translate('ImagesPlugin.ImageTab',
+ u'Thumbnails'))
+ self.showThumbnailsCheckBox.setText(translate('ImagesPlugin.ImageTab',
+ u'Show thumbnails'))
def onbackgroundColorButtonClicked(self):
new_color = QtGui.QColorDialog.getColor(
@@ -83,20 +98,31 @@
self.backgroundColorButton.setStyleSheet(
u'background-color: %s' % self.bg_color)
+ def onShowThumbnailsCheckBoxChanged(self, check_state):
+ self.show_thumbs = False
+ # we have a set value convert to True/False
+ if check_state == QtCore.Qt.Checked:
+ self.show_thumbs = True
+
def load(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
self.bg_color = unicode(settings.value(
u'background color', QtCore.QVariant(u'#000000')).toString())
self.initial_color = self.bg_color
+ self.show_thumbs = settings.value(
+ u'show thumbnails', QtCore.QVariant(True)).toBool()
settings.endGroup()
self.backgroundColorButton.setStyleSheet(
u'background-color: %s' % self.bg_color)
+ self.showThumbnailsCheckBox.setChecked(self.show_thumbs)
def save(self):
settings = Settings()
settings.beginGroup(self.settingsSection)
settings.setValue(u'background color', QtCore.QVariant(self.bg_color))
+ settings.setValue(u'show thumbnails',
+ QtCore.QVariant(self.show_thumbs))
settings.endGroup()
if self.initial_color != self.bg_color:
Receiver.send_message(u'image_updated')
=== modified file 'openlp/plugins/images/lib/mediaitem.py'
--- openlp/plugins/images/lib/mediaitem.py 2012-12-04 06:09:55 +0000
+++ openlp/plugins/images/lib/mediaitem.py 2012-12-28 18:08:22 +0000
@@ -55,9 +55,24 @@
self.hasSearch = True
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'live_theme_changed'), self.liveThemeChanged)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'config_updated'), self.configUpdated)
# Allow DnD from the desktop
self.listView.activateDnD()
+ def configUpdated(self):
+ self.showThumbnails = Settings().value(
+ self.settingsSection + u'/show thumbnails',
+ QtCore.QVariant(u'True')).toBool()
+ self.listView.clear()
+ self.listView.setIconSize(QtCore.QSize(88, 50))
+ self.servicePath = os.path.join(
+ AppLocation.get_section_data_path(self.settingsSection),
+ u'thumbnails')
+ check_directory_exists(self.servicePath)
+ self.loadList(SettingsManager.load_list(
+ self.settingsSection, u'images'), True)
+
def retranslateUi(self):
self.onNewPrompt = translate('ImagePlugin.MediaItem',
'Select Image(s)')
@@ -78,14 +93,7 @@
def initialise(self):
log.debug(u'initialise')
- self.listView.clear()
- self.listView.setIconSize(QtCore.QSize(88, 50))
- self.servicePath = os.path.join(
- AppLocation.get_section_data_path(self.settingsSection),
- u'thumbnails')
- check_directory_exists(self.servicePath)
- self.loadList(SettingsManager.load_list(
- self.settingsSection, u'images'), True)
+ self.configUpdated()
def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self)
@@ -137,12 +145,14 @@
if not os.path.exists(unicode(imageFile)):
icon = build_icon(u':/general/general_delete.png')
else:
- if validate_thumb(unicode(imageFile), thumb):
- icon = build_icon(thumb)
- else:
- icon = create_thumb(unicode(imageFile), thumb)
+ if self.showThumbnails:
+ if validate_thumb(unicode(imageFile), thumb):
+ icon = build_icon(thumb)
+ else:
+ icon = create_thumb(unicode(imageFile), thumb)
item_name = QtGui.QListWidgetItem(filename)
- item_name.setIcon(icon)
+ if self.showThumbnails:
+ item_name.setIcon(icon)
item_name.setToolTip(imageFile)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(imageFile))
self.listView.addItem(item_name)
Follow ups