Use Self for Tui (#4130)
This commit is contained in:
parent
2c85b5eab0
commit
2c154245cb
|
|
@ -9,7 +9,7 @@ from collections.abc import Callable
|
||||||
from curses.ascii import isprint
|
from curses.ascii import isprint
|
||||||
from curses.textpad import Textbox
|
from curses.textpad import Textbox
|
||||||
from types import FrameType, TracebackType
|
from types import FrameType, TracebackType
|
||||||
from typing import Literal, override
|
from typing import ClassVar, Literal, Self, override
|
||||||
|
|
||||||
from archinstall.lib.translationhandler import tr
|
from archinstall.lib.translationhandler import tr
|
||||||
|
|
||||||
|
|
@ -1240,7 +1240,7 @@ class SelectMenu[ValueT](AbstractCurses[ValueT]):
|
||||||
|
|
||||||
|
|
||||||
class Tui:
|
class Tui:
|
||||||
_t: Tui | None = None
|
_t: ClassVar[Self | None] = None
|
||||||
|
|
||||||
def __enter__(self) -> None:
|
def __enter__(self) -> None:
|
||||||
if Tui._t is None:
|
if Tui._t is None:
|
||||||
|
|
@ -1254,10 +1254,10 @@ class Tui:
|
||||||
def screen(self) -> curses.window:
|
def screen(self) -> curses.window:
|
||||||
return self._screen
|
return self._screen
|
||||||
|
|
||||||
@staticmethod
|
@classmethod
|
||||||
def t() -> 'Tui':
|
def t(cls) -> Self:
|
||||||
assert Tui._t is not None
|
assert cls._t is not None
|
||||||
return Tui._t
|
return cls._t
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def shutdown() -> None:
|
def shutdown() -> None:
|
||||||
|
|
@ -1266,7 +1266,7 @@ class Tui:
|
||||||
|
|
||||||
Tui.t().stop()
|
Tui.t().stop()
|
||||||
|
|
||||||
def init(self) -> 'Tui':
|
def init(self) -> Self:
|
||||||
self._screen = curses.initscr()
|
self._screen = curses.initscr()
|
||||||
curses.noecho()
|
curses.noecho()
|
||||||
curses.cbreak()
|
curses.cbreak()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue