mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-26 07:43:15 +02:00
More QIcon.ic usage
This commit is contained in:
parent
7475ded979
commit
2243d331b0
5 changed files with 8 additions and 21 deletions
|
|
@ -119,7 +119,7 @@ class BOOX(HANLINV3):
|
|||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
METADATA_CACHE = '.metadata.calibre'
|
||||
DRIVEINFO = '.driveinfo.calibre'
|
||||
icon = I('devices/boox.png')
|
||||
icon = 'devices/boox.png'
|
||||
|
||||
# Ordered list of supported formats
|
||||
FORMATS = ['epub', 'fb2', 'djvu', 'pdf', 'html', 'txt', 'rtf', 'mobi',
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class KINDLE(USBMS):
|
|||
|
||||
name = 'Kindle Device Interface'
|
||||
gui_name = 'Amazon Kindle'
|
||||
icon = I('devices/kindle.png')
|
||||
icon = 'devices/kindle.png'
|
||||
description = _('Communicate with the Kindle e-book reader.')
|
||||
author = 'John Schember'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
|
|
|||
|
|
@ -1353,7 +1353,7 @@ class KOBOTOUCH(KOBO):
|
|||
' Aura H2O Edition 2, Clara HD, Forma, Libra H2O, Elipsa,'
|
||||
' Sage and Libra 2 eReaders.'
|
||||
' Based on the existing Kobo driver by %s.') % KOBO.author
|
||||
# icon = I('devices/kobotouch.jpg')
|
||||
# icon = 'devices/kobotouch.jpg'
|
||||
|
||||
supported_dbversion = 166
|
||||
min_supported_dbversion = 53
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class NOOK(USBMS):
|
|||
gui_name = _('The Nook')
|
||||
description = _('Communicate with the Nook e-book reader.')
|
||||
author = 'John Schember'
|
||||
icon = I('devices/nook.png')
|
||||
icon = 'devices/nook.png'
|
||||
supported_platforms = ['windows', 'linux', 'osx']
|
||||
|
||||
# Ordered list of supported formats
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
from calibre.utils.file_type_icons import EXT_MAP
|
||||
from calibre.utils.localization import get_lang
|
||||
from polyglot import queue
|
||||
from polyglot.builtins import iteritems, itervalues, string_or_bytes
|
||||
from polyglot.builtins import iteritems, string_or_bytes
|
||||
|
||||
del pqc
|
||||
try:
|
||||
|
|
@ -625,23 +625,10 @@ class FileIconProvider(QFileIconProvider):
|
|||
|
||||
def __init__(self):
|
||||
QFileIconProvider.__init__(self)
|
||||
upath, bpath = I('mimetypes'), I('mimetypes', allow_user_override=False)
|
||||
if upath != bpath:
|
||||
# User has chosen to override mimetype icons
|
||||
path_map = {v:I('mimetypes/%s.png' % v) for v in set(itervalues(self.ICONS))}
|
||||
icons = self.ICONS.copy()
|
||||
for uicon in glob.glob(os.path.join(upath, '*.png')):
|
||||
ukey = os.path.basename(uicon).rpartition('.')[0].lower()
|
||||
if ukey not in path_map:
|
||||
path_map[ukey] = uicon
|
||||
icons[ukey] = ukey
|
||||
else:
|
||||
path_map = {v:os.path.join(bpath, v + '.png') for v in set(itervalues(self.ICONS))}
|
||||
icons = self.ICONS
|
||||
self.icons = {k:path_map[v] for k, v in iteritems(icons)}
|
||||
self.icons = {k:f'mimetypes/{v}.png' for k, v in self.ICONS.items()}
|
||||
self.icons['calibre'] = I('lt.png', allow_user_override=False)
|
||||
for i in ('dir', 'default', 'zero'):
|
||||
self.icons[i] = QIcon(self.icons[i])
|
||||
self.icons[i] = QIcon.ic(self.icons[i])
|
||||
|
||||
def key_from_ext(self, ext):
|
||||
key = ext if ext in list(self.icons.keys()) else 'default'
|
||||
|
|
@ -654,7 +641,7 @@ def cached_icon(self, key):
|
|||
candidate = self.icons[key]
|
||||
if isinstance(candidate, QIcon):
|
||||
return candidate
|
||||
icon = QIcon(candidate)
|
||||
icon = QIcon.ic(candidate)
|
||||
self.icons[key] = icon
|
||||
return icon
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue