Fix btn left confusion (#711)

* removed erroneous error message

* use dangerously_mapped_btn_left() instead of checking manually in show_injector_result()

* fix dangerously_mapped_btn_left() by ignoring origin_hash

* Avoid `No origin_hash set` Warning
pull/673/merge
jonasBoss 1 year ago committed by GitHub
parent 4d3ce4523b
commit 7a0ccac5d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -232,21 +232,12 @@ class Preset(Generic[MappingModel]):
existing = self._mappings.get(permutation)
if existing is not None:
return existing
logger.error(
"Combination %s not found. Available: %s",
repr(combination),
list(
self._mappings.keys(),
),
)
return None
def dangerously_mapped_btn_left(self) -> bool:
"""Return True if this mapping disables BTN_Left."""
if InputCombination([InputConfig.btn_left()]) not in [
m.input_combination for m in self
if (ecodes.EV_KEY, ecodes.BTN_LEFT) not in [
m.input_combination[0].type_and_code for m in self
]:
return False

@ -655,9 +655,7 @@ class Controller:
def running():
msg = _("Applied preset %s") % self.data_manager.active_preset.name
if self.data_manager.active_preset.get_mapping(
InputCombination([InputConfig.btn_left()])
):
if self.data_manager.active_preset.dangerously_mapped_btn_left():
msg += _(", CTRL + DEL to stop")
self.show_status(CTX_APPLY, msg)
logger.info(

@ -329,10 +329,13 @@ class DataManager:
mapping = self._active_preset.get_mapping(combination)
if not mapping:
raise KeyError(
msg = (
f"the mapping with {combination = } does not "
f"exist in the {self._active_preset.path}"
)
logger.error(msg)
raise KeyError(msg)
self._active_input_config = None
self._active_mapping = mapping
self.publish_mapping()

Loading…
Cancel
Save