PreferencesSectionUI.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from typing import Dict
  2. from PyQt5 import QtWidgets, QtCore
  3. from appGUI.ColumnarFlowLayout import ColumnarFlowLayout
  4. from appGUI.preferences.OptionUI import OptionUI
  5. from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
  6. class PreferencesSectionUI(QtWidgets.QWidget):
  7. def __init__(self, **kwargs):
  8. super().__init__(**kwargs)
  9. self.layout = ColumnarFlowLayout() # QtWidgets.QHBoxLayout()
  10. self.setLayout(self.layout)
  11. self.groups = self.build_groups()
  12. for group in self.groups:
  13. group.setMinimumWidth(250)
  14. self.layout.addWidget(group)
  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. scroll_area.setWidgetResizable(True)
  27. return scroll_area
  28. def get_tab_id(self) -> str:
  29. raise NotImplementedError
  30. def get_tab_label(self) -> str:
  31. raise NotImplementedError