MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / save

Method save

SLiCAP/schematic/preferences_dialog.py:227–246  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

225 outer.addWidget(buttons)
226
227 def save(self) -> None:
228 # Edit the CURRENT schematic's style: start from the effective config so
229 # unedited keys are preserved, overlay the dialog's widget values, and
230 # apply live. It is persisted to <name>.ini when the schematic is saved.
231 import SLiCAP.schematic.config as config
232 cfg = config.snapshot()
233 for (section, key), widget in self._widgets.items():
234 if section not in cfg:
235 cfg[section] = {}
236 if isinstance(widget, _ColorButton):
237 cfg[section][key] = widget.color().name()
238 elif isinstance(widget, QDoubleSpinBox):
239 cfg[section][key] = str(widget.value())
240 elif isinstance(widget, QSpinBox):
241 cfg[section][key] = str(widget.value())
242 elif isinstance(widget, QComboBox):
243 cfg[section][key] = widget.currentText()
244 elif isinstance(widget, QCheckBox):
245 cfg[section][key] = "true" if widget.isChecked() else "false"
246 config.apply_parser(cfg)

Callers 1

_on_preferencesMethod · 0.95

Calls 1

colorMethod · 0.45

Tested by

no test coverage detected