Select-All Broken in Import Dialogue

Bug #1874499 reported by Elsie Hupp on 2020-04-23
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Unassigned

Bug Description

Note: I am using Calibre 4.13 on macOS (10.15.3), and this feedback is relative to expected behavior on the macOS platform. (ie I cannot speak to expected behavior on Linux or Windows.)

(1) One expected behavior in macOS for "open" dialogues that allow the user to select multiple files is that Cmd-A will select all files in the currently open folder. In the "Add Books" or "Import" dialogue box—that is, the modal system "open" dialogue—this keyboard shortcut does not work. (This oversight may be related to the lack of a persistent "Edit" menu in Calibre.)

(2) Another expected behavior in macOS for "open" dialogues that allow the user to select multiple files is that if the user clicks the "Open" button in the lower right, the application will attempt to open the entire contents (ie multiple files) of the currently open folder. In the "Add Books" or "Import" dialogue box—that is, the modal system "open" dialogue—this behavior also does not work.

I don't know to what extent these the "open" dialogue in Calibre is platform-specific, but to the extent that it is, the "open" dialogue in macOS should support these two behaviors. As a long-time Mac user with subconscious familiarity with the platform's "feel", I have found myself repeatedly stymied by the Calibre "Import" dialogue's inconsistencies with the platform norms.

The open dialogs come from the system, calibre has no code for them and
cannot control their behavior in any way.

Regarding (1) I sympathise. Sadly, like most things Apple,
cocoa file dialogs are brain dead. Their keyboard shortcuts require global menu
items for copy/paste, select all, etc *for the application* to work. If
the application does not have these, and calibre doesn't because it has
a dynamic and user customizable menubar, which is a level of flexibility
beyond Apple's comfort zone, then there is no real way to ensure these.

You should really open a bug with Apple explaining to them that the way
an independent file dialog works really should not be influenced by the
application's menu bar, or if it is, there needs to be a way for dialogs
to override them. That said it may be possible for me to work around
this brain dead-ness by adding a few dedicated shortcuts to the menubar
before the dialog is opened and removing them after it is closed. I'll
look into that when I next have nothing better to do.

As for (2) I have no clue why the file dialog would not behave as the
platform one, since it is the platform one. Probably another case of
Apple using some global application state to modify dialog behavior.

Kovid Goyal (kovid) wrote :

Actually, reading the apple docs fixing (1) should be as simple as
going to Preferences->Shortcuts in calibre, and setting the keyboard
shortcut for some action to cmd+a, making sure that action is present in
the menubar (which can itself be customised via Preferences->Toolbars)

 status fixreleased

Changed in calibre:
status: New → Fix Released
Kovid Goyal (kovid) wrote :

Of course doing this means that you will not be able to use cmd-A to
select all books in the book list, but then...

Elsie Hupp (elsiehupp) wrote :

I have very little experience with application development (just game development, which is less platform-specific), but would it be possible to create Mac-style standard menus using Python and Calibre's plugin API? I wouldn't be averse to brushing up on my Python and trying to do it myself if you tell me it's even possible.

It could also be nice to be able to create and edit custom menubar menus within Calibre itself for this purpose (among others), but that sort of new feature seems like a much, much larger scope.

On Fri, Apr 24, 2020 at 03:12:30AM -0000, Elsie Hupp wrote:
> I have very little experience with application development (just game
> development, which is less platform-specific), but would it be possible
> to create Mac-style standard menus using Python and Calibre's plugin
> API? I wouldn't be averse to brushing up on my Python and trying to do
> it myself if you tell me it's even possible.
>
> It could also be nice to be able to create and edit custom menubar menus
> within Calibre itself for this purpose (among others), but that sort of
> new feature seems like a much, much larger scope.

You can do it already in Preferences->Toobars and menus

Elsie Hupp (elsiehupp) wrote :

Yes and no. You can assign menus to different places, but you can't edit the *contents* of the menus without, I imagine, dipping into Python. For example, the existing "Toolbars and Menus" preference pane would not allow me to build custom "File" and "Edit" menus in line with platform norms.

Again, I'd actually be pretty excited to dip into Python in order to build "File" and "Edit" menus, but I haven't dug around enough to know if this is within the scope of Calibre's Python API. Is it? 😬

You dont need file and edit menus, just any item that uses the standard
shortcuts cmd+a and cmd+c and cmd+v

Elsie Hupp (elsiehupp) wrote :

I know I don't need File and Edit menus in order to create keyboard shortcuts. I would just be creating them for their own sake (in order to make the menu structure more in line with macOS platform norms). My guess is that this is perfectly within the scope of the plugin API, right? (I know this is a shift from my original bug report.)

Oh, and I'm in the process of setting up a Calibre development environment to fiddle around with. Yay!

Kovid Goyal (kovid) wrote :

No the plugin API does not have facilities for modifying menubars. You
can ofcourse create new menu entries that cn go into the bars in a
plugin but where they go is up to the user configuration. And if you
wish to modify the menubar look in bars.py

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

 status fixreleased

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

Other bug subscribers