Skip to content

Commit

Permalink
Handle compat for get_resources(), ref #13
Browse files Browse the repository at this point in the history
  • Loading branch information
ping committed Sep 12, 2023
1 parent 7cd0431 commit f6ff126
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions calibre-plugin/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,20 @@ def genesis(self):
# This method is called once per plugin, do initial setup here

# extract icons
image_resources = get_resources(
[v.file for v in ICON_MAP.values()]
+ [PLUGIN_ICON, CARD_ICON, COVER_PLACEHOLDER, CI_COMMIT_TXT],
print_tracebacks_for_missing_resources=DEBUG, # noqa
)
try:
image_resources = get_resources(
[v.file for v in ICON_MAP.values()]
+ [PLUGIN_ICON, CARD_ICON, COVER_PLACEHOLDER, CI_COMMIT_TXT],
print_tracebacks_for_missing_resources=DEBUG, # noqa
)
except TypeError:
# older than 6.2.0
# ref: https://github.com/kovidgoyal/calibre/commit/ef6c2b439f3870c9b87184a63441ede054db0e34
image_resources = get_resources(
[v.file for v in ICON_MAP.values()]
+ [PLUGIN_ICON, CARD_ICON, COVER_PLACEHOLDER, CI_COMMIT_TXT],
)

self.resources = {}
for k, v in ICON_MAP.items():
self.resources[k] = svg_to_qicon(
Expand Down

0 comments on commit f6ff126

Please sign in to comment.