mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-01 20:33:46 +08:00
type-checking fix
This commit is contained in:
parent
6a2471cf77
commit
448eafd13f
@ -30,7 +30,7 @@ from ba import charstr
|
|||||||
from ba import SpecialChar as SpCh
|
from ba import SpecialChar as SpCh
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import List, Tuple, Optional, Type
|
from typing import List, Tuple, Optional
|
||||||
|
|
||||||
|
|
||||||
class OnScreenKeyboardWindow(ba.Window):
|
class OnScreenKeyboardWindow(ba.Window):
|
||||||
@ -242,13 +242,13 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
|
|
||||||
self._refresh()
|
self._refresh()
|
||||||
|
|
||||||
def _get_keyboard(self) -> Type[ba.Keyboard]:
|
def _get_keyboard(self) -> ba.Keyboard:
|
||||||
assert ba.app.metascan is not None
|
assert ba.app.metascan is not None
|
||||||
path = ba.app.metascan.keyboards[self._keyboard_index]
|
path = ba.app.metascan.keyboards[self._keyboard_index]
|
||||||
classname = path.split('.')[-1]
|
classname = path.split('.')[-1]
|
||||||
module = path[:-len(classname) - 1]
|
module = path[:-len(classname) - 1]
|
||||||
keyboard = getattr(__import__(module), classname)
|
keyboard = getattr(__import__(module), classname)()
|
||||||
assert issubclass(keyboard, ba.Keyboard)
|
assert isinstance(keyboard, ba.Keyboard)
|
||||||
return keyboard
|
return keyboard
|
||||||
|
|
||||||
def _refresh(self) -> None:
|
def _refresh(self) -> None:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user