23 from PyQt5
import QtCore, QtWidgets
24 from render_mode_widget
import RenderModeWidget
29 RenderModeWidget.__init__(self, parent)
35 self.
mode_ = gfx.RenderMode.TUBE
39 max_spline_detail = 20
51 tube_label = QtWidgets.QLabel(
"Tube Settings")
52 font = tube_label.font()
56 poly_mode_label = QtWidgets.QLabel(
"Poly Mode")
59 self.poly_mode_cb_.addItem(
"Points")
60 self.poly_mode_cb_.addItem(
"Wireframe")
61 self.poly_mode_cb_.addItem(
"Surface")
64 spline_label = QtWidgets.QLabel(
"Spline Detail")
67 self.spline_spinbox_.setRange(min_spline_detail, max_spline_detail)
70 arc_label = QtWidgets.QLabel(
"Arc Detail")
73 self.arc_spinbox_.setRange(min_arc_detail, max_arc_detail)
76 radius_label = QtWidgets.QLabel(
"Tube radius")
80 self.radius_spinbox_.setRange(min_radius, max_radius)
81 self.radius_spinbox_.setDecimals(1)
82 self.radius_spinbox_.setSingleStep(0.1)
85 self.radius_slider_.setRange(min_radius*10.0, max_radius*10.0)
86 self.radius_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
87 self.radius_slider_.setTickInterval(1)
90 ratio_label = QtWidgets.QLabel(
"Tube ratio")
93 self.ratio_spinbox_.setRange(min_ratio, max_ratio)
94 self.ratio_spinbox_.setDecimals(1)
95 self.ratio_spinbox_.setSingleStep(0.1)
97 self.ratio_slider_.setRange(min_ratio*10.0, max_ratio*10.0)
98 self.ratio_slider_.setTickPosition(QtWidgets.QSlider.NoTicks)
99 self.ratio_slider_.setTickInterval(2)
101 grid = QtWidgets.QGridLayout()
102 grid.addWidget(tube_label,0,0,1,3)
103 grid.addWidget(poly_mode_label,1,0,1,3)
105 grid.addWidget(spline_label, 2, 0, 1, 3)
107 grid.addWidget(arc_label,3,0,1,3)
109 grid.addWidget(radius_label,4,0,1,1)
112 grid.addWidget(ratio_label,5,0,1,1)
115 grid.setRowStretch(6,1)
120 self.poly_mode_cb_.currentIndexChanged.connect(self.
UpdatePolyMode)
121 self.radius_spinbox_.valueChanged.connect(self.
UpdateRadius)
123 self.ratio_spinbox_.valueChanged.connect(self.
UpdateRatio)
126 self.setMinimumSize(250,200)
129 self.poly_mode_cb_.setCurrentIndex(options.GetPolyMode())
130 self.spline_spinbox_.setValue(options.GetSplineDetail())
131 self.arc_spinbox_.setValue(options.GetArcDetail())
136 self.GetOptions().SetPolyMode(value)
140 self.GetOptions().SetSplineDetail(value)
144 self.GetOptions().SetArcDetail(value)
148 self.GetOptions().SetTubeRadius(value)
152 self.GetOptions().SetTubeRadius(value/10.0)
155 self.GetOptions().SetTubeRatio(value)
158 self.GetOptions().SetTubeRatio(value/10.0)
161 value = round(value, 2)
162 if(abs(value*10.0 - self.radius_slider_.value())>=self.radius_slider_.singleStep()):
163 self.radius_slider_.setValue(value*10.0)
164 if(abs(value - self.radius_spinbox_.value())>=self.radius_spinbox_.singleStep()):
165 self.radius_spinbox_.setValue(value)
168 value = round(value, 2)
169 if(abs(value*10.0 - self.ratio_slider_.value())>=self.ratio_slider_.singleStep()):
170 self.ratio_slider_.setValue(value*10.0)
171 if(abs(value - self.ratio_spinbox_.value())>=self.ratio_spinbox_.singleStep()):
172 self.ratio_spinbox_.setValue(value)