mirror of
https://github.com/sezanzeb/input-remapper
synced 2024-11-04 12:00:16 +00:00
populating the autoload switch state
This commit is contained in:
parent
881b906b44
commit
64f7c3de3a
@ -56,9 +56,22 @@ class _Config:
|
|||||||
del self._config['autoload'][device]
|
del self._config['autoload'][device]
|
||||||
|
|
||||||
def iterate_autoload_presets(self):
|
def iterate_autoload_presets(self):
|
||||||
"""get tuples of (device, preset)."""
|
"""Get tuples of (device, preset)."""
|
||||||
return self._config.get('autoload', {}).items()
|
return self._config.get('autoload', {}).items()
|
||||||
|
|
||||||
|
def is_autoloaded(self, device, preset):
|
||||||
|
"""Should this preset be loaded automatically?"""
|
||||||
|
# TODO test
|
||||||
|
autoload_map = self._config.get('autoload')
|
||||||
|
if autoload_map is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
autoload_preset = autoload_map.get(device)
|
||||||
|
if autoload_preset is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def load_config(self):
|
def load_config(self):
|
||||||
"""Load the config from the file system."""
|
"""Load the config from the file system."""
|
||||||
self.clear_config()
|
self.clear_config()
|
||||||
|
@ -364,6 +364,12 @@ class Window:
|
|||||||
)
|
)
|
||||||
key_list.insert(single_key_mapping, -1)
|
key_list.insert(single_key_mapping, -1)
|
||||||
|
|
||||||
|
autoload_switch = self.get('preset_autoload_switch')
|
||||||
|
autoload_switch.set_active(config.is_autoloaded(
|
||||||
|
self.selected_device,
|
||||||
|
self.selected_preset
|
||||||
|
))
|
||||||
|
|
||||||
self.get('preset_name_input').set_text('')
|
self.get('preset_name_input').set_text('')
|
||||||
self.add_empty()
|
self.add_empty()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user