Exemple #1
0
def icon(name, resample=False, icon_path=None):
    if not _resource['loaded']:
        print('Loading iconic fonts...')
        qta.load_font('fa',
                      'fontawesome-webfont-4.7.0.ttf',
                      'fontawesome-webfont-4.7.0-charmap.json',
                      directory=_resource['directory'])
        _resource['loaded'] = True
    args, kwargs = _qtaargs[name]
    return qta.icon(*args, **kwargs)
def icon(name, resample=False, icon_path=None):
    theme = CONF.get('main', 'icon_theme')
    if theme == 'spyder 3':
        if not _resource['loaded']:
            qta.load_font('spyder', 'spyder.ttf', 'spyder-charmap.json',
                          directory=_resource['directory'])
            _resource['loaded'] = True
        args, kwargs = _qtaargs[name]
        return qta.icon(*args, **kwargs)
    elif theme == 'spyder 2':
        icon = get_icon(name + '.png', resample=resample)
        if icon_path:
            icon_path = osp.join(icon_path, name + '.png')
            if osp.isfile(icon_path):
                icon = QIcon(icon_path)
        return icon if icon is not None else QIcon()
Exemple #3
0
def icon(name, resample=False, icon_path=None):
    theme = CONF.get('appearance', 'icon_theme')
    if theme == 'spyder 3':
        if not _resource['loaded']:
            qta.load_font('spyder', 'spyder.ttf', 'spyder-charmap.json',
                          directory=_resource['directory'])
            _resource['loaded'] = True
        args, kwargs = _qtaargs[name]
        return qta.icon(*args, **kwargs)
    elif theme == 'spyder 2':
        icon = get_icon(name + '.png', resample=resample)
        if icon_path:
            icon_path = osp.join(icon_path, name + '.png')
            if osp.isfile(icon_path):
                icon = QIcon(icon_path)
        return icon if icon is not None else QIcon()
Exemple #4
0
 def icon(self, name, scale_factor=None, resample=False):
     theme = CONF.get('appearance', 'icon_theme')
     if theme == 'spyder 3':
         try:
             # Try to load the icons from QtAwesome
             if not self._resource['loaded']:
                 qta.load_font('spyder', 'spyder.ttf', 'spyder-charmap.json',
                             directory=self._resource['directory'])
                 self._resource['loaded'] = True
             args, kwargs = self._qtaargs[name]
             if scale_factor is not None:
                 kwargs['scale_factor'] = scale_factor
             return qta.icon(*args, **kwargs)
         except KeyError:
             # Load custom icons
             icon = QIcon(self.get_icon(name))
             return icon if icon is not None else QIcon()
     elif theme == 'spyder 2':
         icon = self.get_icon(name, resample=resample)
         return icon if icon is not None else QIcon()
Exemple #5
0
def icon(name, resample=False, icon_path=None):
    theme = CONF.get('main', 'icon_theme')
    if theme == 'ezcad 3':
        if not _resource['loaded']:
            print('Loading iconic fonts...')
            qta.load_font('spyder', 'spyder.ttf', 'spyder-charmap.json',
                          directory=_resource['directory'])
            qta.load_font('ezcad', 'ezcad.ttf', 'ezcad-charmap.json',
                          directory=_resource['directory'])
            _resource['loaded'] = True
        args, kwargs = _qtaargs[name]
        return qta.icon(*args, **kwargs)
    elif theme == 'ezcad 2':
        icon = get_icon(name + '.png', resample=resample)
        if icon_path:
            icon_path = osp.join(icon_path, name + '.png')
            if osp.isfile(icon_path):
                icon = QIcon(icon_path)
        return icon if icon is not None else QIcon()
    else:
        raise ValueError("Unknown icon theme.")
Exemple #6
0
 def __load_fonts(self):
     qta.load_font('far',
                   'fa-regular-400.ttf',
                   'charmap.json',
                   directory=os.path.join(Environment.get_resource_path(),
                                          'fonts'))
     qta.load_font('fas',
                   'fa-solid-900.ttf',
                   'charmap.json',
                   directory=os.path.join(Environment.get_resource_path(),
                                          'fonts'))
     qta.load_font('fab',
                   'fa-brands-400.ttf',
                   'charmap.json',
                   directory=os.path.join(Environment.get_resource_path(),
                                          'fonts'))
Exemple #7
0
 def load(self):
     """
     These are the font icons used in the code.
     """
     font_path = AppLocation.get_directory(AppLocation.AppDir) / 'core' / 'ui' / 'fonts' / 'OpenLP.ttf'
     charmap_path = AppLocation.get_directory(AppLocation.AppDir) / 'core' / 'ui' / 'fonts' / 'openlp-charmap.json'
     qta.load_font('op', font_path, charmap_path)
     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))
     icon_list = {
         'active': {'icon': 'fa.child'},
         'add': {'icon': 'fa.plus-circle'},
         'alert': {'icon': 'fa.exclamation-triangle'},
         'arrow_down': {'icon': 'fa.arrow-down'},
         'arrow_left': {'icon': 'fa.arrow-left'},
         'arrow_right': {'icon': 'fa.arrow-right'},
         'arrow_up': {'icon': 'fa.arrow-up'},
         'audio': {'icon': 'fa.file-sound-o'},
         'authentication': {'icon': 'fa.exclamation-triangle', 'attr': 'red'},
         'address': {'icon': 'fa.book'},
         'back': {'icon': 'fa.step-backward'},
         'bible': {'icon': 'fa.book'},
         'blank': {'icon': 'fa.times-circle'},
         'blank_theme': {'icon': 'fa.file-image-o'},
         'book': {'icon': 'fa.book'},
         'bottom': {'icon': 'fa.angle-double-down'},
         'box': {'icon': 'fa.briefcase'},
         'clapperboard': {'icon': 'fa.chess-board'},
         'clock': {'icon': 'fa.clock-o'},
         'clone': {'icon': 'fa.clone'},
         'close': {'icon': 'fa.times-circle-o'},
         'copy': {'icon': 'fa.copy'},
         'copyright': {'icon': 'fa.copyright'},
         'database': {'icon': 'fa.database'},
         'default': {'icon': 'fa.info-circle'},
         'desktop': {'icon': 'fa.desktop'},
         'delete': {'icon': 'fa.trash'},
         'download': {'icon': 'fa.download'},
         'edit': {'icon': 'fa.edit'},
         'email': {'icon': 'fa.envelope'},
         'error': {'icon': 'fa.exclamation', 'attr': 'red'},
         'exception': {'icon': 'fa.times-circle'},
         'exit': {'icon': 'fa.sign-out'},
         'group': {'icon': 'fa.object-group'},
         'inactive': {'icon': 'fa.child', 'attr': 'lightGray'},
         'info': {'icon': 'fa.info'},
         'light_bulb': {'icon': 'fa.lightbulb-o'},
         'live': {'icon': 'fa.eye'},
         'manual': {'icon': 'fa.graduation-cap'},
         'media': {'icon': 'fa.fax'},
         'minus': {'icon': 'fa.minus'},
         'music': {'icon': 'fa.music'},
         'new': {'icon': 'fa.file'},
         'new_group': {'icon': 'fa.folder'},
         'notes': {'icon': 'fa.sticky-note'},
         'open': {'icon': 'fa.folder-open'},
         'optical': {'icon': 'fa.file-video-o'},
         'pause': {'icon': 'fa.pause'},
         'play': {'icon': 'fa.play'},
         'player': {'icon': 'fa.tablet'},
         'plugin_list': {'icon': 'fa.puzzle-piece'},
         'plus': {'icon': 'fa.plus'},
         'presentation': {'icon': 'fa.bar-chart'},
         'preview': {'icon': 'fa.laptop'},
         'projector': {'icon': 'op.video'},
         'projector_connect': {'icon': 'fa.plug'},
         'projector_cooldown': {'icon': 'fa.video-camera', 'attr': 'blue'},
         'projector_disconnect': {'icon': 'fa.plug', 'attr': 'lightGray'},
         'projector_error': {'icon': 'fa.video-camera', 'attr': 'red'},
         'projector_hdmi': {'icon': 'op.hdmi'},
         'projector_off': {'icon': 'fa.video-camera', 'attr': 'black'},
         'projector_on': {'icon': 'fa.video-camera', 'attr': 'green'},
         'projector_warmup': {'icon': 'fa.video-camera', 'attr': 'yellow'},
         'picture': {'icon': 'fa.picture-o'},
         'print': {'icon': 'fa.print'},
         'remote': {'icon': 'fa.rss'},
         'repeat': {'icon': 'fa.repeat'},
         'save': {'icon': 'fa.save'},
         'search': {'icon': 'fa.search'},
         'search_ccli': {'icon': 'op.search-CCLI'},
         'search_comb': {'icon': 'fa.columns'},
         'search_lyrcs': {'icon': 'op.search-lyrcs'},
         'search_minus': {'icon': 'fa.search-minus'},
         'search_plus': {'icon': 'fa.search-plus'},
         'search_ref': {'icon': 'fa.institution'},
         'search_text': {'icon': 'op.search-text'},
         'settings': {'icon': 'fa.cogs'},
         'shortcuts': {'icon': 'fa.wrench'},
         'song_usage': {'icon': 'fa.line-chart'},
         'song_usage_active': {'icon': 'op.plus_sign'},
         'song_usage_inactive': {'icon': 'op.minus_sign'},
         'sort': {'icon': 'fa.sort'},
         'stop': {'icon': 'fa.stop'},
         'square': {'icon': 'fa.square'},
         'text': {'icon': 'op.file-text'},
         'time': {'icon': 'fa.history'},
         'theme': {'icon': 'fa.paint-brush'},
         'top': {'icon': 'fa.angle-double-up'},
         'undo': {'icon': 'fa.undo'},
         'upload': {'icon': 'fa.upload'},
         'user': {'icon': 'fa.user'},
         'usermo': {'icon': 'op.users'},
         'users': {'icon': 'fa.users'},
         'video': {'icon': 'fa.file-video-o'},
         'volunteer': {'icon': 'fa.group'}
     }
     self.load_icons(self, icon_list)