mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-05 23:13:46 +08:00
more import tests
This commit is contained in:
parent
870581c4c6
commit
fbbc396568
@ -4080,18 +4080,18 @@
|
|||||||
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b2/55/64d847b58c501c80b4ea53678e9a",
|
"build/prefab/full/linux_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b2/55/64d847b58c501c80b4ea53678e9a",
|
||||||
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/9f/37/b4553f9f9fda9fb07d7f3f3ab2f6",
|
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/9f/37/b4553f9f9fda9fb07d7f3f3ab2f6",
|
||||||
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/cf/b4/d955fed8589fd59e0f15e69ab568",
|
"build/prefab/full/linux_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/cf/b4/d955fed8589fd59e0f15e69ab568",
|
||||||
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/12/83/23a307429d4a729f562b954400f6",
|
"build/prefab/full/mac_arm64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/0a/e3/4fbc3dc52af3f1b972ef1be52f77",
|
||||||
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b1/2f/33ad58bdcbcb2ac5de570b7b86d4",
|
"build/prefab/full/mac_arm64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/b1/2f/33ad58bdcbcb2ac5de570b7b86d4",
|
||||||
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/a5/56/1b4153622fd9c8d2a1e7f14cf3b7",
|
"build/prefab/full/mac_arm64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/52/98/c2c12cc656073db630da4ef8c996",
|
||||||
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d4/50/fc305556a2926c5c69004b49a09a",
|
"build/prefab/full/mac_arm64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/d4/50/fc305556a2926c5c69004b49a09a",
|
||||||
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/a6/95/4745877e61819b8d9747960ca8d4",
|
"build/prefab/full/mac_x86_64_gui/debug/ballisticakit": "https://files.ballistica.net/cache/ba1/d3/bd/39608485bc10553589523928740e",
|
||||||
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/bc/5d/513cbfa9287f138912cb73f61783",
|
"build/prefab/full/mac_x86_64_gui/release/ballisticakit": "https://files.ballistica.net/cache/ba1/bc/5d/513cbfa9287f138912cb73f61783",
|
||||||
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/79/2d/0606820548fc2d0f84ceff572049",
|
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/ae/b6/653d88e5f1cc84247ad51da0620b",
|
||||||
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e3/71/cd19381bd0a9c81f112dd90868ae",
|
"build/prefab/full/mac_x86_64_server/release/dist/ballisticakit_headless": "https://files.ballistica.net/cache/ba1/e3/71/cd19381bd0a9c81f112dd90868ae",
|
||||||
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/a4/a8/577d056e8566cd1c084db7f8aaab",
|
"build/prefab/full/windows_x86_gui/debug/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/2f/37/31627eb0d24b1d85295c8cbdc52d",
|
||||||
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/c3/33/1967e1c77d409733e636b5883a85",
|
"build/prefab/full/windows_x86_gui/release/BallisticaKit.exe": "https://files.ballistica.net/cache/ba1/bc/e7/8cda7a606b0c572d59c36df0ac52",
|
||||||
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/e4/ed/88f5da9640034d053fd68e34b356",
|
"build/prefab/full/windows_x86_server/debug/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/ec/fd/1de6183cbab383ffd981f319562e",
|
||||||
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/37/c6/42b4eb716aed07f9a9ed5e1b5bc1",
|
"build/prefab/full/windows_x86_server/release/dist/BallisticaKitHeadless.exe": "https://files.ballistica.net/cache/ba1/4d/75/f02f361fff8f8ac49c49823e4638",
|
||||||
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/98/32/43c61f1e11520f764158cf0e76d2",
|
"build/prefab/lib/linux_arm64_gui/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/98/32/43c61f1e11520f764158cf0e76d2",
|
||||||
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ca/65/cba463f21a8f76c5bbfe27cae124",
|
"build/prefab/lib/linux_arm64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/ca/65/cba463f21a8f76c5bbfe27cae124",
|
||||||
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/73/20/119211f1700bb5a410cedf4e76f2",
|
"build/prefab/lib/linux_arm64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/73/20/119211f1700bb5a410cedf4e76f2",
|
||||||
@ -4108,14 +4108,14 @@
|
|||||||
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/90/9b/94f733c3a48691e02240e04dc792",
|
"build/prefab/lib/mac_x86_64_gui/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/90/9b/94f733c3a48691e02240e04dc792",
|
||||||
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2e/c7/873af48627997b6fab4b2c4ba6bc",
|
"build/prefab/lib/mac_x86_64_server/debug/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/2e/c7/873af48627997b6fab4b2c4ba6bc",
|
||||||
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3a/94/4780fada10f0fc3f43a54f29c86f",
|
"build/prefab/lib/mac_x86_64_server/release/libballistica_plus.a": "https://files.ballistica.net/cache/ba1/3a/94/4780fada10f0fc3f43a54f29c86f",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/b7/3d/d6ab07ea8b3b58c6605ae7864eec",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/6f/26/c227f23af91c96c8b1081f74ff1c",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/ad/86/03386a6e15c55e0661e932044c60",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/8c/c8/4b4312d3c6b3293a37dca0661233",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/d3/87/d8024acf61db6b471bc5aa19e57f",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/61/db/055d73f415ebbcd377f0a7f5cd16",
|
||||||
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/f5/1b/783a8c5673613b66fc73b16724ee",
|
"build/prefab/lib/windows/Debug_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/c5/70/4d6a2171de7316f7d8796f526fc9",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/54/92/f516fb3937a7c0c52bffdcb223f2",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.lib": "https://files.ballistica.net/cache/ba1/c7/9f/60f9af18ef8fc02018e96cc2ba0d",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/2b/8c/59209d69c14c866957e83d6a5495",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitGenericPlus.pdb": "https://files.ballistica.net/cache/ba1/59/0c/58ea59ed03c625212ff28ff51092",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/1f/a5/5b2f8514ce9eccadea84c0d1c7e9",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.lib": "https://files.ballistica.net/cache/ba1/b9/40/be2c8f8da250538230feda77589f",
|
||||||
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/d8/d2/727ea6711db0cbc9e03b7a995b46",
|
"build/prefab/lib/windows/Release_Win32/BallisticaKitHeadlessPlus.pdb": "https://files.ballistica.net/cache/ba1/6a/49/ac9574ec9359804b019fb71044f9",
|
||||||
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa",
|
"src/assets/ba_data/python/babase/_mgen/__init__.py": "https://files.ballistica.net/cache/ba1/52/c6/c11130af7b10d6c0321add5518fa",
|
||||||
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1",
|
"src/assets/ba_data/python/babase/_mgen/enums.py": "https://files.ballistica.net/cache/ba1/38/c3/1dedd5e74f2508efc5974c8815a1",
|
||||||
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/4e/07/87dd93e7ef29b8b78d0b4791d6f8",
|
"src/ballistica/base/mgen/pyembed/binding_base.inc": "https://files.ballistica.net/cache/ba1/4e/07/87dd93e7ef29b8b78d0b4791d6f8",
|
||||||
|
|||||||
@ -30,6 +30,6 @@ with specific naming conventions:
|
|||||||
named `bafoobarmeta` ('ba' prefix, name with spaces removed, 'meta' suffix)
|
named `bafoobarmeta` ('ba' prefix, name with spaces removed, 'meta' suffix)
|
||||||
that lives under [meta source files](../../src/meta).
|
that lives under [meta source files](../../src/meta).
|
||||||
- **Test Package**: If feature set `foo_bar` provides a set of tests, it should
|
- **Test Package**: If feature set `foo_bar` provides a set of tests, it should
|
||||||
be a directory named `test_bafoobar` ('test_ba' prefix, name with spaces
|
be a directory named `test_foo_bar` ('test_' prefix, unmodified feature set
|
||||||
removed) under [tests](../../tests).
|
name) under [tests](../../tests).
|
||||||
|
|
||||||
|
|||||||
@ -7,22 +7,30 @@ from __future__ import annotations
|
|||||||
import logging
|
import logging
|
||||||
from typing import cast
|
from typing import cast
|
||||||
|
|
||||||
import bauiv1 as bui
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
import babase
|
||||||
|
from _babase import screenmessage
|
||||||
|
import _bauiv1
|
||||||
|
from bauiv1.ui import Window
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
import bauiv1 as bui
|
||||||
|
|
||||||
|
|
||||||
class OnScreenKeyboardWindow(bui.Window):
|
class OnScreenKeyboardWindow(Window):
|
||||||
"""Simple built-in on-screen keyboard."""
|
"""Simple built-in on-screen keyboard."""
|
||||||
|
|
||||||
def __init__(self, textwidget: bui.Widget, label: str, max_chars: int):
|
def __init__(self, textwidget: bui.Widget, label: str, max_chars: int):
|
||||||
self._target_text = textwidget
|
self._target_text = textwidget
|
||||||
self._width = 700
|
self._width = 700
|
||||||
self._height = 400
|
self._height = 400
|
||||||
assert bui.app.classic is not None
|
assert babase.app.classic is not None
|
||||||
uiscale = bui.app.classic.ui.uiscale
|
uiscale = babase.app.classic.ui.uiscale
|
||||||
top_extra = 20 if uiscale is bui.UIScale.SMALL else 0
|
top_extra = 20 if uiscale is babase.UIScale.SMALL else 0
|
||||||
super().__init__(
|
super().__init__(
|
||||||
root_widget=bui.containerwidget(
|
root_widget=_bauiv1.containerwidget(
|
||||||
parent=bui.get_special_widget('overlay_stack'),
|
parent=_bauiv1.get_special_widget('overlay_stack'),
|
||||||
size=(self._width, self._height + top_extra),
|
size=(self._width, self._height + top_extra),
|
||||||
transition='in_scale',
|
transition='in_scale',
|
||||||
scale_origin_stack_offset=(
|
scale_origin_stack_offset=(
|
||||||
@ -30,49 +38,49 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
),
|
),
|
||||||
scale=(
|
scale=(
|
||||||
2.0
|
2.0
|
||||||
if uiscale is bui.UIScale.SMALL
|
if uiscale is babase.UIScale.SMALL
|
||||||
else 1.5
|
else 1.5
|
||||||
if uiscale is bui.UIScale.MEDIUM
|
if uiscale is babase.UIScale.MEDIUM
|
||||||
else 1.0
|
else 1.0
|
||||||
),
|
),
|
||||||
stack_offset=(0, 0)
|
stack_offset=(0, 0)
|
||||||
if uiscale is bui.UIScale.SMALL
|
if uiscale is babase.UIScale.SMALL
|
||||||
else (0, 0)
|
else (0, 0)
|
||||||
if uiscale is bui.UIScale.MEDIUM
|
if uiscale is babase.UIScale.MEDIUM
|
||||||
else (0, 0),
|
else (0, 0),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self._done_button = bui.buttonwidget(
|
self._done_button = _bauiv1.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width - 200, 44),
|
position=(self._width - 200, 44),
|
||||||
size=(140, 60),
|
size=(140, 60),
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=bui.Lstr(resource='doneText'),
|
label=babase.Lstr(resource='doneText'),
|
||||||
on_activate_call=self._done,
|
on_activate_call=self._done,
|
||||||
)
|
)
|
||||||
bui.containerwidget(
|
_bauiv1.containerwidget(
|
||||||
edit=self._root_widget,
|
edit=self._root_widget,
|
||||||
on_cancel_call=self._cancel,
|
on_cancel_call=self._cancel,
|
||||||
start_button=self._done_button,
|
start_button=self._done_button,
|
||||||
)
|
)
|
||||||
|
|
||||||
bui.textwidget(
|
_bauiv1.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width * 0.5, self._height - 41),
|
position=(self._width * 0.5, self._height - 41),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
scale=0.95,
|
scale=0.95,
|
||||||
text=label,
|
text=label,
|
||||||
maxwidth=self._width - 140,
|
maxwidth=self._width - 140,
|
||||||
color=bui.app.classic.ui.title_color,
|
color=babase.app.classic.ui.title_color,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
)
|
)
|
||||||
|
|
||||||
self._text_field = bui.textwidget(
|
self._text_field = _bauiv1.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(70, self._height - 116),
|
position=(70, self._height - 116),
|
||||||
max_chars=max_chars,
|
max_chars=max_chars,
|
||||||
text=cast(str, bui.textwidget(query=self._target_text)),
|
text=cast(str, _bauiv1.textwidget(query=self._target_text)),
|
||||||
on_return_press_call=self._done,
|
on_return_press_call=self._done,
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
size=(self._width - 140, 55),
|
size=(self._width - 140, 55),
|
||||||
@ -122,7 +130,7 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
key_color = self._key_color
|
key_color = self._key_color
|
||||||
key_color_dark = self._key_color_dark
|
key_color_dark = self._key_color_dark
|
||||||
|
|
||||||
self._click_sound = bui.getsound('click01')
|
self._click_sound = _bauiv1.getsound('click01')
|
||||||
|
|
||||||
# kill prev char keys
|
# kill prev char keys
|
||||||
for key in self._char_keys:
|
for key in self._char_keys:
|
||||||
@ -137,21 +145,21 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
h = row_starts[row_num]
|
h = row_starts[row_num]
|
||||||
# shift key before row 3
|
# shift key before row 3
|
||||||
if row_num == 2 and self._shift_button is None:
|
if row_num == 2 and self._shift_button is None:
|
||||||
self._shift_button = bui.buttonwidget(
|
self._shift_button = _bauiv1.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(h - key_width * 2.0, v),
|
position=(h - key_width * 2.0, v),
|
||||||
size=(key_width * 1.7, key_height),
|
size=(key_width * 1.7, key_height),
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
textcolor=key_textcolor,
|
textcolor=key_textcolor,
|
||||||
color=key_color_dark,
|
color=key_color_dark,
|
||||||
label=bui.charstr(bui.SpecialChar.SHIFT),
|
label=babase.charstr(babase.SpecialChar.SHIFT),
|
||||||
enable_sound=False,
|
enable_sound=False,
|
||||||
extra_touch_border_scale=0.3,
|
extra_touch_border_scale=0.3,
|
||||||
button_type='square',
|
button_type='square',
|
||||||
)
|
)
|
||||||
|
|
||||||
for _ in row:
|
for _ in row:
|
||||||
btn = bui.buttonwidget(
|
btn = _bauiv1.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(h, v),
|
position=(h, v),
|
||||||
size=(key_width, key_height),
|
size=(key_width, key_height),
|
||||||
@ -171,7 +179,7 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
if self._backspace_button is not None:
|
if self._backspace_button is not None:
|
||||||
self._backspace_button.delete()
|
self._backspace_button.delete()
|
||||||
|
|
||||||
self._backspace_button = bui.buttonwidget(
|
self._backspace_button = _bauiv1.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(h + 4, v),
|
position=(h + 4, v),
|
||||||
size=(key_width * 1.8, key_height),
|
size=(key_width * 1.8, key_height),
|
||||||
@ -180,7 +188,7 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
repeat=True,
|
repeat=True,
|
||||||
textcolor=key_textcolor,
|
textcolor=key_textcolor,
|
||||||
color=key_color_dark,
|
color=key_color_dark,
|
||||||
label=bui.charstr(bui.SpecialChar.DELETE),
|
label=babase.charstr(babase.SpecialChar.DELETE),
|
||||||
button_type='square',
|
button_type='square',
|
||||||
on_activate_call=self._del,
|
on_activate_call=self._del,
|
||||||
)
|
)
|
||||||
@ -188,7 +196,7 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
# Do space bar and stuff.
|
# Do space bar and stuff.
|
||||||
if row_num == 2:
|
if row_num == 2:
|
||||||
if self._num_mode_button is None:
|
if self._num_mode_button is None:
|
||||||
self._num_mode_button = bui.buttonwidget(
|
self._num_mode_button = _bauiv1.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(112, v - 8),
|
position=(112, v - 8),
|
||||||
size=(key_width * 2, key_height + 5),
|
size=(key_width * 2, key_height + 5),
|
||||||
@ -201,7 +209,7 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
label='',
|
label='',
|
||||||
)
|
)
|
||||||
if self._emoji_button is None:
|
if self._emoji_button is None:
|
||||||
self._emoji_button = bui.buttonwidget(
|
self._emoji_button = _bauiv1.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(56, v - 8),
|
position=(56, v - 8),
|
||||||
size=(key_width, key_height + 5),
|
size=(key_width, key_height + 5),
|
||||||
@ -209,13 +217,13 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
enable_sound=False,
|
enable_sound=False,
|
||||||
textcolor=key_textcolor,
|
textcolor=key_textcolor,
|
||||||
color=key_color_dark,
|
color=key_color_dark,
|
||||||
label=bui.charstr(bui.SpecialChar.LOGO_FLAT),
|
label=babase.charstr(babase.SpecialChar.LOGO_FLAT),
|
||||||
extra_touch_border_scale=0.3,
|
extra_touch_border_scale=0.3,
|
||||||
button_type='square',
|
button_type='square',
|
||||||
)
|
)
|
||||||
btn1 = self._num_mode_button
|
btn1 = self._num_mode_button
|
||||||
if self._space_button is None:
|
if self._space_button is None:
|
||||||
self._space_button = bui.buttonwidget(
|
self._space_button = _bauiv1.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(210, v - 12),
|
position=(210, v - 12),
|
||||||
size=(key_width * 6.1, key_height + 15),
|
size=(key_width * 6.1, key_height + 15),
|
||||||
@ -224,49 +232,51 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
textcolor=key_textcolor,
|
textcolor=key_textcolor,
|
||||||
color=key_color_dark,
|
color=key_color_dark,
|
||||||
label=bui.Lstr(resource='spaceKeyText'),
|
label=babase.Lstr(resource='spaceKeyText'),
|
||||||
on_activate_call=bui.Call(self._type_char, ' '),
|
on_activate_call=babase.Call(self._type_char, ' '),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Show change instructions only if we have more than one
|
# Show change instructions only if we have more than one
|
||||||
# keyboard option.
|
# keyboard option.
|
||||||
keyboards = (
|
keyboards = (
|
||||||
bui.app.meta.scanresults.exports_of_class(bui.Keyboard)
|
babase.app.meta.scanresults.exports_of_class(
|
||||||
if bui.app.meta.scanresults is not None
|
babase.Keyboard
|
||||||
|
)
|
||||||
|
if babase.app.meta.scanresults is not None
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
if len(keyboards) > 1:
|
if len(keyboards) > 1:
|
||||||
bui.textwidget(
|
_bauiv1.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
h_align='center',
|
h_align='center',
|
||||||
position=(210, v - 70),
|
position=(210, v - 70),
|
||||||
size=(key_width * 6.1, key_height + 15),
|
size=(key_width * 6.1, key_height + 15),
|
||||||
text=bui.Lstr(
|
text=babase.Lstr(
|
||||||
resource='keyboardChangeInstructionsText'
|
resource='keyboardChangeInstructionsText'
|
||||||
),
|
),
|
||||||
scale=0.75,
|
scale=0.75,
|
||||||
)
|
)
|
||||||
btn2 = self._space_button
|
btn2 = self._space_button
|
||||||
btn3 = self._emoji_button
|
btn3 = self._emoji_button
|
||||||
bui.widget(edit=btn1, right_widget=btn2, left_widget=btn3)
|
_bauiv1.widget(edit=btn1, right_widget=btn2, left_widget=btn3)
|
||||||
bui.widget(
|
_bauiv1.widget(
|
||||||
edit=btn2, left_widget=btn1, right_widget=self._done_button
|
edit=btn2, left_widget=btn1, right_widget=self._done_button
|
||||||
)
|
)
|
||||||
bui.widget(edit=btn3, left_widget=btn1)
|
_bauiv1.widget(edit=btn3, left_widget=btn1)
|
||||||
bui.widget(edit=self._done_button, left_widget=btn2)
|
_bauiv1.widget(edit=self._done_button, left_widget=btn2)
|
||||||
|
|
||||||
bui.containerwidget(
|
_bauiv1.containerwidget(
|
||||||
edit=self._root_widget, selected_child=self._char_keys[14]
|
edit=self._root_widget, selected_child=self._char_keys[14]
|
||||||
)
|
)
|
||||||
|
|
||||||
self._refresh()
|
self._refresh()
|
||||||
|
|
||||||
def _get_keyboard(self) -> bui.Keyboard:
|
def _get_keyboard(self) -> bui.Keyboard:
|
||||||
assert bui.app.meta.scanresults is not None
|
assert babase.app.meta.scanresults is not None
|
||||||
classname = bui.app.meta.scanresults.exports_of_class(bui.Keyboard)[
|
classname = babase.app.meta.scanresults.exports_of_class(
|
||||||
self._keyboard_index
|
babase.Keyboard
|
||||||
]
|
)[self._keyboard_index]
|
||||||
kbclass = bui.getclass(classname, bui.Keyboard)
|
kbclass = babase.getclass(classname, babase.Keyboard)
|
||||||
return kbclass()
|
return kbclass()
|
||||||
|
|
||||||
def _refresh(self) -> None:
|
def _refresh(self) -> None:
|
||||||
@ -275,23 +285,23 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
chars = list(self._chars)
|
chars = list(self._chars)
|
||||||
if self._mode == 'caps':
|
if self._mode == 'caps':
|
||||||
chars = [c.upper() for c in chars]
|
chars = [c.upper() for c in chars]
|
||||||
bui.buttonwidget(
|
_bauiv1.buttonwidget(
|
||||||
edit=self._shift_button,
|
edit=self._shift_button,
|
||||||
color=self._key_color_lit
|
color=self._key_color_lit
|
||||||
if self._mode == 'caps'
|
if self._mode == 'caps'
|
||||||
else self._key_color_dark,
|
else self._key_color_dark,
|
||||||
label=bui.charstr(bui.SpecialChar.SHIFT),
|
label=babase.charstr(babase.SpecialChar.SHIFT),
|
||||||
on_activate_call=self._shift,
|
on_activate_call=self._shift,
|
||||||
)
|
)
|
||||||
bui.buttonwidget(
|
_bauiv1.buttonwidget(
|
||||||
edit=self._num_mode_button,
|
edit=self._num_mode_button,
|
||||||
label='123#&*',
|
label='123#&*',
|
||||||
on_activate_call=self._num_mode,
|
on_activate_call=self._num_mode,
|
||||||
)
|
)
|
||||||
bui.buttonwidget(
|
_bauiv1.buttonwidget(
|
||||||
edit=self._emoji_button,
|
edit=self._emoji_button,
|
||||||
color=self._key_color_dark,
|
color=self._key_color_dark,
|
||||||
label=bui.charstr(bui.SpecialChar.LOGO_FLAT),
|
label=babase.charstr(babase.SpecialChar.LOGO_FLAT),
|
||||||
on_activate_call=self._next_mode,
|
on_activate_call=self._next_mode,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -299,21 +309,21 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
chars = list(self._keyboard.nums)
|
chars = list(self._keyboard.nums)
|
||||||
else:
|
else:
|
||||||
chars = list(self._keyboard.pages[self._mode])
|
chars = list(self._keyboard.pages[self._mode])
|
||||||
bui.buttonwidget(
|
_bauiv1.buttonwidget(
|
||||||
edit=self._shift_button,
|
edit=self._shift_button,
|
||||||
color=self._key_color_dark,
|
color=self._key_color_dark,
|
||||||
label='',
|
label='',
|
||||||
on_activate_call=self._null_press,
|
on_activate_call=self._null_press,
|
||||||
)
|
)
|
||||||
bui.buttonwidget(
|
_bauiv1.buttonwidget(
|
||||||
edit=self._num_mode_button,
|
edit=self._num_mode_button,
|
||||||
label='abc',
|
label='abc',
|
||||||
on_activate_call=self._abc_mode,
|
on_activate_call=self._abc_mode,
|
||||||
)
|
)
|
||||||
bui.buttonwidget(
|
_bauiv1.buttonwidget(
|
||||||
edit=self._emoji_button,
|
edit=self._emoji_button,
|
||||||
color=self._key_color_dark,
|
color=self._key_color_dark,
|
||||||
label=bui.charstr(bui.SpecialChar.LOGO_FLAT),
|
label=babase.charstr(babase.SpecialChar.LOGO_FLAT),
|
||||||
on_activate_call=self._next_mode,
|
on_activate_call=self._next_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -324,7 +334,7 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
# No such char.
|
# No such char.
|
||||||
have_char = False
|
have_char = False
|
||||||
pagename = self._mode
|
pagename = self._mode
|
||||||
if bui.do_once():
|
if babase.do_once():
|
||||||
errstr = (
|
errstr = (
|
||||||
f'Size of page "{pagename}" of keyboard'
|
f'Size of page "{pagename}" of keyboard'
|
||||||
f' "{self._keyboard.name}" is incorrect:'
|
f' "{self._keyboard.name}" is incorrect:'
|
||||||
@ -332,10 +342,10 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
f' (size of default "normal" page)'
|
f' (size of default "normal" page)'
|
||||||
)
|
)
|
||||||
logging.error(errstr)
|
logging.error(errstr)
|
||||||
bui.buttonwidget(
|
_bauiv1.buttonwidget(
|
||||||
edit=btn,
|
edit=btn,
|
||||||
label=chars[i] if have_char else ' ',
|
label=chars[i] if have_char else ' ',
|
||||||
on_activate_call=bui.Call(
|
on_activate_call=babase.Call(
|
||||||
self._type_char, chars[i] if have_char else ' '
|
self._type_char, chars[i] if have_char else ' '
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -360,20 +370,22 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
self._refresh()
|
self._refresh()
|
||||||
|
|
||||||
def _next_keyboard(self) -> None:
|
def _next_keyboard(self) -> None:
|
||||||
assert bui.app.meta.scanresults is not None
|
assert babase.app.meta.scanresults is not None
|
||||||
kbexports = bui.app.meta.scanresults.exports_of_class(bui.Keyboard)
|
kbexports = babase.app.meta.scanresults.exports_of_class(
|
||||||
|
babase.Keyboard
|
||||||
|
)
|
||||||
self._keyboard_index = (self._keyboard_index + 1) % len(kbexports)
|
self._keyboard_index = (self._keyboard_index + 1) % len(kbexports)
|
||||||
|
|
||||||
self._load_keyboard()
|
self._load_keyboard()
|
||||||
if len(kbexports) < 2:
|
if len(kbexports) < 2:
|
||||||
bui.getsound('error').play()
|
_bauiv1.getsound('error').play()
|
||||||
bui.screenmessage(
|
screenmessage(
|
||||||
bui.Lstr(resource='keyboardNoOthersAvailableText'),
|
babase.Lstr(resource='keyboardNoOthersAvailableText'),
|
||||||
color=(1, 0, 0),
|
color=(1, 0, 0),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
bui.screenmessage(
|
screenmessage(
|
||||||
bui.Lstr(
|
babase.Lstr(
|
||||||
resource='keyboardSwitchText',
|
resource='keyboardSwitchText',
|
||||||
subs=[('${NAME}', self._keyboard.name)],
|
subs=[('${NAME}', self._keyboard.name)],
|
||||||
),
|
),
|
||||||
@ -394,29 +406,29 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
|
|
||||||
def _del(self) -> None:
|
def _del(self) -> None:
|
||||||
self._click_sound.play()
|
self._click_sound.play()
|
||||||
txt = cast(str, bui.textwidget(query=self._text_field))
|
txt = cast(str, _bauiv1.textwidget(query=self._text_field))
|
||||||
# pylint: disable=unsubscriptable-object
|
# pylint: disable=unsubscriptable-object
|
||||||
txt = txt[:-1]
|
txt = txt[:-1]
|
||||||
bui.textwidget(edit=self._text_field, text=txt)
|
_bauiv1.textwidget(edit=self._text_field, text=txt)
|
||||||
|
|
||||||
def _type_char(self, char: str) -> None:
|
def _type_char(self, char: str) -> None:
|
||||||
self._click_sound.play()
|
self._click_sound.play()
|
||||||
if char.isspace():
|
if char.isspace():
|
||||||
if (
|
if (
|
||||||
bui.apptime() - self._last_space_press
|
babase.apptime() - self._last_space_press
|
||||||
< self._double_space_interval
|
< self._double_space_interval
|
||||||
):
|
):
|
||||||
self._last_space_press = 0
|
self._last_space_press = 0
|
||||||
self._next_keyboard()
|
self._next_keyboard()
|
||||||
self._del() # We typed unneeded space around 1s ago.
|
self._del() # We typed unneeded space around 1s ago.
|
||||||
return
|
return
|
||||||
self._last_space_press = bui.apptime()
|
self._last_space_press = babase.apptime()
|
||||||
|
|
||||||
# Operate in unicode so we don't do anything funky like chop utf-8
|
# Operate in unicode so we don't do anything funky like chop utf-8
|
||||||
# chars in half.
|
# chars in half.
|
||||||
txt = cast(str, bui.textwidget(query=self._text_field))
|
txt = cast(str, _bauiv1.textwidget(query=self._text_field))
|
||||||
txt += char
|
txt += char
|
||||||
bui.textwidget(edit=self._text_field, text=txt)
|
_bauiv1.textwidget(edit=self._text_field, text=txt)
|
||||||
|
|
||||||
# If we were caps, go back only if not Shift is pressed twice.
|
# If we were caps, go back only if not Shift is pressed twice.
|
||||||
if self._mode == 'caps' and not self._double_press_shift:
|
if self._mode == 'caps' and not self._double_press_shift:
|
||||||
@ -424,13 +436,13 @@ class OnScreenKeyboardWindow(bui.Window):
|
|||||||
self._refresh()
|
self._refresh()
|
||||||
|
|
||||||
def _cancel(self) -> None:
|
def _cancel(self) -> None:
|
||||||
bui.getsound('swish').play()
|
_bauiv1.getsound('swish').play()
|
||||||
bui.containerwidget(edit=self._root_widget, transition='out_scale')
|
_bauiv1.containerwidget(edit=self._root_widget, transition='out_scale')
|
||||||
|
|
||||||
def _done(self) -> None:
|
def _done(self) -> None:
|
||||||
bui.containerwidget(edit=self._root_widget, transition='out_scale')
|
_bauiv1.containerwidget(edit=self._root_widget, transition='out_scale')
|
||||||
if self._target_text:
|
if self._target_text:
|
||||||
bui.textwidget(
|
_bauiv1.textwidget(
|
||||||
edit=self._target_text,
|
edit=self._target_text,
|
||||||
text=cast(str, bui.textwidget(query=self._text_field)),
|
text=cast(str, _bauiv1.textwidget(query=self._text_field)),
|
||||||
)
|
)
|
||||||
|
|||||||
@ -10,11 +10,10 @@ from batools import testrun
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
testrun.test_runs_disabled(),
|
testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason()
|
||||||
reason='Test app runs disabled here.',
|
|
||||||
)
|
)
|
||||||
def test_babase_imports() -> None:
|
def test_imports() -> None:
|
||||||
"""Testing."""
|
"""Test imports for our featureset."""
|
||||||
|
|
||||||
# Make sure our package and binary module can be cleanly imported by
|
# Make sure our package and binary module can be cleanly imported by
|
||||||
# themselves.
|
# themselves.
|
||||||
1
tests/test_plus/__init__.py
Normal file
1
tests/test_plus/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Released under the MIT License. See LICENSE for details.
|
||||||
21
tests/test_plus/test_imports.py
Normal file
21
tests/test_plus/test_imports.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Released under the MIT License. See LICENSE for details.
|
||||||
|
#
|
||||||
|
"""Testing asset manager functionality."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from batools import testrun
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason()
|
||||||
|
)
|
||||||
|
def test_imports() -> None:
|
||||||
|
"""Test imports for our featureset."""
|
||||||
|
|
||||||
|
# Make sure our package and binary module can be cleanly imported by
|
||||||
|
# themselves.
|
||||||
|
testrun.run_command('import baplus')
|
||||||
|
testrun.run_command('import _baplus')
|
||||||
1
tests/test_ui_v1/__init__.py
Normal file
1
tests/test_ui_v1/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Released under the MIT License. See LICENSE for details.
|
||||||
21
tests/test_ui_v1/test_imports.py
Normal file
21
tests/test_ui_v1/test_imports.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Released under the MIT License. See LICENSE for details.
|
||||||
|
#
|
||||||
|
"""Testing asset manager functionality."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from batools import testrun
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
testrun.test_runs_disabled(), reason=testrun.test_runs_disabled_reason()
|
||||||
|
)
|
||||||
|
def test_imports() -> None:
|
||||||
|
"""Test imports for our featureset."""
|
||||||
|
|
||||||
|
# Make sure our package and binary module can be cleanly imported by
|
||||||
|
# themselves.
|
||||||
|
testrun.run_command('import bauiv1')
|
||||||
|
testrun.run_command('import _bauiv1')
|
||||||
@ -147,7 +147,7 @@ class FeatureSet:
|
|||||||
@property
|
@property
|
||||||
def name_python_package_tests(self) -> str:
|
def name_python_package_tests(self) -> str:
|
||||||
"""The name of our Python tests package."""
|
"""The name of our Python tests package."""
|
||||||
return f'test_ba{self.name_compact}'
|
return f'test_{self.name}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name_python_binary_module(self) -> str:
|
def name_python_binary_module(self) -> str:
|
||||||
|
|||||||
@ -24,6 +24,12 @@ def test_runs_disabled() -> bool:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def test_runs_disabled_reason() -> str:
|
||||||
|
"""Why are test runs disabled here?"""
|
||||||
|
# Can get more specific later.
|
||||||
|
return 'App test runs disabled here.'
|
||||||
|
|
||||||
|
|
||||||
def get_binary() -> str:
|
def get_binary() -> str:
|
||||||
"""Return a path to a server build binary, building it if need be."""
|
"""Return a path to a server build binary, building it if need be."""
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user