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.textpad import Textbox
|
||||
from types import FrameType, TracebackType
|
||||
from typing import Literal, override
|
||||
from typing import ClassVar, Literal, Self, override
|
||||
|
||||
from archinstall.lib.translationhandler import tr
|
||||
|
||||
|
|
@ -1240,7 +1240,7 @@ class SelectMenu[ValueT](AbstractCurses[ValueT]):
|
|||
|
||||
|
||||
class Tui:
|
||||
_t: Tui | None = None
|
||||
_t: ClassVar[Self | None] = None
|
||||
|
||||
def __enter__(self) -> None:
|
||||
if Tui._t is None:
|
||||
|
|
@ -1254,10 +1254,10 @@ class Tui:
|
|||
def screen(self) -> curses.window:
|
||||
return self._screen
|
||||
|
||||
@staticmethod
|
||||
def t() -> 'Tui':
|
||||
assert Tui._t is not None
|
||||
return Tui._t
|
||||
@classmethod
|
||||
def t(cls) -> Self:
|
||||
assert cls._t is not None
|
||||
return cls._t
|
||||
|
||||
@staticmethod
|
||||
def shutdown() -> None:
|
||||
|
|
@ -1266,7 +1266,7 @@ class Tui:
|
|||
|
||||
Tui.t().stop()
|
||||
|
||||
def init(self) -> 'Tui':
|
||||
def init(self) -> Self:
|
||||
self._screen = curses.initscr()
|
||||
curses.noecho()
|
||||
curses.cbreak()
|
||||
|
|
|
|||
Loading…
Reference in New Issue