diff --git a/View/sample_data_tab.py b/View/sample_data_tab.py index 85cb76f..9d1467f 100644 --- a/View/sample_data_tab.py +++ b/View/sample_data_tab.py @@ -28,6 +28,7 @@ import pandas as pd import itertools import matplotlib.pyplot as plt +# from QtCore.QByteArray import length from matplotlib.colors import LogNorm, BASE_COLORS from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar @@ -189,6 +190,9 @@ class SampleDataTab(QWidget): self.combobox_x_axis = QComboBox() self.combobox_x_axis.addItems(['Concentration (g/L)', 'Concentration (%)']) + self.combobox_x_axis.setItemData(1, + "FINE : 100 * Cfine / (Cfine + Csand) | SAND : 100 * Csand / (Cfine + Csand)" + , Qt.ToolTipRole) self.gridLayout_groupbox_option_total_concentration_plot.addWidget(self.combobox_x_axis, 0, 1) self.label_y_axis = QLabel() @@ -246,6 +250,9 @@ class SampleDataTab(QWidget): self.pushbutton_plot_transect.clicked.connect(self.fill_comboboxes_and_plot_transect) + self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration) + self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration) + self.combobox_PSD_plot.currentTextChanged.connect(self.plot_PSD_fine_and_sand_sediments) # -------------------- Functions for Sample Data Tab -------------------- @@ -424,6 +431,8 @@ class SampleDataTab(QWidget): i, 0, self.comboBox_sample_table_fine[i] ) + self.comboBox_sample_table_fine[i].setCurrentIndex(i % len(list(color_list.keys()))) + self.comboBox_sample_table_fine[i]\ .currentTextChanged\ .connect(self.plot_total_concentration) @@ -469,8 +478,8 @@ class SampleDataTab(QWidget): self.tableWidget_fine.itemChanged.connect(self.plot_total_concentration) self.tableWidget_fine.itemChanged.connect(self.plot_PSD_fine_and_sand_sediments) - self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration) - self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration) + # self.combobox_x_axis.currentIndexChanged.connect(self.plot_total_concentration) + # self.combobox_y_axis.currentIndexChanged.connect(self.plot_total_concentration) self.plot_sample_position_on_transect() self.plot_total_concentration() @@ -521,6 +530,8 @@ class SampleDataTab(QWidget): i, 0, self.comboBox_sample_table_sand[i] ) + self.comboBox_sample_table_sand[i].setCurrentIndex(i % len(list(color_list.keys()))) + self.comboBox_sample_table_sand[i]\ .currentTextChanged\ .connect(self.plot_total_concentration) @@ -1367,6 +1378,11 @@ class SampleDataTab(QWidget): else: + self.tableWidget_fine.blockSignals(True) + self.tableWidget_sand.blockSignals(True) + self.combobox_x_axis.blockSignals(True) + self.combobox_y_axis.blockSignals(True) + self.verticalLayout_groupbox_plot_total_concentration.removeWidget(self.canvas_plot_total_concentration) self.verticalLayout_groupbox_plot_total_concentration.removeWidget(self.toolbar_plot_total_concentration) @@ -1632,6 +1648,11 @@ class SampleDataTab(QWidget): self.axis_total_concentration.legend(loc="upper right") self.figure_total_concentration.canvas.draw_idle() + self.tableWidget_fine.blockSignals(False) + self.tableWidget_sand.blockSignals(False) + self.combobox_x_axis.blockSignals(False) + self.combobox_y_axis.blockSignals(False) + def plot_PSD_fine_and_sand_sediments(self): """ Update the plot of Particle Size Distribution according to choices of x-axis and y-axis combo-boxes """