diff --git a/openlp/core/common/i18n.py b/openlp/core/common/i18n.py index 34af54b8f..29b91e2f4 100644 --- a/openlp/core/common/i18n.py +++ b/openlp/core/common/i18n.py @@ -554,3 +554,29 @@ def get_language(name): if language.name == name_title or language.code == name_lower: return language return None + +import qtawesome as qta + + +class UiIcons(object): + """ + Provide standard strings for objects to use. + """ + __instance__ = None + + def __new__(cls): + """ + Override the default object creation method to return a single instance. + """ + if not cls.__instance__: + cls.__instance__ = object.__new__(cls) + return cls.__instance__ + + def __init__(self): + """ + These strings should need a good reason to be retranslated elsewhere. + Should some/more/less of these have an & attached? + """ + self.database = qta.icon('fa.database') + self.save = qta.icon('fa.save') + #self.images = qta.icon('fa.images') diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index bcc87c19e..4d67702a1 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -136,6 +136,7 @@ def build_icon(icon): pix_map = None button_icon = QtGui.QIcon() if isinstance(icon, str): + print(icon) pix_map = QtGui.QPixmap(icon) elif isinstance(icon, Path): pix_map = QtGui.QPixmap(str(icon)) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index f5fc6d445..72f1e1e99 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -207,21 +207,21 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties): if self.has_edit_icon: create_widget_action(self.list_view, text=self.plugin.get_string(StringContent.Edit)['title'], - icon=':/general/general_edit.png', + icon1=':/general/general_edit.png', triggers=self.on_edit_click) create_widget_action(self.list_view, separator=True) create_widget_action(self.list_view, 'listView{plugin}{preview}Item'.format(plugin=self.plugin.name.title(), preview=StringContent.Preview.title()), text=self.plugin.get_string(StringContent.Preview)['title'], - icon=':/general/general_preview.png', + icon1=':/general/general_preview.png', can_shortcuts=True, triggers=self.on_preview_click) create_widget_action(self.list_view, 'listView{plugin}{live}Item'.format(plugin=self.plugin.name.title(), live=StringContent.Live.title()), text=self.plugin.get_string(StringContent.Live)['title'], - icon=':/general/general_live.png', + icon1=':/general/general_live.png', can_shortcuts=True, triggers=self.on_live_click) create_widget_action(self.list_view, diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index bb46868a2..2875a9446 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -75,7 +75,7 @@ class Ui_ExceptionDialog(object): icon=':/general/general_email.png', click=self.on_send_report_button_clicked) self.save_report_button = create_button(exception_dialog, 'save_report_button', - icon=':/general/general_save.png', + icon=UiIcon().save, click=self.on_save_report_button_clicked) self.attach_tile_button = create_button(exception_dialog, 'attach_tile_button', icon=':/general/general_open.png', diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 0c16d24b2..6c7ccbf1c 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -22,7 +22,6 @@ """ This is the main window, where all the action happens. """ -import logging import sys from datetime import datetime from distutils import dir_util @@ -36,7 +35,7 @@ from openlp.core.api.http import server from openlp.core.common import is_win, is_macosx, add_actions from openlp.core.common.actions import ActionList, CategoryOrder from openlp.core.common.applocation import AppLocation -from openlp.core.common.i18n import LanguageManager, UiStrings, translate +from openlp.core.common.i18n import LanguageManager, UiStrings, UiIcons, translate from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.path import Path, copyfile, create_paths from openlp.core.common.registry import Registry @@ -172,7 +171,7 @@ class Ui_MainWindow(object): self.file_open_item = create_action(main_window, 'fileOpenItem', icon=':/general/general_open.png', can_shortcuts=True, category=UiStrings().File, triggers=self.service_manager_contents.on_load_service_clicked) - self.file_save_item = create_action(main_window, 'fileSaveItem', icon=':/general/general_save.png', + self.file_save_item = create_action(main_window, 'fileSaveItem', icon=UiIcons().save, can_shortcuts=True, category=UiStrings().File, triggers=self.service_manager_contents.decide_save_method) self.file_save_as_item = create_action(main_window, 'fileSaveAsItem', can_shortcuts=True, diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 2e5d29e4d..efb95338a 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -36,7 +36,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import ThemeLevel, delete_file from openlp.core.common.actions import ActionList, CategoryOrder from openlp.core.common.applocation import AppLocation -from openlp.core.common.i18n import UiStrings, format_time, translate +from openlp.core.common.i18n import UiStrings, UiIcons, format_time, translate from openlp.core.common.json import OpenLPJsonDecoder, OpenLPJsonEncoder from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.path import Path, str_to_path @@ -144,7 +144,7 @@ class Ui_ServiceManager(object): tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'), triggers=self.on_load_service_clicked) self.toolbar.add_toolbar_action('saveService', text=UiStrings().SaveService, - icon=':/general/general_save.png', + icon=UiIcons().save, tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), triggers=self.decide_save_method) self.toolbar.addSeparator() diff --git a/openlp/core/widgets/wizard.py b/openlp/core/widgets/wizard.py index 32db6c1ff..0ca072240 100644 --- a/openlp/core/widgets/wizard.py +++ b/openlp/core/widgets/wizard.py @@ -197,7 +197,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(':/general/general_save.png')) + self.error_save_to_button.setIcon(build_icon(UiIcon().save)) self.error_button_layout.addWidget(self.error_save_to_button) self.progress_layout.addLayout(self.error_button_layout) self.addPage(self.progress_page) diff --git a/openlp/plugins/alerts/forms/alertdialog.py b/openlp/plugins/alerts/forms/alertdialog.py index 5c2ddb920..258002164 100644 --- a/openlp/plugins/alerts/forms/alertdialog.py +++ b/openlp/plugins/alerts/forms/alertdialog.py @@ -22,7 +22,7 @@ from PyQt5 import QtWidgets -from openlp.core.common.i18n import translate +from openlp.core.common.i18n import UiIcons, translate from openlp.core.lib import build_icon from openlp.core.lib.ui import create_button, create_button_box @@ -69,7 +69,7 @@ class Ui_AlertDialog(object): 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(':/general/general_save.png')) + self.save_button.setIcon(build_icon(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, diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index b3888fceb..db7980d75 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -26,7 +26,7 @@ from PyQt5 import QtCore, QtWidgets from sqlalchemy.sql import and_, or_ from openlp.core.common.applocation import AppLocation -from openlp.core.common.i18n import UiStrings, translate, get_natural_key +from openlp.core.common.i18n import UiStrings, UiIcons, translate, get_natural_key from openlp.core.common.path import copyfile, create_paths from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings @@ -99,7 +99,7 @@ class SongMediaItem(MediaManagerItem): self.toolbar.addSeparator() # Song Maintenance Button self.maintenance_action = self.toolbar.add_toolbar_action('maintenance_action', - icon=':/songs/song_maintenance.png', + icon=UiIcons().database, triggers=self.on_song_maintenance_click) self.add_search_to_toolbar() # Signals and slots