Toolbar fixups

This commit is contained in:
Tim Bentley 2009-12-06 08:39:56 +00:00
parent a745d15a98
commit 40523ed0f6
2 changed files with 21 additions and 11 deletions

View File

@ -68,21 +68,30 @@ class OpenLPToolbar(QtGui.QToolBar):
``objectname``
The name of the object, as used in `<button>.setObjectName()`.
"""
ButtonIcon = build_icon(icon)
ToolbarButton = None
if icon:
ButtonIcon = build_icon(icon)
else:
ButtonIcon = None
if ButtonIcon:
if slot and not checkable:
ToolbarButton = self.addAction(ButtonIcon, title, slot)
else:
ToolbarButton = self.addAction(ButtonIcon, title)
if tooltip:
ToolbarButton.setToolTip(tooltip)
if checkable:
ToolbarButton.setCheckable(True)
QtCore.QObject.connect(ToolbarButton,
QtCore.SIGNAL(u'toggled(bool)'), slot)
self.icons[title] = ButtonIcon
self.actions[title] = ToolbarButton
return ToolbarButton
else:
ToolbarButton = QtGui.QAction(title, ToolbarButton)
self.addAction(ToolbarButton)
QtCore.QObject.connect(ToolbarButton,
QtCore.SIGNAL(u'triggered()'), slot)
if tooltip:
ToolbarButton.setToolTip(tooltip)
if checkable:
ToolbarButton.setCheckable(True)
QtCore.QObject.connect(ToolbarButton,
QtCore.SIGNAL(u'toggled(bool)'), slot)
self.actions[title] = ToolbarButton
return ToolbarButton
def addToolbarSeparator(self, handle):
"""

View File

@ -209,7 +209,7 @@ class SlideController(QtGui.QWidget):
# Build the Song Toolbar
if isLive:
self.Songbar = OpenLPToolbar(self)
self.Songbar.addToolbarButton(u'Intro:1', u'I',
self.Songbar.addToolbarButton( u'I', u':/pages/slide.png',
self.trUtf8('Intro'),self.onSongBarHandler)
self.Songbar.addToolbarButton(u'Bridge:1', u'B',
self.trUtf8('Bridge'),self.onSongBarHandler)
@ -353,7 +353,8 @@ class SlideController(QtGui.QWidget):
if item.is_song() and \
str_to_bool(self.songsconfig.get_config(u'show songbar', True)):
for action in self.Songbar.actions:
self.Songbar.actions[action].setVisible(False)
pass
#self.Songbar.actions[action].setVisible(False)
hasButtons = False
for slide in self.slideList:
if slide is not None: