curses-utils2 0.4.0__tar.gz → 0.5.0__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.
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/PKG-INFO +1 -1
- curses_utils2-0.5.0/curses_utils2/__init__.py +1 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/list3_v2.py +12 -4
- curses_utils2-0.5.0/curses_utils2/list3m.py +57 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/winbox.py +1 -1
- curses_utils2-0.4.0/curses_utils2/__init__.py +0 -1
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/LICENSE +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/README.rst +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/app.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/list1.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/list1_v2.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/list1m.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/list1m_v2.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/list3.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/listbox.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/proto.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/py.typed +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/text.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/curses_utils2/win.py +0 -0
- {curses_utils2-0.4.0 → curses_utils2-0.5.0}/pyproject.toml +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.5.0'
|
|
@@ -39,8 +39,16 @@ class List3v2(WinProto):
|
|
|
39
39
|
|
|
40
40
|
def set_win(self, win: curses.window | None):
|
|
41
41
|
self.win = win
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
|
|
43
|
+
if not win:
|
|
44
|
+
return
|
|
45
|
+
|
|
46
|
+
rows, _ = win.getmaxyx()
|
|
47
|
+
if rows < self.height:
|
|
48
|
+
self.win = None
|
|
49
|
+
return
|
|
50
|
+
|
|
51
|
+
win.keypad(True)
|
|
44
52
|
|
|
45
53
|
def addstr(self, i: int, g: Generator[str], attr: int = 0):
|
|
46
54
|
if not self.win:
|
|
@@ -123,8 +131,8 @@ class List3v2(WinProto):
|
|
|
123
131
|
self.cur += 1
|
|
124
132
|
else:
|
|
125
133
|
self.win.move(0, 0)
|
|
126
|
-
self.
|
|
127
|
-
|
|
134
|
+
for _ in range(self.height):
|
|
135
|
+
self.win.deleteln()
|
|
128
136
|
self.cur = rows - 1
|
|
129
137
|
self.addstr(self.cur, next_s, attr=self.current_color)
|
|
130
138
|
self.idx += 1
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import curses
|
|
2
|
+
|
|
3
|
+
from .list3_v2 import List3v2, ListProto3
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class List3mProto(ListProto3):
|
|
7
|
+
def record_move_up(self, i: int) -> bool: # type: ignore[empty-body]
|
|
8
|
+
pass
|
|
9
|
+
|
|
10
|
+
def record_move_down(self, i: int) -> bool: # type: ignore[empty-body]
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class List3m(List3v2):
|
|
15
|
+
'List + move_up(), move_down()'
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
proto: List3mProto,
|
|
20
|
+
**kwargs,
|
|
21
|
+
):
|
|
22
|
+
super().__init__(proto, **kwargs)
|
|
23
|
+
self.proto: List3mProto = proto
|
|
24
|
+
|
|
25
|
+
def move_up(self, i: int):
|
|
26
|
+
if not self.proto.record_move_up(i):
|
|
27
|
+
return
|
|
28
|
+
if self.idx > 0:
|
|
29
|
+
self.idx -= 1
|
|
30
|
+
if self.cur > 0:
|
|
31
|
+
self.cur -= 1
|
|
32
|
+
self.refresh()
|
|
33
|
+
|
|
34
|
+
def move_down(self, i: int):
|
|
35
|
+
if not self.win:
|
|
36
|
+
return
|
|
37
|
+
if not self.proto.record_move_down(i):
|
|
38
|
+
return
|
|
39
|
+
len_ = self.proto.records_len()
|
|
40
|
+
rows, _ = self.win.getmaxyx()
|
|
41
|
+
rows //= self.height
|
|
42
|
+
if self.idx + 1 < len_:
|
|
43
|
+
self.idx += 1
|
|
44
|
+
if self.cur + 1 < rows:
|
|
45
|
+
self.cur += 1
|
|
46
|
+
self.refresh()
|
|
47
|
+
|
|
48
|
+
def handle_input(self, ch: int) -> bool:
|
|
49
|
+
if super().handle_input(ch):
|
|
50
|
+
return True
|
|
51
|
+
if ch == curses.KEY_SR: # Shift-Up
|
|
52
|
+
self.move_up(self.idx)
|
|
53
|
+
elif ch == curses.KEY_SF: # Shift-Down
|
|
54
|
+
self.move_down(self.idx)
|
|
55
|
+
else:
|
|
56
|
+
return False
|
|
57
|
+
return True
|
|
@@ -16,9 +16,9 @@ class WinBox:
|
|
|
16
16
|
'offy: y offset, offx: x offset'
|
|
17
17
|
self.body = body
|
|
18
18
|
self.offy, self.offx = offy, offx
|
|
19
|
+
self.win: curses.window | None = None
|
|
19
20
|
|
|
20
21
|
def set_win(self, win: curses.window | None):
|
|
21
|
-
# pylint: disable=attribute-defined-outside-init
|
|
22
22
|
self.win = win
|
|
23
23
|
|
|
24
24
|
if not win:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '0.4.0'
|
|
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
|
|
File without changes
|