mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 08:54:53 +01:00
number widget shows input widget
This commit is contained in:
parent
519817f179
commit
6e9e7a40f8
3 changed files with 27 additions and 4 deletions
|
|
@ -271,9 +271,9 @@ class NumberEntity(InputEntity):
|
|||
def item_initalization(self):
|
||||
self.minimum = self.schema_data.get("minimum", -99999)
|
||||
self.maximum = self.schema_data.get("maximum", 99999)
|
||||
self.decimals = self.schema_data.get("decimal", 0)
|
||||
self.decimal = self.schema_data.get("decimal", 0)
|
||||
|
||||
if self.decimals:
|
||||
if self.decimal:
|
||||
valid_value_types = (int, float)
|
||||
else:
|
||||
valid_value_types = (int, )
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ class SystemWidget(SettingsCategoryWidget):
|
|||
content_widget = QtWidgets.QWidget(scroll_widget)
|
||||
content_layout = QtWidgets.QVBoxLayout(content_widget)
|
||||
content_layout.setContentsMargins(3, 3, 3, 3)
|
||||
content_layout.setSpacing(0)
|
||||
content_layout.setSpacing(5)
|
||||
content_layout.setAlignment(QtCore.Qt.AlignTop)
|
||||
|
||||
scroll_widget.setWidgetResizable(True)
|
||||
|
|
|
|||
|
|
@ -4325,7 +4325,30 @@ class TextWidgetTwo(BaseWidget):
|
|||
|
||||
|
||||
class NumberWidgetTwo(BaseWidget):
|
||||
|
||||
def create_ui(self):
|
||||
layout = QtWidgets.QHBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
layout.setSpacing(5)
|
||||
|
||||
kwargs = {
|
||||
"minimum": self.entity.minimum,
|
||||
"maximum": self.entity.maximum,
|
||||
"decimal": self.entity.decimal
|
||||
}
|
||||
self.input_field = NumberSpinBox(self, **kwargs)
|
||||
|
||||
self.setFocusProxy(self.input_field)
|
||||
|
||||
layout.addWidget(self.input_field, 1)
|
||||
|
||||
self.input_field.valueChanged.connect(self._on_value_change)
|
||||
|
||||
self.entity_widget.add_widget_to_layout(self, self.entity.label)
|
||||
|
||||
def _on_value_change(self):
|
||||
print("value changed", self.entity.path)
|
||||
|
||||
|
||||
def create_ui_for_entity(entity, entity_widget):
|
||||
if isinstance(entity, GUIEntity):
|
||||
return GUIWidget(entity, entity_widget)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue