ripose-jp / Memento

An mpv-based video player for studying Japanese
https://ripose-jp.github.io/Memento/
GNU General Public License v2.0
432 stars 21 forks source link

[Feature Request] Glossary Selection Marker #208

Open BigBoyBarney opened 3 months ago

BigBoyBarney commented 3 months ago

It would be really cool to have a marker for the currently selected text from the glossary, perhaps with something like {glossary-selection}.

image

Cheers!

ripose-jp commented 2 months ago

Why do you need this?

BigBoyBarney commented 2 months ago

I would like to add the concise definition in the given context right under the sentence on the back of my Anki card. Additionally, J-J grammar dictionary entries can be incredibly long, so a selection marker would be very useful.

ripose-jp commented 2 months ago

I understand the use case, but it seems pretty specific considering it's already possible to select the entries you want using the checkboxes. Is this something that can't already be accomplished with the {clipboard} marker?

BigBoyBarney commented 2 months ago

Checkboxes can only be unselected, so if an entry has 13 checkboxes, I'd have to click 12 times to get the one I'd like.

Additionally, I don't really want to remove the other entries, but add the context-specific definition at the top of my card, which requires a separate marker.

Is this something that can't already be accomplished with the {clipboard} marker?

Not fully, as of right now. If the subtitle list is visible — which it always is in my use case — ctrl + c will default to copying the subtitle line from the list, instead of the selected text in the pop-up. If the pop-up selection were to take precedence over the subtitle list, it would mostly solve it.

Would implementing a separate marker be a lot of trouble? If yes, would it be possible to make the popup selection take precedence?

Cheers!

wandero commented 2 months ago

@ripose-jp I also really need the {selection-text} parameter for the same reasons as @BigBoyBarney. Although currently using {clipboard-text} also works as a workaround (by pressing Ctrl+C one more time) I would be very grateful if the {selection-text} parameter could be added. Thank you once again. The application is excellent, (but it seems to have very little promotion. I spent a lot of effort configuring mpvacious yomitan before I discovered Memento...)

ripose-jp commented 2 months ago

Checkboxes can only be unselected

This isn't entirely true. You can set which dictionaries are selected by default by going to SettingsOptionsAnki IntegrationCheck Show Advanced OptionsInclude in Glossary.

My main apprehension with implementing this is that it's not clear how it should work. If you try to select text in different definitions, you'll see that selecting something in one doesn't deselect text in the other. There's no correct way to handle this, just different approaches. For example, is last selected better than a bullet list of selections? Tags can be selected as well, should they be included? I don't know because I don't understand the use case.

wandero commented 2 months ago

@ripose-jp

Is this something that can't already be accomplished with the {clipboard} marker?

Using {clipboard} can be done, but it requires pressing Ctrl+C one more time. Sometimes I forget to press it, and then the new card ends up with the definition from the previous card.

BigBoyBarney commented 2 months ago

This isn't entirely true. You can set which dictionaries are selected by default by going to Settings → Options → Anki Integration → Check Show Advanced Options → Include in Glossary.

This option doesn't do anything if the entries are from the same dictionary. image

My main apprehension with implementing this is that it's not clear how it should work. If you try to select text in different definitions, you'll see that selecting something in one doesn't deselect text in the other. There's no correct way to handle this, just different approaches. For example, is last selected better than a bullet list of selections? Tags can be selected as well, should they be included? I don't know because I don't understand the use case.

I can't really speak for others, but for my own, potentially specific use case, I would need 2 separate markers ideally.

  1. Selected text is exported as is, in ascending order (from top to bottom). This would include everything from tags, to list formatting etc.
  2. A "Selected Entry" marker would be really cool to have. Essentially the opposite of the checkboxes, maybe on the right side. Whatever is checked, gets exported with this marker.

To illustrate, here is one of my older cards: image

I do want to include all of the definitions on the card for completeness' sake, but I want the context-specific definition at the top, in accordance with the minimum information principle. This is particularly important with J-J definitions, as those are not bulleted lists, but sentences; So highlighting keywords at the top is very useful.

Thanks in advance!

ripose-jp commented 2 months ago

Selected text is exported as is, in ascending order (from top to bottom). This would include everything from tags, to list formatting etc.

I don't think this is doable because of how Qt Widgets handles selection across multiple widgets. While you can select tags, you can't select text outside of the current tag you're selecting. It's a very different architecture from a webpage where everything is selectable. Selecting the glossaries themselves is doable and they have the added benefit retaining selection due to being based on QTextEdit instead of QLabel. I don't think you'll be able to get everything you want here.

A "Selected Entry" marker would be really cool to have. Essentially the opposite of the checkboxes, maybe on the right side. Whatever is checked, gets exported with this marker.

If I'm understanding this correctly, you want a way to export {glossary} twice with two different sets of definitions. I don't want to modify the UI in any way for this since it's so niche. I think any UI modifications would annoy far more users than it would help. Adding a new marker like {glossary-all}, or if I ever get around to implementing extended marker syntax {glossary:all}, that ignores checkboxes and exports the entire glossary always sounds like it would work for your use case.

wandero commented 2 months ago

@ripose-jp Thank you for your patient reply. It seems that our use cases are different. It appears that Chinese dictionaries do not have well-tagged entries, so I need to select specific words to add to my cards. For example, in the image, the word "朋友" (friend) is highlighted; I only need this word (without crossing tags). If I select by tag, the Japanese-Chinese dictionary does not separate the content and would add the entire set of definitions for the word to the card. Of course, I can achieve this using {clipboard} as well, but it requires an extra press of Ctrl+C.

Snipaste_2024-04-24_15-45-53

BigBoyBarney commented 2 months ago

While you can select tags, you can't select text outside of the current tag you're selecting.

That's totally fine, not a huge deal for my use case. As you can see in the image I sent above, 99.9% of the time it's one definition / tag that I want to narrow down and show at the top. I don't think I've ever tried or wanted to select definitions from multiple widgets.

Adding a new marker like {glossary-all}, or if I ever get around to implementing extended marker syntax {glossary:all}, that ignores checkboxes and exports the entire glossary always sounds like it would work for your use case.

I am perfectly happy with how default checkbox selection works right now, I only want to select certain parts of the text, much like @wandero's use case. A {selection-text} that does the same as double-pressing CTRL+C would solve both his and my issue.

Cheers!

ripose-jp commented 2 months ago

Thanks @wandero and @BigBoyBarney for the clarification. I got a much better idea of what's needed now.