32 from PyQt5
import QtCore, QtWidgets, QtWidgets
33 from .scene_selection_helper
import SelHelper
34 from .gradient_editor_widget
import GradientEditor
35 from .uniform_color_widget
import UniformColorWidget
36 from .combo_options_widget
import ComboOptionsWidget
40 ComboOptionsWidget.__init__(self, parent)
44 conly_label_ = QtWidgets.QLabel(
'carbons only')
49 self.entity_widgets_.append([
"Color by Element",
ByElementWidget(
"Color by Element", self)])
50 self.entity_widgets_.append([
"Color by Chain",
ByChainWidget(
"Color by Chain", self)])
51 self.entity_widgets_.append([
"Color by Entity",
ByEntityWidget(
"Color by Entity", self)])
52 self.entity_widgets_.append([
"Color by Property", GradientEditor(self)])
53 self.entity_widgets_.append([
"Uniform",UniformColorWidget(self)])
56 self.img_widgets_.append([
"Uniform",UniformColorWidget()])
58 qw = QtWidgets.QWidget(self)
59 gl = QtWidgets.QGridLayout(qw)
61 gl.addWidget(conly_label_, 0, 1, 1, 4)
62 self.grid_layout_.addWidget(qw, 2, 0, 1, 1)
64 self.setMinimumSize(250,200)
67 scene_selection = gui.SceneSelection.Instance()
68 if hasattr(item,
"PrepareColoring"):
69 item.PrepareColoring()
70 for i
in range(0,scene_selection.GetActiveNodeCount()):
71 node = scene_selection.GetActiveNode(i)
72 item.ChangeColor(node)
74 if(scene_selection.GetActiveViewCount() > 0):
75 entity = scene_selection.GetViewEntity()
76 view = scene_selection.GetViewUnion()
77 item.ChangeViewColor(entity,view)
84 ComboOptionsWidget.setEnabled(self,
True)
86 if SelHelper().CheckAllFlags(SelHelper.NO_SELECTION):
87 ComboOptionsWidget.setEnabled(self,
False)
91 self.RemoveWidget(w[0])
93 self.RemoveWidget(w[0])
96 if SelHelper().CheckFlags(SelHelper.HAS_IMG | SelHelper.IS_ONE_TYPE):
98 self.AddWidget(w[0], w[1])
99 elif SelHelper().CheckMinOneFlag(SelHelper.HAS_ENTITY| SelHelper.HAS_VIEW| SelHelper.HAS_SURFACE)
and SelHelper().CheckNotFlags(SelHelper.HAS_IMG):
101 self.AddWidget(w[0], w[1])
103 ComboOptionsWidget.setEnabled(self,
False)
106 self.GetCurrentWidget().
Update()
112 return self.conly_box_.isChecked()
117 QtWidgets.QWidget.__init__(self, parent)
125 text_label = QtWidgets.QLabel(text)
126 font = text_label.font()
129 grid = QtWidgets.QGridLayout()
130 grid.addWidget(text_label,0,0,1,1)
131 grid.addWidget(QtWidgets.QLabel(
"No Settings available"), 1, 0, 1, 3)
132 grid.setRowStretch(2,1)
134 self.setMinimumSize(250,60)
142 if self.parent_.GetCarbonsOnly():
143 node.ColorByElement(
"ele=C")
145 node.ColorByElement()
149 if self.parent_.GetCarbonsOnly():
161 QtWidgets.QWidget.__init__(self, parent)
168 text_label = QtWidgets.QLabel(text)
169 font = text_label.font()
172 grid = QtWidgets.QGridLayout()
173 grid.addWidget(text_label,0,0,1,1)
174 grid.setRowStretch(2,1)
176 self.setMinimumSize(250,60)
184 if self.parent_.GetCarbonsOnly():
185 node.ColorByChain(
'ele=C')
191 if self.parent_.GetCarbonsOnly():
202 QtWidgets.QWidget.__init__(self, parent)
209 text_label = QtWidgets.QLabel(text)
210 font = text_label.font()
213 grid = QtWidgets.QGridLayout()
214 grid.addWidget(text_label,0,0,1,1)
215 grid.setRowStretch(2,1)
217 self.setMinimumSize(250,60)
225 scene_selection = gui.SceneSelection.Instance()
226 entity_count = scene_selection.GetActiveNodeCount()
227 for i
in range(0,scene_selection.GetActiveNodeCount()):
229 color=self.gradient_.GetColorAt(0.0)
231 color=self.gradient_.GetColorAt(float(i) / entity_count)
232 node = scene_selection.GetActiveNode(i)
233 if self.parent_.GetCarbonsOnly():
234 node.SetColor(color,
'ele=C')
243 if self.parent_.GetCarbonsOnly():
graphical rendering of mol::EntityHandle entites