Skip to content

Commit

Permalink
Choices bool widget
Browse files Browse the repository at this point in the history
  • Loading branch information
dertwist committed Oct 19, 2024
1 parent a4cf8fc commit 149a74f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 37 deletions.
21 changes: 0 additions & 21 deletions smartprop_editor/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1101,27 +1101,6 @@ QComboBox QAbstractItemView::item:selected {
<string>Type</string>
</property>
</column>
<item>
<property name="text">
<string>Color</string>
</property>
<property name="text">
<string/>
</property>
<item>
<property name="text">
<string>Red</string>
</property>
<item>
<property name="text">
<string>Variable</string>
</property>
<property name="text">
<string>Value</string>
</property>
</item>
</item>
</item>
</widget>
</item>
</layout>
Expand Down
15 changes: 0 additions & 15 deletions smartprop_editor/ui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,6 @@ def setupUi(self, MainWindow):
self.verticalLayout.setObjectName(u"verticalLayout")
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.choices_tree_widget = QTreeWidget(self.dockWidgetContents_3)
__qtreewidgetitem1 = QTreeWidgetItem(self.choices_tree_widget)
__qtreewidgetitem2 = QTreeWidgetItem(__qtreewidgetitem1)
QTreeWidgetItem(__qtreewidgetitem2)
self.choices_tree_widget.setObjectName(u"choices_tree_widget")
self.choices_tree_widget.setUniformRowHeights(True)
self.choices_tree_widget.header().setVisible(True)
Expand Down Expand Up @@ -794,17 +791,5 @@ def retranslateUi(self, MainWindow):
___qtreewidgetitem1.setText(2, QCoreApplication.translate("MainWindow", u"Type", None));
___qtreewidgetitem1.setText(1, QCoreApplication.translate("MainWindow", u"Value", None));
___qtreewidgetitem1.setText(0, QCoreApplication.translate("MainWindow", u"Name", None));

__sortingEnabled = self.choices_tree_widget.isSortingEnabled()
self.choices_tree_widget.setSortingEnabled(False)
___qtreewidgetitem2 = self.choices_tree_widget.topLevelItem(0)
___qtreewidgetitem2.setText(0, QCoreApplication.translate("MainWindow", u"Color", None));
___qtreewidgetitem3 = ___qtreewidgetitem2.child(0)
___qtreewidgetitem3.setText(0, QCoreApplication.translate("MainWindow", u"Red", None));
___qtreewidgetitem4 = ___qtreewidgetitem3.child(0)
___qtreewidgetitem4.setText(1, QCoreApplication.translate("MainWindow", u"Value", None));
___qtreewidgetitem4.setText(0, QCoreApplication.translate("MainWindow", u"Variable", None));
self.choices_tree_widget.setSortingEnabled(__sortingEnabled)

# retranslateUi

5 changes: 4 additions & 1 deletion smartprop_editor/variables/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, default, min, max, model):
self.default = [255, 255, 255]
else:
self.default = default

self.ui.color.clicked.connect(self.open_dialog)
# self.ui.value.setText(str(self.default))
# self.ui.value.textChanged.connect(self.on_changed)
Expand All @@ -32,10 +33,12 @@ def __init__(self, default, min, max, model):
border: 2px solid translucent;
border-color: rgba(80, 80, 80, 100);
""")
self.on_changed()



def on_changed(self):
self.edited.emit(self.default, self.min, self.max, str(self.model))
self.edited.emit(self.default, '', '', '')

def open_dialog(self):
color = self.dialog.getColor().getRgb()[:3]
Expand Down
2 changes: 2 additions & 0 deletions smartprop_editor/variables/combobox.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ def __init__(self, default, elements):

self.ui.value.addItems(elements)
self.ui.value.setCurrentText(str(self.default))
self.on_changed()
self.ui.value.currentTextChanged.connect(self.on_changed)



def on_changed(self):
self.default = self.ui.value.currentText()
self.edited.emit(self.default, self.min, self.max, str(self.model))

0 comments on commit 149a74f

Please sign in to comment.