forked from openlp/openlp
Fix toolbar code to hide / add items
This commit is contained in:
commit
0c9fcd0571
@ -71,14 +71,29 @@ class OpenLPToolbar(QtGui.QToolBar):
|
|||||||
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
ButtonIcon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
||||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
if ButtonIcon is not None:
|
if ButtonIcon is not None:
|
||||||
|
if slot is not None:
|
||||||
|
ToolbarButton = self.addAction(ButtonIcon, title, slot)
|
||||||
|
else:
|
||||||
ToolbarButton = self.addAction(ButtonIcon, title)
|
ToolbarButton = self.addAction(ButtonIcon, title)
|
||||||
if tooltip is not None:
|
if tooltip is not None:
|
||||||
ToolbarButton.setToolTip(tooltip)
|
ToolbarButton.setToolTip(tooltip)
|
||||||
if slot is not None:
|
|
||||||
QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL(u'triggered()'), slot)
|
|
||||||
self.icons[title] = ButtonIcon
|
self.icons[title] = ButtonIcon
|
||||||
self.actions[title] = ToolbarButton
|
self.actions[title] = ToolbarButton
|
||||||
|
|
||||||
|
def addToolbarSeparator(self, handle):
|
||||||
|
"""
|
||||||
|
Add a Separator bar to the toolbar and store it's Handle
|
||||||
|
"""
|
||||||
|
action = self.addSeparator()
|
||||||
|
self.actions[handle] = action
|
||||||
|
|
||||||
|
def addToolbarWidget(self, handle, widget):
|
||||||
|
"""
|
||||||
|
Add a Widget to the toolbar and store it's Handle
|
||||||
|
"""
|
||||||
|
action = self.addWidget(widget)
|
||||||
|
self.actions[handle] = action
|
||||||
|
|
||||||
def getIconFromTitle(self, title):
|
def getIconFromTitle(self, title):
|
||||||
"""
|
"""
|
||||||
Search through the list of icons for an icon with a particular title,
|
Search through the list of icons for an icon with a particular title,
|
||||||
@ -92,3 +107,11 @@ class OpenLPToolbar(QtGui.QToolBar):
|
|||||||
else:
|
else:
|
||||||
self.log.error(u'getIconFromTitle - no icon for %s' % title)
|
self.log.error(u'getIconFromTitle - no icon for %s' % title)
|
||||||
return QtGui.QIcon()
|
return QtGui.QIcon()
|
||||||
|
|
||||||
|
def makeWidgetsInvisible(self, widgets):
|
||||||
|
for widget in widgets:
|
||||||
|
self.actions[widget].setVisible(False)
|
||||||
|
|
||||||
|
def makeWidgetsVisible(self, widgets):
|
||||||
|
for widget in widgets:
|
||||||
|
self.actions[widget].setVisible(True)
|
||||||
|
@ -66,6 +66,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
QtGui.QWidget.__init__(self, parent)
|
QtGui.QWidget.__init__(self, parent)
|
||||||
self.isLive = isLive
|
self.isLive = isLive
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
|
self.image_list = [u'Start Loop', u'Stop Loop', u'Loop Spearator', u'Image SpinBox']
|
||||||
self.Panel = QtGui.QWidget(parent.ControlSplitter)
|
self.Panel = QtGui.QWidget(parent.ControlSplitter)
|
||||||
self.Splitter = QtGui.QSplitter(self.Panel)
|
self.Splitter = QtGui.QSplitter(self.Panel)
|
||||||
self.Splitter.setOrientation(QtCore.Qt.Vertical)
|
self.Splitter.setOrientation(QtCore.Qt.Vertical)
|
||||||
@ -120,13 +121,13 @@ class SlideController(QtGui.QWidget):
|
|||||||
translate(u'SlideController', u'Move to last'),
|
translate(u'SlideController', u'Move to last'),
|
||||||
self.onSlideSelectedLast)
|
self.onSlideSelectedLast)
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.Toolbar.addSeparator()
|
self.Toolbar.addToolbarSeparator(u'Close Separator')
|
||||||
self.Toolbar.addToolbarButton(u'Close Screen',
|
self.Toolbar.addToolbarButton(u'Close Screen',
|
||||||
u':/slides/slide_close.png',
|
u':/slides/slide_close.png',
|
||||||
translate(u'SlideController', u'Close Screen'),
|
translate(u'SlideController', u'Close Screen'),
|
||||||
self.onBlankScreen)
|
self.onBlankScreen)
|
||||||
if isLive:
|
if isLive:
|
||||||
self.Toolbar.addSeparator()
|
self.Toolbar.addToolbarSeparator(u'Loop Spearator')
|
||||||
self.Toolbar.addToolbarButton(u'Start Loop',
|
self.Toolbar.addToolbarButton(u'Start Loop',
|
||||||
u':/media/media_time.png',
|
u':/media/media_time.png',
|
||||||
translate(u'SlideController', u'Start continuous loop'),
|
translate(u'SlideController', u'Start continuous loop'),
|
||||||
@ -135,11 +136,11 @@ class SlideController(QtGui.QWidget):
|
|||||||
u':/media/media_stop.png',
|
u':/media/media_stop.png',
|
||||||
translate(u'SlideController', u'Stop continuous loop'),
|
translate(u'SlideController', u'Stop continuous loop'),
|
||||||
self.onStopLoop)
|
self.onStopLoop)
|
||||||
self.Toolbar.addSeparator()
|
self.DelaySpinBox = QtGui.QSpinBox()
|
||||||
self.DelaySpinBox = QtGui.QSpinBox(self.Toolbar)
|
# self.SpinWidget = QtGui.QWidgetAction(self.Toolbar)
|
||||||
self.SpinWidget = QtGui.QWidgetAction(self.Toolbar)
|
# self.SpinWidget.setDefaultWidget(self.DelaySpinBox)
|
||||||
self.SpinWidget.setDefaultWidget(self.DelaySpinBox)
|
# self.Toolbar.addAction(self.SpinWidget)
|
||||||
self.Toolbar.addAction(self.SpinWidget)
|
self.Toolbar.addToolbarWidget(u'Image SpinBox', self.DelaySpinBox)
|
||||||
#self.DelaySpinBox.setValue(self.parent.parent.ImageTab.loop_delay)
|
#self.DelaySpinBox.setValue(self.parent.parent.ImageTab.loop_delay)
|
||||||
self.DelaySpinBox.setSuffix(translate(u'SlideController', u's'))
|
self.DelaySpinBox.setSuffix(translate(u'SlideController', u's'))
|
||||||
|
|
||||||
@ -195,8 +196,9 @@ class SlideController(QtGui.QWidget):
|
|||||||
Allows the live toolbar to be customised
|
Allows the live toolbar to be customised
|
||||||
"""
|
"""
|
||||||
if item.service_item_type == ServiceType.Text:
|
if item.service_item_type == ServiceType.Text:
|
||||||
a = c
|
self.Toolbar.makeWidgetsInvisible(self.image_list)
|
||||||
pass
|
elif item.service_item_type == ServiceType.Image:
|
||||||
|
self.Toolbar.makeWidgetsVisible(self.image_list)
|
||||||
|
|
||||||
def enablePreviewToolBar(self, item):
|
def enablePreviewToolBar(self, item):
|
||||||
"""
|
"""
|
||||||
|
13
setup.py
13
setup.py
@ -1,4 +1,13 @@
|
|||||||
from setuptools import setup
APP = ['openlp.pyw']
OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4']}
setup(
|
from setuptools import setup
|
||||||
|
|
||||||
|
APP = ['openlp.pyw']
|
||||||
|
OPTIONS = {'argv_emulation': True, 'includes': ['sip', 'PyQt4']}
|
||||||
|
|
||||||
|
setup(
|
||||||
name='openlp.org',
|
name='openlp.org',
|
||||||
version='1.9.0',
|
version='1.9.0',
|
||||||
url='http://www.openlp.org/',
app=APP,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
|
url='http://www.openlp.org/',
|
||||||
|
app=APP,
|
||||||
|
options={'py2app': OPTIONS},
|
||||||
|
setup_requires=['py2app'],
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user