4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection #
6
6
# --------------------------------------------------------------------------- #
7
# Copyright (c) 2008-2018 OpenLP Developers #
7
# Copyright (c) 2008-2019 OpenLP Developers #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it #
10
10
# under the terms of the GNU General Public License as published by the Free #
27
27
from openlp.core.common import delete_file, get_images_filter
28
28
from openlp.core.common.applocation import AppLocation
29
from openlp.core.common.i18n import UiStrings, translate, get_natural_key
29
from openlp.core.common.i18n import UiStrings, get_natural_key, translate
30
30
from openlp.core.common.path import Path, create_paths
31
31
from openlp.core.common.registry import Registry
32
32
from openlp.core.common.settings import Settings
33
from openlp.core.lib import ItemCapabilities, MediaManagerItem, ServiceItemContext, StringContent, build_icon, \
34
check_item_selected, create_thumb, validate_thumb
33
from openlp.core.lib import ServiceItemContext, build_icon, check_item_selected, create_thumb, validate_thumb
34
from openlp.core.lib.mediamanageritem import MediaManagerItem
35
from openlp.core.lib.plugin import StringContent
36
from openlp.core.lib.serviceitem import ItemCapabilities
35
37
from openlp.core.lib.ui import create_widget_action, critical_error_message_box
36
38
from openlp.core.ui.icons import UiIcons
37
39
from openlp.core.widgets.views import TreeWidgetWithDnD
38
from openlp.plugins.images.forms import AddGroupForm, ChooseGroupForm
40
from openlp.plugins.images.forms.addgroupform import AddGroupForm
41
from openlp.plugins.images.forms.choosegroupform import ChooseGroupForm
39
42
from openlp.plugins.images.lib.db import ImageFilenames, ImageGroups
41
45
log = logging.getLogger(__name__)
73
77
# Allow DnD from the desktop.
74
78
self.list_view.activateDnD()
76
def retranslateUi(self):
80
def retranslate_ui(self):
77
81
self.on_new_prompt = translate('ImagePlugin.MediaItem', 'Select Image(s)')
78
82
file_formats = get_images_filter()
79
83
self.on_new_file_masks = '{formats};;{files} (*)'.format(formats=file_formats, files=UiStrings().AllFiles)
427
431
if isinstance(selected_item.data(0, QtCore.Qt.UserRole), ImageGroups):
428
432
preselect_group = selected_item.data(0, QtCore.Qt.UserRole).id
429
433
# Enable and disable parts of the 'choose group' form
430
if preselect_group is None:
431
self.choose_group_form.nogroup_radio_button.setChecked(True)
432
self.choose_group_form.nogroup_radio_button.setFocus()
433
self.choose_group_form.existing_radio_button.setChecked(False)
434
self.choose_group_form.new_radio_button.setChecked(False)
436
self.choose_group_form.nogroup_radio_button.setChecked(False)
437
self.choose_group_form.existing_radio_button.setChecked(True)
438
self.choose_group_form.new_radio_button.setChecked(False)
439
self.choose_group_form.group_combobox.setFocus()
440
434
if self.manager.get_object_count(ImageGroups) == 0:
441
435
self.choose_group_form.existing_radio_button.setDisabled(True)
442
436
self.choose_group_form.group_combobox.setDisabled(True)
548
542
image_items.sort(key=lambda item: get_natural_key(item.text(0)))
549
543
target_group.addChildren(image_items)
551
def generate_slide_data(self, service_item, item=None, xml_version=False, remote=False,
552
context=ServiceItemContext.Service):
545
def generate_slide_data(self, service_item, *, item=None, remote=False, context=ServiceItemContext.Service,
554
548
Generate the slide data. Needs to be implemented by the plugin.
556
550
:param service_item: The service item to be built on
557
551
:param item: The Song item to be used
558
:param xml_version: The xml version (not used)
559
552
:param remote: Triggered from remote
560
553
:param context: Why is it being generated
554
:param kwargs: Consume other unused args specified by the base implementation, but not use by this one.
562
556
background = QtGui.QColor(Settings().value(self.settings_section + '/background color'))