remove more and fix code

This commit is contained in:
Tim Bentley 2018-06-10 20:29:00 +01:00
parent d8e6dfaf19
commit b6dc37fb0b
12 changed files with 26 additions and 28 deletions

View File

@ -108,21 +108,21 @@ class UiProjectorManager(object):
self.one_toolbar.add_toolbar_action('connect_projector_multiple', self.one_toolbar.add_toolbar_action('connect_projector_multiple',
text=translate('OpenLP.ProjectorManager', text=translate('OpenLP.ProjectorManager',
'Connect to selected projectors'), 'Connect to selected projectors'),
icon=':/projector/projector_connect_tiled.png', icon=UiIcons().projector_connect,
tooltip=translate('OpenLP.ProjectorManager', tooltip=translate('OpenLP.ProjectorManager',
'Connect to selected projectors.'), 'Connect to selected projectors.'),
triggers=self.on_connect_projector) triggers=self.on_connect_projector)
self.one_toolbar.add_toolbar_action('disconnect_projector', self.one_toolbar.add_toolbar_action('disconnect_projector',
text=translate('OpenLP.ProjectorManager', text=translate('OpenLP.ProjectorManager',
'Disconnect from selected projectors'), 'Disconnect from selected projectors'),
icon=UiIcons().disconnect, icon=UiIcons().projector_disconnect,
tooltip=translate('OpenLP.ProjectorManager', tooltip=translate('OpenLP.ProjectorManager',
'Disconnect from selected projector.'), 'Disconnect from selected projector.'),
triggers=self.on_disconnect_projector) triggers=self.on_disconnect_projector)
self.one_toolbar.add_toolbar_action('disconnect_projector_multiple', self.one_toolbar.add_toolbar_action('disconnect_projector_multiple',
text=translate('OpenLP.ProjectorManager', text=translate('OpenLP.ProjectorManager',
'Disconnect from selected projector'), 'Disconnect from selected projector'),
icon=':/projector/projector_disconnect_tiled.png', icon=UiIcons().projector_disconnect,
tooltip=translate('OpenLP.ProjectorManager', tooltip=translate('OpenLP.ProjectorManager',
'Disconnect from selected projectors.'), 'Disconnect from selected projectors.'),
triggers=self.on_disconnect_projector) triggers=self.on_disconnect_projector)
@ -137,7 +137,7 @@ class UiProjectorManager(object):
self.one_toolbar.add_toolbar_action('poweron_projector_multiple', self.one_toolbar.add_toolbar_action('poweron_projector_multiple',
text=translate('OpenLP.ProjectorManager', text=translate('OpenLP.ProjectorManager',
'Power on selected projector'), 'Power on selected projector'),
icon=':/projector/projector_power_on_tiled.png', icon=UiIcons().projector_on,
tooltip=translate('OpenLP.ProjectorManager', tooltip=translate('OpenLP.ProjectorManager',
'Power on selected projectors.'), 'Power on selected projectors.'),
triggers=self.on_poweron_projector) triggers=self.on_poweron_projector)
@ -149,7 +149,7 @@ class UiProjectorManager(object):
triggers=self.on_poweroff_projector) triggers=self.on_poweroff_projector)
self.one_toolbar.add_toolbar_action('poweroff_projector_multiple', self.one_toolbar.add_toolbar_action('poweroff_projector_multiple',
text=translate('OpenLP.ProjectorManager', 'Standby selected projector'), text=translate('OpenLP.ProjectorManager', 'Standby selected projector'),
icon=':/projector/projector_power_off_tiled.png', icon=UiIcons().projector_off,
tooltip=translate('OpenLP.ProjectorManager', tooltip=translate('OpenLP.ProjectorManager',
'Put selected projectors in standby.'), 'Put selected projectors in standby.'),
triggers=self.on_poweroff_projector) triggers=self.on_poweroff_projector)
@ -164,21 +164,21 @@ class UiProjectorManager(object):
self.one_toolbar.add_toolbar_action('blank_projector_multiple', self.one_toolbar.add_toolbar_action('blank_projector_multiple',
text=translate('OpenLP.ProjectorManager', text=translate('OpenLP.ProjectorManager',
'Blank selected projectors screen'), 'Blank selected projectors screen'),
icon=':/projector/projector_blank_tiled.png', icon=UiIcons().blank,
tooltip=translate('OpenLP.ProjectorManager', tooltip=translate('OpenLP.ProjectorManager',
'Blank selected projectors screen.'), 'Blank selected projectors screen.'),
triggers=self.on_blank_projector) triggers=self.on_blank_projector)
self.one_toolbar.add_toolbar_action('show_projector', self.one_toolbar.add_toolbar_action('show_projector',
text=translate('OpenLP.ProjectorManager', text=translate('OpenLP.ProjectorManager',
'Show selected projector screen'), 'Show selected projector screen'),
icon=':/projector/projector_show.png', icon=UiIcons().desktop,
tooltip=translate('OpenLP.ProjectorManager', tooltip=translate('OpenLP.ProjectorManager',
'Show selected projector screen.'), 'Show selected projector screen.'),
triggers=self.on_show_projector) triggers=self.on_show_projector)
self.one_toolbar.add_toolbar_action('show_projector_multiple', self.one_toolbar.add_toolbar_action('show_projector_multiple',
text=translate('OpenLP.ProjectorManager', text=translate('OpenLP.ProjectorManager',
'Show selected projector screen'), 'Show selected projector screen'),
icon=':/projector/projector_show_tiled.png', icon=UiIcons().desktop,
tooltip=translate('OpenLP.ProjectorManager', tooltip=translate('OpenLP.ProjectorManager',
'Show selected projectors screen.'), 'Show selected projectors screen.'),
triggers=self.on_show_projector) triggers=self.on_show_projector)
@ -277,7 +277,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
self.projector_list = [] self.projector_list = []
self.source_select_form = None self.source_select_form = None
# Dict for matching projector status to display icon # Dict for matching projector status to display icon
self.self.status_icons = { self.status_icons = {
S_NOT_CONNECTED: UiIcons().projector_disconnect, S_NOT_CONNECTED: UiIcons().projector_disconnect,
S_CONNECTING: UiIcons().projector_connect, S_CONNECTING: UiIcons().projector_connect,
S_CONNECTED: UiIcons().projector_off, S_CONNECTED: UiIcons().projector_off,
@ -713,7 +713,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
""" """
item = ProjectorItem(link=self._add_projector(projector)) item = ProjectorItem(link=self._add_projector(projector))
item.db_item = projector item.db_item = projector
item.icon = QtGui.QIcon(QtGui.QPixmap(self.status_icons[S_NOT_CONNECTED])) item.icon = QtGui.QIcon(self.status_icons[S_NOT_CONNECTED])
widget = QtWidgets.QListWidgetItem(item.icon, widget = QtWidgets.QListWidgetItem(item.icon,
item.link.name, item.link.name,
self.projector_list_widget self.projector_list_widget
@ -800,7 +800,7 @@ class ProjectorManager(QtWidgets.QWidget, RegistryBase, UiProjectorManager, LogM
return return
item.status = status item.status = status
item.icon = QtGui.QIcon(QtGui.QPixmap(self.status_icons[status])) item.icon = self.status_icons[status]
log.debug('({name}) Updating icon with {code}'.format(name=item.link.name, code=STATUS_CODE[status])) log.debug('({name}) Updating icon with {code}'.format(name=item.link.name, code=STATUS_CODE[status]))
item.widget.setIcon(item.icon) item.widget.setIcon(item.icon)
return self.update_icons() return self.update_icons()

View File

@ -46,7 +46,7 @@ class ProjectorTab(SettingsTab):
:param parent: Parent widget :param parent: Parent widget
""" """
self.icon_path = UiIcons().projectore self.icon_path = UiIcons().projector
projector_translated = translate('OpenLP.ProjectorTab', 'Projector') projector_translated = translate('OpenLP.ProjectorTab', 'Projector')
super(ProjectorTab, self).__init__(parent, 'Projector', projector_translated) super(ProjectorTab, self).__init__(parent, 'Projector', projector_translated)

View File

@ -48,7 +48,7 @@ class Ui_ExceptionDialog(object):
self.message_layout.setContentsMargins(0, 0, 50, 0) self.message_layout.setContentsMargins(0, 0, 50, 0)
self.message_layout.addSpacing(12) self.message_layout.addSpacing(12)
self.bug_label = QtWidgets.QLabel(exception_dialog) self.bug_label = QtWidgets.QLabel(exception_dialog)
self.bug_label.setPixmap(QtGui.QPixmap(UiIcons().exception)) self.bug_label.setPixmap(UiIcons().exception.pixmap(40, 40))
self.bug_label.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) self.bug_label.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
self.bug_label.setObjectName('bug_label') self.bug_label.setObjectName('bug_label')
self.message_layout.addWidget(self.bug_label) self.message_layout.addWidget(self.bug_label)

View File

@ -112,12 +112,12 @@ class UiIcons(object):
'projector': {'icon': 'fa.video'}, 'projector': {'icon': 'fa.video'},
'projector_blank': {'icon': 'fa.desktop'}, 'projector_blank': {'icon': 'fa.desktop'},
'projector_connect': {'icon': 'fa.plug'}, 'projector_connect': {'icon': 'fa.plug'},
'projector_cooldown': {'icon': 'fa.video', 'attr': 'blue'}, 'projector_cooldown': {'icon': 'fa.video-camera', 'attr': 'blue'},
'projector_disconnect': {'icon': 'fa.plug', 'attr': 'lightGray'}, 'projector_disconnect': {'icon': 'fa.plug', 'attr': 'lightGray'},
'projector_error': {'icon': 'fa.video', 'attr': 'red'}, 'projector_error': {'icon': 'fa.video-camera', 'attr': 'red'},
'projector_off': {'icon': 'fa.video', 'attr': 'black'}, 'projector_off': {'icon': 'fa.video-camera', 'attr': 'black'},
'projector_on': {'icon': 'fa.video', 'attr': 'green'}, 'projector_on': {'icon': 'fa.video-camera', 'attr': 'green'},
'projector_warmup': {'icon': 'fa.video', 'attr': 'yellow'}, 'projector_warmup': {'icon': 'fa.video-camera', 'attr': 'yellow'},
'picture': {'icon': 'fa.picture-o'}, 'picture': {'icon': 'fa.picture-o'},
'print': {'icon': 'fa.print'}, 'print': {'icon': 'fa.print'},
'remote': {'icon': 'fa.rss'}, 'remote': {'icon': 'fa.rss'},
@ -149,13 +149,18 @@ class UiIcons(object):
'video': {'icon': 'fa.file-video-o'} 'video': {'icon': 'fa.file-video-o'}
} }
self.load_icons(self, icon_list)
def load_icons(self, icon_list):
"""
Load the list of icons to be processed
"""
for key in icon_list: for key in icon_list:
try: try:
icon = icon_list[key]['icon'] icon = icon_list[key]['icon']
try: try:
attr = icon_list[key]['attr'] attr = icon_list[key]['attr']
setattr(self, key, qta.icon(icon, color=attr)) setattr(self, key, qta.icon(icon, color=attr))
a = 1
except KeyError: except KeyError:
setattr(self, key, qta.icon(icon)) setattr(self, key, qta.icon(icon))
except Exception: except Exception:
@ -170,7 +175,7 @@ class UiIcons(object):
@staticmethod @staticmethod
def _print_icons(): def _print_icons():
""" """
Have ability to dump icons to see what is available. Can only run within an application Have ability to dump icons to see what is actually available. Can only run within an application
:return: :return:
""" """
ico = qta._resource['iconic'] ico = qta._resource['iconic']

View File

@ -55,19 +55,13 @@
<file>theme_new.png</file> <file>theme_new.png</file>
</qresource> </qresource>
<qresource prefix="projector"> <qresource prefix="projector">
<file>projector_blank_tiled.png</file>
<file>projector_connect.png</file> <file>projector_connect.png</file>
<file>projector_connect_tiled.png</file>
<file>projector_hdmi.png</file> <file>projector_hdmi.png</file>
<file>projector_disconnect.png</file> <file>projector_disconnect.png</file>
<file>projector_disconnect_tiled.png</file>
<file>projector_not_connected_error.png</file> <file>projector_not_connected_error.png</file>
<file>projector_power_off.png</file> <file>projector_power_off.png</file>
<file>projector_power_off_tiled.png</file>
<file>projector_power_on.png</file> <file>projector_power_on.png</file>
<file>projector_power_on_tiled.png</file>
<file>projector_show.png</file> <file>projector_show.png</file>
<file>projector_show_tiled.png</file>
</qresource> </qresource>
<qresource prefix="remotes"> <qresource prefix="remotes">
<file>app_qr.svg</file> <file>app_qr.svg</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 652 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 894 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 935 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 893 B

View File

@ -137,8 +137,7 @@ class TestMediaItem(TestCase, TestMixin):
Registry().register('main_window', self.mocked_main_window) Registry().register('main_window', self.mocked_main_window)
self.mocked_plugin = MagicMock() self.mocked_plugin = MagicMock()
with patch('openlp.plugins.bibles.lib.mediaitem.build_icon'), \ with patch('openlp.plugins.bibles.lib.mediaitem.MediaManagerItem._setup'), \
patch('openlp.plugins.bibles.lib.mediaitem.MediaManagerItem._setup'), \
patch('openlp.plugins.bibles.lib.mediaitem.BibleMediaItem.setup_item'): patch('openlp.plugins.bibles.lib.mediaitem.BibleMediaItem.setup_item'):
self.media_item = BibleMediaItem(None, self.mocked_plugin) self.media_item = BibleMediaItem(None, self.mocked_plugin)