Rework app settings group

This commit is contained in:
David Robertson
2020-05-03 04:18:10 +01:00
parent f3bdaf8023
commit 7062afc1af
7 changed files with 348 additions and 541 deletions

View File

@@ -1,4 +1,4 @@
from typing import Union
from typing import Union, Sequence
from PyQt5 import QtWidgets
from flatcamGUI.GUIElements import RadioSet, FCCheckBox, FCButton, FCComboBox, FCEntry, FCSpinner, FCColorEntry, \
@@ -89,7 +89,7 @@ class CheckboxOptionUI(OptionUI):
class ComboboxOptionUI(BasicOptionUI):
def __init__(self, option: str, label_text: str, label_tooltip: str, choices: list):
def __init__(self, option: str, label_text: str, label_tooltip: str, choices: Sequence):
self.choices = choices
super().__init__(option=option, label_text=label_text, label_tooltip=label_tooltip)
@@ -119,6 +119,21 @@ class SliderWithSpinnerOptionUI(BasicOptionUI):
return entry
class SpinnerOptionUI(BasicOptionUI):
def __init__(self, option: str, label_text: str, label_tooltip: str, min_value: int, max_value: int, step: int = 1):
self.min_value = min_value
self.max_value = max_value
self.step = step
super().__init__(option=option, label_text=label_text, label_tooltip=label_tooltip)
def build_entry_widget(self) -> QtWidgets.QWidget:
entry = FCSpinner()
entry.set_range(self.min_value, self.max_value)
entry.set_step(self.step)
entry.setWrapping(True)
return entry
class DoubleSpinnerOptionUI(BasicOptionUI):
def __init__(self, option: str, label_text: str, label_tooltip: str, step: float, decimals: int, min_value=None, max_value=None):
self.min_value = min_value