11-14-2014, 05:54 PM | #1 |
null operator (he/him)
Posts: 20,572
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
[V2.10] Keyboard Shortcut stopped working
I have (had) one of the Views in View Manager PI assigned to ctrl/alt/p (Published date primary sort column) for some time (at least 2 years). In Windows 64bit version 2.10 its stopped working. It works fine in Windows 32bit version 2.9 on the same library using the same config data - its a view I use daily when I adding articles/papers etc.
Other similar kb shortcuts work - ctrl/alt/d for default view (Author primary sort column), ctrl/alt/u (Publisher primary sort column), ctrl/alt/m to toggle Mark Book etc. If I change ctrl/alt/P to ctrl/alt/Z it works, I do NOT get a conflict message with ctrl/alt/P or ctrl/alt/Z. I looked at %CALIBRE_CONFIG_DIRECTORY%\shortcuts\main.json - couldn't see anything 'out of order'. Given it works with 32 bit v2.9 says to me that its not 'interference' by a 3rd party program. weird, what Added 1 :Likewise I've had Open With configured to fire up Sigil with Shift/S for a long time, it's also stopped working in version 2.10, again its something I've been using most every day. Added 2 :And now ctrl/alt/z has stopped working for View by Publisher - I think I'll go back to 2.9. I ran Check Library on my libraries - no errors reported. Added 3 :Reinstalled 64bit 2.9 - all keyboard shortcuts appear to be working as expected - looks like something amiss in 2.10 BR Last edited by BetterRed; 11-14-2014 at 09:46 PM. Reason: Added para about Sigil shortcut |
11-14-2014, 09:57 PM | #2 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I dont use the plugins you mention, but assigning Ctrl+Alt+P to a builtin action works fine for me.
|
Advert | |
|
11-14-2014, 10:21 PM | #3 | |
null operator (he/him)
Posts: 20,572
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
I considered deleting config\shortcuts\main.json but everything works fine in 2.9 - same libraries, same config data. Its not a bad download, took one from github and it has same problem - besides problems arising from downloads are normally more serious. I'll install a fresh 2.10 portable, redo PI installs, and keyboard customisations. BR |
|
11-14-2014, 10:27 PM | #4 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
There was one change in 2.10 namely, that all entries in submenus of actions are now registered globally, so there is more potential for conflicts, but I dont see how that could cause random keyboard shortcuts to stop working, unless there are actual conflicts.
|
11-14-2014, 11:18 PM | #5 |
null operator (he/him)
Posts: 20,572
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Kovid, there were no conflicts reported for ctrl/alt/p or anything else - my shortcuts/main.json follows, I've not tested all my customisations. I'll do a thorough test when I do the 2.10 portable install as previously mentioned - that wont happen until tomorrow or Monday.
Spoiler:
BR |
Advert | |
|
11-15-2014, 10:04 AM | #6 |
Plugin Developer
Posts: 6,322
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
|
I'm seeing the same problem.
All of the shortcuts I have configured to go to my FFDL plugin are failing with debug log: Code:
QAction::eventFilter: Ambiguous shortcut overload: 0 QAction::eventFilter: Ambiguous shortcut overload: 1 QAction::eventFilter: Ambiguous shortcut overload: 3 QAction::eventFilter: Ambiguous shortcut overload: Ctrl+L QAction::eventFilter: Ambiguous shortcut overload: L Returning to calibre 2.9, they all work again. |
11-15-2014, 10:19 AM | #7 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Like I said, in 2.10 all keyboard shortcuts from all the popup menus of all plugins/builtin actions are registered globally. This is necessary to make them work on desktops such as OS X and Ubuntu Unity that use global menu bars. So some plugin will likely be using those shortcuts. I suggest disabling your plugins one by one till you find the culprit. Then that plugin should be fixed to make its shortcuts customizable via Preferences->Keyboard.
|
11-15-2014, 12:12 PM | #8 |
Plugin Developer
Posts: 6,322
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
|
Cutting to the chase, I removed all the plugin zip files except for my own FFDL from the plugin dir (I assume that will work the same as removing via Prefs and let me put them all back easier).
(Many of the plugins I have installed can't be disabled--including my own. Is there some additional part of the plugin API that needs to be implemented for that? I was able to disable Device, File and Metadata plugins, but not UI plugins.) FFDL does configure keyboard shortcuts by connecting a button to InterfaceActionBase.actual_plugin_.edit_shortcuts. I assume that part is correct. My short cuts worked until I changed libraries, then they stopped working. Also if I pull up the FFDL menu--both cases where FFDL rebuilds its menu list. The same function is called when the plugin is first initialized. FFDL can change its menus depending on library settings. At the end of rebuilding its menus, it spins through all it's menu items unregistering them and then calling self.gui.keyboard.finalize() to re-register the ones that need to be: Code:
for menu_id, unique_name in self.old_actions_unique_map.iteritems(): if menu_id not in self.actions_unique_map: self.gui.keyboard.unregister_shortcut(unique_name) self.old_actions_unique_map = self.actions_unique_map self.gui.keyboard.finalize() I believe I copied that pattern from one of kiwidude's plugins (like everybody else). Kovid, can you suggest a better way to handle this case--menus and shortcuts that can change by library/settings? Or a pointer to a place in calibre's code that does it better? I appreciate any guidance you can give me, thanks. |
11-15-2014, 02:27 PM | #9 | |
null operator (he/him)
Posts: 20,572
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
I have often wondered 'how come' it was that a PI such as View Manager could have library specific configurations, whereas its keyboard shortcuts were global. But hey, it worked so my wondering whilst long was also shallow. Of the 18 optional PI's I have installed, 16 are by kiwidude. I'll put my investigation with Portable on hold, as a PI Developer JimmXinu is in a much better position that yours truly to help solve the problem. BR |
|
11-15-2014, 04:58 PM | #10 | |
Plugin Developer
Posts: 6,322
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
|
Quote:
But I have proven that kiwidude's Reading List plugin has the same problem, so it's not just my plugin. I suspect that at least FFDL, Reading List, View Manager and Open With will have this problem. I'm hoping somebody who understands the shortcuts mechanism better can tell us what we're doing wrong. |
|
11-15-2014, 10:41 PM | #11 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I'm not clear as to why it needs to register/unregister actions. Why not simply register all possible actions at the start (in genesis), then based on settings enable/disable/show/hide the appropriate actions? That would be the way I would handle it.
|
11-15-2014, 10:44 PM | #12 | |
Plugin Developer
Posts: 6,322
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
|
Quote:
But Reading List, View Manager and Open With all add menu items that can be assigned shortcuts based on what you configure--IE, what Reading Lists you have, what programs you configure to Open With, etc. |
|
11-15-2014, 10:52 PM | #13 |
creator of calibre
Posts: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Yes but those will change only in response to configuration, correct? You can just have the plugin ask the user to restart calibre to have the config changes take effect.
Otherwise, if you really want to continue with adding/removing actions dynamically, the only additional wrinkle is that now you have to do self.gui.removeAction(action_to_be_removed) in addition to unregistering the shortcut from the keyboard manager. |
11-15-2014, 11:19 PM | #14 | |
null operator (he/him)
Posts: 20,572
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
11-15-2014, 11:49 PM | #15 |
Plugin Developer
Posts: 6,322
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
|
Okay, I might have a handle on this (maybe). What I think is happening, is:
First, the plugins clear their menu object. Then they recreate and add all the menu items they want to have. And call InterfaceAction.create_menu_action() to create the menu items. Which now calls self.gui.addAction(ac) on each action created to make it available . So the next time the menu is rebuild, it's adding additional actions to self.gui that are overlapping. Reading List has (and I lifted) some code to call self.gui.keyboard.unregister_shortcut(unique_name) after menu rebuild, but only on menu items that have been 'removed', IE, not recreated. I honestly don't know why. But replacing that with a brute force approach appears to work after limited testing: save the menu actions in a list and call unregister_shortcut and removeAction on all of them before rebuilding the menus. Code:
for action in self.menu_actions: self.gui.keyboard.unregister_shortcut(action.calibre_shortcut_unique_name) self.gui.removeAction(action) # rebuild menus... self.gui.keyboard.finalize() |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Keyboard Shortcut: Rename | CRB_Clive | General Discussions | 1 | 04-01-2014 01:32 PM |
Keyboard Shortcut for user created columns | dredwerker | Calibre | 2 | 07-03-2012 02:44 AM |
Replace/customize keyboard shortcut? | eosrose | Calibre | 2 | 11-10-2011 07:17 PM |
Keyboard Shortcut Issue in viewer | bigpallooka | Calibre | 2 | 10-21-2010 01:32 AM |
Add keyboard shortcut? | Chris Edwards | Amazon Kindle | 0 | 09-25-2010 01:58 PM |