Skip to content

[Dispatcher] add enable_func to Dispatcher:addSubMenu#12929

Closed
Commodore64user wants to merge 8 commits into
koreader:masterfrom
Commodore64user:dispatcher-enabled
Closed

[Dispatcher] add enable_func to Dispatcher:addSubMenu#12929
Commodore64user wants to merge 8 commits into
koreader:masterfrom
Commodore64user:dispatcher-enabled

Conversation

@Commodore64user

@Commodore64user Commodore64user commented Dec 20, 2024

Copy link
Copy Markdown
Member

what's new

  • frontend/dispatcher.lua: Added an enabled_func to the Dispatcher:addSubMenu function to check the current UI context and determine if various dispatcher submenus should be enabled. This function considers different contexts such as FileManager, ReaderPaging, and ReaderRolling to ensure appropriate submenu visibility.

screenshots


This change is Reviewable

@Commodore64user

Commodore64user commented Dec 20, 2024

Copy link
Copy Markdown
Member Author

I hope this doesn't [negatively] affect Profiles... @hius07

@Frenzie

Frenzie commented Dec 20, 2024

Copy link
Copy Markdown
Member

Presently this change would unfortunately be highly undesirable, and to a large degree I'm not sure if that can or even should change. E.g., being able to set ReaderPaging and ReaderRolling things in the same gesture half of which ignored when not applicable is a feature, not a bug.

@Commodore64user

Copy link
Copy Markdown
Member Author

I was kinda expecting something like that to be honest, would removing the elseifs ameliorate the situation? I still believe the reader and fm stuff should not overlap.

@Frenzie

Frenzie commented Dec 20, 2024

Copy link
Copy Markdown
Member

The reader and file browser are part of that. Actions like folder shortcuts can be started from anywhere but the file browser is a logical place for them.

Contrary to the rolling vs paging thing it's something that could be resolved more or less satisfactorily, but the solving would all have to happen prior to any disabling.

@Commodore64user

Copy link
Copy Markdown
Member Author

Folder shortcuts could be moved to "General" (seems reasonable) and remain accessible everywhere. File search can also be accessed from the reader so perhaps the same treatment...?

That way we'd have fm and reader stuff segregated.

@pazos

pazos commented Dec 20, 2024

Copy link
Copy Markdown
Member

I agree with both of you, @Commodore64user and @Frenzie

Like Frenzie said we don't want to disable them.

I like the context construct . Maybe it can be used in a help_func that generates programatically a infomessage with the context where the action applies.

ie: "$Named action is for scrolling read"

That way they can setup their actions in any context and still get useful info when in doubt.

Edit: I think the help_func is paired with a long press on the menu. Anyhow that's the intended behaviour of my suggestion.

@mergen3107

Copy link
Copy Markdown
Contributor

I would support such division a lot!

I remember when I got confused the first time. I was setting up gestures in Reader, and also set up those for FM actions.

Then I realized that I needed time set up those FM gestures again, but from within FM.

@pazos

pazos commented Dec 20, 2024

Copy link
Copy Markdown
Member

I've just reviewed the code.

hold_callback is already in use by the dispatcher menu generator. Cannot be used to display text messages.

@Commodore64user Commodore64user left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, so that last commit is what i feel is a happy medium. All the reader only stuff is limited to the reading module and all the FM only to fm module. comments...

as @mergen3107 mentioned, yeah. this stuff is very confusing (little Timmy I've got your back) and i just don't think it needs to be. This is by no means a perfect solution but an improvement nonetheless.

edit: looking closely at File search, it is not available from the top menu whilst in the reader... so event though a gesture/hotkey can activated from it [reader], it could stay in the file browser category...

@Frenzie

Frenzie commented Dec 21, 2024

Copy link
Copy Markdown
Member

I'm not necessarily convinced by the eviction as opposed to duplication, but I suppose it's okay.

At a glance you overlooked export all notes. (I'd say definitely duplication for that one.)

it is not available from the top menu

The default menu has different goals.

@hius07

hius07 commented Dec 21, 2024

Copy link
Copy Markdown
Member

File search should be available in Reader by a gesture.
OPDS catalog should be available in Reader by a gesture.
All actions should be available in FM/Reader for Profiles.
Generally, undesirable change and inaccurate implementation.

@Commodore64user

Copy link
Copy Markdown
Member Author

At a glance you overlooked export all notes. (I'd say definitely duplication for that one.)

that bad boy already is duplicated

Dispatcher:registerAction("export_all_notes",
{category="none", event="ExportAllNotes", title=_("Export all notes in all books in history"), reader=true, filemanager=true})

File search should be available in Reader by a gesture.

it is. I was just asking

OPDS catalog should be available in Reader by a gesture.

will do

All actions should be available in FM/Reader for Profiles.

I came up with something... if you have a better approach, please feel free to comment.

Generally, undesirable change and inaccurate implementation.

think of the children, you are not thinking about them. In all seriousness, this is genuinely helpful for users new to the programme, I know it makes sense to you and me now, but normal user struggle figuring all this stuff out.

@Commodore64user

Copy link
Copy Markdown
Member Author

would these two also need to be in both reader/fm? not familiar with sync as I don't use it.

function KOSync:onDispatcherRegisterActions()
Dispatcher:registerAction("kosync_push_progress", { category="none", event="KOSyncPushProgress", title=_("Push progress from this device"), reader=true,})
Dispatcher:registerAction("kosync_pull_progress", { category="none", event="KOSyncPullProgress", title=_("Pull progress from other devices"), reader=true, separator=true,})
end

@hius07

hius07 commented Dec 23, 2024

Copy link
Copy Markdown
Member

Don't waste your time.

@hius07

hius07 commented Dec 23, 2024

Copy link
Copy Markdown
Member

I remember when I got confused the first time. I was setting up gestures in Reader, and also set up those for FM actions.

We can extend the menu item name:
Taps and gestures (in file browser) and Taps and gestures (in reader) as a reminder to an inexperienced user.

@mergen3107

Copy link
Copy Markdown
Contributor

Taps and gestures (in file browser)

This solution sounds like trying to put white paint over the black paint. The result will NOT be a white surface, but rather something gray.

IMHO, a better wording would be something like Taps and gestures (**must be set while** in file browser) (and the same for reader).

What is needed to fix this ambiguity for real, is to sand down the black paint to bare metal, then put base, then emulsion, then white paint (and then lacquer). Which I believe this PR is trying to achieve: if users don't see unnecessary options, they won't be able to set them up and get confused.

@Frenzie

Frenzie commented Dec 23, 2024

Copy link
Copy Markdown
Member

I'm not convinced that graying out signals the app is a bit like two apps with some shared features. It seems much better to state it plainly, for example along the general lines suggested by @hius07, than to try to hint a little louder.

@Frenzie

Frenzie commented Dec 23, 2024

Copy link
Copy Markdown
Member

Forgot to say, but I do think the two can be complementary. I don't see any harm in this in principle.

@Commodore64user

Commodore64user commented Dec 23, 2024

Copy link
Copy Markdown
Member Author

I'm not convinced that graying out signals the app is a bit like two apps with some shared features.

i agree with that, and i do so because it doesn’t. Signalling that FM and reader are two separate entities is another beast altogether for which I don’t have a solution to. What this is a solution to is the problem of choice, instead of having hundreds of options to choose from, let’s only have the dozen or two that actually make sense. The alternative is to expect people to know that changing the margins with a gesture in FM doesn’t do anything even if the software is happy to accept it as input.

My thinking though is that upon seeing that some options are greyed out, a user might think that if the open from a book, they’ll be able to see those other options and that in my opinion should offer a slightly better user experience.

edit: perhaps it would be a brilliant idea to mention in the quick start guide that some settings work independently in fm and reader… that’s an idea.

@Frenzie

Frenzie commented Dec 23, 2024

Copy link
Copy Markdown
Member

I doubt that which isn't on page 1 is given all that much attention (though maybe a little later as a reference), but it can't hurt.

@Commodore64user

Copy link
Copy Markdown
Member Author

Any other comments here @Frenzie ?

Comment on lines +223 to +224
Note, our hotkeys plugin works independently for both our reader and file manager modules.
You will need to set up the hotkeys for both modules separately.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make it something more like this. Primarily I'm not sold on "modules," and "file browser" is the name we settled on.

Suggested change
Note, our hotkeys plugin works independently for both our reader and file manager modules.
You will need to set up the hotkeys for both modules separately.
Note, the hotkeys plugin works independently for both the reader (book display) and file browser, and hotkeys will need to be set up for each individually.

@Frenzie

Frenzie commented Dec 31, 2024

Copy link
Copy Markdown
Member

@hius07 Do you still have misgivings? It seems more reasonable now, though I admit I'm also not the biggest fan.

@hius07

hius07 commented Jan 1, 2025

Copy link
Copy Markdown
Member

I do not like the idea of disabling Gesture manager submenues.

@Frenzie

Frenzie commented Jan 1, 2025

Copy link
Copy Markdown
Member

Yeah, me neither. :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants