11-04-2018, 08:45 AM | #1 |
Guru
Posts: 664
Karma: 2180702
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
|
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. |
11-04-2018, 11:04 AM | #2 |
creator of calibre
Posts: 43,776
Karma: 22666666
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 | |
|
11-04-2018, 12:17 PM | #3 |
Guru
Posts: 664
Karma: 2180702
Join Date: Jan 2017
Location: Poland
Device: Kindle (Key3, PW2, PW3), Nook (ST, GLP), Kobo Touch, Tolino Vision 2
|
Thank you. Works!
Code:
def location_selected(self, loc): enabled = loc == 'library' self.qaction.setEnabled(enabled) self.menuless_qaction.setEnabled(enabled) |
Thread Tools | Search this Thread |
|
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 09:55 PM |
question about "user defined usb device" plugin | Kaverin | Plugins | 2 | 03-08-2014 09:59 PM |
Folder "device" plugin - suggestions? | schizoiddonkey | Development | 4 | 05-03-2012 12:20 PM |
SONY pocket edition: "Device locked" + "charge battery" obstacles? | hermes | Devices | 3 | 06-02-2011 03:32 AM |
Run plugin after "send to device" | minicheck | Development | 1 | 02-26-2011 09:42 PM |