mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-07 08:03:30 +08:00
The reset.
This commit is contained in:
parent
f11d4ac261
commit
878665391e
@ -13,7 +13,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
|
|
||||||
def get_input_device_mapped_value(
|
def get_input_device_mapped_value(
|
||||||
devicename: str, unique_id: str, name: str
|
devicename: str, unique_id: str, name: str, default: bool = False,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
"""Returns a mapped value for an input device.
|
"""Returns a mapped value for an input device.
|
||||||
|
|
||||||
@ -30,8 +30,9 @@ def get_input_device_mapped_value(
|
|||||||
subplatform = app.classic.subplatform
|
subplatform = app.classic.subplatform
|
||||||
appconfig = babase.app.config
|
appconfig = babase.app.config
|
||||||
|
|
||||||
# If there's an entry in our config for this controller, use it.
|
# If there's an entry in our config for this controller and
|
||||||
if 'Controllers' in appconfig:
|
# we're not looking for our default mappings, use it.
|
||||||
|
if 'Controllers' in appconfig and not default:
|
||||||
ccfgs = appconfig['Controllers']
|
ccfgs = appconfig['Controllers']
|
||||||
if devicename in ccfgs:
|
if devicename in ccfgs:
|
||||||
mapping = None
|
mapping = None
|
||||||
|
|||||||
@ -570,7 +570,7 @@ class ClassicSubsystem(babase.AppSubsystem):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def get_input_device_mapped_value(
|
def get_input_device_mapped_value(
|
||||||
self, device: bascenev1.InputDevice, name: str
|
self, device: bascenev1.InputDevice, name: str, default: bool = False,
|
||||||
) -> Any:
|
) -> Any:
|
||||||
"""Returns a mapped value for an input device.
|
"""Returns a mapped value for an input device.
|
||||||
|
|
||||||
@ -578,7 +578,7 @@ class ClassicSubsystem(babase.AppSubsystem):
|
|||||||
where available.
|
where available.
|
||||||
"""
|
"""
|
||||||
return _input.get_input_device_mapped_value(
|
return _input.get_input_device_mapped_value(
|
||||||
device.name, device.unique_identifier, name
|
device.name, device.unique_identifier, name, default
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_input_device_map_hash(
|
def get_input_device_map_hash(
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
self._is_main_menu = is_main_menu
|
self._is_main_menu = is_main_menu
|
||||||
self._displayname = self._name
|
self._displayname = self._name
|
||||||
self._width = 700 if self._is_secondary else 730
|
self._width = 700 if self._is_secondary else 730
|
||||||
self._height = 440 if self._is_secondary else 450
|
self._height = 440 if self._is_secondary else 490
|
||||||
self._spacing = 40
|
self._spacing = 40
|
||||||
assert bui.app.classic is not None
|
assert bui.app.classic is not None
|
||||||
uiscale = bui.app.ui_v1.uiscale
|
uiscale = bui.app.ui_v1.uiscale
|
||||||
@ -64,10 +64,79 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self._settings: dict[str, int] = {}
|
||||||
|
if not self._is_secondary:
|
||||||
|
self._get_config_mapping()
|
||||||
# Don't ask to config joysticks while we're in here.
|
# Don't ask to config joysticks while we're in here.
|
||||||
self._rebuild_ui()
|
self._rebuild_ui()
|
||||||
|
|
||||||
def _rebuild_ui(self) -> None:
|
def _get_config_mapping(self, default: bool = False) -> None:
|
||||||
|
for button in [
|
||||||
|
'buttonJump',
|
||||||
|
'buttonJump_B',
|
||||||
|
'buttonPunch',
|
||||||
|
'buttonPunch_B',
|
||||||
|
'buttonBomb',
|
||||||
|
'buttonBomb_B',
|
||||||
|
'buttonPickUp',
|
||||||
|
'buttonPickUp_B',
|
||||||
|
'buttonStart',
|
||||||
|
'buttonStart_B',
|
||||||
|
'buttonStart2',
|
||||||
|
'buttonStart2_B',
|
||||||
|
'buttonUp',
|
||||||
|
'buttonUp_B',
|
||||||
|
'buttonDown',
|
||||||
|
'buttonDown_B',
|
||||||
|
'buttonLeft',
|
||||||
|
'buttonLeft_B',
|
||||||
|
'buttonRight',
|
||||||
|
'buttonRight_B',
|
||||||
|
'buttonRun1',
|
||||||
|
'buttonRun1_B',
|
||||||
|
'buttonRun2',
|
||||||
|
'buttonRun2_B',
|
||||||
|
'triggerRun1',
|
||||||
|
'triggerRun1_B',
|
||||||
|
'triggerRun2',
|
||||||
|
'triggerRun2_B',
|
||||||
|
'buttonIgnored',
|
||||||
|
'buttonIgnored_B',
|
||||||
|
'buttonIgnored2',
|
||||||
|
'buttonIgnored2_B',
|
||||||
|
'buttonIgnored3',
|
||||||
|
'buttonIgnored3_B',
|
||||||
|
'buttonIgnored4',
|
||||||
|
'buttonIgnored4_B',
|
||||||
|
'buttonVRReorient',
|
||||||
|
'buttonVRReorient_B',
|
||||||
|
'analogStickDeadZone',
|
||||||
|
'analogStickDeadZone_B',
|
||||||
|
'dpad',
|
||||||
|
'dpad_B',
|
||||||
|
'unassignedButtonsRun',
|
||||||
|
'unassignedButtonsRun_B',
|
||||||
|
'startButtonActivatesDefaultWidget',
|
||||||
|
'startButtonActivatesDefaultWidget_B',
|
||||||
|
'uiOnly',
|
||||||
|
'uiOnly_B',
|
||||||
|
'ignoreCompletely',
|
||||||
|
'ignoreCompletely_B',
|
||||||
|
'autoRecalibrateAnalogStick',
|
||||||
|
'autoRecalibrateAnalogStick_B',
|
||||||
|
'analogStickLR',
|
||||||
|
'analogStickLR_B',
|
||||||
|
'analogStickUD',
|
||||||
|
'analogStickUD_B',
|
||||||
|
'enableSecondary',
|
||||||
|
]:
|
||||||
|
val = bui.app.classic.get_input_device_mapped_value(
|
||||||
|
self._input, button, default
|
||||||
|
)
|
||||||
|
if val != -1:
|
||||||
|
self._settings[button] = val
|
||||||
|
|
||||||
|
def _rebuild_ui(self, reset: bool = False) -> None:
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
# pylint: disable=too-many-locals
|
# pylint: disable=too-many-locals
|
||||||
|
|
||||||
@ -79,77 +148,6 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
|
|
||||||
self._textwidgets: dict[str, bui.Widget] = {}
|
self._textwidgets: dict[str, bui.Widget] = {}
|
||||||
|
|
||||||
# If we were supplied with settings, we're a secondary joystick and
|
|
||||||
# just operate on that. in the other (normal) case we make our own.
|
|
||||||
if not self._is_secondary:
|
|
||||||
# Fill our temp config with present values (for our primary and
|
|
||||||
# secondary controls).
|
|
||||||
self._settings = {}
|
|
||||||
for skey in [
|
|
||||||
'buttonJump',
|
|
||||||
'buttonJump_B',
|
|
||||||
'buttonPunch',
|
|
||||||
'buttonPunch_B',
|
|
||||||
'buttonBomb',
|
|
||||||
'buttonBomb_B',
|
|
||||||
'buttonPickUp',
|
|
||||||
'buttonPickUp_B',
|
|
||||||
'buttonStart',
|
|
||||||
'buttonStart_B',
|
|
||||||
'buttonStart2',
|
|
||||||
'buttonStart2_B',
|
|
||||||
'buttonUp',
|
|
||||||
'buttonUp_B',
|
|
||||||
'buttonDown',
|
|
||||||
'buttonDown_B',
|
|
||||||
'buttonLeft',
|
|
||||||
'buttonLeft_B',
|
|
||||||
'buttonRight',
|
|
||||||
'buttonRight_B',
|
|
||||||
'buttonRun1',
|
|
||||||
'buttonRun1_B',
|
|
||||||
'buttonRun2',
|
|
||||||
'buttonRun2_B',
|
|
||||||
'triggerRun1',
|
|
||||||
'triggerRun1_B',
|
|
||||||
'triggerRun2',
|
|
||||||
'triggerRun2_B',
|
|
||||||
'buttonIgnored',
|
|
||||||
'buttonIgnored_B',
|
|
||||||
'buttonIgnored2',
|
|
||||||
'buttonIgnored2_B',
|
|
||||||
'buttonIgnored3',
|
|
||||||
'buttonIgnored3_B',
|
|
||||||
'buttonIgnored4',
|
|
||||||
'buttonIgnored4_B',
|
|
||||||
'buttonVRReorient',
|
|
||||||
'buttonVRReorient_B',
|
|
||||||
'analogStickDeadZone',
|
|
||||||
'analogStickDeadZone_B',
|
|
||||||
'dpad',
|
|
||||||
'dpad_B',
|
|
||||||
'unassignedButtonsRun',
|
|
||||||
'unassignedButtonsRun_B',
|
|
||||||
'startButtonActivatesDefaultWidget',
|
|
||||||
'startButtonActivatesDefaultWidget_B',
|
|
||||||
'uiOnly',
|
|
||||||
'uiOnly_B',
|
|
||||||
'ignoreCompletely',
|
|
||||||
'ignoreCompletely_B',
|
|
||||||
'autoRecalibrateAnalogStick',
|
|
||||||
'autoRecalibrateAnalogStick_B',
|
|
||||||
'analogStickLR',
|
|
||||||
'analogStickLR_B',
|
|
||||||
'analogStickUD',
|
|
||||||
'analogStickUD_B',
|
|
||||||
'enableSecondary',
|
|
||||||
]:
|
|
||||||
val = bui.app.classic.get_input_device_mapped_value(
|
|
||||||
self._input, skey
|
|
||||||
)
|
|
||||||
if val != -1:
|
|
||||||
self._settings[skey] = val
|
|
||||||
|
|
||||||
back_button: bui.Widget | None
|
back_button: bui.Widget | None
|
||||||
|
|
||||||
if self._is_secondary:
|
if self._is_secondary:
|
||||||
@ -171,7 +169,7 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
else:
|
else:
|
||||||
cancel_button = bui.buttonwidget(
|
cancel_button = bui.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(51, self._height - 65),
|
position=(51, self._height - 115),
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
size=(160, 60),
|
size=(160, 60),
|
||||||
label=bui.Lstr(resource='cancelText'),
|
label=bui.Lstr(resource='cancelText'),
|
||||||
@ -181,12 +179,27 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
bui.containerwidget(
|
bui.containerwidget(
|
||||||
edit=self._root_widget, cancel_button=cancel_button
|
edit=self._root_widget, cancel_button=cancel_button
|
||||||
)
|
)
|
||||||
|
reset_button: bui.Widget | None
|
||||||
|
if not self._is_secondary:
|
||||||
|
reset_button = bui.buttonwidget(
|
||||||
|
parent=self._root_widget,
|
||||||
|
autoselect=True,
|
||||||
|
position=((self._width / 2) - 80, self._height - 115),
|
||||||
|
size=(180, 60),
|
||||||
|
label=bui.Lstr(resource='settingsWindowAdvanced.resetText'),
|
||||||
|
scale=0.9,
|
||||||
|
text_scale=0.9,
|
||||||
|
color=(0.4, 0.4, 0.9),
|
||||||
|
textcolor=(1.0, 1.0, 1.0),
|
||||||
|
on_activate_call=self._reset,
|
||||||
|
)
|
||||||
|
if reset:
|
||||||
|
bui.containerwidget(edit=self._root_widget, selected_child=reset_button)
|
||||||
save_button: bui.Widget | None
|
save_button: bui.Widget | None
|
||||||
if not self._is_secondary:
|
if not self._is_secondary:
|
||||||
save_button = bui.buttonwidget(
|
save_button = bui.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width - 195, self._height - 65),
|
position=(self._width - 195, self._height - 115),
|
||||||
size=(180, 60),
|
size=(180, 60),
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=bui.Lstr(resource='saveText'),
|
label=bui.Lstr(resource='saveText'),
|
||||||
@ -203,7 +216,7 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
v = self._height - 59
|
v = self._height - 59
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(0, v + 5),
|
position=(0, v + 10),
|
||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=bui.Lstr(resource=self._r + '.titleText'),
|
text=bui.Lstr(resource=self._r + '.titleText'),
|
||||||
color=bui.app.ui_v1.title_color,
|
color=bui.app.ui_v1.title_color,
|
||||||
@ -211,11 +224,11 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
)
|
)
|
||||||
v -= 48
|
v -= 95
|
||||||
|
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(0, v + 3),
|
position=(0, v - 5),
|
||||||
size=(self._width, 25),
|
size=(self._width, 25),
|
||||||
text=self._name,
|
text=self._name,
|
||||||
color=bui.app.ui_v1.infotextcolor,
|
color=bui.app.ui_v1.infotextcolor,
|
||||||
@ -227,7 +240,7 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
|
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(50, v + 10),
|
position=(50, v + 5),
|
||||||
size=(self._width - 100, 30),
|
size=(self._width - 100, 30),
|
||||||
text=bui.Lstr(resource=self._r + '.appliesToAllText'),
|
text=bui.Lstr(resource=self._r + '.appliesToAllText'),
|
||||||
maxwidth=330,
|
maxwidth=330,
|
||||||
@ -382,9 +395,19 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if cancel_button is not None and save_button is not None:
|
bui.widget(
|
||||||
bui.widget(edit=cancel_button, right_widget=save_button)
|
edit=cancel_button,
|
||||||
bui.widget(edit=save_button, left_widget=cancel_button)
|
right_widget=reset_button if reset_button else save_button if save_button else None
|
||||||
|
)
|
||||||
|
bui.widget(
|
||||||
|
edit=reset_button,
|
||||||
|
left_widget=cancel_button if cancel_button else None,
|
||||||
|
right_widget=save_button if save_button else None,
|
||||||
|
)
|
||||||
|
bui.widget(
|
||||||
|
edit=save_button,
|
||||||
|
left_widget=reset_button if reset_button else cancel_button if cancel_button else None
|
||||||
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception('Error wiring up gamepad config window.')
|
logging.exception('Error wiring up gamepad config window.')
|
||||||
|
|
||||||
@ -809,6 +832,27 @@ class GamepadSettingsWindow(bui.Window):
|
|||||||
from_window=self._root_widget,
|
from_window=self._root_widget,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _reset(self) -> None:
|
||||||
|
from bauiv1lib.confirm import ConfirmWindow
|
||||||
|
|
||||||
|
assert bui.app.classic is not None
|
||||||
|
ConfirmWindow(
|
||||||
|
# TODO: Implement a translation string for this!
|
||||||
|
'Are you sure you want to reset your button mapping?\n'
|
||||||
|
'(This will include your advanced settings)',
|
||||||
|
self._do_reset,
|
||||||
|
width=480,
|
||||||
|
height=110,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _do_reset(self) -> None:
|
||||||
|
"""Resets the input's mapping settings."""
|
||||||
|
self._settings: dict[str, int] = {}
|
||||||
|
self._get_config_mapping(default=True)
|
||||||
|
self._rebuild_ui(reset=True)
|
||||||
|
bui.getsound('gunCocking').play()
|
||||||
|
|
||||||
|
|
||||||
def _save(self) -> None:
|
def _save(self) -> None:
|
||||||
classic = bui.app.classic
|
classic = bui.app.classic
|
||||||
assert classic is not None
|
assert classic is not None
|
||||||
|
|||||||
@ -27,9 +27,10 @@ class ConfigKeyboardWindow(bui.Window):
|
|||||||
self._displayname = bui.Lstr(translate=('inputDeviceNames', dname_raw))
|
self._displayname = bui.Lstr(translate=('inputDeviceNames', dname_raw))
|
||||||
self._width = 700
|
self._width = 700
|
||||||
if self._unique_id != '#1':
|
if self._unique_id != '#1':
|
||||||
self._height = 480
|
self._height = 490
|
||||||
else:
|
else:
|
||||||
self._height = 375
|
self._height = 375
|
||||||
|
self._height += 45
|
||||||
self._spacing = 40
|
self._spacing = 40
|
||||||
assert bui.app.classic is not None
|
assert bui.app.classic is not None
|
||||||
uiscale = bui.app.ui_v1.uiscale
|
uiscale = bui.app.ui_v1.uiscale
|
||||||
@ -48,16 +49,12 @@ class ConfigKeyboardWindow(bui.Window):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self._settings: dict[str, int] = {}
|
||||||
|
self._get_config_mapping()
|
||||||
|
|
||||||
self._rebuild_ui()
|
self._rebuild_ui()
|
||||||
|
|
||||||
def _rebuild_ui(self) -> None:
|
def _get_config_mapping(self, default: bool = False):
|
||||||
assert bui.app.classic is not None
|
|
||||||
|
|
||||||
for widget in self._root_widget.get_children():
|
|
||||||
widget.delete()
|
|
||||||
|
|
||||||
# Fill our temp config with present values.
|
|
||||||
self._settings: dict[str, int] = {}
|
|
||||||
for button in [
|
for button in [
|
||||||
'buttonJump',
|
'buttonJump',
|
||||||
'buttonPunch',
|
'buttonPunch',
|
||||||
@ -73,22 +70,43 @@ class ConfigKeyboardWindow(bui.Window):
|
|||||||
self._settings[
|
self._settings[
|
||||||
button
|
button
|
||||||
] = bui.app.classic.get_input_device_mapped_value(
|
] = bui.app.classic.get_input_device_mapped_value(
|
||||||
self._input, button
|
self._input, button, default
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _rebuild_ui(self, reset: bool = False) -> None:
|
||||||
|
assert bui.app.classic is not None
|
||||||
|
|
||||||
|
for widget in self._root_widget.get_children():
|
||||||
|
widget.delete()
|
||||||
|
|
||||||
|
b_off = 0 if self._unique_id != '#1' else 9
|
||||||
cancel_button = bui.buttonwidget(
|
cancel_button = bui.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
position=(38, self._height - 85),
|
position=(38, self._height - 115 - b_off),
|
||||||
size=(170, 60),
|
size=(170, 60),
|
||||||
label=bui.Lstr(resource='cancelText'),
|
label=bui.Lstr(resource='cancelText'),
|
||||||
scale=0.9,
|
scale=0.9,
|
||||||
on_activate_call=self._cancel,
|
on_activate_call=self._cancel,
|
||||||
)
|
)
|
||||||
|
reset_button = bui.buttonwidget(
|
||||||
|
parent=self._root_widget,
|
||||||
|
autoselect=True,
|
||||||
|
position=((self._width / 2) - 80, self._height - 115 - b_off),
|
||||||
|
size=(180, 60),
|
||||||
|
label=bui.Lstr(resource='settingsWindowAdvanced.resetText'),
|
||||||
|
scale=0.9,
|
||||||
|
text_scale=0.9,
|
||||||
|
color=(0.4, 0.4, 0.9),
|
||||||
|
textcolor=(1.0, 1.0, 1.0),
|
||||||
|
on_activate_call=self._reset,
|
||||||
|
)
|
||||||
|
if reset:
|
||||||
|
bui.containerwidget(edit=self._root_widget, selected_child=reset_button)
|
||||||
save_button = bui.buttonwidget(
|
save_button = bui.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
position=(self._width - 190, self._height - 85),
|
position=(self._width - 190, self._height - 115 - b_off),
|
||||||
size=(180, 60),
|
size=(180, 60),
|
||||||
label=bui.Lstr(resource='saveText'),
|
label=bui.Lstr(resource='saveText'),
|
||||||
scale=0.9,
|
scale=0.9,
|
||||||
@ -101,13 +119,15 @@ class ConfigKeyboardWindow(bui.Window):
|
|||||||
start_button=save_button,
|
start_button=save_button,
|
||||||
)
|
)
|
||||||
|
|
||||||
bui.widget(edit=cancel_button, right_widget=save_button)
|
bui.widget(edit=cancel_button, right_widget=reset_button)
|
||||||
bui.widget(edit=save_button, left_widget=cancel_button)
|
bui.widget(edit=reset_button, left_widget=cancel_button, right_widget=save_button)
|
||||||
|
bui.widget(edit=save_button, left_widget=reset_button)
|
||||||
|
|
||||||
v = self._height - 74.0
|
v = self._height - 74.0
|
||||||
|
t_off = 0 if self._unique_id != '#1' else -10
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(self._width * 0.5, v + 15),
|
position=(self._width * 0.5, v + 41 + t_off),
|
||||||
size=(0, 0),
|
size=(0, 0),
|
||||||
text=bui.Lstr(
|
text=bui.Lstr(
|
||||||
resource=self._r + '.configuringText',
|
resource=self._r + '.configuringText',
|
||||||
@ -117,12 +137,12 @@ class ConfigKeyboardWindow(bui.Window):
|
|||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
maxwidth=270,
|
maxwidth=270,
|
||||||
scale=0.83,
|
scale=0.99,
|
||||||
)
|
)
|
||||||
v -= 20
|
v -= 20
|
||||||
|
|
||||||
if self._unique_id != '#1':
|
if self._unique_id != '#1':
|
||||||
v -= 20
|
v -= 60
|
||||||
v -= self._spacing
|
v -= self._spacing
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
@ -140,9 +160,9 @@ class ConfigKeyboardWindow(bui.Window):
|
|||||||
v -= 10
|
v -= 10
|
||||||
v -= self._spacing * 2.2
|
v -= self._spacing * 2.2
|
||||||
v += 25
|
v += 25
|
||||||
v -= 42
|
v -= 45 if self._unique_id != '#1' else 86
|
||||||
h_offs = 160
|
h_offs = 160
|
||||||
dist = 70
|
dist = 68
|
||||||
d_color = (0.4, 0.4, 0.8)
|
d_color = (0.4, 0.4, 0.8)
|
||||||
self._capture_button(
|
self._capture_button(
|
||||||
pos=(h_offs, v + 0.95 * dist),
|
pos=(h_offs, v + 0.95 * dist),
|
||||||
@ -282,6 +302,25 @@ class ConfigKeyboardWindow(bui.Window):
|
|||||||
from_window=self._root_widget,
|
from_window=self._root_widget,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def _reset(self) -> None:
|
||||||
|
from bauiv1lib.confirm import ConfirmWindow
|
||||||
|
|
||||||
|
assert bui.app.classic is not None
|
||||||
|
ConfirmWindow(
|
||||||
|
# TODO: Implement a translation string for this!
|
||||||
|
'Are you sure you want to reset your button mapping?',
|
||||||
|
self._do_reset,
|
||||||
|
width=480,
|
||||||
|
height=95,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _do_reset(self) -> None:
|
||||||
|
"""Resets the input's mapping settings."""
|
||||||
|
self._settings: dict[str, int] = {}
|
||||||
|
self._get_config_mapping(default=True)
|
||||||
|
self._rebuild_ui(reset=True)
|
||||||
|
bui.getsound('gunCocking').play()
|
||||||
|
|
||||||
def _save(self) -> None:
|
def _save(self) -> None:
|
||||||
from bauiv1lib.settings.controls import ControlsSettingsWindow
|
from bauiv1lib.settings.controls import ControlsSettingsWindow
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user