curses-utils2 0.4.0__tar.gz → 0.4.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: curses-utils2
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: A curses utils
5
5
  Project-URL: homepage, https://github.com/shamilbi/curses-utils2
6
6
  Author-email: Shamil Bikineyev <shamilbi@gmail.com>
@@ -0,0 +1 @@
1
+ __version__ = '0.4.1'
@@ -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
- if win:
43
- win.keypad(True)
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.win.deleteln()
127
- self.win.deleteln()
134
+ for i 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
@@ -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