Added configurable key bindings (#472)

* added configurable key bindings

* added configurable key bindings

* Update README.rst

* Added flake8 fixes

* Move key config docs to docs

Co-authored-by: Cibin Mathew <cibinmathew@users.noreply.github.com>
Co-authored-by: Andreas Kloeckner <inform@tiker.net>
This commit is contained in:
Cibin Mathew 2022-02-11 04:14:23 +05:30 committed by GitHub
parent 0917e51e9a
commit 94d67364c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 5 deletions

View File

@ -20,3 +20,8 @@ version = ver_dic["VERSION"]
# The full version, including alpha/beta/rc tags.
release = version
intersphinx_mapping = {
"https://docs.python.org/3": None,
"urwid": ("https://urwid.org/", None),
}

View File

@ -9,6 +9,8 @@ If you are using Python 2.5, PuDB version 2013.5.1 is the last version to
support that version of Python. urwid 1.1.1 works with Python 2.5, newer
versions do not.
.. _faq:
FAQ
---
@ -17,7 +19,7 @@ back to the source view?**
A: Press your left arrow key.
**Q: Where are breakpoints stored?**
**Q: Where are breakpoints, PuDB settings file or shell history stored?**
A: All PuDB information is stored in a location specified by the `XDG Base
Directory Specification

View File

@ -44,3 +44,27 @@ to its built-in stringification behavior.
A stringifier that takes a long time will further stall
the debugger UI while it runs.
Configuring PuDB
----------------
Overriding default key bindings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Configure in the settings file (see :ref:`faq`).
- Add the bindings under mentioned section in the config file
(see :ref:`urwid:keyboard-input`).
- Only few actions are supported currently, coverage will increase with time.
(Contributions welcome!)
.. code-block:: ini
[pudb]
# window chooser bindings
hotkeys_breakpoints = B
hotkeys_code = C
hotkeys_stack = S
hotkeys_variables = V

View File

@ -2093,10 +2093,10 @@ class DebuggerUI(FrameVarInfoKeeper):
self.top.listen("!", run_cmdline)
self.top.listen("e", show_traceback)
self.top.listen("C", focus_code)
self.top.listen("V", RHColumnFocuser(0))
self.top.listen("S", RHColumnFocuser(1))
self.top.listen("B", RHColumnFocuser(2))
self.top.listen(CONFIG["hotkeys_code"], focus_code)
self.top.listen(CONFIG["hotkeys_variables"], RHColumnFocuser(0))
self.top.listen(CONFIG["hotkeys_stack"], RHColumnFocuser(1))
self.top.listen(CONFIG["hotkeys_breakpoints"], RHColumnFocuser(2))
self.top.listen("q", quit)
self.top.listen("ctrl p", do_edit_config)

View File

@ -123,6 +123,12 @@ def load_config():
conf_dict.setdefault("hide_cmdline_win", "False")
# hotkeys
conf_dict.setdefault("hotkeys_code", "C")
conf_dict.setdefault("hotkeys_variables", "V")
conf_dict.setdefault("hotkeys_stack", "S")
conf_dict.setdefault("hotkeys_breakpoints", "B")
def normalize_bool_inplace(name):
try:
if conf_dict[name].lower() in ["0", "false", "off"]: