~tomasgroth/openlp/presentation-load-speedup

« back to all changes in this revision

Viewing changes to openlp/core/lib/serviceitem.py

  • Committer: Tomas Groth
  • Date: 2018-08-05 20:52:07 UTC
  • mfrom: (2815.1.13 openlp)
  • Revision ID: tomasgroth@yahoo.dk-20180805205207-2xdcfcbrj054kox1
trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
from openlp.core.common import sha256_file_hash
36
36
from openlp.core.common.applocation import AppLocation
37
37
from openlp.core.common.i18n import translate
 
38
from openlp.core.ui.icons import UiIcons
38
39
from openlp.core.common.mixins import RegistryProperties
39
40
from openlp.core.common.path import Path
40
41
from openlp.core.common.settings import Settings
169
170
        self.processor = None
170
171
        self.audit = ''
171
172
        self.items = []
172
 
        self.iconic_representation = None
 
173
        self.icon = UiIcons().default
173
174
        self.raw_footer = []
174
175
        self.foot_text = ''
175
176
        self.theme = None
230
231
        """
231
232
        return capability in self.capabilities
232
233
 
233
 
    def add_icon(self, icon):
 
234
    def add_icon(self):
234
235
        """
235
236
        Add an icon to the service item. This is used when displaying the service item in the service manager.
236
 
 
237
 
        :param icon: A string to an icon in the resources or on disk.
238
237
        """
239
 
        self.icon = icon
240
 
        self.iconic_representation = build_icon(icon)
 
238
        if self.name == 'songs':
 
239
            self.icon = UiIcons().music
 
240
        elif self.name == 'bibles':
 
241
            self.icon = UiIcons().bible
 
242
        elif self.name == 'presentations':
 
243
            self.icon = UiIcons().presentation
 
244
        elif self.name == 'images':
 
245
            self.icon = UiIcons().picture
 
246
        elif self.name == 'media':
 
247
            self.icon = UiIcons().video
 
248
        else:
 
249
            self.icon = UiIcons().clone
241
250
 
242
251
    def render(self, provides_own_theme_data=False):
243
252
        """
370
379
            'plugin': self.name,
371
380
            'theme': self.theme,
372
381
            'title': self.title,
373
 
            'icon': self.icon,
374
382
            'footer': self.raw_footer,
375
383
            'type': self.service_item_type,
376
384
            'audit': self.audit,
424
432
        self.name = header['name']
425
433
        self.service_item_type = header['type']
426
434
        self.theme = header['theme']
427
 
        self.add_icon(header['icon'])
 
435
        self.add_icon()
428
436
        self.raw_footer = header['footer']
429
437
        self.audit = header['audit']
430
438
        self.notes = header['notes']