PreferencesSectionUI.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. from typing import Dict
  2. from PyQt5 import QtWidgets
  3. from flatcamGUI.preferences.OptionUI import OptionUI
  4. from flatcamGUI.preferences.OptionsGroupUI import OptionsGroupUI
  5. class PreferencesSectionUI(QtWidgets.QWidget):
  6. def __init__(self, **kwargs):
  7. super().__init__(**kwargs)
  8. self.layout = QtWidgets.QHBoxLayout()
  9. self.setLayout(self.layout)
  10. self.groups = self.build_groups()
  11. for group in self.groups:
  12. group.setMinimumWidth(250)
  13. self.layout.addWidget(group)
  14. self.layout.addStretch()
  15. def build_groups(self) -> [OptionsGroupUI]:
  16. return []
  17. def option_dict(self) -> Dict[str, OptionUI]:
  18. result = {}
  19. for group in self.groups:
  20. groupoptions = group.option_dict()
  21. result.update(groupoptions)
  22. return result
  23. def build_tab(self):
  24. scroll_area = QtWidgets.QScrollArea()
  25. scroll_area.setWidget(self)
  26. return scroll_area
  27. def get_tab_id(self) -> str:
  28. raise NotImplementedError
  29. def get_tab_label(self) -> str:
  30. raise NotImplementedError