🔨 refactor(MainWindow.py): add graph_type_changed method to handle changes in graph type selection
✨ feat(MainWindow.ui): add a label and a spinbox to display the number of graphs selected
The graph_type_changed method is added to handle changes in the graph type selection. It updates the number of graphs selected and displays it in the newly added spinbox. The label is also added to display the text "Nombre de graphes :".
This commit is contained in:
parent
2ef063f4b3
commit
0ae697096c
@ -69,6 +69,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
for combo_box in self.combo_boxes:
|
for combo_box in self.combo_boxes:
|
||||||
combo_box.addItems(self.graphType)
|
combo_box.addItems(self.graphType)
|
||||||
|
combo_box.currentIndexChanged.connect(self.graph_type_changed)
|
||||||
|
|
||||||
self.slots = [
|
self.slots = [
|
||||||
[self.slot0,"Aucun"],
|
[self.slot0,"Aucun"],
|
||||||
@ -88,6 +89,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
slot[1] = SettingManager.get_instance().get_last_graph(slot_nb)
|
slot[1] = SettingManager.get_instance().get_last_graph(slot_nb)
|
||||||
self.combo_boxes[slot_nb].setCurrentText(slot[1])
|
self.combo_boxes[slot_nb].setCurrentText(slot[1])
|
||||||
|
|
||||||
|
self.graph_nb =0
|
||||||
|
self.graph_type_changed()
|
||||||
|
|
||||||
self.settings_window = Settings()
|
self.settings_window = Settings()
|
||||||
|
|
||||||
self.has_changed = True
|
self.has_changed = True
|
||||||
@ -341,7 +345,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
for i in reversed(range(slot.count())):
|
for i in reversed(range(slot.count())):
|
||||||
slot.itemAt(i).widget().setParent(None)
|
slot.itemAt(i).widget().setParent(None)
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# #
|
# #
|
||||||
# #
|
# #
|
||||||
@ -378,3 +381,13 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
Show the settings window
|
Show the settings window
|
||||||
"""
|
"""
|
||||||
self.settings_window.show()
|
self.settings_window.show()
|
||||||
|
|
||||||
|
def graph_type_changed(self):
|
||||||
|
"""
|
||||||
|
Update the number of graphs
|
||||||
|
"""
|
||||||
|
self.graph_nb = 0
|
||||||
|
for combo_box in self.combo_boxes:
|
||||||
|
if combo_box.currentIndex() != 0:
|
||||||
|
self.graph_nb += 1
|
||||||
|
self.graph_nb_spinbox.setValue(self.graph_nb)
|
@ -117,7 +117,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="graphs_params_layout">
|
||||||
|
<item>
|
||||||
<widget class="QCheckBox" name="show_graph_checkbox">
|
<widget class="QCheckBox" name="show_graph_checkbox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>afficher les graphes</string>
|
<string>afficher les graphes</string>
|
||||||
@ -127,6 +129,28 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Nombre de graphes :</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="graph_nb_spinbox">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="buttonSymbols">
|
||||||
|
<enum>QAbstractSpinBox::NoButtons</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="start_analyse_button">
|
<widget class="QPushButton" name="start_analyse_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -75,10 +75,22 @@ class Ui_MainWindow(object):
|
|||||||
self.analyse_progress_bar.setProperty("value", 0)
|
self.analyse_progress_bar.setProperty("value", 0)
|
||||||
self.analyse_progress_bar.setObjectName("analyse_progress_bar")
|
self.analyse_progress_bar.setObjectName("analyse_progress_bar")
|
||||||
self.MainSettingsLayout.addWidget(self.analyse_progress_bar)
|
self.MainSettingsLayout.addWidget(self.analyse_progress_bar)
|
||||||
|
self.graphs_params_layout = QtWidgets.QHBoxLayout()
|
||||||
|
self.graphs_params_layout.setObjectName("graphs_params_layout")
|
||||||
self.show_graph_checkbox = QtWidgets.QCheckBox(self.MainSettings)
|
self.show_graph_checkbox = QtWidgets.QCheckBox(self.MainSettings)
|
||||||
self.show_graph_checkbox.setChecked(True)
|
self.show_graph_checkbox.setChecked(True)
|
||||||
self.show_graph_checkbox.setObjectName("show_graph_checkbox")
|
self.show_graph_checkbox.setObjectName("show_graph_checkbox")
|
||||||
self.MainSettingsLayout.addWidget(self.show_graph_checkbox, 0, QtCore.Qt.AlignHCenter)
|
self.graphs_params_layout.addWidget(self.show_graph_checkbox)
|
||||||
|
self.label = QtWidgets.QLabel(self.MainSettings)
|
||||||
|
self.label.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.graphs_params_layout.addWidget(self.label)
|
||||||
|
self.graph_nb_spinbox = QtWidgets.QSpinBox(self.MainSettings)
|
||||||
|
self.graph_nb_spinbox.setReadOnly(True)
|
||||||
|
self.graph_nb_spinbox.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
|
||||||
|
self.graph_nb_spinbox.setObjectName("graph_nb_spinbox")
|
||||||
|
self.graphs_params_layout.addWidget(self.graph_nb_spinbox)
|
||||||
|
self.MainSettingsLayout.addLayout(self.graphs_params_layout)
|
||||||
self.start_analyse_button = QtWidgets.QPushButton(self.MainSettings)
|
self.start_analyse_button = QtWidgets.QPushButton(self.MainSettings)
|
||||||
self.start_analyse_button.setObjectName("start_analyse_button")
|
self.start_analyse_button.setObjectName("start_analyse_button")
|
||||||
self.MainSettingsLayout.addWidget(self.start_analyse_button)
|
self.MainSettingsLayout.addWidget(self.start_analyse_button)
|
||||||
@ -307,6 +319,7 @@ class Ui_MainWindow(object):
|
|||||||
self.output_file_prefix_label.setText(_translate("MainWindow", "Préfix du fichier de sortie"))
|
self.output_file_prefix_label.setText(_translate("MainWindow", "Préfix du fichier de sortie"))
|
||||||
self.discretisation_label.setText(_translate("MainWindow", "Discretisation (en mm)"))
|
self.discretisation_label.setText(_translate("MainWindow", "Discretisation (en mm)"))
|
||||||
self.show_graph_checkbox.setText(_translate("MainWindow", "afficher les graphes"))
|
self.show_graph_checkbox.setText(_translate("MainWindow", "afficher les graphes"))
|
||||||
|
self.label.setText(_translate("MainWindow", "Nombre de graphes :"))
|
||||||
self.start_analyse_button.setText(_translate("MainWindow", "Analyser le fichier"))
|
self.start_analyse_button.setText(_translate("MainWindow", "Analyser le fichier"))
|
||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "1"))
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "1"))
|
||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "2"))
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "2"))
|
||||||
|
Loading…
Reference in New Issue
Block a user