mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
c78cfdd926
@ -708,7 +708,7 @@ class TagsView(QTreeView): # {{{
|
|||||||
# global_vars=None, all_functions=None, builtin_functions=None,
|
# global_vars=None, all_functions=None, builtin_functions=None,
|
||||||
# python_context_object=None, dialog_number=None,
|
# python_context_object=None, dialog_number=None,
|
||||||
formatter=EvalFormatter, icon_dir='tb_icons/template_icons')
|
formatter=EvalFormatter, icon_dir='tb_icons/template_icons')
|
||||||
if d.exec():
|
if d.exec() == QDialog.DialogCode.Accepted:
|
||||||
self._model.set_value_icon(key, TEMPLATE_ICON_INDICATOR, d.rule[2], False)
|
self._model.set_value_icon(key, TEMPLATE_ICON_INDICATOR, d.rule[2], False)
|
||||||
self.recount()
|
self.recount()
|
||||||
return
|
return
|
||||||
@ -722,16 +722,18 @@ class TagsView(QTreeView): # {{{
|
|||||||
_('Change icon for: %s')%key, filters=[
|
_('Change icon for: %s')%key, filters=[
|
||||||
('Images', ['png', 'gif', 'jpg', 'jpeg'])],
|
('Images', ['png', 'gif', 'jpg', 'jpeg'])],
|
||||||
all_files=False, select_only_single_file=True)
|
all_files=False, select_only_single_file=True)
|
||||||
if path:
|
if not path:
|
||||||
path = path[0]
|
return
|
||||||
p = QIcon(path).pixmap(QSize(128, 128))
|
path = path[0]
|
||||||
d = os.path.join(config_dir, 'tb_icons')
|
p = QIcon(path).pixmap(QSize(128, 128))
|
||||||
if not os.path.exists(d):
|
d = os.path.join(config_dir, 'tb_icons')
|
||||||
os.makedirs(d)
|
if not os.path.exists(d):
|
||||||
with open(os.path.join(d, icon_file_name), 'wb') as f:
|
os.makedirs(d)
|
||||||
f.write(pixmap_to_data(p, format='PNG'))
|
with open(os.path.join(d, icon_file_name), 'wb') as f:
|
||||||
|
f.write(pixmap_to_data(p, format='PNG'))
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
# Already have an icon. User wants to change whether it applies to children
|
# Already have an icon. User wants to change whether it applies to children
|
||||||
icon_file_name = desired_file_name
|
icon_file_name = desired_file_name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user