py_cui icon indicating copy to clipboard operation
py_cui copied to clipboard

add escape_unfocuses field to PyCUI

Open tadeaspaule opened this issue 3 years ago • 2 comments

More control over Escape / focus behavior. For use cases like single-widget applications and those that never want to go out of focus mode

  • [x] I have read the contribution guidelines
  • [x] CI Unit tests pass
  • [x] New functions/classes have consistent docstrings

What this pull request changes

  • add escape_unfocuses field to PyCUI objects, default True. If set to False, user can provide widget-specific behavior for when Esc is pressed.

Issues fixed with this pull request

  • #135 (with escape_unfocuses == False you can do widget.add_key_command(py_cui.keys.KEY_ESCAPE, foo))

tadeaspaule avatar Sep 13 '21 19:09 tadeaspaule

I've thought about this, and would it perhaps be better to have the unfocus key be settable? With KEY_ESCAPE just the default? We could even add the option to set it to None so that there is no default unfocus key

jwlodek avatar Dec 29 '21 20:12 jwlodek

Agreed

-------- Original Message -------- On 29 Dec 2021, 21:09, Jakub Wlodek wrote:

I've thought about this, and would it perhaps be better to have the unfocus key be settable? With KEY_ESCAPE just the default? We could even add the option to set it to None so that there is no default unfocus key

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

tadeaspaule avatar Dec 30 '21 06:12 tadeaspaule