Enhancement Request: Changing icon of Open With application: Icons from executable

Bug #1998165 reported by ownedbycats
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

Calibre 6.9

Changing the icon of an Open With application only allows for image formats. A lot of applications embed the icons into the executable, necessitating the user to extract them with a separate program in order to import them to Calibre. Extracting them would be helpful.

If I understand right, QtFileIconProvider should be able to help: https://forum.qt.io/topic/62866/getting-icon-from-external-applications/4

Thanks. :)

description: updated
description: updated
summary: - Enhancement Request: Open With: Get icons from executable
+ Enhancement Request: Changing icon of Open With application: Icons from
+ executable
Revision history for this message
Kovid Goyal (kovid) wrote :

Open With already automatically loads icons from executables. So not
sure what you are asking for?

Changed in calibre:
status: New → Invalid
Revision history for this message
ownedbycats (ownedbycats) wrote :

I added Sumatra PDF (https://www.sumatrapdfreader.org) for an option for my two djvu files. The icon didn't import. I tried using "Change Icon," switching to all files, and selecting the executable but nothing actually happened.

Revision history for this message
Kovid Goyal (kovid) wrote :

attach the exe file you used and I will see why the icon was not
extracted.

Changed in calibre:
status: Invalid → Incomplete
Revision history for this message
ownedbycats (ownedbycats) wrote :
Revision history for this message
ownedbycats (ownedbycats) wrote :

Running from debug mode I got this error:

Traceback (most recent call last):
  File "calibre\gui2\open_with.py", line 107, in finalize_entry
  File "calibre\gui2\open_with.py", line 97, in icon_for_entry
  File "calibre\utils\open_with\windows.py", line 93, in load_icon_for_cmdline
  File "calibre\utils\open_with\windows.py", line 84, in load_icon_for_file
  File "calibre\utils\open_with\windows.py", line 19, in hicon_to_pixmap
AttributeError: type object 'QImage' has no attribute 'fromHICON'

Revision history for this message
Kovid Goyal (kovid) wrote :

Ah, looks like PyQt is missing that needed function. I will ask Phil
about it.

Changed in calibre:
status: Incomplete → Invalid
Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every alternate Friday.

 status fixreleased

Changed in calibre:
status: Invalid → Fix Released
Revision history for this message
ownedbycats (ownedbycats) wrote :

Is this one of those things that need an actual Calibre update? I ran from source got this:

Traceback (most recent call last):
  File "D:\Documents\git\calibre\src\calibre\gui2\open_with.py", line 121, in entry_to_item
  File "D:\Documents\git\calibre\src\calibre\gui2\open_with.py", line 97, in icon_for_entry
  File "D:\Documents\git\calibre\src\calibre\utils\open_with\windows.py", line 93, in load_icon_for_cmdline
  File "D:\Documents\git\calibre\src\calibre\utils\open_with\windows.py", line 84, in load_icon_for_file
  File "D:\Documents\git\calibre\src\calibre\utils\open_with\windows.py", line 19, in hicon_to_pixmap
AttributeError: module 'calibre_extensions.progress_indicator' has no attribute 'image_from_hicon'
Traceback (most recent call last):
  File "D:\Documents\git\calibre\src\calibre\gui2\open_with.py", line 107, in finalize_entry
  File "D:\Documents\git\calibre\src\calibre\gui2\open_with.py", line 97, in icon_for_entry
  File "D:\Documents\git\calibre\src\calibre\utils\open_with\windows.py", line 93, in load_icon_for_cmdline
  File "D:\Documents\git\calibre\src\calibre\utils\open_with\windows.py", line 84, in load_icon_for_file
  File "D:\Documents\git\calibre\src\calibre\utils\open_with\windows.py", line 19, in hicon_to_pixmap
AttributeError: module 'calibre_extensions.progress_indicator' has no attribute 'image_from_hicon'

Revision history for this message
Kovid Goyal (kovid) wrote :

yes, this needs an actual update.

Revision history for this message
ownedbycats (ownedbycats) wrote :

Trying to open "Edit Open With Applications" now produces this error:

calibre, version 6.10.0
ERROR: Unhandled exception: <b>TypeError</b>:QIcon(): argument 1 has unexpected type 'QImage'

calibre 6.10 embedded-python: True
Windows-10-10.0.19045-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.19045')
Python 3.10.1
Windows: ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: DeACSM (0, 0, 16) && DeDRM (10, 0, 2) && Action Chains (1, 18, 1) && Baen (1, 1, 0) && Barnes & Noble (1, 4, 0) && Comments Cleaner (1, 8, 0) && Count Pages (1, 12, 0) && Embed Comic Metadata (1, 6, 4) && EpubCheck (0, 2, 4) && EpubMerge (2, 15, 0) && EpubSplit (3, 5, 0) && Extract ISBN (1, 6, 0) && FanFicFare (4, 18, 0) && Fantastic Fiction (1, 6, 0) && Favourites Menu (1, 3, 0) && Find Duplicates (1, 10, 7) && Generate Cover (2, 3, 0) && GetFileName (0, 2, 0) && Goodreads (1, 7, 1) && Import List (1, 9, 0) && Job Spy (1, 0, 197) && Kindle hi-res covers (0, 5, 0) && KindleUnpack - The Plugin (0, 83, 1) && Kobo Books (1, 9, 2) && Kobo Utilities (2, 16, 6) && KoboTouchExtended (3, 6, 3) && Last Modified (0, 8, 4) && Manage Series (1, 5, 0) && Modify ePub (1, 8, 1) && MultiColumnSearch (1, 0, 95) && Obok DeDRM (7, 2, 1) && Open With (1, 8, 0) && Overdrive Link (2, 53, 0) && Quality Check (1, 13, 3) && Reading List (1, 14, 0) && Search The Internet (1, 10, 0) && SmartEject (2, 5, 0) && Standard Ebooks (1, 0, 0) && Sum Column (0, 3, 1) && View Manager (1, 10, 2) && Walk Search History (1, 5, 3) && Overdrive Link Metadata Source (2, 53, 0)
Traceback (most recent call last):
  File "calibre\gui2\open_with.py", line 472, in edit_programs
  File "calibre\gui2\open_with.py", line 394, in __init__
  File "calibre\gui2\widgets2.py", line 222, in __init__
  File "calibre\gui2\open_with.py", line 411, in setup_ui
  File "calibre\gui2\open_with.py", line 419, in populate
  File "calibre\gui2\open_with.py", line 128, in entry_to_item
TypeError: QIcon(): argument 1 has unexpected type 'QImage'

Revision history for this message
ownedbycats (ownedbycats) wrote :

If relevant, one of the applications in the list no longer exists - I was going there to remove it.

Revision history for this message
Kovid Goyal (kovid) wrote :
Revision history for this message
ownedbycats (ownedbycats) wrote :

That fixes it. :) Will there be a hot-fix update for this?

Revision history for this message
Kovid Goyal (kovid) wrote :

Depends if anyone else reports it in the next day or so. I dont think
setting Open With programs is a commonly done task, so it can probably
wait till the next release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.