29
29
# \ingroup FEM
30
30
# \brief task panel for constraint section print object
31
31
32
+ from PySide import QtCore
32
33
from PySide import QtGui
33
34
34
35
import FreeCAD
@@ -52,6 +53,14 @@ def __init__(self, obj):
52
53
FreeCAD .getHomePath () + "Mod/Fem/Resources/ui/ConstraintSectionPrint.ui"
53
54
)
54
55
56
+ self .init_parameter_widget ()
57
+
58
+ QtCore .QObject .connect (
59
+ self .parameterWidget .cb_variable ,
60
+ QtCore .SIGNAL ("currentIndexChanged(int)" ),
61
+ self .variable_changed
62
+ )
63
+
55
64
# geometry selection widget
56
65
self .selectionWidget = selection_widgets .GeometryElementsSelection (
57
66
obj .References ,
@@ -61,15 +70,11 @@ def __init__(self, obj):
61
70
)
62
71
63
72
# form made from param and selection widget
64
- self .form = [self .parameterWidget , self .selectionWidget ]
73
+ self .form = [self .selectionWidget , self .parameterWidget ]
65
74
66
75
def accept (self ):
67
76
# check values
68
77
items = len (self .selectionWidget .references )
69
- FreeCAD .Console .PrintMessage (
70
- "Task panel: found references: {}\n {}\n "
71
- .format (items , self .selectionWidget .references )
72
- )
73
78
74
79
if items != 1 :
75
80
msgBox = QtGui .QMessageBox ()
@@ -87,6 +92,8 @@ def accept(self):
87
92
return False
88
93
elif msgBox .clickedButton () == ignoreButton :
89
94
pass
95
+
96
+ self .obj .Variable = self .variable
90
97
self .obj .References = self .selectionWidget .references
91
98
self .recompute_and_set_back_all ()
92
99
return True
@@ -102,3 +109,13 @@ def recompute_and_set_back_all(self):
102
109
if self .selectionWidget .sel_server :
103
110
FreeCADGui .Selection .removeObserver (self .selectionWidget .sel_server )
104
111
doc .resetEdit ()
112
+
113
+ def init_parameter_widget (self ):
114
+ self .variable = self .obj .Variable
115
+ self .variable_enum = self .obj .getEnumerationsOfProperty ("Variable" )
116
+ self .parameterWidget .cb_variable .addItems (self .variable_enum )
117
+ index = self .variable_enum .index (self .variable )
118
+ self .parameterWidget .cb_variable .setCurrentIndex (index )
119
+
120
+ def variable_changed (self , index ):
121
+ self .variable = self .variable_enum [index ]
0 commit comments