forked from openlp/openlp
Cleanups
bzr-revno: 860
This commit is contained in:
commit
685fe0311a
@ -97,11 +97,10 @@ def build_icon(icon):
|
|||||||
The icon to build. This can be a QIcon, a resource string in the form
|
The icon to build. This can be a QIcon, a resource string in the form
|
||||||
``:/resource/file.png``, or a file location like ``/path/to/file.png``.
|
``:/resource/file.png``, or a file location like ``/path/to/file.png``.
|
||||||
"""
|
"""
|
||||||
button_icon = None
|
button_icon = QtGui.QIcon()
|
||||||
if isinstance(icon, QtGui.QIcon):
|
if isinstance(icon, QtGui.QIcon):
|
||||||
button_icon = icon
|
button_icon = icon
|
||||||
elif isinstance(icon, basestring):
|
elif isinstance(icon, basestring):
|
||||||
button_icon = QtGui.QIcon()
|
|
||||||
if icon.startswith(u':/'):
|
if icon.startswith(u':/'):
|
||||||
button_icon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
|
button_icon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal,
|
||||||
QtGui.QIcon.Off)
|
QtGui.QIcon.Off)
|
||||||
@ -109,7 +108,6 @@ def build_icon(icon):
|
|||||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
button_icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)),
|
||||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
elif isinstance(icon, QtGui.QImage):
|
elif isinstance(icon, QtGui.QImage):
|
||||||
button_icon = QtGui.QIcon()
|
|
||||||
button_icon.addPixmap(QtGui.QPixmap.fromImage(icon),
|
button_icon.addPixmap(QtGui.QPixmap.fromImage(icon),
|
||||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
return button_icon
|
return button_icon
|
||||||
|
@ -72,9 +72,6 @@ class OpenLPToolbar(QtGui.QToolBar):
|
|||||||
ToolbarButton = None
|
ToolbarButton = None
|
||||||
if icon:
|
if icon:
|
||||||
ButtonIcon = build_icon(icon)
|
ButtonIcon = build_icon(icon)
|
||||||
else:
|
|
||||||
ButtonIcon = None
|
|
||||||
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:
|
||||||
|
@ -29,7 +29,7 @@ import os
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
|
||||||
ItemCapabilities, SettingsManager, context_menu_action, Receiver, translate
|
ItemCapabilities, SettingsManager, translate
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user