summaryrefslogtreecommitdiff
path: root/urwid/signals.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix incorrect type cast in vterm (`apply_mapping` should return `bytes`) (#545)Alexey Stepanov2023-04-251-37/+60
| | | | | | | | | | | | | | | | | | | | | | | * 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>
* Annotate types in simple cases and use isinstance (& protocol) based type ↵Alexey Stepanov2023-04-041-8/+9
| | | | | | | | | | | 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>
* Python 37+ initial migration (#522)Alexey Stepanov2023-03-311-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Fix TypeError in signals module on weak object dispose (#503)Roman Guchevskij2023-03-281-5/+1
| | | squash and merge
* Python dual support (#266)Andrew Dunai2018-01-041-1/+2
| | | | | | | | | | | | | | | | | | | | * WIP * Metaclasses * String literal fixes * Remove 2to3 and make tests compatible with both Python 2 & 3 * Removed debug code. * Added tests for ProgressBar * Fixed examples. * future division & font literals fix * Cleaner fonts initialization.
* correct spelling mistakesEdward Betts2017-02-221-2/+2
|
* Fix some Python 3 things that work fine in 2.6 anyway.Eevee (Alex Munroe)2014-05-111-2/+2
|
* signals: use doctest for example in docstringIan Ward2013-12-291-12/+11
|
* fix signal emit order:use list for handlersIan Ward2013-12-261-12/+10
|
* do not use the empty list as default argument valueMatthijs Kooijman2012-12-141-3/+3
| | | | | | | Since default arguments are only evaluated once, this could cause unexpected behaviour when the default list is modified in place. This doesn't happen in the current code, but using None instead of [] as the default value should prevent any future problems.
* use weakref callbacks to automatically disconnect signalsMatthijs Kooijman2012-12-141-8/+29
| | | | | | When any of the weakref arguments to a signal handler are garbage collected, the signal handler is disconnect (since calling it no longer make sense without all the arguments).
* store signal handlers using a dict instead of a listMatthijs Kooijman2012-12-141-9/+68
| | | | | | | This allows removing a signal handler using an arbitrary key, instead of requiring to know the callback and all user arguments. This is needed to support automatically disconnecting signal handlers when any of the weakreferenced arguments are garbage collected.
* allow passing "weak arguments" to signal callbacksMatthijs Kooijman2012-12-141-20/+98
| | | | | | | | | | | This means that the arguments are passed just like the existing user_args, but they are stored as weak references to prevent a callback from keeping its user_args alive. The emit code transparently dereferences the arguments before passing them to the callback. If any of the arguments are cleaned up, the callback is no longer called (it's not actually automatically removed from the list yet, but it will be).
* when connecting signals, allow multiple user_argsMatthijs Kooijman2012-12-141-15/+33
| | | | | | | This additionally deprecates the existing (single) user_arg arguments in favor of the new user_args argument. Also note that the user_args are added at the start of the argument list, while the old user_arg was appended to the end.
* manual: finish updating and correcting linksIan Ward2012-08-281-12/+0
| | | | | --HG-- branch : feature-sphinx
* reference: signals, global settings, attrspecIan Ward2012-07-171-18/+25
| | | | | --HG-- branch : feature-sphinx
* bug fix: objects connected with signals not gc'd properlyIan Ward2009-10-161-5/+12
|
* add docstrings to Signals classIan Ward2009-06-271-1/+48
|
* untab signals.pyIan Ward2009-06-271-41/+41
|
* split up util.py: command_map.py main_loop.py monitored_list.py signals.py ↵ian2007-12-301-0/+80
text_layout.py; add display_common.py module --HG-- extra : convert_revision : 66ffcaede1358ec26e11dcce6ba3d5254ef78a94