diff --git a/src/View/Geometry/GeometryWindow.py b/src/View/Geometry/GeometryWindow.py index 1336a0e90d3bee55769777f37a5c94f99ac13387..6b46161f5ed209680d83293388c6c41531d63961 100644 --- a/src/View/Geometry/GeometryWindow.py +++ b/src/View/Geometry/GeometryWindow.py @@ -36,9 +36,18 @@ class GeometryWindow(QMainWindow, WindowToolKit): self.tableView_header = self.ui.tableView_header self.model = None self.filename = None + self.setup_model() self.setup_connections() + def setup_model(self): + self.model = qtableview_reach.PandasModelEditableCreateReach( + headers = self.ui.tableView_header, + rows = self._reach + ) + self.tableView.setModel(self.model) + self.tableView.setItemDelegate(qtableview_reach.Delegate()) + def setup_connections(self): self.ui.btn_open.clicked.connect(self.open_file_dialog) self.ui.btn_sort_asc.clicked.connect(self.sort_ascending) @@ -55,11 +64,6 @@ class GeometryWindow(QMainWindow, WindowToolKit): self.ui.btn_slider_down.clicked.connect(self.increment_value_slider) self.ui.btn_move_up.clicked.connect(self.changed_profile_slot) - def setup_model(self): - self.model = qtableview_reach.PandasModelEditableCreateReach([], self.ui.tableView_header) - self.tableView.setModel(self.model) - self.tableView.setItemDelegate(qtableview_reach.Delegate()) - def open_file_dialog(self): options = QFileDialog.Options() DEFAULT_DIRECTORY = os.getenv("HOME") @@ -681,10 +685,12 @@ class GeometryWindow(QMainWindow, WindowToolKit): get_pk_i = self.get_pk_i(ind) get_z_min_i = self.get_z_min_i(ind) get_z_max_i = self.get_z_max_i(ind) + self.after_plot_selected_2.set_data( (get_pk_i, get_pk_i), (get_z_min_i, get_z_max_i) ) + self.after_plot_selected_2.set_visible(True) self.ui.canvas_2.figure.canvas.draw_idle() @@ -727,10 +733,9 @@ class GeometryWindow(QMainWindow, WindowToolKit): self.select_before_plot_selected_1(row - 1) self.after_plot_selected_2.set_visible(False) self.select_before_plot_selected_2(row - 1) - self.tableView.model().blockSignals(False) + self.tableView.model().blockSignals(False) self.update_graphic_3(row) - self.ui.canvas_1.figure.canvas.draw_idle() self.ui.canvas_2.figure.canvas.draw_idle() @@ -741,8 +746,8 @@ class GeometryWindow(QMainWindow, WindowToolKit): self.ui.verticalSlider.setMaximum(self.model.rowCount() - 1) slider_value = self.ui.verticalSlider.value() - pk = self.model.get_pk_profile_i(slider_value) + self.ui.vertical_slider_label.setText( _translate("MainWindow_reach", "Pk : ") + f"{pk}" + "\n" + @@ -754,7 +759,6 @@ class GeometryWindow(QMainWindow, WindowToolKit): self.select_plot_graphic_1(slider_value) self.select_plot_graphic_2(slider_value) self.select_row_profile_slider(slider_value) - self.tableView.model().blockSignals(False) def increment_value_slider(self): diff --git a/src/View/Geometry/mainwindow_ui_reach.py b/src/View/Geometry/mainwindow_ui_reach.py index 2aa392f732cee5eb10864cc0b780dfa44d311789..8e13e673345c8b0f36b5eefb086831124029da5a 100644 --- a/src/View/Geometry/mainwindow_ui_reach.py +++ b/src/View/Geometry/mainwindow_ui_reach.py @@ -38,18 +38,18 @@ class Ui_MainWindow(object): self.label_section_order = QtWidgets.QLabel(self.widget) self.label_section_order.setLayoutDirection(Qt.LeftToRight) self.label_section_order.setObjectName("label_section_order") - self.label_section_order.setStyleSheet( - "QLabel{ border: 1px solid darkGray;\n" - " gridline-color: gray;\n" - " border-radius: 1px;\n" - " border-style: solid;\n" - " background-color: ; \n" - " selection-background-color: #218ede;\n" - " font-size: 12px;\n" - " font-family: Helvetica\n" - "\n" - " }" - ) + # self.label_section_order.setStyleSheet( + # "QLabel{ border: 1px solid darkGray;\n" + # " gridline-color: gray;\n" + # " border-radius: 1px;\n" + # " border-style: solid;\n" + # " background-color: ; \n" + # " selection-background-color: #218ede;\n" + # " font-size: 12px;\n" + # " font-family: Helvetica\n" + # "\n" + # " }" + # ) self.verticalLayout.addWidget(self.label_section_order) btn_size = QSize(30, 30) self.btn_open = QtWidgets.QPushButton(self.widget) @@ -187,18 +187,18 @@ class Ui_MainWindow(object): self.tableView.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # ajuster la largeur du tableau self.tableView.setAlternatingRowColors(True) # colorie une ligne sur 2 self.tableView.verticalHeader().hide() # hide vertical/row headers - self.tableView.setStyleSheet( - " QTableView { border: 1px solid black;\n" - " gridline-color: blue;\n" - " border-radius: 2px;\n" - " border-style: solid;\n" - " background-color: #EEF6FC; \n" - " selection-background-color: #218ede;\n" - " font-size: 12px;\n" - " font-family: Helvetica\n" - "\n" - " }" - ) + # self.tableView.setStyleSheet( + # " QTableView { border: 1px solid black;\n" + # " gridline-color: blue;\n" + # " border-radius: 2px;\n" + # " border-style: solid;\n" + # " background-color: #EEF6FC; \n" + # " selection-background-color: #218ede;\n" + # " font-size: 12px;\n" + # " font-family: Helvetica\n" + # "\n" + # " }" + # ) self.tableView.resizeColumnsToContents() self.tableView.resizeRowsToContents() @@ -225,18 +225,18 @@ class Ui_MainWindow(object): self.toolbar_1 = navigation_toolbar_2qt.PamHyrNavigationToolbar2QT( self.canvas_1, self.centralwidget ) - self.toolbar_1.setStyleSheet( - "QToolBar{ border: 1px solid darkGray;\n" - " gridline-color: blue;\n" - " border-radius: 4px;\n" - " border-style: solid;\n" - " background-color: #EEF6FC; \n" - " selection-background-color: #218ede;\n" - " font-size: 12px;\n" - " font-family: Helvetica\n" - "\n" - " }" - ) + # self.toolbar_1.setStyleSheet( + # "QToolBar{ border: 1px solid darkGray;\n" + # " gridline-color: blue;\n" + # " border-radius: 4px;\n" + # " border-style: solid;\n" + # " background-color: #EEF6FC; \n" + # " selection-background-color: #218ede;\n" + # " font-size: 12px;\n" + # " font-family: Helvetica\n" + # "\n" + # " }" + # ) self.verticalLayout_canvas_1.addWidget(self.toolbar_1) self.verticalLayout_canvas_1.addWidget(self.canvas_1) @@ -251,18 +251,18 @@ class Ui_MainWindow(object): self.canvas_2.setObjectName("canvas_2") self.toolbar_2 = navigation_toolbar_2qt.PamHyrNavigationToolbar2QT(self.canvas_2, self.centralwidget) - self.toolbar_2.setStyleSheet( - "QToolBar{ border: 1px solid darkGray;\n" - " gridline-color: blue;\n" - " border-radius: 4px;\n" - " border-style: solid;\n" - " background-color: #EEF6FC; \n" - " selection-background-color: #218ede;\n" - " font-size: 12px;\n" - " font-family: Helvetica\n" - "\n" - " }" - ) + # self.toolbar_2.setStyleSheet( + # "QToolBar{ border: 1px solid darkGray;\n" + # " gridline-color: blue;\n" + # " border-radius: 4px;\n" + # " border-style: solid;\n" + # " background-color: #EEF6FC; \n" + # " selection-background-color: #218ede;\n" + # " font-size: 12px;\n" + # " font-family: Helvetica\n" + # "\n" + # " }" + # ) self.verticalLayout_canvas_2.addWidget(self.toolbar_2) self.verticalLayout_canvas_2.addWidget(self.canvas_2) @@ -276,18 +276,18 @@ class Ui_MainWindow(object): self.canvas_3.setObjectName("canvas_3") self.toolbar_3 = navigation_toolbar_2qt.PamHyrNavigationToolbar2QT(self.canvas_3, self.centralwidget) - self.toolbar_3.setStyleSheet( - "QToolBar{ border: 1px solid darkGray;\n" - " gridline-color: blue;\n" - " border-radius: 4px;\n" - " border-style: solid;\n" - " background-color: #EEF6FC; \n" - " selection-background-color: #218ede;\n" - " font-size: 12px;\n" - " font-family: Helvetica\n" - "\n" - " }" - ) + # self.toolbar_3.setStyleSheet( + # "QToolBar{ border: 1px solid darkGray;\n" + # " gridline-color: blue;\n" + # " border-radius: 4px;\n" + # " border-style: solid;\n" + # " background-color: #EEF6FC; \n" + # " selection-background-color: #218ede;\n" + # " font-size: 12px;\n" + # " font-family: Helvetica\n" + # "\n" + # " }" + # ) self.verticalLayout_canvas_3.addWidget(self.toolbar_3) self.verticalLayout_canvas_3.addWidget(self.canvas_3) diff --git a/src/View/Geometry/qtableview_profile.py b/src/View/Geometry/qtableview_profile.py index 267d88623de89a1462c00104ca0f452b05fb5084..afbe290ecc27ac7c41179c6fbf59434edcc9e408 100644 --- a/src/View/Geometry/qtableview_profile.py +++ b/src/View/Geometry/qtableview_profile.py @@ -55,12 +55,12 @@ class PandasModelEditable(QAbstractTableModel): if role == Qt.TextAlignmentRole: return Qt.AlignHCenter | Qt.AlignVCenter - if index.column() == 2: - if role == Qt.ForegroundRole: - if value == min(self._data.iloc[:, index.column()]): - return QtGui.QColor("red") - elif value == max(self._data.iloc[:, index.column()]): - return QtGui.QColor("Blue") + # if index.column() == 2: + # if role == Qt.ForegroundRole: + # if value == min(self._data.iloc[:, index.column()]): + # return QtGui.QColor("red") + # elif value == max(self._data.iloc[:, index.column()]): + # return QtGui.QColor("Blue") if role == Qt.ToolTipRole: if value == min(self._data.iloc[:, index.column()]): @@ -90,8 +90,8 @@ class PandasModelEditable(QAbstractTableModel): font.setBold(True) return font - if role == Qt.BackgroundRole: - return QtGui.QColor("#ededee") + # if role == Qt.BackgroundRole: + # return QtGui.QColor("#ededee") return QVariant() diff --git a/src/View/Geometry/qtableview_reach.py b/src/View/Geometry/qtableview_reach.py index 472f7a69c0ae491d603976f911ae1e066a92e1f9..22c8f2fc5402857be2c003a120c16cb60c2b3f0b 100644 --- a/src/View/Geometry/qtableview_reach.py +++ b/src/View/Geometry/qtableview_reach.py @@ -66,21 +66,22 @@ class PandasModelEditable(QAbstractTableModel): if index.column() == column and role == Qt.TextAlignmentRole: return Qt.AlignHCenter | Qt.AlignVCenter - if role == Qt.BackgroundRole and index.column() == 1: - return QtGui.QColor(Qt.lightGray) + # if role == Qt.BackgroundRole and index.column() == 1: + # return QtGui.QColor(Qt.lightGray) - if role == Qt.BackgroundRole and index.column() == 2: - color = QtGui.QColor() - data_i_profile_type = self._data.profile[index.row()].profile_type + # if role == Qt.BackgroundRole and index.column() == 2: + # color = QtGui.QColor() + # data_i_profile_type = self._data.profile[index.row()].profile_type - if data_i_profile_type == self.profiles_type[1]: - color = QtGui.QColor("magenta") - elif data_i_profile_type == self.profiles_type[2]: - color = QtGui.QColor("red") - else: - color = QtGui.QColor("lightgreen") + # if data_i_profile_type == self.profiles_type[1]: + # color = QtGui.QColor("magenta") + # elif data_i_profile_type == self.profiles_type[2]: + # color = QtGui.QColor("red") + # else: + # color = QtGui.QColor("lightgreen") + + # return color - return color if role == Qt.ForegroundRole and index.column() == 0: if self._data.profile[index.row()].name == "Amont": return QtGui.QColor("Green") @@ -404,7 +405,7 @@ class Delegate11(QtWidgets.QItemDelegate): def createEditor(self, parent, option, index): self.editor = QtWidgets.QComboBox(parent) - self.editor.currentIndexChanged.connect(self.commit_editor) + # self.editor.currentIndexChanged.connect(self.commit_editor) self.editor.addItems(self.items) return self.editor @@ -417,25 +418,25 @@ class Delegate11(QtWidgets.QItemDelegate): style.drawComplexControl(QtWidgets.QStyle.CC_ComboBox, opt, painter) QtWidgets.QItemDelegate.paint(self, painter, option, index) - def commit_editor(self): - editor = self.sender() - color = QtGui.QColor() - if editor.currentText() == "ProfilXYZ": - color = QtGui.QColor("lightgreen") - elif editor.currentText() == "ProfilAC": - color = QtGui.QColor("red") - qss = """QComboBox{background-color : %s;}""" % (color.name(),) - editor.setStyleSheet(qss) - self.commitData.emit(editor) + # def commit_editor(self): + # editor = self.sender() + # color = QtGui.QColor() + # if editor.currentText() == "ProfilXYZ": + # color = QtGui.QColor("lightgreen") + # elif editor.currentText() == "ProfilAC": + # color = QtGui.QColor("red") + # qss = """QComboBox{background-color : %s;}""" % (color.name(),) + # editor.setStyleSheet(qss) + # self.commitData.emit(editor) def setEditorData(self, editor, index): editor.blockSignals(True) editor.setCurrentIndex(index.row()) # replacement editor.blockSignals(False) - @pyqtSlot() - def currentIndexChanged(self): - self.commit_editor.emit(self.sender()) + # @pyqtSlot() + # def currentIndexChanged(self): + # self.commit_editor.emit(self.sender()) def setModelData(self, editor, model, index): value = editor.currentText() @@ -457,22 +458,22 @@ class Delegate1(QtWidgets.QStyledItemDelegate): def createEditor(self, parent, option, index): editor = QtWidgets.QComboBox(parent) - editor.currentIndexChanged.connect(self.commit_editor) + # editor.currentIndexChanged.connect(self.commit_editor) editor.addItems(self.items) return editor - def commit_editor(self): - editor = self.sender() - color = QtGui.QColor() + # def commit_editor(self): + # editor = self.sender() + # color = QtGui.QColor() - if editor.currentText() == "ProfilXYZ": - color = QtGui.QColor("lightgreen") - elif editor.currentText() == "ProfilAC": - color = QtGui.QColor("red") + # if editor.currentText() == "ProfilXYZ": + # color = QtGui.QColor("lightgreen") + # elif editor.currentText() == "ProfilAC": + # color = QtGui.QColor("red") - qss = """QComboBox{background-color : %s;}""" % (color.name(),) - editor.setStyleSheet(qss) - self.commitData.emit(editor) + # qss = """QComboBox{background-color : %s;}""" % (color.name(),) + # editor.setStyleSheet(qss) + # self.commitData.emit(editor) def setEditorData(self, editor, index): editor.blockSignals(True) @@ -526,8 +527,8 @@ class PandasModelEditableCreateReach(QAbstractTableModel): if index.column() == column and role == Qt.TextAlignmentRole: return Qt.AlignHCenter | Qt.AlignVCenter - if role == Qt.BackgroundRole and index.column() == 1: - return QtGui.QColor(Qt.lightGray) + # if role == Qt.BackgroundRole and index.column() == 1: + # return QtGui.QColor(Qt.lightGray) return QVariant() # None @@ -948,7 +949,7 @@ class Delegate11(QtWidgets.QItemDelegate): def createEditor(self, parent, option, index): self.editor = QtWidgets.QComboBox(parent) - self.editor.currentIndexChanged.connect(self.commit_editor) + # self.editor.currentIndexChanged.connect(self.commit_editor) self.editor.addItems(self.items) return self.editor @@ -962,25 +963,25 @@ class Delegate11(QtWidgets.QItemDelegate): QtWidgets.QItemDelegate.paint(self, painter, option, index) - def commit_editor(self): - editor = self.sender() - color = QtGui.QColor() - if editor.currentText() == "ProfilXYZ": - color = QtGui.QColor("lightgreen") - elif editor.currentText() == "ProfilAC": - color = QtGui.QColor("red") - qss = """QComboBox{background-color : %s;}""" % (color.name(),) - editor.setStyleSheet(qss) - self.commitData.emit(editor) + # def commit_editor(self): + # editor = self.sender() + # color = QtGui.QColor() + # if editor.currentText() == "ProfilXYZ": + # color = QtGui.QColor("lightgreen") + # elif editor.currentText() == "ProfilAC": + # color = QtGui.QColor("red") + # qss = """QComboBox{background-color : %s;}""" % (color.name(),) + # editor.setStyleSheet(qss) + # self.commitData.emit(editor) def setEditorData(self, editor, index): editor.blockSignals(True) editor.setCurrentIndex(index.row()) # replacement editor.blockSignals(False) - @pyqtSlot() - def currentIndexChanged(self): - self.commit_editor.emit(self.sender()) + # @pyqtSlot() + # def currentIndexChanged(self): + # self.commit_editor.emit(self.sender()) def setModelData(self, editor, model, index): value = editor.currentText() @@ -1002,20 +1003,20 @@ class Delegate1(QtWidgets.QStyledItemDelegate): def createEditor(self, parent, option, index): editor = QtWidgets.QComboBox(parent) - editor.currentIndexChanged.connect(self.commit_editor) + # editor.currentIndexChanged.connect(self.commit_editor) editor.addItems(self.items) return editor - def commit_editor(self): - editor = self.sender() - color = QtGui.QColor() - if editor.currentText() == "ProfilXYZ": - color = QtGui.QColor("lightgreen") - elif editor.currentText() == "ProfilAC": - color = QtGui.QColor("red") - qss = """QComboBox{background-color : %s;}""" % (color.name(),) - editor.setStyleSheet(qss) - self.commitData.emit(editor) + # def commit_editor(self): + # editor = self.sender() + # color = QtGui.QColor() + # if editor.currentText() == "ProfilXYZ": + # color = QtGui.QColor("lightgreen") + # elif editor.currentText() == "ProfilAC": + # color = QtGui.QColor("red") + # qss = """QComboBox{background-color : %s;}""" % (color.name(),) + # editor.setStyleSheet(qss) + # self.commitData.emit(editor) def setEditorData(self, editor, index): editor.blockSignals(True) diff --git a/src/View/Plot/MplCanvas.py b/src/View/Plot/MplCanvas.py index fa4c3ffffd6a2929ac54d9d31dac1cf33d2bb480..a78da19c6f411d0c98743a477b3c4b9491fbf4af 100644 --- a/src/View/Plot/MplCanvas.py +++ b/src/View/Plot/MplCanvas.py @@ -3,13 +3,15 @@ from matplotlib.figure import Figure class MplCanvas(FigureCanvasQTAgg): - def __init__(self, width=5, height=4, dpi=100): fig = Figure(figsize=(width, height), dpi=dpi) super(MplCanvas, self).__init__(fig) self.axes = fig.add_subplot(111) - self.axes.format_coord = lambda x, y: '(x = ' + format(x, '1.4f') + ', \t' + ' y = ' + format(y, '1.4f') + ')' + self.axes.format_coord = lambda x, y: ( + '(x = ' + format(x, '1.4f') + ', \t' + + ' y = ' + format(y, '1.4f') + ')' + ) self.axes.grid(color='green', linestyle='--', linewidth=0.5) self.axes.yaxis.tick_left() self.axes.xaxis.tick_bottom() diff --git a/src/View/Plot/mpl_canvas_onpick_event.py b/src/View/Plot/mpl_canvas_onpick_event.py index 6a7e3f12a865b2422dbcdc8786d8ed923a5d998c..6415aee70d0437021eb7a43729e7a4ac060800a6 100644 --- a/src/View/Plot/mpl_canvas_onpick_event.py +++ b/src/View/Plot/mpl_canvas_onpick_event.py @@ -27,25 +27,30 @@ class OnpickEvent(object): self.counter_onclick = 0 # self.select_point_plot() self.count = 0 - self.annotation_onclick = self.ax.annotate("", xytext=(np.mean(self.x), np.mean(self.y)), - xy=(np.mean(self.x), np.mean(self.y)), - horizontalalignment='center', - fontsize=8, - # fontstyle='italic', - fontweight='bold', - alpha=0.7 - - ) + self.annotation_onclick = self.ax.annotate( + "", + xytext=(np.mean(self.x), np.mean(self.y)), + xy=(np.mean(self.x), np.mean(self.y)), + horizontalalignment='center', + fontsize=8, + # fontstyle='italic', + fontweight='bold', + alpha=0.7 + ) self.annotation_onclick.set_visible(False) self.pos_x = 0 self.zomm_xmin_xmax = self.ax.get_xlim() self.plot_selec() # self.select_point_plot() - self._largeur_miroir, = self.ax.plot(self.x[1], self.y[1], - color='blue', lw=1.2, ls=":") + self._largeur_miroir, = self.ax.plot( + self.x[1], self.y[1], + color='blue', lw=1.2, ls=":" + ) self.pt = [] - self.tableView.selectionModel().selectionChanged.connect(self.update_select_point_point) + self.tableView.selectionModel()\ + .selectionChanged\ + .connect(self.update_select_point_point) def select_row_pt_clicked(self, ind: int = 0): """ @@ -56,9 +61,12 @@ class OnpickEvent(object): if self.tableView is not None: selectionModel = self.tableView.selectionModel() index = self.tableView.model().index(ind, 0) - selectionModel.select(index, - QItemSelectionModel.Rows | QItemSelectionModel.ClearAndSelect | - QItemSelectionModel.Select) + selectionModel.select( + index, + QItemSelectionModel.Rows | + QItemSelectionModel.ClearAndSelect | + QItemSelectionModel.Select + ) self.tableView.scrollTo(index) def select_qtableview_row(self, event): @@ -73,28 +81,35 @@ class OnpickEvent(object): Returns: sélectionne le(s) point(s) du graphique correspondant à la/aux ligne(s) sélectionnée(s) dans le tableau. """ if self.tableView is not None: - rows = list(set([index.row() for index in self.tableView.selectedIndexes()])) + rows = list(set( + [index.row() for index in self.tableView.selectedIndexes()] + )) for row in rows: pass def update_select_point_point(self): if self.tableView is not None: - rows = list(set([index.row() for index in self.tableView.selectedIndexes()])) + rows = list(set( + [index.row() for index in self.tableView.selectedIndexes()] + )) + if len(rows) > 1: for row in rows: - self.pt1 = self.ax.plot(self.x[row], self.y[row], '+', c='Blue', markersize=7) + self.pt1 = self.ax.plot(self.x[row], self.y[row], + '+', c='Blue', markersize=7) self.pt.append(self.pt1) self.update_select_point_point_bis(self.x[row], self.y[row]) - elif len(rows) == 1: for row in rows: try: - [pl[0].set_data([], []) for pl in self.pt if len(self.pt) > 1] + [pl[0].set_data([], []) + for pl in self.pt if len(self.pt) > 1] except: print("Probleme de mise à jour ... update_select_point_point()") try: - self.update_select_point_point_bis(self.x[row], self.y[row]) + self.update_select_point_point_bis(self.x[row], + self.y[row]) except: print("index introuvable pour la mise à jour de l'affichage de la sélection du point." "Editer les cases en 'nan'.") @@ -102,7 +117,8 @@ class OnpickEvent(object): self.ax.figure.canvas.draw_idle() def plot_selec(self): - self.point_selec, = self.ax.plot(self.x[0], self.y[0], '+', c='Blue', markersize=7) + self.point_selec, = self.ax.plot(self.x[0], self.y[0], + '+', c='Blue', markersize=7) self.point_selec.set_visible(False) def update_select_point_point_bis(self, x_ind, y_ind): @@ -118,7 +134,8 @@ class OnpickEvent(object): Returns: sélectionne le point du graphique correspond à la ligne sélectionnée dans le tableau. """ if self.tableView is not None: - self.select_point, = self.ax.plot(x, y, '+', c='Blue', markersize=7) + self.select_point, = self.ax.plot(x, y, + '+', c='Blue', markersize=7) else: self.select_point, = self.ax.plot([], []) @@ -207,7 +224,9 @@ class OnpickEvent(object): thisline = event.artist xdata = thisline.get_xdata() ydata = thisline.get_ydata() - points_onpick = np.array([(xdata[i], ydata[i]) for i in self.indice_points_onpick(event)]) + points_onpick = np.array( + [(xdata[i], ydata[i]) for i in self.indice_points_onpick(event)] + ) return points_onpick def distance_normee(self, event): @@ -338,7 +357,8 @@ class OnpickEvent(object): event.ydata = self.z_berge_basse A, p, L = self.calcul_ligne_eau(event.ydata) - etiq = f"Z = {event.ydata:.3f} m, A = {A:.3f} m\u00B2, p = {p:.3f} m, L = {L:.3f} m" + etiq = f"Z = {event.ydata:.3f} m, A = {A:.3f} "\ + f"m\u00B2, p = {p:.3f} m, L = {L:.3f} m" self.annotation_onclick.set_text(etiq) x_min, x_max = self.ax.get_xlim() self.pos_x_annotation = x_min + ((x_max - x_min) / 2) @@ -366,7 +386,8 @@ class OnpickEvent(object): cte = event.y * 0.1 / 100 self.y_pos_text_param_hydrau = event.ydata + cte - self.annotation_onclick.set_position((self.pos_x_annotation, self.y_pos_text_param_hydrau)) + self.annotation_onclick.set_position((self.pos_x_annotation, + self.y_pos_text_param_hydrau)) self.ax.callbacks.connect('ylim_changed', self.on_ylims_change) @@ -442,7 +463,9 @@ class OnpickEvent(object): if self.z_point_bas < val <= self.z_berge_basse: z_eau = np.array([val] * (len(self.z_sans_rebord))) - self.poly_col_bis = self.remplir_zone_mouillee(self.x_sans_rebord, z_eau, self.z_sans_rebord) + self.poly_col_bis = self.remplir_zone_mouillee(self.x_sans_rebord, + z_eau, + self.z_sans_rebord) liste_chemins = self.poly_col_bis.get_paths() couleurs = ['crimson', 'pink'] * len(liste_chemins) aire_calculee_shapely = None diff --git a/src/View/Plot/navigation_toolbar_2qt.py b/src/View/Plot/navigation_toolbar_2qt.py index 44d86f72633b7e66e4933e85607396dd2493f36f..d07386de6d05d4c251613940c5c3803184a995d1 100644 --- a/src/View/Plot/navigation_toolbar_2qt.py +++ b/src/View/Plot/navigation_toolbar_2qt.py @@ -86,7 +86,6 @@ class PamHyrNavigationToolbar2QT(NavigationToolbar2QT): self._actions["non_isometric_view"].setIcon(icon_btn_global_view) self.addSeparator() - self.set_style_sheet() def save_figure(self, *args): filetypes = self.canvas.get_supported_filetypes_grouped() @@ -146,17 +145,3 @@ class PamHyrNavigationToolbar2QT(NavigationToolbar2QT): self._actions['save_figure'].setToolTip(_translate("Toolbar", "Enregistrer la figure")) self.action_isometric_view.setToolTip(_translate("Toolbar", "Vue isométrique (Shift+W)")) self.action_auto_global_view.setToolTip(_translate("Toolbar", "Vue globale automatique (Shift+X)")) - - def set_style_sheet(self): - self.setStyleSheet( - "QToolBar{ border: 1px solid darkGray;\n" - " gridline-color: blue;\n" - " border-radius: 4px;\n" - " border-style: solid;\n" - " background-color: #EEF6FC; \n" - " selection-background-color: #218ede;\n" - " font-size: 12px;\n" - " font-family: Helvetica\n" - "\n" - " }" - )