mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Put the icon file map into field metadata, then change tag_view to use it.
This commit is contained in:
parent
82ab206727
commit
2e10fd115b
@ -17,7 +17,7 @@ from PyQt4.Qt import Qt, QTreeView, QApplication, pyqtSignal, \
|
|||||||
|
|
||||||
from calibre.ebooks.metadata import title_sort
|
from calibre.ebooks.metadata import title_sort
|
||||||
from calibre.gui2 import config, NONE
|
from calibre.gui2 import config, NONE
|
||||||
from calibre.library.field_metadata import TagsIcons
|
from calibre.library.field_metadata import TagsIcons, category_icon_map
|
||||||
from calibre.utils.search_query_parser import saved_searches
|
from calibre.utils.search_query_parser import saved_searches
|
||||||
from calibre.gui2 import error_dialog
|
from calibre.gui2 import error_dialog
|
||||||
from calibre.gui2.dialogs.confirm_delete import confirm
|
from calibre.gui2.dialogs.confirm_delete import confirm
|
||||||
@ -382,17 +382,11 @@ class TagsModel(QAbstractItemModel): # {{{
|
|||||||
# must do this here because 'QPixmap: Must construct a QApplication
|
# must do this here because 'QPixmap: Must construct a QApplication
|
||||||
# before a QPaintDevice'. The ':' in front avoids polluting either the
|
# before a QPaintDevice'. The ':' in front avoids polluting either the
|
||||||
# user-defined categories (':' at end) or columns namespaces (no ':').
|
# user-defined categories (':' at end) or columns namespaces (no ':').
|
||||||
self.category_icon_map = TagsIcons({
|
iconmap = {}
|
||||||
'authors' : QIcon(I('user_profile.png')),
|
for key in category_icon_map:
|
||||||
'series' : QIcon(I('series.png')),
|
iconmap[key] = QIcon(I(category_icon_map[key]))
|
||||||
'formats' : QIcon(I('book.png')),
|
self.category_icon_map = TagsIcons(iconmap)
|
||||||
'publisher' : QIcon(I('publisher.png')),
|
|
||||||
'rating' : QIcon(I('rating.png')),
|
|
||||||
'news' : QIcon(I('news.png')),
|
|
||||||
'tags' : QIcon(I('tags.png')),
|
|
||||||
':custom' : QIcon(I('column.png')),
|
|
||||||
':user' : QIcon(I('drawer.png')),
|
|
||||||
'search' : QIcon(I('search.png'))})
|
|
||||||
self.categories_with_ratings = ['authors', 'series', 'publisher', 'tags']
|
self.categories_with_ratings = ['authors', 'series', 'publisher', 'tags']
|
||||||
self.drag_drop_finished = drag_drop_finished
|
self.drag_drop_finished = drag_drop_finished
|
||||||
|
|
||||||
|
@ -22,6 +22,20 @@ class TagsIcons(dict):
|
|||||||
raise ValueError('Missing category icon [%s]'%a)
|
raise ValueError('Missing category icon [%s]'%a)
|
||||||
self[a] = icon_dict[a]
|
self[a] = icon_dict[a]
|
||||||
|
|
||||||
|
category_icon_map = {
|
||||||
|
'authors' : 'user_profile.png',
|
||||||
|
'series' : 'series.png',
|
||||||
|
'formats' : 'book.png',
|
||||||
|
'publisher' : 'publisher.png',
|
||||||
|
'rating' : 'rating.png',
|
||||||
|
'news' : 'news.png',
|
||||||
|
'tags' : 'tags.png',
|
||||||
|
':custom' : 'column.png',
|
||||||
|
':user' : 'drawer.png',
|
||||||
|
'search' : 'search.png'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class FieldMetadata(dict):
|
class FieldMetadata(dict):
|
||||||
'''
|
'''
|
||||||
key: the key to the dictionary is:
|
key: the key to the dictionary is:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user