mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-07 08:03:30 +08:00
Fixing conflicts
This commit is contained in:
parent
06174ef34c
commit
17e995f227
@ -13,11 +13,6 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
"""Settings window for touchscreens."""
|
"""Settings window for touchscreens."""
|
||||||
|
|
||||||
def __del__(self) -> None:
|
def __del__(self) -> None:
|
||||||
# Note - this happens in 'back' too;
|
|
||||||
# we just do it here too in case the window is closed by other means.
|
|
||||||
|
|
||||||
# FIXME: Could switch to a UI destroy callback now that those are a
|
|
||||||
# thing that exists.
|
|
||||||
bs.set_touchscreen_editing(False)
|
bs.set_touchscreen_editing(False)
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@ -25,9 +20,9 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
transition: str | None = 'in_right',
|
transition: str | None = 'in_right',
|
||||||
origin_widget: bui.Widget | None = None,
|
origin_widget: bui.Widget | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self._width = 650
|
self._width = 780
|
||||||
self._height = 380
|
self._height = 380
|
||||||
self._spacing = 40
|
# self._spacing = 40
|
||||||
self._r = 'configTouchscreenWindow'
|
self._r = 'configTouchscreenWindow'
|
||||||
|
|
||||||
bs.set_touchscreen_editing(True)
|
bs.set_touchscreen_editing(True)
|
||||||
@ -47,6 +42,9 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
if uiscale is bui.UIScale.SMALL
|
if uiscale is bui.UIScale.SMALL
|
||||||
else 'menu_full'
|
else 'menu_full'
|
||||||
),
|
),
|
||||||
|
stack_offset=(
|
||||||
|
(0, -20) if uiscale is bui.UIScale.SMALL else (0, 0)
|
||||||
|
),
|
||||||
),
|
),
|
||||||
transition=transition,
|
transition=transition,
|
||||||
origin_widget=origin_widget,
|
origin_widget=origin_widget,
|
||||||
@ -56,22 +54,21 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
bui.containerwidget(
|
bui.containerwidget(
|
||||||
edit=self._root_widget, on_cancel_call=self.main_window_back
|
edit=self._root_widget, on_cancel_call=self.main_window_back
|
||||||
)
|
)
|
||||||
btn = None
|
|
||||||
else:
|
else:
|
||||||
btn = bui.buttonwidget(
|
btn = bui.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(55, self._height - 60),
|
position=(55, self._height - 60),
|
||||||
size=(120, 60),
|
size=(60, 60),
|
||||||
label=bui.Lstr(resource='backText'),
|
label=bui.charstr(bui.SpecialChar.BACK),
|
||||||
button_type='back',
|
button_type='backSmall',
|
||||||
scale=0.8,
|
scale=0.8,
|
||||||
on_activate_call=self.main_window_back
|
on_activate_call=self.main_window_back,
|
||||||
)
|
)
|
||||||
bui.containerwidget(edit=self._root_widget, cancel_button=btn)
|
bui.containerwidget(edit=self._root_widget, cancel_button=btn)
|
||||||
|
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(25, self._height - 62),
|
position=(25, self._height - 57),
|
||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=bui.Lstr(resource=f'{self._r}.titleText'),
|
text=bui.Lstr(resource=f'{self._r}.titleText'),
|
||||||
color=bui.app.ui_v1.title_color,
|
color=bui.app.ui_v1.title_color,
|
||||||
@ -80,13 +77,6 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
v_align='center',
|
v_align='center',
|
||||||
)
|
)
|
||||||
|
|
||||||
bui.buttonwidget(
|
|
||||||
edit=btn,
|
|
||||||
button_type='backSmall',
|
|
||||||
size=(60, 60),
|
|
||||||
label=bui.charstr(bui.SpecialChar.BACK),
|
|
||||||
)
|
|
||||||
|
|
||||||
self._scroll_width = self._width - 100
|
self._scroll_width = self._width - 100
|
||||||
self._scroll_height = self._height - 110
|
self._scroll_height = self._height - 110
|
||||||
self._sub_width = self._scroll_width - 20
|
self._sub_width = self._scroll_width - 20
|
||||||
@ -124,6 +114,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _build_gui(self) -> None:
|
def _build_gui(self) -> None:
|
||||||
|
# pylint: disable=too-many-locals
|
||||||
from bauiv1lib.config import ConfigNumberEdit, ConfigCheckBox
|
from bauiv1lib.config import ConfigNumberEdit, ConfigCheckBox
|
||||||
from bauiv1lib.radiogroup import make_radio_group
|
from bauiv1lib.radiogroup import make_radio_group
|
||||||
|
|
||||||
@ -132,13 +123,16 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
for child in children:
|
for child in children:
|
||||||
child.delete()
|
child.delete()
|
||||||
h = 30
|
h = 30
|
||||||
|
hoffs = 100
|
||||||
|
hoffs2 = 70
|
||||||
|
hoffs3 = 320
|
||||||
v = self._sub_height - 85
|
v = self._sub_height - 85
|
||||||
clr = (0.8, 0.8, 0.8, 1.0)
|
clr = (0.8, 0.8, 0.8, 1.0)
|
||||||
clr2 = (0.8, 0.8, 0.8)
|
clr2 = (0.8, 0.8, 0.8)
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
parent=self._subcontainer,
|
parent=self._subcontainer,
|
||||||
position=(-10, v + 43),
|
position=(self._sub_width * 0.5, v + 63),
|
||||||
size=(self._sub_width, 25),
|
size=(0, 0),
|
||||||
text=bui.Lstr(resource=f'{self._r}.swipeInfoText'),
|
text=bui.Lstr(resource=f'{self._r}.swipeInfoText'),
|
||||||
flatness=1.0,
|
flatness=1.0,
|
||||||
color=(0, 0.9, 0.1, 0.7),
|
color=(0, 0.9, 0.1, 0.7),
|
||||||
@ -159,7 +153,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
)
|
)
|
||||||
cb1 = bui.checkboxwidget(
|
cb1 = bui.checkboxwidget(
|
||||||
parent=self._subcontainer,
|
parent=self._subcontainer,
|
||||||
position=(h + 220, v),
|
position=(h + hoffs + 220, v),
|
||||||
size=(170, 30),
|
size=(170, 30),
|
||||||
text=bui.Lstr(resource=f'{self._r}.joystickText'),
|
text=bui.Lstr(resource=f'{self._r}.joystickText'),
|
||||||
maxwidth=100,
|
maxwidth=100,
|
||||||
@ -168,7 +162,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
)
|
)
|
||||||
cb2 = bui.checkboxwidget(
|
cb2 = bui.checkboxwidget(
|
||||||
parent=self._subcontainer,
|
parent=self._subcontainer,
|
||||||
position=(h + 357, v),
|
position=(h + hoffs + 357, v),
|
||||||
size=(170, 30),
|
size=(170, 30),
|
||||||
text=bui.Lstr(resource=f'{self._r}.swipeText'),
|
text=bui.Lstr(resource=f'{self._r}.swipeText'),
|
||||||
maxwidth=100,
|
maxwidth=100,
|
||||||
@ -183,7 +177,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
ConfigNumberEdit(
|
ConfigNumberEdit(
|
||||||
parent=self._subcontainer,
|
parent=self._subcontainer,
|
||||||
position=(h, v),
|
position=(h, v),
|
||||||
xoffset=65,
|
xoffset=hoffs2 + 65,
|
||||||
configkey='Touch Controls Scale Movement',
|
configkey='Touch Controls Scale Movement',
|
||||||
displayname=bui.Lstr(
|
displayname=bui.Lstr(
|
||||||
resource=f'{self._r}.movementControlScaleText'
|
resource=f'{self._r}.movementControlScaleText'
|
||||||
@ -206,7 +200,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
)
|
)
|
||||||
cb1 = bui.checkboxwidget(
|
cb1 = bui.checkboxwidget(
|
||||||
parent=self._subcontainer,
|
parent=self._subcontainer,
|
||||||
position=(h + 220, v),
|
position=(h + hoffs + 220, v),
|
||||||
size=(170, 30),
|
size=(170, 30),
|
||||||
text=bui.Lstr(resource=f'{self._r}.buttonsText'),
|
text=bui.Lstr(resource=f'{self._r}.buttonsText'),
|
||||||
maxwidth=100,
|
maxwidth=100,
|
||||||
@ -215,7 +209,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
)
|
)
|
||||||
cb2 = bui.checkboxwidget(
|
cb2 = bui.checkboxwidget(
|
||||||
parent=self._subcontainer,
|
parent=self._subcontainer,
|
||||||
position=(h + 357, v),
|
position=(h + hoffs + 357, v),
|
||||||
size=(170, 30),
|
size=(170, 30),
|
||||||
text=bui.Lstr(resource=f'{self._r}.swipeText'),
|
text=bui.Lstr(resource=f'{self._r}.swipeText'),
|
||||||
maxwidth=100,
|
maxwidth=100,
|
||||||
@ -229,7 +223,7 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
ConfigNumberEdit(
|
ConfigNumberEdit(
|
||||||
parent=self._subcontainer,
|
parent=self._subcontainer,
|
||||||
position=(h, v),
|
position=(h, v),
|
||||||
xoffset=65,
|
xoffset=hoffs2 + 65,
|
||||||
configkey='Touch Controls Scale Actions',
|
configkey='Touch Controls Scale Actions',
|
||||||
displayname=bui.Lstr(resource=f'{self._r}.actionControlScaleText'),
|
displayname=bui.Lstr(resource=f'{self._r}.actionControlScaleText'),
|
||||||
changesound=False,
|
changesound=False,
|
||||||
@ -239,13 +233,23 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
)
|
)
|
||||||
|
|
||||||
v -= 50
|
v -= 50
|
||||||
|
bui.textwidget(
|
||||||
|
parent=self._subcontainer,
|
||||||
|
position=(h, v - 2),
|
||||||
|
size=(0, 30),
|
||||||
|
text=bui.Lstr(resource=f'{self._r}.swipeControlsHiddenText'),
|
||||||
|
maxwidth=190,
|
||||||
|
color=clr,
|
||||||
|
v_align='center',
|
||||||
|
)
|
||||||
|
|
||||||
ConfigCheckBox(
|
ConfigCheckBox(
|
||||||
parent=self._subcontainer,
|
parent=self._subcontainer,
|
||||||
position=(h, v),
|
position=(h + hoffs3, v),
|
||||||
size=(400, 30),
|
size=(100, 30),
|
||||||
maxwidth=400,
|
maxwidth=400,
|
||||||
configkey='Touch Controls Swipe Hidden',
|
configkey='Touch Controls Swipe Hidden',
|
||||||
displayname=bui.Lstr(resource=f'{self._r}.swipeControlsHiddenText'),
|
displayname='',
|
||||||
)
|
)
|
||||||
v -= 65
|
v -= 65
|
||||||
|
|
||||||
@ -299,18 +303,18 @@ class TouchscreenSettingsWindow(bui.MainWindow):
|
|||||||
cfg.apply_and_commit()
|
cfg.apply_and_commit()
|
||||||
bui.apptimer(0, self._build_gui)
|
bui.apptimer(0, self._build_gui)
|
||||||
|
|
||||||
def _back(self) -> None:
|
# def _back(self) -> None:
|
||||||
from bauiv1lib.settings import controls
|
# from bauiv1lib.settings import controls
|
||||||
|
|
||||||
# no-op if our underlying widget is dead or on its way out.
|
# # no-op if our underlying widget is dead or on its way out.
|
||||||
if not self._root_widget or self._root_widget.transitioning_out:
|
# if not self._root_widget or self._root_widget.transitioning_out:
|
||||||
return
|
# return
|
||||||
|
|
||||||
bui.containerwidget(edit=self._root_widget, transition='out_right')
|
# bui.containerwidget(edit=self._root_widget, transition='out_right')
|
||||||
assert bui.app.classic is not None
|
# assert bui.app.classic is not None
|
||||||
bui.app.ui_v1.set_main_window(
|
# bui.app.ui_v1.set_main_window(
|
||||||
controls.ControlsSettingsWindow(transition='in_left'),
|
# controls.ControlsSettingsWindow(transition='in_left'),
|
||||||
from_window=self,
|
# from_window=self,
|
||||||
is_back=True,
|
# is_back=True,
|
||||||
)
|
# )
|
||||||
bs.set_touchscreen_editing(False)
|
# bs.set_touchscreen_editing(False)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user