From 4760343899049ae1bc59c7ed25b6f854533c7110 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Tue, 10 Apr 2018 20:26:56 +0100 Subject: [PATCH] fix up location of icons --- openlp/core/common/i18n.py | 55 ------------ openlp/core/lib/mediamanageritem.py | 3 +- openlp/core/lib/serviceitem.py | 3 +- openlp/core/projectors/manager.py | 3 +- openlp/core/ui/exceptiondialog.py | 3 +- openlp/core/ui/formattingtagdialog.py | 3 +- openlp/core/ui/icons.py | 85 +++++++++++++++++++ openlp/core/ui/mainwindow.py | 3 +- openlp/core/ui/servicemanager.py | 3 +- openlp/core/ui/slidecontroller.py | 3 +- openlp/core/ui/thememanager.py | 3 +- openlp/core/widgets/wizard.py | 3 +- openlp/plugins/alerts/forms/alertdialog.py | 3 +- openlp/plugins/bibles/bibleplugin.py | 3 +- openlp/plugins/custom/customplugin.py | 3 +- openlp/plugins/images/imageplugin.py | 3 +- openlp/plugins/media/mediaplugin.py | 3 +- .../presentations/presentationplugin.py | 3 +- openlp/plugins/songs/lib/mediaitem.py | 3 +- openlp/plugins/songs/songsplugin.py | 3 +- 20 files changed, 121 insertions(+), 73 deletions(-) create mode 100644 openlp/core/ui/icons.py diff --git a/openlp/core/common/i18n.py b/openlp/core/common/i18n.py index 301c27f44..34af54b8f 100644 --- a/openlp/core/common/i18n.py +++ b/openlp/core/common/i18n.py @@ -554,58 +554,3 @@ 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 icons 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 are the font icons used in the code. - """ - self.add = qta.icon('fa.plus-circle') - self.arrow_down = qta.icon('fa.arrow-down') - self.arrow_up = qta.icon('fa.arrow-up') - self.address = qta.icon('fa.book') - self.bible = qta.icon('fa.book') - self.bottom = qta.icon('fa.angle-double-down') - self.clone = qta.icon('fa.clone') - self.copy = qta.icon('fa.copy') - self.copyright = qta.icon('fa.copyright') - self.database = qta.icon('fa.database') - self.default = qta.icon('fa.info-circle') - self.delete = qta.icon('fa.trash') - self.edit = qta.icon('fa.edit') - self.exit = qta.icon('fa.sign-out') - self.download = qta.icon('fa.cloud-download') - self.live = qta.icon('fa.camera') - self.minus = qta.icon('fa.minus') - self.music = qta.icon('fa.music') - self.new = qta.icon('fa.file') - self.notes = qta.icon('fa.sticky-note') - self.open = qta.icon('fa.map') - self.plus = qta.icon('fa.plus') - self.presentation = qta.icon("fa.bar-chart") - self.preview = qta.icon('fa.laptop') - self.picture = qta.icon("fa.picture-o") - self.print = qta.icon('fa.print') - #self.remote = qta.icon('fa.podcast') - self.save = qta.icon('fa.save') - self.settings = qta.icon('fa.cogs') - self.top = qta.icon('fa.angle-double-up') - self.upload = qta.icon('fa.cloud-upload') - self.user = qta.icon('fa.user') - self.video = qta.icon('fa.file-video-o') diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 2e23b9dba..687537867 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -27,7 +27,8 @@ import re from PyQt5 import QtCore, QtWidgets -from openlp.core.common.i18n import UiStrings, UiIcons, translate +from openlp.core.common.i18n import UiStrings, translate +from openlp.core.ui.icons import UiIcons from openlp.core.common.mixins import RegistryProperties from openlp.core.common.path import path_to_str, str_to_path from openlp.core.common.registry import Registry diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 2b4d25d02..e3fe4bf1d 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -34,7 +34,8 @@ from PyQt5 import QtGui from openlp.core.common import md5_hash from openlp.core.common.applocation import AppLocation -from openlp.core.common.i18n import UiIcons, translate +from openlp.core.common.i18n import translate +from openlp.core.ui.icons import UiIcons from openlp.core.common.mixins import RegistryProperties from openlp.core.common.path import Path from openlp.core.common.settings import Settings diff --git a/openlp/core/projectors/manager.py b/openlp/core/projectors/manager.py index 3a8faca3b..b71ef9572 100644 --- a/openlp/core/projectors/manager.py +++ b/openlp/core/projectors/manager.py @@ -29,7 +29,8 @@ import logging from PyQt5 import QtCore, QtGui, QtWidgets -from openlp.core.common.i18n import UiIcons, translate +from openlp.core.common.i18n import translate +from openlp.core.ui.icons import UiIcons from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.registry import RegistryBase from openlp.core.common.settings import Settings diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index 078722fcf..7b581bbc8 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -25,7 +25,8 @@ The GUI widgets of the exception dialog. from PyQt5 import QtGui, QtWidgets -from openlp.core.common.i18n import UiIcons, translate +from openlp.core.common.i18n import translate +from openlp.core.ui.icons import UiIcons from openlp.core.lib import build_icon from openlp.core.lib.ui import create_button, create_button_box diff --git a/openlp/core/ui/formattingtagdialog.py b/openlp/core/ui/formattingtagdialog.py index 9f876b494..cd5c04015 100644 --- a/openlp/core/ui/formattingtagdialog.py +++ b/openlp/core/ui/formattingtagdialog.py @@ -24,7 +24,8 @@ The UI widgets for the formatting tags window. """ from PyQt5 import QtCore, QtWidgets -from openlp.core.common.i18n import UiStrings, UiIcons, translate +from openlp.core.common.i18n import UiStrings, translate +from openlp.core.ui.icons import UiIcons from openlp.core.lib import build_icon from openlp.core.lib.ui import create_button_box diff --git a/openlp/core/ui/icons.py b/openlp/core/ui/icons.py new file mode 100644 index 000000000..862357fe5 --- /dev/null +++ b/openlp/core/ui/icons.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2018 OpenLP Developers # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### +""" +The :mod:`languages` module provides a list of icons. +""" +import qtawesome as qta + +from PyQt5 import QtGui, QtWidgets + + +class UiIcons(object): + """ + Provide standard icons 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 are the font icons used in the code. + """ + palette = QtWidgets.QApplication.palette() + qta.set_defaults(color=palette.color(QtGui.QPalette.Active, + QtGui.QPalette.ButtonText), + color_disabled=palette.color(QtGui.QPalette.Disabled, + QtGui.QPalette.ButtonText)) + self.add = qta.icon('fa.plus-circle') + self.arrow_down = qta.icon('fa.arrow-down') + self.arrow_up = qta.icon('fa.arrow-up') + self.address = qta.icon('fa.book') + self.bible = qta.icon('fa.book') + self.bottom = qta.icon('fa.angle-double-down') + self.clone = qta.icon('fa.clone') + self.copy = qta.icon('fa.copy') + self.copyright = qta.icon('fa.copyright') + self.database = qta.icon('fa.database') + self.default = qta.icon('fa.info-circle') + self.delete = qta.icon('fa.trash') + self.edit = qta.icon('fa.edit') + self.exit = qta.icon('fa.sign-out') + self.download = qta.icon('fa.cloud-download') + self.live = qta.icon('fa.camera') + self.minus = qta.icon('fa.minus') + self.music = qta.icon('fa.music') + self.new = qta.icon('fa.file') + self.notes = qta.icon('fa.sticky-note') + self.open = qta.icon('fa.map') + self.plus = qta.icon('fa.plus') + self.presentation = qta.icon("fa.bar-chart") + self.preview = qta.icon('fa.laptop') + self.picture = qta.icon("fa.picture-o") + self.print = qta.icon('fa.print') + #self.remote = qta.icon('fa.podcast') + self.save = qta.icon('fa.save') + self.settings = qta.icon('fa.cogs') + self.top = qta.icon('fa.angle-double-up') + self.upload = qta.icon('fa.cloud-upload') + self.user = qta.icon('fa.user') + self.video = qta.icon('fa.file-video-o') diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 3c1e78d72..cfb3b6e61 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -35,7 +35,8 @@ 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, UiIcons, translate +from openlp.core.common.i18n import LanguageManager, UiStrings, translate +from openlp.core.ui.icons import UiIcons 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 diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 141ce45c6..20235033e 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -36,7 +36,8 @@ 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, UiIcons, format_time, translate +from openlp.core.common.i18n import UiStrings, format_time, translate +from openlp.core.ui.icons import UiIcons 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 diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index c7126eb5b..ae28ae4f3 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -31,7 +31,8 @@ from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import SlideLimits from openlp.core.common.actions import ActionList, CategoryOrder -from openlp.core.common.i18n import UiStrings, UiIcons, translate +from openlp.core.common.i18n import UiStrings, translate +from openlp.core.ui.icons import UiIcons from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.settings import Settings diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 284d5aeec..b1c6ff806 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -30,7 +30,8 @@ from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import delete_file from openlp.core.common.applocation import AppLocation -from openlp.core.common.i18n import UiStrings, UiIcons, translate, get_locale_key +from openlp.core.common.i18n import UiStrings, translate, get_locale_key +from openlp.core.ui.icons import UiIcons from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.path import Path, copyfile, create_paths, path_to_str from openlp.core.common.registry import Registry, RegistryBase diff --git a/openlp/core/widgets/wizard.py b/openlp/core/widgets/wizard.py index 4ea045faa..b3fb92299 100644 --- a/openlp/core/widgets/wizard.py +++ b/openlp/core/widgets/wizard.py @@ -27,7 +27,8 @@ import logging from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import is_macosx -from openlp.core.common.i18n import UiStrings, UiIcons, translate +from openlp.core.common.i18n import UiStrings, translate +from openlp.core.ui.icons import UiIcons from openlp.core.common.mixins import RegistryProperties from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings diff --git a/openlp/plugins/alerts/forms/alertdialog.py b/openlp/plugins/alerts/forms/alertdialog.py index e356b7c36..81fbd3a80 100644 --- a/openlp/plugins/alerts/forms/alertdialog.py +++ b/openlp/plugins/alerts/forms/alertdialog.py @@ -22,7 +22,8 @@ from PyQt5 import QtWidgets -from openlp.core.common.i18n import UiIcons, translate +from openlp.core.common.i18n import translate +from openlp.core.ui.icons import UiIcons from openlp.core.lib import build_icon from openlp.core.lib.ui import create_button, create_button_box diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 7e9a57238..dcf8c988f 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -24,7 +24,8 @@ import logging from openlp.core.api.http import register_endpoint from openlp.core.common.actions import ActionList -from openlp.core.common.i18n import UiStrings, UiIcons, translate +from openlp.core.common.i18n import UiStrings, translate +from openlp.core.ui.icons import UiIcons from openlp.core.lib import Plugin, StringContent, build_icon from openlp.core.lib.ui import create_action from openlp.plugins.bibles.endpoint import api_bibles_endpoint, bibles_endpoint diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index 402f3985e..cc9ec4f17 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -27,7 +27,8 @@ for the Custom Slides plugin. import logging from openlp.core.api.http import register_endpoint -from openlp.core.common.i18n import UiIcons, translate +from openlp.core.common.i18n import translate +from openlp.core.ui.icons import UiIcons from openlp.core.lib import Plugin, StringContent, build_icon from openlp.core.lib.db import Manager from openlp.plugins.custom.endpoint import api_custom_endpoint, custom_endpoint diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index aec4a3f1d..231273548 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -25,7 +25,8 @@ import logging from PyQt5 import QtGui from openlp.core.api.http import register_endpoint -from openlp.core.common.i18n import UiIcons, translate +from openlp.core.common.i18n import translate +from openlp.core.ui.icons import UiIcons from openlp.core.common.settings import Settings from openlp.core.lib import Plugin, StringContent, ImageSource, build_icon from openlp.core.lib.db import Manager diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index d59907860..b81d730d5 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -30,7 +30,8 @@ from PyQt5 import QtCore from openlp.core.api.http import register_endpoint from openlp.core.common import check_binary_exists from openlp.core.common.applocation import AppLocation -from openlp.core.common.i18n import UiIcons, translate +from openlp.core.common.i18n import translate +from openlp.core.ui.icons import UiIcons from openlp.core.common.path import Path from openlp.core.lib import Plugin, StringContent, build_icon from openlp.plugins.media.endpoint import api_media_endpoint, media_endpoint diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index 7650d41dd..fa72c5eb1 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -30,7 +30,8 @@ from PyQt5 import QtCore from openlp.core.api.http import register_endpoint from openlp.core.common import extension_loader -from openlp.core.common.i18n import UiIcons, translate +from openlp.core.common.i18n import translate +from openlp.core.ui.icons import UiIcons from openlp.core.common.settings import Settings from openlp.core.lib import Plugin, StringContent, build_icon from openlp.plugins.presentations.endpoint import api_presentations_endpoint, presentations_endpoint diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index aef0a64ef..9cf86244a 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -26,7 +26,8 @@ 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, UiIcons, translate, get_natural_key +from openlp.core.common.i18n import UiStrings, translate, get_natural_key +from openlp.core.ui.icons import UiIcons from openlp.core.common.path import copyfile, create_paths from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 586503575..be2f008b8 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -33,7 +33,8 @@ from PyQt5 import QtCore, QtWidgets from openlp.core.api.http import register_endpoint from openlp.core.common.actions import ActionList -from openlp.core.common.i18n import UiStrings, UiIcons, translate +from openlp.core.common.i18n import UiStrings, translate +from openlp.core.ui.icons import UiIcons from openlp.core.common.registry import Registry from openlp.core.lib import Plugin, StringContent, build_icon from openlp.core.lib.db import Manager