forked from openlp/openlp
Song Verses Toolbar: Phase 1
- Convert verse icons to drop-down verse menu.
This commit is contained in:
parent
9f5d1956ac
commit
583d96b5d1
@ -68,19 +68,28 @@ class OpenLPToolbar(QtGui.QToolBar):
|
|||||||
``objectname``
|
``objectname``
|
||||||
The name of the object, as used in `<button>.setObjectName()`.
|
The name of the object, as used in `<button>.setObjectName()`.
|
||||||
"""
|
"""
|
||||||
|
ToolbarButton = None
|
||||||
|
if icon:
|
||||||
ButtonIcon = build_icon(icon)
|
ButtonIcon = build_icon(icon)
|
||||||
|
else:
|
||||||
|
ButtonIcon = None
|
||||||
if ButtonIcon:
|
if ButtonIcon:
|
||||||
if slot and not checkable:
|
if slot and not checkable:
|
||||||
ToolbarButton = self.addAction(ButtonIcon, title, slot)
|
ToolbarButton = self.addAction(ButtonIcon, title, slot)
|
||||||
else:
|
else:
|
||||||
ToolbarButton = self.addAction(ButtonIcon, title)
|
ToolbarButton = self.addAction(ButtonIcon, title)
|
||||||
|
self.icons[title] = ButtonIcon
|
||||||
|
else:
|
||||||
|
ToolbarButton = QtGui.QAction(title, ToolbarButton)
|
||||||
|
self.addAction(ToolbarButton)
|
||||||
|
QtCore.QObject.connect(ToolbarButton,
|
||||||
|
QtCore.SIGNAL(u'triggered()'), slot)
|
||||||
if tooltip:
|
if tooltip:
|
||||||
ToolbarButton.setToolTip(tooltip)
|
ToolbarButton.setToolTip(tooltip)
|
||||||
if checkable:
|
if checkable:
|
||||||
ToolbarButton.setCheckable(True)
|
ToolbarButton.setCheckable(True)
|
||||||
QtCore.QObject.connect(ToolbarButton,
|
QtCore.QObject.connect(ToolbarButton,
|
||||||
QtCore.SIGNAL(u'toggled(bool)'), slot)
|
QtCore.SIGNAL(u'toggled(bool)'), slot)
|
||||||
self.icons[title] = ButtonIcon
|
|
||||||
self.actions[title] = ToolbarButton
|
self.actions[title] = ToolbarButton
|
||||||
return ToolbarButton
|
return ToolbarButton
|
||||||
|
|
||||||
|
@ -208,22 +208,16 @@ 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(
|
self.SongMenu.setText(self.trUtf8('Go to Verse'))
|
||||||
u'Bridge', u':/pages/page_bridge.png',
|
self.SongMenu.setPopupMode(QtGui.QToolButton.InstantPopup)
|
||||||
self.trUtf8('Bridge'),
|
self.Toolbar.addWidget(self.SongMenu)
|
||||||
self.onSongBarHandler)
|
self.SongMenu.setMenu(QtGui.QMenu(self.trUtf8('Go to Verse'), self.Toolbar))
|
||||||
self.Songbar.addToolbarButton(
|
self.SongMenu.menu().addAction(self.trUtf8('V1'), self.onSongBarHandler)
|
||||||
u'Chorus', u':/pages/page_chorus.png',
|
self.SongMenu.menu().addAction(self.trUtf8('V2'), self.onSongBarHandler)
|
||||||
self.trUtf8('Chorus'),
|
self.SongMenu.menu().addAction(self.trUtf8('V3'), self.onSongBarHandler)
|
||||||
self.onSongBarHandler)
|
self.SongMenu.setVisible(False)
|
||||||
for verse in range(1, 12):
|
self.SongMenu.menu().setVisible(False)
|
||||||
self.Songbar.addToolbarButton(
|
|
||||||
unicode(verse), u':/pages/page_%s.png' % verse,
|
|
||||||
unicode(self.trUtf8('Verse %s'))%verse,
|
|
||||||
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))
|
||||||
@ -319,7 +313,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
#Remember list is 1 out!
|
#Remember list is 1 out!
|
||||||
slideno = int(request) - 1
|
slideno = int(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:
|
||||||
@ -344,17 +338,18 @@ 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.Songbar.setVisible(False)
|
||||||
|
self.SongMenu.setVisible(True)
|
||||||
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:
|
#for action in self.Songbar.actions:
|
||||||
self.Songbar.actions[action].setVisible(False)
|
# self.Songbar.actions[action].setVisible(False)
|
||||||
if item.verse_order:
|
#if item.verse_order:
|
||||||
verses = item.verse_order.split(u' ')
|
# verses = item.verse_order.split(u' ')
|
||||||
# for verse in verses:
|
# for verse in verses:
|
||||||
# if not verse or int(verse) > 12:
|
# if not verse or int(verse) > 12:
|
||||||
# break
|
# break
|
||||||
@ -363,7 +358,8 @@ class SlideController(QtGui.QWidget):
|
|||||||
# except:
|
# except:
|
||||||
# #More than 20 verses hard luck
|
# #More than 20 verses hard luck
|
||||||
# pass
|
# pass
|
||||||
self.Songbar.setVisible(True)
|
# self.Songbar.setVisible(True)
|
||||||
|
self.SongMenu.setVisible(True)
|
||||||
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:
|
||||||
@ -524,6 +520,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:
|
||||||
|
Loading…
Reference in New Issue
Block a user