Skip to content

Commit ffb7210

Browse files
committed
Bug Fix for #84
1 parent f1bdd1c commit ffb7210

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

joystick_diagrams/input/profile.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,30 @@ def merge_profiles(self, profile: "Profile_"):
4343
src_profile = deepcopy(self)
4444

4545
for guid, device in profile.devices.items():
46+
_logger.debug(f"Handling {guid=} and {device=}")
4647
if guid not in src_profile.devices:
4748
# If the device is not in the current profile, deepcopy the entire device
49+
_logger.debug(f"Device {guid=} not found so adding whole device")
4850
src_profile.devices[guid] = deepcopy(device)
4951
else:
5052
# If the device exists in the current profile, merge inputs
5153
existing_device = src_profile.devices[guid]
54+
_logger.debug(f"Existing device is {existing_device=}")
5255
for input_type, inputs in device.inputs.items():
56+
_logger.debug(f"Processing {input_type} and {inputs=}")
5357
for input_key, input_ in inputs.items():
58+
_logger.debug(f"Processing {input_key} and {input_=}")
5459
if input_key not in existing_device.inputs[input_type]:
60+
_logger.debug(
61+
f"Input key not found, so adding whole key {input_key=}"
62+
)
5563
# If the input is not in the existing device, deepcopy the input
5664
existing_device.inputs[input_type][input_key] = deepcopy(
5765
input_
5866
)
5967
else:
6068
# If the input exists, merge modifiers
69+
_logger.debug(f"Input key exists {input_key=}")
6170
existing_input = existing_device.inputs[input_type][
6271
input_key
6372
]

joystick_diagrams/profile_wrapper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ def get_parents_for_profile(self):
5353
_wrapper = [
5454
x for x in _state.profile_wrappers if x.profile_key == parent_key
5555
]
56-
_logger.debug(f"Profiles fond {_wrapper}")
56+
_logger.debug(f"Profiles found {_wrapper}")
5757
if _wrapper:
58+
_logger.debug(f"Appending profile to parents {_wrapper}")
5859
self.parents.append(_wrapper[0])
5960

6061
def update_parents_for_profile(self, parents: list["ProfileWrapper"]):
@@ -70,9 +71,12 @@ def inherit_parents_into_profile(self):
7071
_parents = self.parents # Reverse list to flip obj >> parent
7172
_parents.reverse()
7273

74+
_logger.debug(f"Parents are {_parents}")
75+
7376
merged_profiles = deepcopy(self.original_profile)
7477

75-
for parent in _parents[:1]:
78+
for parent in _parents:
79+
_logger.debug(f"Processing {parent=}")
7680
obj = deepcopy(parent.original_profile)
7781
merged_profiles = merged_profiles.merge_profiles(obj)
7882

0 commit comments

Comments
 (0)