Correct image override process

This commit is contained in:
Tim Bentley 2010-03-25 20:24:52 +00:00
parent 63aa583942
commit 463847c61c
2 changed files with 20 additions and 37 deletions

View File

@ -178,6 +178,12 @@ class SlideController(QtGui.QWidget):
self.blankButton = self.Toolbar.addToolbarButton( self.blankButton = self.Toolbar.addToolbarButton(
u'Blank Screen', u':/slides/slide_blank.png', u'Blank Screen', u':/slides/slide_blank.png',
self.trUtf8('Blank Screen'), self.onBlankDisplay, True) self.trUtf8('Blank Screen'), self.onBlankDisplay, True)
self.themeButton = self.Toolbar.addToolbarButton(
u'Display Theme', u':/slides/slide_theme.png',
self.trUtf8('Blank Screen'), self.onBlankDisplay, True)
self.hideButton = self.Toolbar.addToolbarButton(
u'Hide screen', u':/slides/slide_desktop.png',
self.trUtf8('Blank Screen'), self.onBlankDisplay, True)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'live_slide_blank'), self.blankScreen) QtCore.SIGNAL(u'live_slide_blank'), self.blankScreen)
if not self.isLive: if not self.isLive:

View File

@ -54,7 +54,6 @@ class ImageMediaItem(MediaManagerItem):
self.servicePath = None self.servicePath = None
self.addToServiceItem = True self.addToServiceItem = True
MediaManagerItem.__init__(self, parent, icon, title) MediaManagerItem.__init__(self, parent, icon, title)
self.overrideActive = False
def initPluginNameVisible(self): def initPluginNameVisible(self):
self.PluginNameVisible = self.trUtf8('Image') self.PluginNameVisible = self.trUtf8('Image')
@ -92,26 +91,11 @@ class ImageMediaItem(MediaManagerItem):
self.ImageWidget.sizePolicy().hasHeightForWidth()) self.ImageWidget.sizePolicy().hasHeightForWidth())
self.ImageWidget.setSizePolicy(sizePolicy) self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget') self.ImageWidget.setObjectName(u'ImageWidget')
self.OverrideLayout = QtGui.QVBoxLayout(self.ImageWidget) self.blankButton = self.Toolbar.addToolbarButton(
self.OverrideLayout.setMargin(5) u'Replace Background', u':/slides/slide_blank.png',
self.OverrideLayout.setSpacing(4) self.trUtf8('Replace Background'), self.onReplaceClick, False)
self.OverrideLayout.setObjectName(u'OverrideLayout')
self.OverrideCheckBox = QtGui.QCheckBox(self.ImageWidget)
self.OverrideCheckBox.setObjectName(u'OverrideCheckBox')
self.OverrideCheckBox.setCheckable(True)
self.OverrideCheckBox.setChecked(False)
self.OverrideCheckBox.setText(self.trUtf8('Override background'))
self.OverrideCheckBox.setStatusTip(
self.trUtf8('Allow the background of live slide to be overridden'))
self.OverrideLayout.addWidget(self.OverrideCheckBox)
self.OverrideLabel = QtGui.QLabel(self.ImageWidget)
self.OverrideLabel.setObjectName(u'OverrideLabel')
self.OverrideLayout.addWidget(self.OverrideLabel)
# Add the song widget to the page layout # Add the song widget to the page layout
self.PageLayout.addWidget(self.ImageWidget) self.PageLayout.addWidget(self.ImageWidget)
QtCore.QObject.connect(self.OverrideCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.toggleOverrideState)
def onDeleteClick(self): def onDeleteClick(self):
items = self.ListView.selectedIndexes() items = self.ListView.selectedIndexes()
@ -158,24 +142,17 @@ class ImageMediaItem(MediaManagerItem):
else: else:
return False return False
def toggleOverrideState(self): def onReplaceClick(self):
self.overrideActive = not self.overrideActive if not self.ListView.selectedIndexes():
if not self.overrideActive: QtGui.QMessageBox.information(self,
self.OverrideLabel.setText(u'') self.trUtf8('No item selected...'),
self.parent.render_manager.override_background = None self.trUtf8('You must select one item'))
items = self.ListView.selectedIndexes()
for item in items:
bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
frame = QtGui.QImage(unicode(filename))
self.parent.maindisplay.addImageWithText(frame)
def onPreviewClick(self): def onPreviewClick(self):
if self.overrideActive:
if not self.ListView.selectedIndexes():
QtGui.QMessageBox.information(self,
self.trUtf8('No items selected...'),
self.trUtf8('You must select one or more items'))
items = self.ListView.selectedIndexes()
for item in items:
bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
self.OverrideLabel.setText(bitem.text())
frame = QtGui.QImage(unicode(filename))
self.parent.maindisplay.addImageWithText(frame)
else:
MediaManagerItem.onPreviewClick(self) MediaManagerItem.onPreviewClick(self)