MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / _edit_setting

Method _edit_setting

pager/pager_display.py:784–804  ·  view source on GitHub ↗

Dispatch to the appropriate editor based on setting type.

(self, setting)

Source from the content-addressed store, hash-verified

782 logger.error(f"Error saving setting {key}: {e}")
783
784 def _edit_setting(self, setting):
785 """Dispatch to the appropriate editor based on setting type."""
786 key = setting['key']
787 stype = setting['type']
788 label = setting['label']
789
790 if stype == 'bool':
791 # Boolean: immediate toggle, no dialog needed
792 current = bool(self.shared_data.config.get(key, False))
793 self._save_setting(key, not current)
794
795 elif stype == 'int':
796 self._edit_int_dialog(
797 key, label,
798 setting.get('min', 0),
799 setting.get('max', 9999),
800 setting.get('step', 1)
801 )
802
803 elif stype == 'choice':
804 self._edit_choice_dialog(key, label, setting['choices'])
805
806 def _edit_int_dialog(self, key, label, min_val, max_val, step):
807 """Show a dialog to edit an integer setting with UP/DOWN to change value."""

Callers 1

_settings_activateMethod · 0.95

Calls 4

_save_settingMethod · 0.95
_edit_int_dialogMethod · 0.95
_edit_choice_dialogMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected