|
|
#1 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 906
Karma: 3501166
Join Date: Jan 2017
Location: Poland
Device: Various
|
How to gray out the plugin icon after selecting "Device"
I want grayed plugin icon on toolbar after click on "Device" icon.
This plugin works only in libraries. Of course I have the right message, but grayed icon suits me better/easier. |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,697
Karma: 28549304
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
disable the qaction of the plugin, that should make qt render it as disabled. But in general in calibre actions are not rendered disabled, as it is not always clear to the user why it is disabled. Instead popup an error message explaining that the action can only be used in the main book list not the device list. And add metadata to the plugin to indicate it should not be added to the device toolbars (see dont_add_to) in the plugin api.
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 906
Karma: 3501166
Join Date: Jan 2017
Location: Poland
Device: Various
|
Thank you. Works!
Code:
def location_selected(self, loc):
enabled = loc == 'library'
self.qaction.setEnabled(enabled)
self.menuless_qaction.setEnabled(enabled)
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sorting the Wheat from the Chaff - Selecting "New Market" EBooks | darryl | General Discussions | 18 | 09-11-2014 10:55 PM |
| question about "user defined usb device" plugin | Kaverin | Plugins | 2 | 03-08-2014 10:59 PM |
| Folder "device" plugin - suggestions? | schizoiddonkey | Development | 4 | 05-03-2012 01:20 PM |
| SONY pocket edition: "Device locked" + "charge battery" obstacles? | hermes | Devices | 3 | 06-02-2011 04:32 AM |
| Run plugin after "send to device" | minicheck | Development | 1 | 02-26-2011 10:42 PM |