Start to add change in toolbar

This commit is contained in:
Tim Bentley 2009-12-06 13:55:07 +00:00
commit 528004df23
2 changed files with 57 additions and 51 deletions

View File

@ -356,6 +356,7 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
self.trUtf8('No items selected...'), self.trUtf8('No items selected...'),
self.trUtf8('You must select one or more items')) self.trUtf8('You must select one or more items'))
else:
log.debug(self.PluginNameShort + u' Preview Requested') log.debug(self.PluginNameShort + u' Preview Requested')
service_item = self.buildServiceItem() service_item = self.buildServiceItem()
if service_item: if service_item:
@ -367,6 +368,7 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
self.trUtf8('No items selected...'), self.trUtf8('No items selected...'),
self.trUtf8('You must select one or more items')) self.trUtf8('You must select one or more items'))
else:
log.debug(self.PluginNameShort + u' Live Requested') log.debug(self.PluginNameShort + u' Live Requested')
service_item = self.buildServiceItem() service_item = self.buildServiceItem()
if service_item: if service_item:
@ -378,6 +380,7 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
self.trUtf8('No items selected...'), self.trUtf8('No items selected...'),
self.trUtf8('You must select one or more items')) self.trUtf8('You must select one or more items'))
else:
log.debug(self.PluginNameShort + u' Add Requested') log.debug(self.PluginNameShort + u' Add Requested')
service_item = self.buildServiceItem() service_item = self.buildServiceItem()
if service_item: if service_item:

View File

@ -208,28 +208,20 @@ class SlideController(QtGui.QWidget):
self.ControllerLayout.addWidget(self.Mediabar) self.ControllerLayout.addWidget(self.Mediabar)
# Build the Song Toolbar # Build the Song Toolbar
if isLive: if isLive:
self.Songbar = OpenLPToolbar(self) self.SongMenu = QtGui.QToolButton(self.Toolbar)
self.Songbar.addToolbarButton( u'I', u':/pages/slide.png', self.SongMenu.setText(self.trUtf8('Go to Verse'))
self.trUtf8('Intro'),self.onSongBarHandler) self.SongMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
self.Songbar.addToolbarButton(u'Bridge:1', u'B', self.Toolbar.addToolbarWidget(u'Song Menu', self.SongMenu)
self.trUtf8('Bridge'),self.onSongBarHandler) self.SongMenu.setMenu(QtGui.QMenu(self.trUtf8('Go to Verse'), self.Toolbar))
self.Songbar.addToolbarButton(u'PreChorus:1', u'P', self.SongMenu.menu().addAction(self.trUtf8('Intro'), self.onSongBarHandler)
self.trUtf8('PreChorus'), self.onSongBarHandler) self.SongMenu.menu().addAction(self.trUtf8('Bridge'), self.onSongBarHandler)
self.Songbar.addToolbarButton(u'Chorus:1', u'C', self.SongMenu.menu().addAction(self.trUtf8('PreChorus'), self.onSongBarHandler)
self.trUtf8('Chorus'), self.onSongBarHandler) self.SongMenu.menu().addAction(self.trUtf8('Chorus'), self.onSongBarHandler)
self.Songbar.addToolbarButton(u'Tag:1', u'T', for i in range(1, 10):
self.trUtf8('Tag'), self.onSongBarHandler) self.SongMenu.menu().addAction(self.trUtf8('V%s'%i), self.onSongBarHandler)
for verse in range(1, 12): self.SongMenu.menu().addAction(self.trUtf8('Other'), self.onSongBarHandler)
self.Songbar.addToolbarButton( self.SongMenu.menu().addAction(self.trUtf8('End'), self.onSongBarHandler)
unicode(u'Verse:%s'% verse), u'%s' % verse, self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
unicode(self.trUtf8('Verse %s'))% verse,
self.onSongBarHandler)
self.Songbar.addToolbarButton(u'Other:1', u'O',
self.trUtf8('Other'), self.onSongBarHandler)
self.Songbar.addToolbarButton(u'Ending:1', u'E',
self.trUtf8('Ending'), self.onSongBarHandler)
self.ControllerLayout.addWidget(self.Songbar)
self.Songbar.setVisible(False)
# Screen preview area # Screen preview area
self.PreviewFrame = QtGui.QFrame(self.Splitter) self.PreviewFrame = QtGui.QFrame(self.Splitter)
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225)) self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225))
@ -276,8 +268,6 @@ class SlideController(QtGui.QWidget):
QtCore.QObject.connect(self.PreviewListWidget, QtCore.QObject.connect(self.PreviewListWidget,
QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected) QtCore.SIGNAL(u'activated(QModelIndex)'), self.onSlideSelected)
if isLive: if isLive:
#QtCore.QObject.connect(self.blackPushButton,
# QtCore.SIGNAL(u'clicked(bool)'), self.onBlankScreen)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'update_spin_delay'), self.receiveSpinDelay) QtCore.SIGNAL(u'update_spin_delay'), self.receiveSpinDelay)
Receiver.send_message(u'request_spin_delay') Receiver.send_message(u'request_spin_delay')
@ -320,12 +310,21 @@ class SlideController(QtGui.QWidget):
def onSongBarHandler(self): def onSongBarHandler(self):
request = unicode(self.sender().text()) request = unicode(self.sender().text())
#Remember list is 1 out! #Remember list is 1 out!
slideno = self.slideList[request] slideno = self.slideList[request[1:]] -1
if slideno > self.PreviewListWidget.rowCount(): if slideno > self.PreviewListWidget.rowCount():
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount()) self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
else: else:
self.PreviewListWidget.selectRow(slideno) self.PreviewListWidget.selectRow(slideno)
self.onSlideSelected() self.onSlideSelected()
#=======
# #Remember list is 1 out!
# slideno = int(request[1:]) - 1
# if slideno > self.PreviewListWidget.rowCount():
# self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
# else:
# self.PreviewListWidget.selectRow(slideno)
# self.onSlideSelected()
#>>>>>>> MERGE-SOURCE
def receiveSpinDelay(self, value): def receiveSpinDelay(self, value):
self.DelaySpinBox.setValue(int(value)) self.DelaySpinBox.setValue(int(value))
@ -345,23 +344,19 @@ class SlideController(QtGui.QWidget):
Allows the live toolbar to be customised Allows the live toolbar to be customised
""" """
self.Toolbar.setVisible(True) self.Toolbar.setVisible(True)
self.Songbar.setVisible(False)
self.Mediabar.setVisible(False) self.Mediabar.setVisible(False)
self.Toolbar.makeWidgetsInvisible(self.image_list) self.Toolbar.makeWidgetsInvisible(self.image_list)
if item.is_text(): if item.is_text():
self.Toolbar.makeWidgetsInvisible(self.image_list) self.Toolbar.makeWidgetsInvisible(self.image_list)
if item.is_song() and \ if item.is_song() and \
str_to_bool(self.songsconfig.get_config(u'show songbar', True)): str_to_bool(self.songsconfig.get_config(u'show songbar', True)):
for action in self.Songbar.actions:
pass
#self.Songbar.actions[action].setVisible(False)
hasButtons = False hasButtons = False
for slide in self.slideList: for slide in self.slideList:
if slide is not None: # if slide is not None:
self.Songbar.actions[slide].setVisible(True) # self.SongMenu.actions[slide].setVisible(True)
hasButtons = True hasButtons = True
if hasButtons: if hasButtons:
self.Songbar.setVisible(True) self.Toolbar.makeWidgetsVisible([u'Song Menu'])
elif item.is_image(): elif item.is_image():
#Not sensible to allow loops with 1 frame #Not sensible to allow loops with 1 frame
if len(item.get_frames()) > 1: if len(item.get_frames()) > 1:
@ -450,10 +445,15 @@ class SlideController(QtGui.QWidget):
#It is a based Text Render #It is a based Text Render
if self.serviceItem.is_text(): if self.serviceItem.is_text():
#only load the slot once #only load the slot once
bits = frame[u'verseTag'].split(u':')
if bits[0] == self.trUtf8('Verse'):
tag = u'%s%s' % (bits[0][0], bits[1][0] )
else:
tag = bits[0]
try: try:
test = self.slideList[frame[u'verseTag']] test = self.slideList[tag]
except: except:
self.slideList[frame[u'verseTag']] = framenumber self.slideList[tag] = framenumber
item.setText(frame[u'text']) item.setText(frame[u'text'])
else: else:
label = QtGui.QLabel() label = QtGui.QLabel()
@ -526,6 +526,9 @@ class SlideController(QtGui.QWidget):
else: else:
before = time.time() before = time.time()
frame = self.serviceItem.get_rendered_frame(row) frame = self.serviceItem.get_rendered_frame(row)
if isinstance(frame, QtGui.QImage):
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
else:
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame[u'main'])) self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame[u'main']))
log.log(15, u'Slide Rendering took %4s' % (time.time() - before)) log.log(15, u'Slide Rendering took %4s' % (time.time() - before))
if self.isLive: if self.isLive: