more cleanups print finished

This commit is contained in:
Tim Bentley 2018-04-21 06:47:20 +01:00
parent 50511dc31d
commit 606efa47b9
16 changed files with 30 additions and 38 deletions

View File

@ -619,7 +619,7 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties):
:param context: The context on which this is called
"""
service_item = ServiceItem(self.plugin)
service_item.add_icon(self.plugin.icon_path)
service_item.add_icon()
if self.generate_slide_data(service_item, item, xml_version, remote, context):
return service_item
else:

View File

@ -170,7 +170,7 @@ class ServiceItem(RegistryProperties):
self.processor = None
self.audit = ''
self.items = []
self.iconic_representation = None
self.icon = UiIcons().default
self.raw_footer = []
self.foot_text = ''
self.theme = None
@ -230,25 +230,22 @@ class ServiceItem(RegistryProperties):
"""
return capability in self.capabilities
def add_icon(self, icon):
def add_icon(self):
"""
Add an icon to the service item. This is used when displaying the service item in the service manager.
:param icon: A string to an icon in the resources or on disk.
"""
self.icon = icon
if self.name == 'songs':
self.iconic_representation = UiIcons().music
self.icon = UiIcons().music
elif self.name == 'bibles':
self.iconic_representation = UiIcons().bible
self.icon = UiIcons().bible
elif self.name == 'presentations':
self.iconic_representation = UiIcons().presentation
self.icon = UiIcons().presentation
elif self.name == 'images':
self.iconic_representation = UiIcons().picture
self.icon = UiIcons().picture
elif self.name == 'medias':
self.iconic_representation = UiIcons().video
self.icon = UiIcons().video
else:
self.iconic_representation = UiIcons().clone
self.icon = UiIcons().clone
def render(self, provides_own_theme_data=False):
"""
@ -425,7 +422,7 @@ class ServiceItem(RegistryProperties):
self.name = header['name']
self.service_item_type = header['type']
self.theme = header['theme']
self.add_icon(header['icon'])
self.add_icon()
self.raw_footer = header['footer']
self.audit = header['audit']
self.notes = header['notes']

View File

@ -26,6 +26,7 @@ from PyQt5 import QtCore, QtWidgets, QtPrintSupport
from openlp.core.common.i18n import UiStrings, translate
from openlp.core.lib import build_icon
from openlp.core.ui.icons import UiIcons
from openlp.core.widgets.edits import SpellTextEdit
@ -59,31 +60,31 @@ class Ui_PrintServiceDialog(object):
self.toolbar = QtWidgets.QToolBar(print_service_dialog)
self.toolbar.setIconSize(QtCore.QSize(22, 22))
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.print_button = self.toolbar.addAction(build_icon(':/general/general_print.png'),
self.print_button = self.toolbar.addAction(UiIcons().print,
translate('OpenLP.PrintServiceForm', 'Print'))
self.options_button = QtWidgets.QToolButton(self.toolbar)
self.options_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
self.options_button.setIcon(build_icon(':/system/system_configure.png'))
self.options_button.setIcon(UiIcons().settings)
self.options_button.setCheckable(True)
self.toolbar.addWidget(self.options_button)
self.toolbar.addSeparator()
self.plain_copy = self.toolbar.addAction(build_icon(':/system/system_edit_copy.png'),
self.plain_copy = self.toolbar.addAction(UiIcons().clone,
translate('OpenLP.PrintServiceForm', 'Copy'))
self.html_copy = self.toolbar.addAction(build_icon(':/system/system_edit_copy.png'),
self.html_copy = self.toolbar.addAction(UiIcons().clone,
translate('OpenLP.PrintServiceForm', 'Copy as HTML'))
self.toolbar.addSeparator()
self.zoom_in_button = QtWidgets.QToolButton(self.toolbar)
self.zoom_in_button.setIcon(build_icon(':/general/general_zoom_in.png'))
self.zoom_in_button.setIcon(UiIcons().search_plus)
self.zoom_in_button.setObjectName('zoom_in_button')
self.zoom_in_button.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoom_in_button)
self.zoom_out_button = QtWidgets.QToolButton(self.toolbar)
self.zoom_out_button.setIcon(build_icon(':/general/general_zoom_out.png'))
self.zoom_out_button.setIcon(UiIcons().search_minus)
self.zoom_out_button.setObjectName('zoom_out_button')
self.zoom_out_button.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoom_out_button)
self.zoom_original_button = QtWidgets.QToolButton(self.toolbar)
self.zoom_original_button.setIcon(build_icon(':/general/general_zoom_original.png'))
self.zoom_original_button.setIcon(UiIcons().search)
self.zoom_original_button.setObjectName('zoom_original_button')
self.zoom_original_button.setIconSize(QtCore.QSize(22, 22))
self.toolbar.addWidget(self.zoom_original_button)

View File

@ -209,7 +209,7 @@ class PrintServiceForm(QtWidgets.QDialog, Ui_PrintServiceDialog, RegistryPropert
div = self._add_element('div', class_id='item', parent=body)
# Add the title of the service item.
item_title = self._add_element('h2', parent=div, class_id='itemTitle')
img = image_to_byte(item.iconic_representation.pixmap(20, 20).toImage())
img = image_to_byte(item.icon.pixmap(20, 20).toImage())
self._add_element('img', parent=item_title, attribute=('src', 'data:image/png;base64, ' + img))
self._add_element('span', ' ' + html.escape(item.get_display_title()), item_title)
if self.slide_text_check_box.isChecked():

View File

@ -1168,16 +1168,16 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
tree_widget_item = QtWidgets.QTreeWidgetItem(self.service_manager_list)
if service_item_from_item.is_valid:
if service_item_from_item.notes:
icon = QtGui.QImage(service_item_from_item.icon)
icon = service_item_from_item.icon.pixmap(80, 80).toImage()
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
overlay = QtGui.QImage(UiIcons().notes)
overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
overlay = UiIcons().notes.pixmap(40, 40).toImage()
overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
painter = QtGui.QPainter(icon)
painter.drawImage(0, 0, overlay)
painter.end()
tree_widget_item.setIcon(0, build_icon(icon))
elif service_item_from_item.temporary_edit:
icon = QtGui.QImage(service_item_from_item.icon)
icon = service_item_from_item.icon.pixmap(80, 80).toImage()
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
overlay = QtGui.QImage(UiIcons().upload)
overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
@ -1186,7 +1186,7 @@ class ServiceManager(QtWidgets.QWidget, RegistryBase, Ui_ServiceManager, LogMixi
painter.end()
tree_widget_item.setIcon(0, build_icon(icon))
else:
tree_widget_item.setIcon(0, service_item_from_item.iconic_representation)
tree_widget_item.setIcon(0, service_item_from_item.icon)
else:
tree_widget_item.setIcon(0, UiIcons().delete)
tree_widget_item.setText(0, service_item_from_item.get_display_title())

View File

@ -80,12 +80,12 @@ class Ui_ThemeManager(object):
self.toolbar.addSeparator()
self.toolbar.add_toolbar_action('importTheme',
text=translate('OpenLP.ThemeManager', 'Import Theme'),
icon=build_icon(UiIcons().download),
icon=UiIcons().download,
tooltip=translate('OpenLP.ThemeManager', 'Import a theme.'),
triggers=self.on_import_theme)
self.toolbar.add_toolbar_action('exportTheme',
text=translate('OpenLP.ThemeManager', 'Export Theme'),
icon=build_icon(UiIcons().upload),
icon=UiIcons().upload,
tooltip=translate('OpenLP.ThemeManager', 'Export a theme.'),
triggers=self.on_export_theme)
self.layout.addWidget(self.toolbar)

View File

@ -198,7 +198,7 @@ class OpenLPWizard(QtWidgets.QWizard, RegistryProperties):
self.error_save_to_button = QtWidgets.QPushButton(self.progress_page)
self.error_save_to_button.setObjectName('error_save_to_button')
self.error_save_to_button.setHidden(True)
self.error_save_to_button.setIcon(build_icon(UiIcons().save))
self.error_save_to_button.setIcon(UiIcons().save)
self.error_button_layout.addWidget(self.error_save_to_button)
self.progress_layout.addLayout(self.error_button_layout)
self.addPage(self.progress_page)

View File

@ -65,12 +65,12 @@ class Ui_AlertDialog(object):
self.manage_button_layout = QtWidgets.QVBoxLayout()
self.manage_button_layout.setObjectName('manage_button_layout')
self.new_button = QtWidgets.QPushButton(alert_dialog)
self.new_button.setIcon(build_icon(UiIcons().new))
self.new_button.setIcon(UiIcons().new)
self.new_button.setObjectName('new_button')
self.manage_button_layout.addWidget(self.new_button)
self.save_button = QtWidgets.QPushButton(alert_dialog)
self.save_button.setEnabled(False)
self.save_button.setIcon(build_icon(UiIcons().save))
self.save_button.setIcon(UiIcons().save)
self.save_button.setObjectName('save_button')
self.manage_button_layout.addWidget(self.save_button)
self.delete_button = create_button(alert_dialog, 'delete_button', role='delete', enabled=False,

View File

@ -347,7 +347,7 @@ class MessageListener(object):
# Some of the original serviceitem attributes is needed in the new serviceitem
item.footer = item_cpy.footer
item.from_service = item_cpy.from_service
item.iconic_representation = item_cpy.iconic_representation
item.iconic_representation = item_cpy.icon
item.image_border = item_cpy.image_border
item.main = item_cpy.main
item.theme_data = item_cpy.theme_data

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -25,16 +25,11 @@
<qresource prefix="plugins">
<file>plugin_alerts.png</file>
<file>plugin_songs.png</file>
<file>plugin_remote.png</file>
<file>plugin_songusage.png</file>
</qresource>
<qresource prefix="general">
<file>general_delete.png</file>
<file>general_import.png</file>
<file>general_zoom_out.png</file>
<file>general_zoom_in.png</file>
<file>general_zoom_original.png</file>
<file>general_email.png</file>
<file>general_find.png</file>
<file>general_back.png</file>
</qresource>
@ -74,7 +69,6 @@
<file>system_servicemanager.png</file>
<file>system_thememanager.png</file>
<file>settings_plugin_list.png</file>
<file>system_settings.png</file>
<file>system_edit_copy.png</file>
<file>system_configure_shortcuts.png</file>
</qresource>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB