23 from PyQt4
import QtCore, QtGui
24 from render_mode_widget
import RenderModeWidget
29 RenderModeWidget.__init__(self, parent)
36 max_sphere_detail = 12
48 self.
mode_ = gfx.RenderMode.CUSTOM
53 self.sphere_spinbox_.setRange(min_sphere_detail, max_sphere_detail)
56 self.arc_spinbox_.setRange(min_arc_detail, max_arc_detail)
59 radius_bond_label = QtGui.QLabel(
"Bond Radius")
62 self.radius_bond_spinbox_.setRange(min_rad, max_bond_rad)
63 self.radius_bond_spinbox_.setDecimals(2)
64 self.radius_bond_spinbox_.setSingleStep(0.05)
67 self.radius_bond_slider_.setRange(min_rad*100.0, max_bond_rad*100.0)
68 self.radius_bond_slider_.setTickPosition(QtGui.QSlider.NoTicks)
69 self.radius_bond_slider_.setTickInterval(5)
73 radius_sphere_label = QtGui.QLabel(
"Sphere Radius")
76 self.radius_sphere_spinbox_.setRange(min_rad, max_sphere_rad)
77 self.radius_sphere_spinbox_.setDecimals(2)
78 self.radius_sphere_spinbox_.setSingleStep(0.05)
81 self.radius_sphere_slider_.setRange(min_rad*100.0, max_sphere_rad*100.0)
82 self.radius_sphere_slider_.setTickPosition(QtGui.QSlider.NoTicks)
83 self.radius_sphere_slider_.setTickInterval(5)
85 custom_label = QtGui.QLabel(self.
text_)
86 font = custom_label.font()
89 sphere_label = QtGui.QLabel(
"Sphere Detail")
90 arc_label = QtGui.QLabel(
"Arc Detail")
91 grid = QtGui.QGridLayout()
92 grid.addWidget(custom_label,0,0,1,1)
93 grid.addWidget(sphere_label, 1, 0, 1, 3)
95 grid.addWidget(arc_label,2,0,1,3)
98 grid.addWidget(radius_bond_label, 3, 0, 1, 1)
102 grid.addWidget(radius_sphere_label, 4, 0, 1, 1)
106 grid.setRowStretch(3,1)
113 QtCore.SIGNAL(
"valueChanged(double)"),
116 QtCore.SIGNAL(
"valueChanged(int)"),
120 QtCore.SIGNAL(
"valueChanged(double)"),
123 QtCore.SIGNAL(
"valueChanged(int)"),
126 self.setMinimumSize(250,150)
129 self.GetOptions().SetSphereDetail(value)
133 self.GetOptions().SetArcDetail(value)
137 self.GetOptions().SetBondRad(value)
138 if(self.GetOptions().GetSphereRad()<self.GetOptions().GetBondRad()):
139 self.GetOptions().SetSphereRad(value)
143 self.GetOptions().SetBondRad(value/100.0)
147 self.GetOptions().SetSphereRad(value)
148 if(self.GetOptions().GetSphereRad()<self.GetOptions().GetBondRad()):
149 self.GetOptions().SetBondRad(value)
153 self.GetOptions().SetSphereRad(value/100.0)
157 value = round(value, 2)
158 if(abs(value*100.0 - self.radius_sphere_slider_.value())>=self.radius_sphere_slider_.singleStep()):
159 self.radius_sphere_slider_.setValue(value*100.0)
160 if (abs(value - self.radius_sphere_spinbox_.value())>=self.radius_sphere_spinbox_.singleStep()):
161 self.radius_sphere_spinbox_.setValue(value)
164 value = round(value, 2)
165 if(abs(value*100.0 - self.radius_bond_slider_.value())>=self.radius_bond_slider_.singleStep()):
166 self.radius_bond_slider_.setValue(value*100.0)
167 if (abs(value - self.radius_bond_spinbox_.value())>=self.radius_bond_spinbox_.singleStep()):
168 self.radius_bond_spinbox_.setValue(value)
171 self.sphere_spinbox_.setValue(options.GetSphereDetail())
172 self.arc_spinbox_.setValue(options.GetArcDetail())