summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix `TextCanvas` `CanvasError("Attribute extends beyond text...")` (#555)HEADmasterAlexey Stepanov2023-05-098-40/+172
| | | | | | | | | | | | | | | | | | | | * Fix TextCanvas `CanvasError("Attribute extends beyond text...") * `[[]] * ...` causes list of 1 list with pointers amount equal to multiplier instead of "list of lists" * Add 2 basic font tests which check for Canvas create issue * Add few type annotations during debug process Fix: #554 * Force tests to restore default encoding in tearDown Tests order change should not cause tests failures --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Fix CheckBox default state validation and initialization (#553)Alexey Stepanov2023-05-051-19/+29
| | | | | Fix #552 Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Revert "Allow to pass parameters when open pop_up (#480)" (#551)Alexey Stepanov2023-05-042-13/+352
| | | | | | | | | | | | * Revert "Allow to pass parameters when open pop_up (#480)" This reverts commit 55b6a920 Fix #480 * Update gitignore: reverted PR contained MacOS specific files not intended to present in repo --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Return original code to the deprecated getters and setters (#549)Alexey Stepanov2023-05-014-23/+237
| | | | | | | | | | | | | | | | | * Return original code to the deprecated getters and setters * Make more aggressive deprecation warning Fix: #548 * Return original code to the deprecated getters and setters * Make more aggressive deprecation warning Fix: #548 --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Fix incorrect type cast in vterm (`apply_mapping` should return `bytes`) (#545)Alexey Stepanov2023-04-258-110/+181
| | | | | | | | | | | | | | | | | | | | | | | * Fix incorrect type cast in vterm (`apply_mapping` should return `bytes`) Add `time.sleep(0.1)` to the event loop tests: in the worst scenario on windows and slow machine function in parallel thread/async can wait up to 80 milliseconds (tested) Add type annotations to the `vterm` and `test_vterm` to simplify error lookup. * Fix `DeprecationWarning` in doctests & examples * Add `pytest` configuration in `pyproject.toml` without migration * `Signals.emit()` rework: stop `user_args` join with `weak_args` Partial: #544 Partial: #512 Partial: #406 * drop `sleep`: not enough effective with pytest * set timer for errors raise to 0: faster raise, faster test done --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Fix text layout for `align="center", wrap="clip"` when `maxcol` == ↵Toluwaleke Ogundipe2023-04-242-1/+19
| | | | | | | | | | | | | `line_width - 1` (#543) * Fix text layout for `align="center", wrap="clip"` - Fix: Prevent zero run length in text layout. Refs: urwid#542 * Add test for "clip" text layout fix Refs: #542
* [BREAKING CHANGE] Fixes: #90 Remove idle emulation from asyncio event loop ↵Alexey Stepanov2023-04-215-105/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#541) * [BREAKING CHANGE] Fix: #90 Remove idle emulation from asyncio event loop Re-implement abandoned PR #418 * Fix "not hashable `AttrSpec`" and it's instance creation price (use `__slots__`) `AttrSpec` instances may be created in huge amount, with slots this process consume less resources. * `Terminal` is always created with event loop, if not provided -> `SelectEventLoop` is used * Fixed `TornadoEventLoop` & `AsyncioEventLoop` logic (Tornado IOLoop is asyncio based) For extra details see original PR. * Make `AttrSpec` immutable and hash-reusable * Update IDLE callback comment * Update urwid/display_common.py Co-authored-by: Ian Ward <ian@excess.org> --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com> Co-authored-by: Ian Ward <ian@excess.org>
* Add type annotations and optimize `urwid.font` (#540)Alexey Stepanov2023-04-213-89/+197
| | | | | | | | | | | | | | | * Add type annotations and optimize `urwid.font` * optimize `separate_glyphs`: do not mutate `gl`, less temporary variables * add `__repr__` and human-friendly exception reraise on render * add type annotations to satisfy mypy Partial: #406 * Add FontRegistry metaclass and use self-registration for fonts. --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Deprecate `__super` hack (#538)Alexey Stepanov2023-04-181-1/+12
| | | | | | | | | | | | | | * Deprecate `__super` hack `super()` should be called explicit * Update urwid/util.py Co-authored-by: Ian Ward <ian@excess.org> --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com> Co-authored-by: Ian Ward <ian@excess.org>
* Buildsystem: use autodetect for packages instead of explicit listing (#539)Alexey Stepanov2023-04-181-1/+3
| | | | | * Fix issues, when new packages created, but not listed explicit Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* [BREAKING CHANGE] Refactoring: Split event loop in several modules (#537)Alexey Stepanov2023-04-1818-1701/+1935
| | | | | | | | | | | | | | | | | | | | | | | | | | * [BREAKING CHANGE] Refactoring: Split event loop in several modules * `urwid.main_loop` is split into multiple modules which is easier to maintain * `urwid.compat` is not used anymore and removed * `TornadoEventLoop`, `GLibEventLoop`, `TwistedEventLoop` and `TrioEventLoop` accessible ONLY if required dependencies installed (like: Tornado installed -> `TornadoEventLoop` is accessible for import) * `TornadoEventLoop` use the same idle logic as `AsyncioLoop`: tornado.ioloop.IOLoop is asyncio based. * Trio < 0.15 is not supported. Version 0.15 was released almost 3 years ago. * Tornado < 5.0 is not supported. Tornado 5.0 was released 5 years ago. * Remove useless shebang * `EventLoop` should be real abstract * add new module docstrings * Fix docstrings * remove unneeded import --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Fix crash when string contains SO but not SI (#489)Martin Cooper2023-04-181-1/+1
| | | | | | The DEC_TAG cs type should not be escaped when a lone SO is found and should be used in the same way as when both SO and S1 are present. Fixes #322
* Add two fonts based on Unicode 13 2x3 TRS-80/Teletext mosaic characters (#434)Ricardo Bánffy2023-04-183-0/+51
| | | | | | | | | | | | | | | | | * Add digits for new mosaic font * Patch get_width * Change from 5x8 to 5x7 matrix * Give the fonts a better name, add a small numbers font * Add uppercase to larger sextant font * Fix odd breakage --------- Co-authored-by: Ricardo Bánffy <ricardo.banffy@workday.com>
* Fix empty markup handling (#536)Alexey Stepanov2023-04-122-1/+11
| | | | | | | * not switching to Unicode-only at this moment, so make simple Fix #408 Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Fix regression: `Pile()` focus_item can be Widget -> need to set property ↵Alexey Stepanov2023-04-122-1/+7
| | | | | `focus` in constructor (#535) Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Fix #445 - add `__len__` to listbox with validation if body `Sized` (#534)Alexey Stepanov2023-04-122-7/+51
| | | | | | | * If body is not `Sized` - `__len__` call should raise `AttributeError` * Downside: since body can be replaced, `__len__` is always set ant `ListBox` by itself will pass `Sized` instance check * Relax `SimpleListWalker` constructor rules: any Iterable is allowed as source due to `list` is used internally Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Deprecate legacy property creation (#533)Alexey Stepanov2023-04-1212-402/+1137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Deprecate legacy property creation * Drop long time ago removed methods (never returning methods) * Move large part of property implementations under `@property` * Emit `PendingDeprecationWarning` for old compatibility code for public methods used as core for property and methods for compatibility * Emit `DeprecationWarning` for private methods used in property construction using `property()` call Due to amount of copy-paste like changes, for containers shared part is moved to the existing base classes Add `__len__` to the list based containers. Related #445 Fix typo in type annotation for `Frame.mouse_event` * Update urwid/canvas.py Co-authored-by: Ian Ward <ian@excess.org> * Update urwid/canvas.py Co-authored-by: Ian Ward <ian@excess.org> * Update urwid/tests/test_container.py Co-authored-by: Ian Ward <ian@excess.org> * Fix typo in test name * Frame `header`, `body` and `footer` also has property and methods from pre-property era Make consistent with other containers --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com> Co-authored-by: Ian Ward <ian@excess.org>
* Add extra type annotations (#532)Alexey Stepanov2023-04-0611-167/+240
| | | | | | | | | | | | * add basic mypy config for better tracking (now crazy amount of warnings without `strict`) * Useless check in `raw_display` (`if not Popen` will be always `False`) * use explicit `return None` Partial: #406 Related: #512 Related: #408 Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Fix old_str_util.decode_one : support bytes and str as arguments (#531)Alexey Stepanov2023-04-051-14/+31
| | | | | fix #525 Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Fix input handling and extra type annotations (#530)Alexey Stepanov2023-04-0515-388/+539
| | | | | | | | | | | * keypress always receive `str` * fix `CF635Screen`: was missed return parameter in get_input_nonblocking * fix `LCDScreen`: wrong type used for buffer (pyserial return `bytes`, concatenation to `str` is wrong) Partial #406 Partial #512 Related #408 Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Annotate types in simple cases and use isinstance (& protocol) based type ↵Alexey Stepanov2023-04-0422-1118/+1392
| | | | | | | | | | | checking (#529) * Use `super()` where possible instead of direct base class Related #525 Partial #406 Fix #510 Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Use `locale.getpreferredencoding(False)` if possible (most systems) Fix #436 ↵Alexey Stepanov2023-04-032-13/+39
| | | | | | | | | | | Fix #479 (#528) * Handle impossibility to set locale in tests (docker container scenario) * `detect_encoding` start from non-destructive behavior (do not change locale) and restore exact locale in destructive Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Fix #443 : export ELLIPSIS constant (#527)Alexey Stepanov2023-04-031-0/+1
| | | Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Update readme and build system (#526)Alexey Stepanov2023-04-0311-130/+174
| | | | | | | | | | * Sunset of travis: non-commercial travis is closed * Use PEP517 driven build * stop calling tests deprecated way (via setup.py) * Update readme to allow removing of magic (badges maybe included in package) * Temporary do not display coverage: coveralls require reconfiguration * Remove unsupported python mention in readme Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Provide 80x24 fallback for ansi and vt100 (#465)Rhett Aultman2023-03-311-0/+4
| | | | | | | Not all terminals will necessarily respond to the TIOCGWINSZ ioctl, particularly much older ones providing vt100 or ansi terminals, which will have a fixed 80x24 size. If they respond with some kind of non-sensical value here, then at least give the ansi and vt100 terminals their default so they can draw.
* Python 37+ initial migration (#522)Alexey Stepanov2023-03-3191-1730/+2072
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial migration to the python 3.7: Semi-automatic changes CI related: Update `tox.ini` and `.travis.yml` to run python3 only tests Python 3.11 tests is commented-out on travis until #517 is not merged Manual changes: * `setup.py`: classifiers, remove python2 compatibility code * `docs/manual/wcur2.py`: looks like file was never completed, syntax is invalid * `urwid.compat`: removed `ord2`, `bytes3`, `text_type`, `xrange` and `text_types` Automatic changes (no manual editing, AST validated equality: * removed `u` prefix from all strings: not allowed in modern python code * `bytes()` -> `b''` * `== None` -> `is None` * subclassing of `object` * `super(<Class>`, self>)` ->`super()` * `from __future__ import ...` python3 compatibility imports * `set(<Iterable[Hashable]>)` -> `{<Hashable>}` * partial f-strings conversion * (`IOError`, `select.error`, `socket.error`) -> `OSError` * Switch to f-strings (automatic changes) * Remove `urwid.compat.B` * Remove `urwid.compat.with_metaclass` * use native `super()` instead of `self.__super` * Remove `urwid.compat.chr2` * Remove `urwid.split_repr.python3_repr` * Use native `@classmethod` and `@property` where overload is not possible * Add `from __future__ import annotations` * automatically sort imports * Add DeprecationWarning to the deprecated methods most IDE's will recognize it and annotate during new code usage call with "warnings as errors" mode will help to refactor other users * Address comments * replace homepage address in all files * remove outdated comments in compat.py * make wcur2.py correct python code. For example subclass * replace `self.__super` by `super()` in examples * fix asyncio_socket_server.py: magic with `asyncio` became wrong * Remove `widget.update_wrapper`: this was backport of python `functools.update_wrapper` * display_common.py: fix trivial typo in _colors calculation * use `sorted` method instead of list construction with later sorting * Address comments * `wcur2` include in docs * warning on `signals.Signals.emit` --------- Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Use non deprecated template (#424)Jochen Sprickerhof2023-03-311-1/+1
| | | | | | | | | defindex.html was deprecated a long time ago, see https://github.com/python/cpython/commit/7970cd483346dfd7723da214fb27399ecc574095 for example. Co-authored-by: Jochen Sprickerhof <jspricke@debian.org>
* Reconnect the 'modified' signal after setting a new ListBox.body (#474)exquo2023-03-292-8/+24
| | | | | Ensure that the cached canvas is marked invalidated when a newly set ListBox.body is modified at runtime. Fixes #428
* Test fixes (#524)Alexey Stepanov2023-03-295-47/+47
| | | | | | | | | | | | | | | | * asyncio coroutine was not awaited, so test was false-positive (poor visible on Travis CI) Fix test. * FloatEdit unittests passed, incorrect output doctests not caused exception on CI * warnings on version number * warnings about deprecated setup.py usage for tests run * python2.7 is not able to execute tests for asyncio due to mandatory syntax changes (async def). Fix logic: 1. added `isinstance` check before getting significance 2. Fix FloatEdit and add corner case tests 3. normalize version number 4. execute tests via `unittest` 5. stop using python 2.7 in tests run instead of increasing complexity Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Initial GitHub actions support (#523)Alexey Stepanov2023-03-281-0/+29
| | | Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
* Resolve #499 and add tests (#500)Daniel Sheffield2023-03-282-14/+26
| | | Resolves #499 - FloatEdit mangles decimals
* Allow to pass parameters when open pop_up (#480)Cielo2023-03-282-6/+6
|
* Include _resize_pipe_rd in fd_list for _wait_for_input_ready for raw_display ↵Andreas Klöckner2023-03-281-1/+1
| | | | (#453)
* docs: fix simple typo, incompatable -> incompatible (#446)Tim Gates2023-03-281-1/+1
| | | | | There is a small typo in urwid/numedit.py. Should read `incompatible` rather than `incompatable`.
* Fix merging attributes while decomposing tag markup (#507)Martin André2023-03-282-3/+3
| | | | | | | Previously, nested markup could lead to corrupted output if consecutive elements from different lists shared the same attributes, due to the deletion of the wrong element while merging attributes. Fixes #303.
* Drop some compat for python < 2.6 (#409)Denis Laxalde2023-03-2810-20/+9
| | | | | | | | | | | | * Drop python < 2.4 compat in apply_target_encoding() * Drop compat about bytes for python < 2.6 Support for python 2.4 and 2.5 got dropped in version 1.2.0. Also, these declarations confuse mypy. --------- Co-authored-by: Maxim Ivanov <ulidtko@gmail.com>
* Use == instead of "is" for equality testing (#431)naglis2023-03-281-1/+1
| | | | | | | Identity check (`is`, `is not`) with certain literals (e.g. strings, numbers) is not guaranteed by the language specification to work and issue a warning starting with Python 3.8, e.g.: > examples/browse.py:326: SyntaxWarning: "is" with a literal. Did you mean "=="?
* fix: restore normal screen on ctrl-z (#477)Andrey Proskurin2023-03-281-4/+10
|
* container: fix duplicate text (#490)Mike Frysinger2023-03-281-5/+5
|
* Fix TypeError in signals module on weak object dispose (#503)Roman Guchevskij2023-03-282-5/+63
| | | squash and merge
* make tests compatible with Python 3.11 (#517)Robert Schütz2023-03-281-4/+3
| | | squash and merge
* Update README.rstYan Huihang2022-07-121-1/+1
| | | add requirement information from [the main page](http://urwid.org/) so that poor windows users won't get lost here.
* fix typoCasey Jones2022-07-121-4/+1
| | | "will be have" → "will have"
* Update index.rstAsiel Díaz Benítez2022-07-121-1/+1
| | | fix small typo in tutorial
* Implement 'sgr' mouse reporting. Fixes #476. h/t @Sebi-MTony Cebzanov2021-09-061-3/+59
|
* Merge pull request #473 from devfull/fix-tour-example-typoMaxim Ivanov2021-04-131-1/+1
|\ | | | | Fix column label typo in tour example
| * Fix column label typo in tour exampledevfull2021-04-131-1/+1
|/
* Merge pull request #439 from collmot/fix/trio-hazmat-deprecation-warningtonycpsu2021-02-141-3/+15
|\ | | | | fix: use trio.lowlevel instead of trio.hazmat with Trio >= 0.15
| * fix: use trio.lowlevel instead of trio.hazmat with Trio >= 0.15Tamas Nepusz2020-11-021-3/+15
| |
* | Merge pull request #438 from collmot/fix/doc-fix-TrioEventLoop-run-asynctonycpsu2021-02-141-1/+6
|\ \ | | | | | | Fix documentation of TrioEventLoop.run_async()