flexablelib-tui 3.5.2__tar.gz → 3.5.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {flexablelib_tui-3.5.2/flexablelib_tui.egg-info → flexablelib_tui-3.5.4}/PKG-INFO +2 -2
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/__init__.py +1 -1
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/accessibility.py +28 -16
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/keys.py +21 -3
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4/flexablelib_tui.egg-info}/PKG-INFO +2 -2
- flexablelib_tui-3.5.4/flexablelib_tui.egg-info/requires.txt +1 -0
- flexablelib_tui-3.5.2/flexablelib_tui.egg-info/requires.txt +0 -1
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/LICENSE +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/MANIFEST.in +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/README.md +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/app.py +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/capabilities.py +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/graphics.py +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/keymap.py +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/py.typed +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/screen.py +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/terminal.py +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/widgets.py +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui/wincon.py +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui.egg-info/SOURCES.txt +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui.egg-info/dependency_links.txt +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui.egg-info/top_level.txt +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/setup.cfg +0 -0
- {flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib-tui
|
|
3
|
-
Version: 3.5.
|
|
3
|
+
Version: 3.5.4
|
|
4
4
|
Summary: Terminal interfaces for flexablelib: widgets, full-screen layout, diff redraw, keyboard input, focus and key bindings.
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Author: Benjamin Ramirez
|
|
@@ -17,7 +17,7 @@ Classifier: Topic :: Software Development :: User Interfaces
|
|
|
17
17
|
Requires-Python: >=3.8
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: flexablelib>=3.5.
|
|
20
|
+
Requires-Dist: flexablelib>=3.5.4
|
|
21
21
|
Dynamic: author
|
|
22
22
|
Dynamic: author-email
|
|
23
23
|
Dynamic: classifier
|
|
@@ -12,7 +12,7 @@ Everything here is also reachable as ``flexablelib.ProgressBar``,
|
|
|
12
12
|
``flexablelib.App`` and so on once installed.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
-
__version__ = '3.5.
|
|
15
|
+
__version__ = '3.5.4'
|
|
16
16
|
|
|
17
17
|
from .widgets import (ProgressBar, Sparkline, BarChart, StatusBar, KeyHints,
|
|
18
18
|
LogView, Text, Rule)
|
|
@@ -44,6 +44,7 @@ reader:
|
|
|
44
44
|
import contextlib
|
|
45
45
|
import math
|
|
46
46
|
import os
|
|
47
|
+
import re
|
|
47
48
|
import sys
|
|
48
49
|
|
|
49
50
|
from flexablelib import _frames as _fx
|
|
@@ -340,6 +341,11 @@ _ANSI_RGB = {
|
|
|
340
341
|
'bright_blue': (92, 92, 255), 'bright_magenta': (255, 0, 255),
|
|
341
342
|
'bright_cyan': (0, 255, 255), 'bright_white': (255, 255, 255),
|
|
342
343
|
}
|
|
344
|
+
_HEX_RE = re.compile(r'^#?([0-9a-f]{6})$|^#([0-9a-f]{3})$')
|
|
345
|
+
_DIGITS_RE = re.compile(r'^[0-9]{1,3}$')
|
|
346
|
+
_GREY_RE = re.compile(r'^gr[ae]y([0-9]{1,3})$')
|
|
347
|
+
# The greys of the xterm 256 palette: black, the 24-step ramp, white.
|
|
348
|
+
_GREY_LEVELS = [0] + [8 + 10 * i for i in range(24)] + [255]
|
|
343
349
|
_ATTRS = ('bold', 'dim', 'italic', 'underline', 'blink', 'reverse',
|
|
344
350
|
'hidden', 'strike', 'strikethrough', 'normal', 'faint')
|
|
345
351
|
|
|
@@ -359,33 +365,39 @@ def _xterm_rgb(index):
|
|
|
359
365
|
|
|
360
366
|
|
|
361
367
|
def parse_color(token):
|
|
362
|
-
"""``(r, g, b)`` for ``'#rrggbb'``, ``'#rgb'``, a colour
|
|
363
|
-
``'color:N'`` / ``N`` (256 palette) or
|
|
368
|
+
"""``(r, g, b)`` for ``'#rrggbb'``, ``'#rgb'``, ``'rrggbb'``, a colour
|
|
369
|
+
name, ``'color:N'`` / ``'colour:N'`` / ``N`` (256 palette) or
|
|
370
|
+
``'greyNN'`` (the xterm grey a terminal shows for it); ``None`` if not.
|
|
371
|
+
|
|
372
|
+
Every colour :func:`flexablelib.colors.parse_spec` draws is understood,
|
|
373
|
+
so contrast checks see the colour that is really on screen."""
|
|
364
374
|
if token is None:
|
|
365
375
|
return None
|
|
366
376
|
if isinstance(token, tuple):
|
|
367
377
|
return token
|
|
368
378
|
token = str(token).strip().lower()
|
|
369
|
-
|
|
370
|
-
|
|
379
|
+
hex_match = _HEX_RE.match(token)
|
|
380
|
+
if hex_match:
|
|
381
|
+
digits = hex_match.group(1) or hex_match.group(2)
|
|
371
382
|
if len(digits) == 3:
|
|
372
383
|
digits = ''.join(c * 2 for c in digits)
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
return tuple(int(digits[k:k + 2], 16) for k in (0, 2, 4))
|
|
376
|
-
except ValueError:
|
|
377
|
-
return None
|
|
384
|
+
return tuple(int(digits[k:k + 2], 16) for k in (0, 2, 4))
|
|
385
|
+
if token.startswith('#'):
|
|
378
386
|
return None
|
|
379
387
|
if token in _ANSI_RGB:
|
|
380
388
|
return _ANSI_RGB[token]
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
389
|
+
for prefix in ('color:', 'colour:'):
|
|
390
|
+
if token.startswith(prefix):
|
|
391
|
+
token = token[len(prefix):]
|
|
392
|
+
break
|
|
393
|
+
if _DIGITS_RE.match(token) and int(token) < 256:
|
|
384
394
|
return _xterm_rgb(int(token))
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
395
|
+
grey = _GREY_RE.match(token)
|
|
396
|
+
if grey and int(grey.group(1)) <= 100:
|
|
397
|
+
# parse_spec draws the nearest xterm grey, not the exact level.
|
|
398
|
+
target = int(grey.group(1)) * 255 / 100.0
|
|
399
|
+
level = min(_GREY_LEVELS, key=lambda value: abs(value - target))
|
|
400
|
+
return (level, level, level)
|
|
389
401
|
return None
|
|
390
402
|
|
|
391
403
|
|
|
@@ -95,6 +95,11 @@ class Key(str):
|
|
|
95
95
|
return Key(name, self.char, self.mouse, self.event, self.data,
|
|
96
96
|
self.raw)
|
|
97
97
|
|
|
98
|
+
def __reduce__(self):
|
|
99
|
+
# copy, deepcopy and pickle keep char, mouse, event, data and raw.
|
|
100
|
+
return (Key, (str(self), self.char, self.mouse, self.event,
|
|
101
|
+
self.data, self.raw))
|
|
102
|
+
|
|
98
103
|
def __repr__(self):
|
|
99
104
|
return 'Key({0!r})'.format(str(self))
|
|
100
105
|
|
|
@@ -128,6 +133,10 @@ class MouseEvent(tuple):
|
|
|
128
133
|
return MouseEvent(self[0], self[1] - dx, self[2] - dy, self[3],
|
|
129
134
|
self.action, self.mods)
|
|
130
135
|
|
|
136
|
+
def __reduce__(self):
|
|
137
|
+
return (MouseEvent, (self[0], self[1], self[2], self[3], self.action,
|
|
138
|
+
self.mods))
|
|
139
|
+
|
|
131
140
|
def __repr__(self):
|
|
132
141
|
return 'MouseEvent({0}, {1}, {2}, {3}, {4!r})'.format(
|
|
133
142
|
self[0], self[1], self[2], self[3], self.action)
|
|
@@ -354,7 +363,7 @@ def _char_key(code, mods, shifted=None, text=None):
|
|
|
354
363
|
ch = chr(code)
|
|
355
364
|
except (ValueError, OverflowError):
|
|
356
365
|
return None
|
|
357
|
-
if 'shift' in mods and shifted:
|
|
366
|
+
if 'shift' in mods and shifted and shifted < 0x110000:
|
|
358
367
|
ch = chr(shifted)
|
|
359
368
|
mods.remove('shift')
|
|
360
369
|
if code < 32:
|
|
@@ -532,10 +541,18 @@ class KeyParser(object):
|
|
|
532
541
|
if nxt == ESC:
|
|
533
542
|
# ESC + a sequence is that key with Alt (meta sends escape);
|
|
534
543
|
# otherwise an Escape press followed by whatever comes next.
|
|
535
|
-
if i + 2
|
|
544
|
+
if i + 2 >= n:
|
|
545
|
+
return 0, None # which one is decided by more input
|
|
546
|
+
if buf[i + 2] in '[O':
|
|
547
|
+
in_paste = self._paste is not None
|
|
536
548
|
consumed, key = self._escape(buf, i + 1)
|
|
537
549
|
if consumed == 0:
|
|
538
550
|
return 0, None
|
|
551
|
+
if self._paste is not None and not in_paste:
|
|
552
|
+
# Escape, then a bracketed paste: the paste starts at
|
|
553
|
+
# the second ESC, parsed again on the next step.
|
|
554
|
+
self._paste = None
|
|
555
|
+
return 1, Key('escape')
|
|
539
556
|
if (key is not None and str(key) not in
|
|
540
557
|
('paste', 'response', 'focusin', 'focusout')
|
|
541
558
|
and key.mouse is None and self._paste is None):
|
|
@@ -686,7 +703,8 @@ class KeyParser(object):
|
|
|
686
703
|
mods = _mods(_first(fields, 1, 1), kitty=True)
|
|
687
704
|
text = None
|
|
688
705
|
if len(fields) > 2:
|
|
689
|
-
text = ''.join(chr(c) for c in fields[2]
|
|
706
|
+
text = ''.join(chr(c) for c in fields[2]
|
|
707
|
+
if c and c < 0x110000) or None
|
|
690
708
|
key = _char_key(code, mods, shifted, text)
|
|
691
709
|
if key is None:
|
|
692
710
|
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flexablelib-tui
|
|
3
|
-
Version: 3.5.
|
|
3
|
+
Version: 3.5.4
|
|
4
4
|
Summary: Terminal interfaces for flexablelib: widgets, full-screen layout, diff redraw, keyboard input, focus and key bindings.
|
|
5
5
|
Home-page: https://github.com/Opus-Perpetuus/flexablelib
|
|
6
6
|
Author: Benjamin Ramirez
|
|
@@ -17,7 +17,7 @@ Classifier: Topic :: Software Development :: User Interfaces
|
|
|
17
17
|
Requires-Python: >=3.8
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
-
Requires-Dist: flexablelib>=3.5.
|
|
20
|
+
Requires-Dist: flexablelib>=3.5.4
|
|
21
21
|
Dynamic: author
|
|
22
22
|
Dynamic: author-email
|
|
23
23
|
Dynamic: classifier
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
flexablelib>=3.5.4
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
flexablelib>=3.5.2
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flexablelib_tui-3.5.2 → flexablelib_tui-3.5.4}/flexablelib_tui.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|