Skip to content

Commit

Permalink
Color with cluster ID: problem 1
Browse files Browse the repository at this point in the history
  • Loading branch information
sozykinsa committed Aug 10, 2024
1 parent cbf8ed3 commit aee13d3
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 297 deletions.
1 change: 1 addition & 0 deletions src/core_atomistic_qt/opengl_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ def add_all_elements(self):
self.add_axes()

def color_atoms_with_property(self, prop: str = "charge"):
print("prop: ", prop)
self.clean()
self.prop = prop
self.add_all_elements()
Expand Down
5 changes: 5 additions & 0 deletions src/qtbased/gui4dftform.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ def setup_ui(self): # pragma: no cover
self.ui.changeFragment1StatusByZ.clicked.connect(self.change_fragment1_status_by_z)
self.ui.fragment1Clear.clicked.connect(self.fragment1_clear)

self.ui.show_property_text.clicked.connect(self.show_property)

self.ui.FormActionsPreButDeleteAtom.clicked.connect(self.atom_delete)
self.ui.FormActionsPreButModifyAtom.clicked.connect(self.atom_modify)
self.ui.FormActionsPreButAddAtom.clicked.connect(self.atom_add)
Expand Down Expand Up @@ -1349,6 +1351,7 @@ def cluster_data_to_form(self, clusters):
m1 = self.ui.openGLWidget.main_model.sub_model(cluster)
text += "cm :" + str(m1.center_mass()) + "\n"
text += "size z :" + str(round(m1.max_z() - m1.min_z(), 4)) + "\n"
self.ui.color_atoms_with_cluster_id.setEnabled(True)
self.ui.clusters_info.setText(text)
self.plot_model(self.active_model_id)

Expand Down Expand Up @@ -1876,6 +1879,8 @@ def plot_model(self, value):
return
self.active_model_id = value
self.ui.Form3Dand2DTabs.setCurrentIndex(0)
self.ui.color_atoms_with_atom_type.setChecked(True)
self.ui.color_atoms_with_cluster_id.setEnabled(False)
view_atoms = self.ui.FormSettingsViewCheckShowAtoms.isChecked()
view_atom_numbers = self.ui.FormSettingsViewCheckShowAtomNumber.isChecked()
view_box = self.ui.FormSettingsViewCheckShowBox.isChecked()
Expand Down
159 changes: 73 additions & 86 deletions src/ui/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def setupUi(self, MainWindow):
self.toolBox.setObjectName(u"toolBox")
self.page_3 = QWidget()
self.page_3.setObjectName(u"page_3")
self.page_3.setGeometry(QRect(0, 0, 241, 176))
self.page_3.setGeometry(QRect(0, 0, 371, 562))
self.verticalLayout_86 = QVBoxLayout(self.page_3)
self.verticalLayout_86.setObjectName(u"verticalLayout_86")
self.groupBox_35 = QGroupBox(self.page_3)
Expand Down Expand Up @@ -2451,7 +2451,7 @@ def setupUi(self, MainWindow):
self.toolBox_6.addItem(self.page, u"Cell")
self.page_9 = QWidget()
self.page_9.setObjectName(u"page_9")
self.page_9.setGeometry(QRect(0, 0, 98, 28))
self.page_9.setGeometry(QRect(0, 0, 100, 30))
self.FormModelComboModels_2 = QComboBox(self.page_9)
self.FormModelComboModels_2.setObjectName(u"FormModelComboModels_2")
self.FormModelComboModels_2.setGeometry(QRect(50, 10, 61, 22))
Expand Down Expand Up @@ -5968,11 +5968,74 @@ def setupUi(self, MainWindow):

self.verticalLayout_31.addWidget(self.groupBox)

self.groupBox_68 = QGroupBox(self.tab_32)
self.groupBox_68.setObjectName(u"groupBox_68")
self.groupBox_68.setMinimumSize(QSize(0, 0))
self.horizontalLayout_96 = QHBoxLayout(self.groupBox_68)
self.horizontalLayout_96.setObjectName(u"horizontalLayout_96")
self.PropertyForColorOfAtom = QComboBox(self.groupBox_68)
self.PropertyForColorOfAtom.setObjectName(u"PropertyForColorOfAtom")

self.horizontalLayout_96.addWidget(self.PropertyForColorOfAtom)


self.verticalLayout_31.addWidget(self.groupBox_68)

self.groupBox_60 = QGroupBox(self.tab_32)
self.groupBox_60.setObjectName(u"groupBox_60")
self.groupBox_60.setMinimumSize(QSize(0, 0))
self.horizontalLayout_97 = QHBoxLayout(self.groupBox_60)
self.horizontalLayout_97.setObjectName(u"horizontalLayout_97")
self.horizontalLayout_97.setContentsMargins(-1, 0, -1, 0)
self.frame_11 = QFrame(self.groupBox_60)
self.frame_11.setObjectName(u"frame_11")
self.frame_11.setFrameShape(QFrame.NoFrame)
self.frame_11.setFrameShadow(QFrame.Raised)
self.horizontalLayout_204 = QHBoxLayout(self.frame_11)
self.horizontalLayout_204.setObjectName(u"horizontalLayout_204")
self.color_atoms_with_atom_type = QRadioButton(self.frame_11)
self.color_atoms_with_atom_type.setObjectName(u"color_atoms_with_atom_type")
self.color_atoms_with_atom_type.setChecked(True)

self.horizontalLayout_204.addWidget(self.color_atoms_with_atom_type)

self.color_atoms_with_property = QRadioButton(self.frame_11)
self.color_atoms_with_property.setObjectName(u"color_atoms_with_property")

self.horizontalLayout_204.addWidget(self.color_atoms_with_property)

self.color_atoms_with_cluster_id = QRadioButton(self.frame_11)
self.color_atoms_with_cluster_id.setObjectName(u"color_atoms_with_cluster_id")
self.color_atoms_with_cluster_id.setEnabled(False)

self.horizontalLayout_204.addWidget(self.color_atoms_with_cluster_id)


self.horizontalLayout_97.addWidget(self.frame_11)


self.verticalLayout_31.addWidget(self.groupBox_60)

self.groupBox_29 = QGroupBox(self.tab_32)
self.groupBox_29.setObjectName(u"groupBox_29")
self.groupBox_29.setMinimumSize(QSize(0, 0))
self.verticalLayout_107 = QVBoxLayout(self.groupBox_29)
self.verticalLayout_107.setObjectName(u"verticalLayout_107")
self.frame_82 = QFrame(self.groupBox_29)
self.frame_82.setObjectName(u"frame_82")
self.frame_82.setFrameShape(QFrame.NoFrame)
self.frame_82.setFrameShadow(QFrame.Raised)
self.horizontalLayout_48 = QHBoxLayout(self.frame_82)
self.horizontalLayout_48.setObjectName(u"horizontalLayout_48")
self.horizontalLayout_48.setContentsMargins(-1, 0, -1, 0)
self.show_property_text = QCheckBox(self.frame_82)
self.show_property_text.setObjectName(u"show_property_text")

self.horizontalLayout_48.addWidget(self.show_property_text)


self.verticalLayout_107.addWidget(self.frame_82)

self.frame_165 = QFrame(self.groupBox_29)
self.frame_165.setObjectName(u"frame_165")
self.frame_165.setFrameShape(QFrame.NoFrame)
Expand Down Expand Up @@ -6104,83 +6167,6 @@ def setupUi(self, MainWindow):

self.verticalLayout_31.addWidget(self.frame_36)

self.groupBox_60 = QGroupBox(self.tab_32)
self.groupBox_60.setObjectName(u"groupBox_60")
self.groupBox_60.setMinimumSize(QSize(0, 200))
self.horizontalLayout_97 = QHBoxLayout(self.groupBox_60)
self.horizontalLayout_97.setObjectName(u"horizontalLayout_97")
self.frame_11 = QFrame(self.groupBox_60)
self.frame_11.setObjectName(u"frame_11")
self.frame_11.setFrameShape(QFrame.NoFrame)
self.frame_11.setFrameShadow(QFrame.Raised)
self.verticalLayout_10 = QVBoxLayout(self.frame_11)
self.verticalLayout_10.setObjectName(u"verticalLayout_10")
self.color_atoms_with_atom_type = QRadioButton(self.frame_11)
self.color_atoms_with_atom_type.setObjectName(u"color_atoms_with_atom_type")
self.color_atoms_with_atom_type.setChecked(True)

self.verticalLayout_10.addWidget(self.color_atoms_with_atom_type)

self.color_atoms_with_property = QRadioButton(self.frame_11)
self.color_atoms_with_property.setObjectName(u"color_atoms_with_property")

self.verticalLayout_10.addWidget(self.color_atoms_with_property)

self.color_atoms_with_cluster_id = QRadioButton(self.frame_11)
self.color_atoms_with_cluster_id.setObjectName(u"color_atoms_with_cluster_id")

self.verticalLayout_10.addWidget(self.color_atoms_with_cluster_id)


self.horizontalLayout_97.addWidget(self.frame_11)

self.frame_82 = QFrame(self.groupBox_60)
self.frame_82.setObjectName(u"frame_82")
self.frame_82.setFrameShape(QFrame.NoFrame)
self.frame_82.setFrameShadow(QFrame.Raised)
self.verticalLayout_60 = QVBoxLayout(self.frame_82)
self.verticalLayout_60.setObjectName(u"verticalLayout_60")
self.frame_83 = QFrame(self.frame_82)
self.frame_83.setObjectName(u"frame_83")
self.frame_83.setMinimumSize(QSize(0, 30))
self.frame_83.setFrameShape(QFrame.NoFrame)
self.frame_83.setFrameShadow(QFrame.Raised)

self.verticalLayout_60.addWidget(self.frame_83)

self.frame_95 = QFrame(self.frame_82)
self.frame_95.setObjectName(u"frame_95")
self.frame_95.setFrameShape(QFrame.NoFrame)
self.frame_95.setFrameShadow(QFrame.Raised)
self.horizontalLayout_96 = QHBoxLayout(self.frame_95)
self.horizontalLayout_96.setObjectName(u"horizontalLayout_96")
self.PropertyForColorOfAtom = QComboBox(self.frame_95)
self.PropertyForColorOfAtom.setObjectName(u"PropertyForColorOfAtom")

self.horizontalLayout_96.addWidget(self.PropertyForColorOfAtom)

self.show_property_text = QCheckBox(self.frame_95)
self.show_property_text.setObjectName(u"show_property_text")

self.horizontalLayout_96.addWidget(self.show_property_text)


self.verticalLayout_60.addWidget(self.frame_95)

self.frame_96 = QFrame(self.frame_82)
self.frame_96.setObjectName(u"frame_96")
self.frame_96.setMinimumSize(QSize(0, 40))
self.frame_96.setFrameShape(QFrame.NoFrame)
self.frame_96.setFrameShadow(QFrame.Raised)

self.verticalLayout_60.addWidget(self.frame_96)


self.horizontalLayout_97.addWidget(self.frame_82)


self.verticalLayout_31.addWidget(self.groupBox_60)

self.verticalSpacer_9 = QSpacerItem(20, 374, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)

self.verticalLayout_31.addItem(self.verticalSpacer_9)
Expand Down Expand Up @@ -6883,7 +6869,7 @@ def setupUi(self, MainWindow):
self.Form3Dand2DTabs.addItem(self.page_7, u"3D View")
self.page_8 = QWidget()
self.page_8.setObjectName(u"page_8")
self.page_8.setGeometry(QRect(0, 0, 98, 100))
self.page_8.setGeometry(QRect(0, 0, 665, 765))
self.horizontalLayout = QHBoxLayout(self.page_8)
self.horizontalLayout.setObjectName(u"horizontalLayout")
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -6949,7 +6935,7 @@ def setupUi(self, MainWindow):
self.tabWidget_4.setCurrentIndex(0)
self.tabWidget_2.setCurrentIndex(0)
self.tabWidget_8.setCurrentIndex(0)
self.tabWidget_6.setCurrentIndex(0)
self.tabWidget_6.setCurrentIndex(2)
self.tabWidget_9.setCurrentIndex(0)
self.tabWidget_12.setCurrentIndex(1)
self.Form3Dand2DTabs.setCurrentIndex(0)
Expand Down Expand Up @@ -7414,19 +7400,20 @@ def retranslateUi(self, MainWindow):
self.label_2.setText(QCoreApplication.translate("MainWindow", u"Bond parameter", None))
self.label_31.setText(QCoreApplication.translate("MainWindow", u"-", None))
self.label_30.setText(QCoreApplication.translate("MainWindow", u"A", None))
self.groupBox_68.setTitle(QCoreApplication.translate("MainWindow", u"Property", None))
self.groupBox_60.setTitle(QCoreApplication.translate("MainWindow", u"Color atoms according to", None))
self.color_atoms_with_atom_type.setText(QCoreApplication.translate("MainWindow", u"atom type", None))
self.color_atoms_with_property.setText(QCoreApplication.translate("MainWindow", u"property", None))
self.color_atoms_with_cluster_id.setText(QCoreApplication.translate("MainWindow", u"cluster ID", None))
self.groupBox_29.setTitle(QCoreApplication.translate("MainWindow", u"Text", None))
self.show_property_text.setText(QCoreApplication.translate("MainWindow", u"Show property", None))
self.label_132.setText(QCoreApplication.translate("MainWindow", u"Position: X", None))
self.label_133.setText(QCoreApplication.translate("MainWindow", u", Y", None))
self.label_90.setText(QCoreApplication.translate("MainWindow", u"Font size", None))
self.label_81.setText(QCoreApplication.translate("MainWindow", u"Figures in property", None))
self.groupBox_34.setTitle(QCoreApplication.translate("MainWindow", u"OpenGl", None))
self.OpenGL_GL_CULL_FACE.setText(QCoreApplication.translate("MainWindow", u"GL_CULL_FACE", None))
self.ogl_quality_label.setText(QCoreApplication.translate("MainWindow", u"Quality", None))
self.groupBox_60.setTitle(QCoreApplication.translate("MainWindow", u"Color atoms according to", None))
self.color_atoms_with_atom_type.setText(QCoreApplication.translate("MainWindow", u"atom type", None))
self.color_atoms_with_property.setText(QCoreApplication.translate("MainWindow", u"property", None))
self.color_atoms_with_cluster_id.setText(QCoreApplication.translate("MainWindow", u"cluster ID", None))
self.show_property_text.setText(QCoreApplication.translate("MainWindow", u"Show property", None))
self.tabWidget_9.setTabText(self.tabWidget_9.indexOf(self.tab_32), QCoreApplication.translate("MainWindow", u"View 3D", None))
self.groupBox_9.setTitle(QCoreApplication.translate("MainWindow", u"Colors", None))
self.label_32.setText(QCoreApplication.translate("MainWindow", u"Font color", None))
Expand Down
Loading

0 comments on commit aee13d3

Please sign in to comment.