Skip to content
Snippets Groups Projects
Commit 5fbcbebf authored by Tobias Schmidt's avatar Tobias Schmidt
Browse files

add checkbox 'color carbons only' to color widget

parent 2c107d9f
Branches
Tags
No related merge requests found
...@@ -28,6 +28,16 @@ using namespace ost::gfx; ...@@ -28,6 +28,16 @@ using namespace ost::gfx;
namespace { namespace {
void color_by_chain_01(Entity* e)
{
e->ColorByChain();
}
void color_by_chain_02(Entity* e, const String& selection)
{
e->ColorByChain(selection);
}
void color_by_01(Entity* e, void color_by_01(Entity* e,
const String& prop, const String& prop,
const Gradient& gradient, const Gradient& gradient,
...@@ -308,7 +318,8 @@ void export_Entity() ...@@ -308,7 +318,8 @@ void export_Entity()
.def("PickAtom", &Entity::PickAtom) .def("PickAtom", &Entity::PickAtom)
.def("PickBond", &Entity::PickBond) .def("PickBond", &Entity::PickBond)
.def("ColorByElement",&Entity::ColorByElement) .def("ColorByElement",&Entity::ColorByElement)
.def("ColorByChain",&Entity::ColorByChain) .def("ColorByChain", color_by_chain_01)
.def("ColorByChain", color_by_chain_02)
.def("CleanColorOps", &Entity::CleanColorOps) .def("CleanColorOps", &Entity::CleanColorOps)
.def("ReapplyColorOps", &Entity::ReapplyColorOps) .def("ReapplyColorOps", &Entity::ReapplyColorOps)
.def("GetOptions", &Entity::GetOptions) .def("GetOptions", &Entity::GetOptions)
......
...@@ -792,6 +792,12 @@ void Entity::ColorByChain() ...@@ -792,6 +792,12 @@ void Entity::ColorByChain()
this->Apply(cop); this->Apply(cop);
} }
void Entity::ColorByChain(const String& selection)
{
ByChainColorOp cop = ByChainColorOp(selection);
this->Apply(cop);
}
void Entity::ColorBy(const mol::EntityView& ev, void Entity::ColorBy(const mol::EntityView& ev,
const String& prop, const String& prop,
const Gradient& g, float minv, float maxv) const Gradient& g, float minv, float maxv)
......
...@@ -177,6 +177,9 @@ public: ...@@ -177,6 +177,9 @@ public:
/// \brief color by chain /// \brief color by chain
void ColorByChain(); void ColorByChain();
/// \brief color by chain for a specific selection
void ColorByChain(const String& selection);
/// \brief get view /// \brief get view
mol::EntityView GetView() const; mol::EntityView GetView() const;
......
...@@ -149,9 +149,13 @@ class ByChainWidget(QtGui.QWidget): ...@@ -149,9 +149,13 @@ class ByChainWidget(QtGui.QWidget):
font = text_label.font() font = text_label.font()
font.setBold(True) font.setBold(True)
conly_label = QtGui.QLabel('carbons only')
self.conly_box = QtGui.QCheckBox()
grid = QtGui.QGridLayout() grid = QtGui.QGridLayout()
grid.addWidget(text_label,0,0,1,1) grid.addWidget(text_label,0,0,1,1)
grid.addWidget(QtGui.QLabel("No Settings available"), 1, 0, 1, 3) grid.addWidget(self.conly_box, 1,0,1,1)
grid.addWidget(conly_label, 1,1,1,3)
grid.setRowStretch(2,1) grid.setRowStretch(2,1)
self.setLayout(grid) self.setLayout(grid)
self.setMinimumSize(250,60) self.setMinimumSize(250,60)
...@@ -162,7 +166,11 @@ class ByChainWidget(QtGui.QWidget): ...@@ -162,7 +166,11 @@ class ByChainWidget(QtGui.QWidget):
def ChangeColor(self, node): def ChangeColor(self, node):
if isinstance(node, gfx.Entity): if isinstance(node, gfx.Entity):
node.CleanColorOps() node.CleanColorOps()
node.ColorByChain() if self.conly_box.isChecked():
node.ColorByChain('ele=C')
else:
node.ColorByChain()
def ChangeViewColor(self, entity, view): def ChangeViewColor(self, entity, view):
if isinstance(entity, gfx.Entity) and isinstance(view, mol.EntityView): if isinstance(entity, gfx.Entity) and isinstance(view, mol.EntityView):
...@@ -184,9 +192,13 @@ class ByEntityWidget(QtGui.QWidget): ...@@ -184,9 +192,13 @@ class ByEntityWidget(QtGui.QWidget):
font = text_label.font() font = text_label.font()
font.setBold(True) font.setBold(True)
conly_label = QtGui.QLabel('carbons only')
self.conly_box = QtGui.QCheckBox()
grid = QtGui.QGridLayout() grid = QtGui.QGridLayout()
grid.addWidget(text_label,0,0,1,1) grid.addWidget(text_label,0,0,1,1)
grid.addWidget(QtGui.QLabel("No Settings available"), 1, 0, 1, 3) grid.addWidget(self.conly_box, 1,0,1,1)
grid.addWidget(conly_label, 1,1,1,3)
grid.setRowStretch(2,1) grid.setRowStretch(2,1)
self.setLayout(grid) self.setLayout(grid)
self.setMinimumSize(250,60) self.setMinimumSize(250,60)
...@@ -205,7 +217,10 @@ class ByEntityWidget(QtGui.QWidget): ...@@ -205,7 +217,10 @@ class ByEntityWidget(QtGui.QWidget):
else: else:
color=self.gradient_.GetColorAt(float(i) / entity_count) color=self.gradient_.GetColorAt(float(i) / entity_count)
node = scene_selection.GetActiveNode(i) node = scene_selection.GetActiveNode(i)
node.SetColor(color) if self.conly_box.isChecked():
node.SetColor(color, 'ele=C')
else:
node.SetColor(color)
def ChangeColor(self, node): def ChangeColor(self, node):
pass pass
......
...@@ -42,6 +42,8 @@ class UniformColorWidget(QtGui.QWidget): ...@@ -42,6 +42,8 @@ class UniformColorWidget(QtGui.QWidget):
font = uniform_label.font() font = uniform_label.font()
font.setBold(True) font.setBold(True)
conly_label = QtGui.QLabel('carbons only')
self.conly_box = QtGui.QCheckBox()
self.color_select_widget_ = ColorSelectWidget(1,1,QtGui.QColor("White")) self.color_select_widget_ = ColorSelectWidget(1,1,QtGui.QColor("White"))
...@@ -54,6 +56,9 @@ class UniformColorWidget(QtGui.QWidget): ...@@ -54,6 +56,9 @@ class UniformColorWidget(QtGui.QWidget):
grid.setColumnStretch(0,1) grid.setColumnStretch(0,1)
grid.setColumnStretch(2,1) grid.setColumnStretch(2,1)
grid.addWidget(self.conly_box, 4,0)
grid.addWidget(conly_label, 4,1)
top_layout.addWidget(uniform_label) top_layout.addWidget(uniform_label)
top_layout.addLayout(grid) top_layout.addLayout(grid)
self.setLayout(top_layout) self.setLayout(top_layout)
...@@ -87,7 +92,10 @@ class UniformColorWidget(QtGui.QWidget): ...@@ -87,7 +92,10 @@ class UniformColorWidget(QtGui.QWidget):
gfx_color = self.color_select_widget_.GetGfxColor() gfx_color = self.color_select_widget_.GetGfxColor()
if isinstance(node, gfx.Entity) or isinstance(node, gfx.Surface): if isinstance(node, gfx.Entity) or isinstance(node, gfx.Surface):
node.CleanColorOps() node.CleanColorOps()
node.SetColor(gfx_color,"") if self.conly_box.isChecked():
node.SetColor(gfx_color,"ele=C")
else:
node.SetColor(gfx_color,"")
elif _img_present and isinstance(node, gfx.MapIso): elif _img_present and isinstance(node, gfx.MapIso):
node.SetColor(gfx_color) node.SetColor(gfx_color)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment