7 ms·
No mneonics... All of this Python TUI stuff wastes pixels with 80's technology screen rendering and yet it doesn't have the only thing that still makes TUIs goo
by inshadows 5y ago
No mneonics... All of this Python TUI stuff wastes pixels with 80's technology screen rendering and yet it doesn't have the only thing that still makes TUIs good: fast keyboard navigation. And I don't mean Tab-ing and arrow-ing your way to the button, let alone mouse clicking. I that C or Alt-C presses button with label "[C]ancel". Try to play with Midnight Commander to see. Also not saying that it's not possible in GUI but usually GUIs are not designed with keyboard in mind, while TUIs should be.
EDIT: GUIs had tradition of having mnemonics in menus and sometimes even on buttons. That is until smart people started removing it in the name of the design.
EDIT: Still, will check it out, though I will try to hack my way into adding mnemonics to buttons. Because arrow/tab navigation is f-ing stupid.
- deleted 5y ago[deleted]
- bczsalba 5y agoThere is a pretty in-depth binding system that allows for the exact behaviour you are describing. This library is generally a framework with a loose implementation in the name of WindowManager. Most of these behaviours can and should be implemented in applications using this framework. About "wasting pixels"... What if I (and many others) like the aesthetic and simplicity? There is a sort of magic in never having to leave your terminal emulator. Most frameworks are still keyboard-centered, as many of them don't even have mouse support to replace it with. Edit: Thank you for your interest though! If you have a syntactically neat way to do the things you talked about feel free to raise an issue and I'll get to it as it comes up.
- kleer001 5y agoI'm with you. As beautiful as it is IMHO it's too reliant on the mouse and has no obvious keyboard-only navigation. But, also, it seems like the mnemonics are there, just buried. I would like to see that stuff front and centre and on by default if not obligatory.
- bczsalba 5y agoAfter thinking about it overnight, I'm thinking about adding a button type that automatically binds its onclick method to either a given or automatically generated binding. So something like ptg.KeyboardButton("Help") or ptg.KeyboardButton("Action", binding=ptg.keys.CTRL_B) These would create a button with a label such as "[H]elp" and "[B] Action", and pressing `CTRL_` + their button would activate them. If idea is fine implementation should really not take much time.
- kleer001 5y agoThat sounds really nice!
- inshadows 5y agoPerfect! Usually mnemonics are activated by Meta-$letter, e.g. Meta-C (or Alt-C) for "[C]ancel" or Meta-M for "I[m]port". That has long tradition. I've just found the I[m]port example in Evolution's (mail client) [F]ile menu. It also works that way in console twin-panel file managers Midnight Commander and almost all menu-like GUI panels in Windows applications.
- bczsalba 5y agoSo I'm midway through implmementing it all, and I'm finding that a lot of both meta and alt keys have behaviours that block them from working on my Mac. I know on Linux it probably isn't like that, but a lot of people will have Meta- bindings for some actions in the UI. Would it be a huge issue if it defaulted to CTRL? ATM I'm having issues even recording the value of my meta keypresses as too many of them are default bindings in MacOS. Edit: Regardless, it is now pushed on GH. Will be included in next version, thank you both for the suggestion!
- bczsalba 5y agoAlright, I'll keep that in mind! Thank you for the suggestion :D