~tomasgroth/openlp/portable-path

« back to all changes in this revision

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

  • Committer: Tomas Groth
  • Author(s): tim.bentley at gmail
  • Date: 2018-08-04 21:11:51 UTC
  • mfrom: (2820.3.10 fonts)
  • Revision ID: tomasgroth@yahoo.dk-20180804211151-k681l5vd76zdq5gk
Replaced png icons with fonts
Added ability to have custom fonts

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
from openlp.core.common import md5_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
229
230
        """
230
231
        return capability in self.capabilities
231
232
 
232
 
    def add_icon(self, icon):
 
233
    def add_icon(self):
233
234
        """
234
235
        Add an icon to the service item. This is used when displaying the service item in the service manager.
235
 
 
236
 
        :param icon: A string to an icon in the resources or on disk.
237
236
        """
238
 
        self.icon = icon
239
 
        self.iconic_representation = build_icon(icon)
 
237
        if self.name == 'songs':
 
238
            self.icon = UiIcons().music
 
239
        elif self.name == 'bibles':
 
240
            self.icon = UiIcons().bible
 
241
        elif self.name == 'presentations':
 
242
            self.icon = UiIcons().presentation
 
243
        elif self.name == 'images':
 
244
            self.icon = UiIcons().picture
 
245
        elif self.name == 'media':
 
246
            self.icon = UiIcons().video
 
247
        else:
 
248
            self.icon = UiIcons().clone
240
249
 
241
250
    def render(self, provides_own_theme_data=False):
242
251
        """
361
370
            'plugin': self.name,
362
371
            'theme': self.theme,
363
372
            'title': self.title,
364
 
            'icon': self.icon,
365
373
            'footer': self.raw_footer,
366
374
            'type': self.service_item_type,
367
375
            'audit': self.audit,
413
421
        self.name = header['name']
414
422
        self.service_item_type = header['type']
415
423
        self.theme = header['theme']
416
 
        self.add_icon(header['icon'])
 
424
        self.add_icon()
417
425
        self.raw_footer = header['footer']
418
426
        self.audit = header['audit']
419
427
        self.notes = header['notes']