Dispatch to the appropriate editor based on setting type.
(self, setting)
| 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.""" |
no test coverage detected