tui-editor


Nametui-editor JSON
Version 1.20230114.224756 PyPI version JSON
download
home_pagehttps://github.com/albertz/py-tui-editor
SummarySimple Python terminal (TUI) multi-line editor
upload_time2023-01-14 21:49:18
maintainer
docs_urlNone
authorAlbert Zeyer
requires_python
licenseMIT License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Simple Python terminal (TUI) multi-line editor
##############################################

Features:

- simple multi-line editor
- not whole screen but only next N lines
- status bar (supporting multiple lines):
  show interactive feedback. e.g. mark edits, show number of edits, show diff in separate plane or so

This is just a simple multi-line editor for the terminal
(VT100).
It is a bit like
``input`` (`doc <https://docs.python.org/3/library/functions.html#input>`__)
but supporting multiple lines
and behaving more like a simple editor.
It is different to other editors
and other TUI frameworks in that it will not go full-screen
but only use the last N lines of the terminal.
It is intended to be simple and flexible and hackable,
i.e. the behavior can be changed, typing events can be handled,
etc.
It takes extra care to handle terminal resizing.
It also supports to show a status bar (potential multi-line).

Homepage: https://github.com/albertz/py-tui-editor


Installation
************

The project is on PyPI:
https://pypi.org/project/tui-editor/

Thus you can just do:

.. code-block:: bash

    pip install tui-editor


Usage
*****

Simple empty editor:

.. code-block:: python

    >>> from tui_editor import TuiEditor
    >>> editor = TuiEditor()
    >>> editor.edit()
    >>> editor.get_text()
    'Hello World!'

Predefined editable text:

.. code-block:: python

    >>> from tui_editor import TuiEditor
    >>> editor = TuiEditor()
    >>> editor.set_text('Hello World!')
    >>> editor.edit()
    >>> editor.get_text()
    'Hello World!'


See `demo-prompt.py <https://github.com/albertz/py-tui-editor/blob/main/demo-prompt.py>`__
and `demo-editor.py <https://github.com/albertz/py-tui-editor/blob/main/demo-editor.py>`__.


Screenshot
**********

.. image:: https://raw.githubusercontent.com/albertz/py-tui-editor/master/screenshots/2022-09-02.png?sanitize=true


Screencast
**********

.. image:: https://img.youtube.com/vi/zIFMyBkYwqg/maxresdefault.jpg
   :target: https://youtu.be/zIFMyBkYwqg

This shows the ``demo-prompt.py`` and ``demo-editor.py``.

.. image:: https://img.youtube.com/vi/4ERr0o9k72Y/maxresdefault.jpg
   :target: https://youtu.be/4ERr0o9k72Y

This uses a `very custom small app <https://github.com/albertz/playground/blob/master/pdf-extract-comments.py>`__,
which I use to take over annotated PDF edits into my Latex file,
where I get the editor, and it shows me the live-diff in the status bar of the editor.


Licence
*******

MIT License


History
*******

2015 Paul Sokolovsky:
`picotui project <https://pypi.org/project/picotui/>`__
`seditor.py example <https://github.com/pfalcon/picotui/blob/master/seditor.py>`__.
2022 Albert Zeyer: extend and redesign and package just the text editor as this library.


Related projects
****************

Python terminal user interface (TUI) and related.

The features stated in the beginning were the main motivation.
The related work here did not really satisfy me in getting those features,
or did not really make it simpler to accomplish them.
(At least from a first glance to those other projects
- maybe I'm missing sth! Please share a short demo,
similar to the demos here, if you know how to easily implement it.)

https://docs.python.org/3/library/curses.html
- too complex but at the same time too limited?

https://github.com/bczsalba/pytermgui (1.2k stars)
- limited, no real text editor

https://urwid.org/examples/index.html (2.5k stars)
- edit example: https://github.com/urwid/urwid/blob/master/examples/edit.py

https://github.com/prompt-toolkit/python-prompt-toolkit (7.9k stars)
- too complex...? similar as curses...

https://github.com/pfalcon/picotui (0.7k stars)
- good enough? editor: https://github.com/pfalcon/picotui/blob/master/picotui/editor.py
- another editor: https://github.com/pfalcon/picotui/blob/master/seditor.py

https://github.com/Textualize/textual (13k stars)
- async framework, I don't want that...

(Or coding some line edit by hand, should not be too difficult...?)

https://github.com/pfalcon/picotui/blob/master/seditor.py


References
**********

https://en.wikipedia.org/wiki/ANSI_escape_code
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/albertz/py-tui-editor",
    "name": "tui-editor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Albert Zeyer",
    "author_email": "albzey@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6f/c4/8ca9e113e2435ade917f5288a4d30673789b9f27c040034e7c52bc53e614/tui-editor-1.20230114.224756.tar.gz",
    "platform": null,
    "description": "Simple Python terminal (TUI) multi-line editor\n##############################################\n\nFeatures:\n\n- simple multi-line editor\n- not whole screen but only next N lines\n- status bar (supporting multiple lines):\n  show interactive feedback. e.g. mark edits, show number of edits, show diff in separate plane or so\n\nThis is just a simple multi-line editor for the terminal\n(VT100).\nIt is a bit like\n``input`` (`doc <https://docs.python.org/3/library/functions.html#input>`__)\nbut supporting multiple lines\nand behaving more like a simple editor.\nIt is different to other editors\nand other TUI frameworks in that it will not go full-screen\nbut only use the last N lines of the terminal.\nIt is intended to be simple and flexible and hackable,\ni.e. the behavior can be changed, typing events can be handled,\netc.\nIt takes extra care to handle terminal resizing.\nIt also supports to show a status bar (potential multi-line).\n\nHomepage: https://github.com/albertz/py-tui-editor\n\n\nInstallation\n************\n\nThe project is on PyPI:\nhttps://pypi.org/project/tui-editor/\n\nThus you can just do:\n\n.. code-block:: bash\n\n    pip install tui-editor\n\n\nUsage\n*****\n\nSimple empty editor:\n\n.. code-block:: python\n\n    >>> from tui_editor import TuiEditor\n    >>> editor = TuiEditor()\n    >>> editor.edit()\n    >>> editor.get_text()\n    'Hello World!'\n\nPredefined editable text:\n\n.. code-block:: python\n\n    >>> from tui_editor import TuiEditor\n    >>> editor = TuiEditor()\n    >>> editor.set_text('Hello World!')\n    >>> editor.edit()\n    >>> editor.get_text()\n    'Hello World!'\n\n\nSee `demo-prompt.py <https://github.com/albertz/py-tui-editor/blob/main/demo-prompt.py>`__\nand `demo-editor.py <https://github.com/albertz/py-tui-editor/blob/main/demo-editor.py>`__.\n\n\nScreenshot\n**********\n\n.. image:: https://raw.githubusercontent.com/albertz/py-tui-editor/master/screenshots/2022-09-02.png?sanitize=true\n\n\nScreencast\n**********\n\n.. image:: https://img.youtube.com/vi/zIFMyBkYwqg/maxresdefault.jpg\n   :target: https://youtu.be/zIFMyBkYwqg\n\nThis shows the ``demo-prompt.py`` and ``demo-editor.py``.\n\n.. image:: https://img.youtube.com/vi/4ERr0o9k72Y/maxresdefault.jpg\n   :target: https://youtu.be/4ERr0o9k72Y\n\nThis uses a `very custom small app <https://github.com/albertz/playground/blob/master/pdf-extract-comments.py>`__,\nwhich I use to take over annotated PDF edits into my Latex file,\nwhere I get the editor, and it shows me the live-diff in the status bar of the editor.\n\n\nLicence\n*******\n\nMIT License\n\n\nHistory\n*******\n\n2015 Paul Sokolovsky:\n`picotui project <https://pypi.org/project/picotui/>`__\n`seditor.py example <https://github.com/pfalcon/picotui/blob/master/seditor.py>`__.\n2022 Albert Zeyer: extend and redesign and package just the text editor as this library.\n\n\nRelated projects\n****************\n\nPython terminal user interface (TUI) and related.\n\nThe features stated in the beginning were the main motivation.\nThe related work here did not really satisfy me in getting those features,\nor did not really make it simpler to accomplish them.\n(At least from a first glance to those other projects\n- maybe I'm missing sth! Please share a short demo,\nsimilar to the demos here, if you know how to easily implement it.)\n\nhttps://docs.python.org/3/library/curses.html\n- too complex but at the same time too limited?\n\nhttps://github.com/bczsalba/pytermgui (1.2k stars)\n- limited, no real text editor\n\nhttps://urwid.org/examples/index.html (2.5k stars)\n- edit example: https://github.com/urwid/urwid/blob/master/examples/edit.py\n\nhttps://github.com/prompt-toolkit/python-prompt-toolkit (7.9k stars)\n- too complex...? similar as curses...\n\nhttps://github.com/pfalcon/picotui (0.7k stars)\n- good enough? editor: https://github.com/pfalcon/picotui/blob/master/picotui/editor.py\n- another editor: https://github.com/pfalcon/picotui/blob/master/seditor.py\n\nhttps://github.com/Textualize/textual (13k stars)\n- async framework, I don't want that...\n\n(Or coding some line edit by hand, should not be too difficult...?)\n\nhttps://github.com/pfalcon/picotui/blob/master/seditor.py\n\n\nReferences\n**********\n\nhttps://en.wikipedia.org/wiki/ANSI_escape_code\nhttps://invisible-island.net/xterm/ctlseqs/ctlseqs.html\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Simple Python terminal (TUI) multi-line editor",
    "version": "1.20230114.224756",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6fc48ca9e113e2435ade917f5288a4d30673789b9f27c040034e7c52bc53e614",
                "md5": "889dd5159082977c8f7024793f44f15b",
                "sha256": "a968b63af110ab61fd9b0fd6f7663843f2b2bc2f74648c3eda4018c2240ae70b"
            },
            "downloads": -1,
            "filename": "tui-editor-1.20230114.224756.tar.gz",
            "has_sig": false,
            "md5_digest": "889dd5159082977c8f7024793f44f15b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11290,
            "upload_time": "2023-01-14T21:49:18",
            "upload_time_iso_8601": "2023-01-14T21:49:18.257253Z",
            "url": "https://files.pythonhosted.org/packages/6f/c4/8ca9e113e2435ade917f5288a4d30673789b9f27c040034e7c52bc53e614/tui-editor-1.20230114.224756.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-14 21:49:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "albertz",
    "github_project": "py-tui-editor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tui-editor"
}
        
Elapsed time: 0.02671s