| Name | hoptex JSON |
| Version |
0.1.0
JSON |
| download |
| home_page | https://github.com/Cvaniak/Hoptex |
| Summary | Hoptex is Textual plugin that allows you to focus widgets fast! |
| upload_time | 2023-08-30 08:51:57 |
| maintainer | |
| docs_url | None |
| author | Cvaniak |
| requires_python | >=3.7,<4.0 |
| license | |
| keywords |
|
| VCS |
 |
| bugtrack_url |
|
| requirements |
No requirements were recorded.
|
| Travis-CI |
No Travis.
|
| coveralls test coverage |
No coveralls.
|
# Hoptex
If you are Vim user you heard about [EasyMotion](https://github.com/easymotion/vim-easymotion) and [Hop](https://github.com/phaazon/hop.nvim). This library is exactly this concept but for [Textual](https://github.com/Textualize/textual)!
Just type your shortcut and focus/press widget you want. No mouse needed!
> Please always pin version of this library as API may change rapidly. It is experimental project and some staff may be modified.
## Demo


## Documentation
**Hoptex** allow to focus object and additionaly press it.
By default:
- `space` will highlight `focusable` widgets and allow to focus choosen one
- `ctrl+o` will focus and press widgets that are `focusable` and have `on_click` or `_on_click` method.
### Usage
The most basic usage is just adding decorator on your **Textual** app like this:
```python
from textual.app import App
from hoptex import hoptex
@hoptex()
class NewTextualApp(App):
...
```
That is all. Super easy, right?
### Allow and Block list
To choose which widgets will be highlighted **Hoptex** checks for three condition:
- Widget have property `focusable=True`.
- Widget is in allow list (then will be forced to be highlighted)
- Widget is in blocked list (it have priority to exclude widget over allow list)
This parameters can be changed in `@hoptex` parameter `filter_lists` using `HoptexFilterWidgetsConfig`.
By default `allow_list` and `block_list` are empty and `include_focusable=True`.
Example can be like this:
```python
from textual.demo import DemoApp, LocationLink # Tested on Texutal 0.30.0 Demo App
from textual.widgets import TextLog
from hoptex import hoptex
from hoptex.configs import HoptexWidgetsFiltersConfig
widgets_filters = HoptexWidgetsFiltersConfig(allow_list=[LocationLink], block_list=[TextLog])
@hoptex(widgets_filters=widgets_filters)
class WrappedDemoApp(DemoApp):
...
```
### Custom bindings
If you do not like default bindings you can change them with `HoptexBindingConfig`.
It has four fields, which you can replace with keybinding like in **Textual**:
- `focus`, default to `space` -> Run **Hoptex** screen to focus widget
- `press`, default to `ctrl+p` -> Run **Hoptex** screen to focus and press/click widget
- `quit`, default to `escape` -> Quits from **Hoptex** screen
- `unfocus`, default to `escape` -> Unfocuses from any widgets (if you are in e.x. text window, you need first to unfocus to use `space`)
and also four config fields, that takes dictionary that will be injected in standard Binding field:
- `focus_conf`, default to `{"description": "Hop Focus"}`
- `press_conf`, default to `{"description": "Hop Press"}`
- `quit_conf`, default to `{"description": "Hop Quit", "show": False}`
- `unfocus_conf`, default to `{"description": "Hop Unfocus", "show": False}`
```python
from textual.demo import DemoApp
from hoptex import hoptex
from hoptex.configs import HoptexBindingConfig
bindings = HoptexBindingConfig(press="ctrl+g", press_conf={"description": "Another description"})
@hoptex(bindings=bindings)
class DemoAppMy(DemoApp):
...
```
### Custom Appearance
You can also inject custom label appearance, by `label` value. It should inherit from `Static`
and allow for one argument (the letter that will be displayed).
However easier way is to change CSS of `HopLabel`, which default is to:
```css
HopLabel {
width: 1;
height: 1;
color: yellow;
text-style: bold;
background: black;
}
```
## TODO
- Support more widgets on screen
- Allow to use hoptex as wrapper for application (open any app with hoptex support)
- If no place to jump, return
- Color change
- list of characters
- custom Widget to mark
Raw data
{
"_id": null,
"home_page": "https://github.com/Cvaniak/Hoptex",
"name": "hoptex",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Cvaniak",
"author_email": "igna.cwaniak@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/22/ca/59ad3234520eba5887173759c7f6725c814e56c4f72a841648b0118315d6/hoptex-0.1.0.tar.gz",
"platform": null,
"description": "# Hoptex\n\nIf you are Vim user you heard about [EasyMotion](https://github.com/easymotion/vim-easymotion) and [Hop](https://github.com/phaazon/hop.nvim). This library is exactly this concept but for [Textual](https://github.com/Textualize/textual)!\nJust type your shortcut and focus/press widget you want. No mouse needed!\n\n> Please always pin version of this library as API may change rapidly. It is experimental project and some staff may be modified.\n\n## Demo\n\n\n\n\n## Documentation\n\n**Hoptex** allow to focus object and additionaly press it.\nBy default:\n\n- `space` will highlight `focusable` widgets and allow to focus choosen one\n- `ctrl+o` will focus and press widgets that are `focusable` and have `on_click` or `_on_click` method.\n\n### Usage\n\nThe most basic usage is just adding decorator on your **Textual** app like this:\n\n```python\nfrom textual.app import App\nfrom hoptex import hoptex\n\n@hoptex()\nclass NewTextualApp(App):\n ...\n```\n\nThat is all. Super easy, right?\n\n### Allow and Block list\n\nTo choose which widgets will be highlighted **Hoptex** checks for three condition:\n\n- Widget have property `focusable=True`.\n- Widget is in allow list (then will be forced to be highlighted)\n- Widget is in blocked list (it have priority to exclude widget over allow list)\n\nThis parameters can be changed in `@hoptex` parameter `filter_lists` using `HoptexFilterWidgetsConfig`.\nBy default `allow_list` and `block_list` are empty and `include_focusable=True`.\nExample can be like this:\n\n```python\nfrom textual.demo import DemoApp, LocationLink # Tested on Texutal 0.30.0 Demo App\nfrom textual.widgets import TextLog\nfrom hoptex import hoptex\nfrom hoptex.configs import HoptexWidgetsFiltersConfig\n\nwidgets_filters = HoptexWidgetsFiltersConfig(allow_list=[LocationLink], block_list=[TextLog])\n\n\n@hoptex(widgets_filters=widgets_filters)\nclass WrappedDemoApp(DemoApp):\n ...\n\n```\n\n### Custom bindings\n\nIf you do not like default bindings you can change them with `HoptexBindingConfig`.\nIt has four fields, which you can replace with keybinding like in **Textual**:\n\n- `focus`, default to `space` -> Run **Hoptex** screen to focus widget\n- `press`, default to `ctrl+p` -> Run **Hoptex** screen to focus and press/click widget\n- `quit`, default to `escape` -> Quits from **Hoptex** screen\n- `unfocus`, default to `escape` -> Unfocuses from any widgets (if you are in e.x. text window, you need first to unfocus to use `space`)\n\nand also four config fields, that takes dictionary that will be injected in standard Binding field:\n\n- `focus_conf`, default to `{\"description\": \"Hop Focus\"}`\n- `press_conf`, default to `{\"description\": \"Hop Press\"}`\n- `quit_conf`, default to `{\"description\": \"Hop Quit\", \"show\": False}`\n- `unfocus_conf`, default to `{\"description\": \"Hop Unfocus\", \"show\": False}`\n\n```python\n\nfrom textual.demo import DemoApp\n\nfrom hoptex import hoptex\nfrom hoptex.configs import HoptexBindingConfig\n\nbindings = HoptexBindingConfig(press=\"ctrl+g\", press_conf={\"description\": \"Another description\"})\n\n\n@hoptex(bindings=bindings)\nclass DemoAppMy(DemoApp):\n ...\n\n```\n\n### Custom Appearance\n\nYou can also inject custom label appearance, by `label` value. It should inherit from `Static`\nand allow for one argument (the letter that will be displayed).\nHowever easier way is to change CSS of `HopLabel`, which default is to:\n\n```css\nHopLabel {\n width: 1;\n height: 1;\n color: yellow;\n text-style: bold;\n background: black;\n}\n```\n\n## TODO\n\n- Support more widgets on screen\n- Allow to use hoptex as wrapper for application (open any app with hoptex support)\n- If no place to jump, return\n- Color change\n- list of characters\n- custom Widget to mark\n",
"bugtrack_url": null,
"license": "",
"summary": "Hoptex is Textual plugin that allows you to focus widgets fast!",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/Cvaniak/Hoptex",
"Repository": "https://github.com/Cvaniak/Hoptex"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2ec76e3c4658c4b9a72cc2df30de0b27230ca4630b932e5be71fb23cfba0b8fa",
"md5": "63b4436cf4a10e3dbfe9c379b3c23bce",
"sha256": "66cd49d081218efd97a268c36f9231030bf3a240b42c697ec10e6649d559b341"
},
"downloads": -1,
"filename": "hoptex-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "63b4436cf4a10e3dbfe9c379b3c23bce",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 5867,
"upload_time": "2023-08-30T08:51:55",
"upload_time_iso_8601": "2023-08-30T08:51:55.344199Z",
"url": "https://files.pythonhosted.org/packages/2e/c7/6e3c4658c4b9a72cc2df30de0b27230ca4630b932e5be71fb23cfba0b8fa/hoptex-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "22ca59ad3234520eba5887173759c7f6725c814e56c4f72a841648b0118315d6",
"md5": "ebf4a9cc7fb2b9eb5ad42ffac2503615",
"sha256": "9564048175a33706b6eeadf9446836824e5bc6e263a431a19457d99707d6e0e4"
},
"downloads": -1,
"filename": "hoptex-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "ebf4a9cc7fb2b9eb5ad42ffac2503615",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 4528,
"upload_time": "2023-08-30T08:51:57",
"upload_time_iso_8601": "2023-08-30T08:51:57.111135Z",
"url": "https://files.pythonhosted.org/packages/22/ca/59ad3234520eba5887173759c7f6725c814e56c4f72a841648b0118315d6/hoptex-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-30 08:51:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Cvaniak",
"github_project": "Hoptex",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "hoptex"
}