diff --git a/src/Model/OutputKpAdists/OutputKpAdists.py b/src/Model/OutputKpAdists/OutputKpAdists.py index f27332b108bb99e464abc18ca1dbea3db08c6014..75520c4db994e889e14aa2007c1518f44133beec 100644 --- a/src/Model/OutputKpAdists/OutputKpAdists.py +++ b/src/Model/OutputKpAdists/OutputKpAdists.py @@ -35,21 +35,22 @@ class OutputKpAdists(SQLSubModel): _id_cnt = 0 def __init__(self, id: int = -1, reach = None, kp = None, title: str = "", status=None): - super(LateralContribution, self).__init__() + super(OutputKpAdists, self).__init__() self._status = status if id == -1: - self.id = LateralContribution._id_cnt + self.id = OutputKpAdists._id_cnt else: self.id = id self._reach = reach self._kp = kp self._title = str(title) + self._enabled = True - LateralContribution._id_cnt = max( - LateralContribution._id_cnt + 1, self.id) + OutputKpAdists._id_cnt = max( + OutputKpAdists._id_cnt + 1, self.id) @property def reach(self): @@ -110,19 +111,20 @@ class OutputKpAdists(SQLSubModel): f"FROM OutputKpAdists" ) - for row in table: - id = row[0] - id_reach = row[1] - id_kp = row[2] - title = row[3] + if table is not None: + for row in table: + id = row[0] + id_reach = row[1] + id_kp = row[2] + title = row[3] - new_output = cls( - id=id, reach=id_reach, - kp=id_kp, title=title, - status=status - ) + new_output = cls( + id=id, reach=id_reach, + kp=id_kp, title=title, + status=status + ) - new.append(new_output) + new.append(new_output) return new @@ -141,6 +143,16 @@ class OutputKpAdists(SQLSubModel): return True + @property + def enabled(self): + return self._enabled + + @enabled.setter + def enabled(self, enabled): + self._enabled = enabled + self._status.modified() + + diff --git a/src/Model/OutputKpAdists/OutputKpListAdists.py b/src/Model/OutputKpAdists/OutputKpListAdists.py index 95886137ce62990f07ab0d2cc507483ab2003ec9..d6560e6847c5357de3bc241f02fb293d57b95afe 100644 --- a/src/Model/OutputKpAdists/OutputKpListAdists.py +++ b/src/Model/OutputKpAdists/OutputKpListAdists.py @@ -49,8 +49,8 @@ class OutputKpAdistsList(PamhyrModelList): def OutputKp_List(self): return self.lst - def new(self, index): + def new(self, lst, index): n = OutputKpAdists(status=self._status) - self.insert(index, n) + self._lst.insert(index, n) self._status.modified() return n diff --git a/src/Solver/AdisTS.py b/src/Solver/AdisTS.py index 364f2be40a4695d2b3b57012a13a07deb4a3182a..e60fcde8f2a21bd7e9110ade51c2eb464efa5c97 100644 --- a/src/Solver/AdisTS.py +++ b/src/Solver/AdisTS.py @@ -68,7 +68,6 @@ class AdisTS(CommandLineSolver): ("adists_timestep_csv", "60"), ("adists_timestep_mage", "60"), ("adists_initial_concentration", "60"), - ("adists_output_points_csv", ""), ] return lst diff --git a/src/View/OutputKpAdisTS/BasicHydraulicStructures/Window.py b/src/View/OutputKpAdisTS/BasicHydraulicStructures/Window.py index 9a39f49c64749b995b3ac3733038ee0e720003b5..838d7bc071ce023a6b2683ca0f5c8aa29213e0d0 100644 --- a/src/View/OutputKpAdisTS/BasicHydraulicStructures/Window.py +++ b/src/View/OutputKpAdisTS/BasicHydraulicStructures/Window.py @@ -38,8 +38,6 @@ from PyQt5.QtWidgets import ( from View.Tools.Plot.PamhyrCanvas import MplCanvas from View.Tools.Plot.PamhyrToolbar import PamhyrPlotToolbar -from View.HydraulicStructures.PlotAC import PlotAC - from View.HydraulicStructures.BasicHydraulicStructures.Table import ( ComboBoxDelegate, TableModel, ParametersTableModel, ) @@ -78,7 +76,6 @@ class BasicHydraulicStructuresWindow(PamhyrWindow): self.setup_table() self.setup_checkbox() - self.setup_plot() self.setup_connections() self.update() @@ -139,37 +136,6 @@ class BasicHydraulicStructuresWindow(PamhyrWindow): self._checkbox = self.find(QCheckBox, f"checkBox") self._set_checkbox_state() - def setup_plot(self): - self.canvas = MplCanvas(width=5, height=4, dpi=100) - self.canvas.setObjectName("canvas") - self.toolbar = PamhyrPlotToolbar( - self.canvas, self - ) - self.plot_layout = self.find(QVBoxLayout, "verticalLayout") - self.plot_layout.addWidget(self.toolbar) - self.plot_layout.addWidget(self.canvas) - - reach = self._hs.input_reach - profile_kp = self._hs.input_kp - if profile_kp is not None: - profiles = reach.reach.get_profiles_from_kp(float(profile_kp)) - else: - profiles = None - if profiles is not None: - profile = profiles[0] - else: - profile = None - - self.plot_ac = PlotAC( - canvas=self.canvas, - river=self._study.river, - reach=self._hs.input_reach, - profile=profile, - trad=self._trad, - toolbar=self.toolbar - ) - self.plot_ac.draw() - def setup_connections(self): self.find(QAction, "action_add").triggered.connect(self.add) self.find(QAction, "action_delete").triggered.connect(self.delete) diff --git a/src/View/OutputKpAdisTS/PlotAC.py b/src/View/OutputKpAdisTS/PlotAC.py deleted file mode 100644 index c63dc9bfdef5fb2e311b54eb90cf85e4937a4b1c..0000000000000000000000000000000000000000 --- a/src/View/OutputKpAdisTS/PlotAC.py +++ /dev/null @@ -1,120 +0,0 @@ -# PlotAC.py -- Pamhyr -# Copyright (C) 2023-2024 INRAE -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. - -# -*- coding: utf-8 -*- - -from tools import timer -from View.Tools.PamhyrPlot import PamhyrPlot -from matplotlib import pyplot as plt - - -class PlotAC(PamhyrPlot): - def __init__(self, canvas=None, trad=None, toolbar=None, - river=None, reach=None, profile=None, - parent=None): - super(PlotAC, self).__init__( - canvas=canvas, - trad=trad, - data=river, - toolbar=toolbar, - parent=parent - ) - - self._current_reach = reach - self._current_profile = profile - - self.label_x = self._trad["x"] - self.label_y = self._trad["unit_elevation"] - - self._isometric_axis = False - - self._auto_relim_update = True - self._autoscale_update = True - - @property - def river(self): - return self.data - - @river.setter - def river(self, river): - self.data = river - - @timer - def draw(self): - self.init_axes() - - if self.data is None: - self.line_kp = None - return - - if self._current_reach is None: - self.line_kp = None - return - - self.draw_data() - - self.idle() - self._init = True - - def draw_data(self): - reach = self._current_reach - - if self._current_profile is None: - self.line_kp = None - else: - profile = self._current_profile - x = profile.get_station() - z = profile.z() - - self.line_kp, = self.canvas.axes.plot( - x, z, - color=self.color_plot_river_bottom, - **self.plot_default_kargs - ) - - def set_reach(self, reach): - self._current_reach = reach - self.update() - - def set_profile(self, profile): - self._current_profile = profile - self.update() - - def update(self): - if self.line_kp is None: - self.draw() - return - - if self._current_reach is None or self._current_profile is None: - self.update_clear() - else: - self.update_data() - - self.update_idle() - - def update_data(self): - profile = self._current_profile - x = profile.get_station() - z = profile.z() - - self.line_kp.set_data(x, z) - - def clear(self): - self.update_clear() - - def update_clear(self): - if self.line_kp is not None: - self.line_kp.set_data([], []) diff --git a/src/View/OutputKpAdisTS/PlotKPC.py b/src/View/OutputKpAdisTS/PlotKPC.py deleted file mode 100644 index 3327f6e627114ac8513dda1ca57670b0cdf722e8..0000000000000000000000000000000000000000 --- a/src/View/OutputKpAdisTS/PlotKPC.py +++ /dev/null @@ -1,165 +0,0 @@ -# PlotKPC.py -- Pamhyr -# Copyright (C) 2023-2024 INRAE -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. - -# -*- coding: utf-8 -*- - -from tools import timer -from View.Tools.PamhyrPlot import PamhyrPlot - -from PyQt5.QtCore import ( - QCoreApplication -) - -from matplotlib.collections import LineCollection - -_translate = QCoreApplication.translate - - -class PlotKPC(PamhyrPlot): - def __init__(self, canvas=None, trad=None, toolbar=None, - river=None, reach=None, profile=None, - parent=None): - super(PlotKPC, self).__init__( - canvas=canvas, - trad=trad, - data=river, - toolbar=toolbar, - parent=parent - ) - - self._current_reach = reach - self._current_profile = profile - - self.label_x = self._trad["unit_kp"] - self.label_y = self._trad["unit_elevation"] - - self._isometric_axis = False - - self._auto_relim_update = True - self._autoscale_update = True - - @property - def river(self): - return self.data - - @river.setter - def river(self, river): - self.data = river - - @timer - def draw(self, highlight=None): - self.init_axes() - - if self.data is None: - self.profile = None - self.line_kp_zmin_zmax = None - self.line_kp_zmin = None - return - - if self._current_reach is None: - self.profile = None - self.line_kp_zmin_zmax = None - self.line_kp_zmin = None - return - - self.draw_data() - self.draw_current() - - self.idle() - self._init = True - - def draw_data(self): - reach = self._current_reach - - kp = reach.reach.get_kp() - z_min = reach.reach.get_z_min() - z_max = reach.reach.get_z_max() - - self.line_kp_zmin, = self.canvas.axes.plot( - kp, z_min, - color=self.color_plot_river_bottom, - lw=1. - ) - - if len(kp) != 0: - self.line_kp_zmin_zmax = self.canvas.axes.vlines( - x=kp, - ymin=z_min, ymax=z_max, - color=self.color_plot, - lw=1. - ) - - def draw_current(self): - if self._current_profile is None: - self.profile = None - else: - kp = [self._current_profile.kp, - self._current_profile.kp] - min_max = [self._current_profile.z_min(), - self._current_profile.z_max()] - - self.profile = self.canvas.axes.plot( - kp, min_max, - color=self.color_plot_current, - lw=1. - ) - - def set_reach(self, reach): - self._current_reach = reach - self._current_profile = None - self.update() - - def set_profile(self, profile): - self._current_profile = profile - self.update_current_profile() - - def update(self): - self.draw() - - def update_current_profile(self): - reach = self._current_reach - kp = reach.reach.get_kp() - z_min = reach.reach.get_z_min() - z_max = reach.reach.get_z_max() - - if self.profile is None: - self.draw() - else: - self.profile.set_data( - [self._current_profile.kp, self._current_profile.kp], - [self._current_profile.z_min(), self._current_profile.z_max()], - ) - - self.update_idle() - - def clear(self): - if self.profile is not None: - self.profile[0].set_data([], []) - - if self.line_kp_zmin_zmax is not None: - self.line_kp_zmin_zmax.remove() - self.line_kp_zmin_zmax = None - - if self.line_kp_zmin is not None: - self.line_kp_zmin.set_data([], []) - - self.canvas.figure.canvas.draw_idle() - - def clear_profile(self): - if self.profile is not None: - self.profile.set_data([], []) - - self.canvas.figure.canvas.draw_idle() diff --git a/src/View/OutputKpAdisTS/Table.py b/src/View/OutputKpAdisTS/Table.py index a794f0a0d2ffc9bf14cf14071086d361e042dbfc..73153ef68264b5be1c922bffe36d80f67274b71e 100644 --- a/src/View/OutputKpAdisTS/Table.py +++ b/src/View/OutputKpAdisTS/Table.py @@ -36,7 +36,7 @@ from PyQt5.QtWidgets import ( from View.Tools.PamhyrTable import PamhyrTableModel -from View.HydraulicStructures.UndoCommand import ( +from View.OutputKpAdisTS.UndoCommand import ( SetNameCommand, SetReachCommand, SetKpCommand, SetEnabledCommand, AddCommand, DelCommand, ) @@ -59,9 +59,9 @@ class ComboBoxDelegate(QItemDelegate): val = [] if self._mode == "kp": - reach = self._data.hydraulic_structures\ + reach = self._data.Output_kp_adists\ .get(index.row())\ - .input_reach + .reach if reach is not None: val = list( map( @@ -107,7 +107,7 @@ class ComboBoxDelegate(QItemDelegate): class TableModel(PamhyrTableModel): def _setup_lst(self): - self._lst = self._data._hydraulic_structures + self._lst = self._data._Output_kp_adists def rowCount(self, parent): return len(self._lst) @@ -119,15 +119,15 @@ class TableModel(PamhyrTableModel): row = index.row() column = index.column() - if self._headers[column] == "name": - return self._lst.get(row).name + if self._headers[column] == "title": + return self._lst.get(row).title elif self._headers[column] == "reach": - n = self._lst.get(row).input_reach + n = self._lst.get(row).reach if n is None: return self._trad['not_associated'] return n.name elif self._headers[column] == "kp": - n = self._lst.get(row).input_kp + n = self._lst.get(row).kp if n is None: return self._trad['not_associated'] return n @@ -143,7 +143,7 @@ class TableModel(PamhyrTableModel): na = self._trad['not_associated'] try: - if self._headers[column] == "name": + if self._headers[column] == "title": self._undo.push( SetNameCommand( self._lst, row, value diff --git a/src/View/OutputKpAdisTS/Translate.py b/src/View/OutputKpAdisTS/Translate.py index b57fb116242da3b1948e8c092878835d139511d7..0a2618077615555a6c6e0a6030773de82c066700 100644 --- a/src/View/OutputKpAdisTS/Translate.py +++ b/src/View/OutputKpAdisTS/Translate.py @@ -34,7 +34,7 @@ class OutputKpAdisTSTranslate(MainTranslate): self._dict["x"] = _translate("OutputKpAdisTS", "X (m)") self._sub_dict["table_headers"] = { - "name": self._dict["name"], + "title": self._dict["title"], "reach": self._dict["reach"], "kp": self._dict["unit_kp"], } diff --git a/src/View/OutputKpAdisTS/UndoCommand.py b/src/View/OutputKpAdisTS/UndoCommand.py index cbb8a2e7927237c3b1a2d97f689c0a547270794d..37f3dec049d32a8b766ac3b720f451617ccc42f0 100644 --- a/src/View/OutputKpAdisTS/UndoCommand.py +++ b/src/View/OutputKpAdisTS/UndoCommand.py @@ -29,131 +29,131 @@ logger = logging.getLogger() class SetNameCommand(QUndoCommand): - def __init__(self, h_s_lst, index, new_value): + def __init__(self, outputkp_lst, index, new_value): QUndoCommand.__init__(self) - self._h_s_lst = h_s_lst + self._outputkp_lst = outputkp_lst self._index = index - self._old = self._h_s_lst.get(self._index).name + self._old = self._outputkp_lst.get(self._index).name self._new = str(new_value) def undo(self): - self._h_s_lst.get(self._index).name = self._old + self._outputkp_lst.get(self._index).name = self._old def redo(self): - self._h_s_lst.get(self._index).name = self._new + self._outputkp_lst.get(self._index).name = self._new class SetReachCommand(QUndoCommand): - def __init__(self, h_s_lst, index, reach): + def __init__(self, outputkp_lst, index, reach): QUndoCommand.__init__(self) - self._h_s_lst = h_s_lst + self._outputkp_lst = outputkp_lst self._index = index - self._old = self._h_s_lst.get(self._index).input_reach + self._old = self._outputkp_lst.get(self._index).input_reach self._new = reach - self._old_kp = self._h_s_lst.get(self._index).input_kp + self._old_kp = self._outputkp_lst.get(self._index).input_kp self._new_kp = None def undo(self): - i = self._h_s_lst.get(self._index) + i = self._outputkp_lst.get(self._index) i.input_reach = self._old i.input_kp = self._old_kp def redo(self): - i = self._h_s_lst.get(self._index) + i = self._outputkp_lst.get(self._index) i.input_reach = self._new i.input_kp = self._new_kp class SetKpCommand(QUndoCommand): - def __init__(self, h_s_lst, index, kp): + def __init__(self, outputkp_lst, index, kp): QUndoCommand.__init__(self) - self._h_s_lst = h_s_lst + self._outputkp_lst = outputkp_lst self._index = index - self._old = self._h_s_lst.get(self._index).input_kp + self._old = self._outputkp_lst.get(self._index).input_kp self._new = kp def undo(self): - self._h_s_lst.get(self._index).input_kp = self._old + self._outputkp_lst.get(self._index).input_kp = self._old def redo(self): - self._h_s_lst.get(self._index).input_kp = self._new + self._outputkp_lst.get(self._index).input_kp = self._new class SetEnabledCommand(QUndoCommand): - def __init__(self, h_s_lst, index, enabled): + def __init__(self, outputkp_lst, index, enabled): QUndoCommand.__init__(self) - self._h_s_lst = h_s_lst + self._outputkp_lst = outputkp_lst self._index = index self._old = not enabled self._new = enabled def undo(self): - self._h_s_lst.get(self._index).enabled = self._old + self._outputkp_lst.get(self._index).enabled = self._old def redo(self): - self._h_s_lst.get(self._index).enabled = self._new + self._outputkp_lst.get(self._index).enabled = self._new class AddCommand(QUndoCommand): - def __init__(self, h_s_lst, index): + def __init__(self, outputkp_lst, index): QUndoCommand.__init__(self) - self._h_s_lst = h_s_lst + self._outputkp_lst = outputkp_lst self._index = index self._new = None def undo(self): - self._h_s_lst.delete_i([self._index]) + self._outputkp_lst.delete_i([self._index]) def redo(self): if self._new is None: - self._new = self._h_s_lst.new(self._h_s_lst, self._index) + self._new = self._outputkp_lst.new(self._outputkp_lst, self._index) else: - self._h_s_lst.insert(self._index, self._new) + self._outputkp_lst.insert(self._index, self._new) class DelCommand(QUndoCommand): - def __init__(self, h_s_lst, rows): + def __init__(self, outputkp_lst, rows): QUndoCommand.__init__(self) - self._h_s_lst = h_s_lst + self._outputkp_lst = outputkp_lst self._rows = rows - self._h_s = [] + self._outputkp = [] for row in rows: - self._h_s.append((row, self._h_s_lst.get(row))) - self._h_s.sort() + self._outputkp.append((row, self._outputkp_lst.get(row))) + self._outputkp.sort() def undo(self): - for row, el in self._h_s: - self._h_s_lst.insert(row, el) + for row, el in self._outputkp: + self._outputkp_lst.insert(row, el) def redo(self): - self._h_s_lst.delete_i(self._rows) + self._outputkp_lst.delete_i(self._rows) class PasteCommand(QUndoCommand): - def __init__(self, h_s_lst, row, h_s): + def __init__(self, outputkp_lst, row, outputkp): QUndoCommand.__init__(self) - self._h_s_lst = h_s_lst + self._outputkp_lst = outputkp_lst self._row = row - self._h_s = deepcopy(h_s) - self._h_s.reverse() + self._outputkp = deepcopy(outputkp) + self._outputkp.reverse() def undo(self): - self._h_s_lst.delete_i( + self._outputkp_lst.delete_i( self._tab, - range(self._row, self._row + len(self._h_s)) + range(self._row, self._row + len(self._outputkp)) ) def redo(self): - for r in self._h_s: - self._h_s_lst.insert(self._row, r) + for r in self._outputkp: + self._outputkp_lst.insert(self._row, r) diff --git a/src/View/OutputKpAdisTS/Window.py b/src/View/OutputKpAdisTS/Window.py index 3951f52af2fb979a117025fa0ff6f0a99221bc85..3ff4ec2f97bcdcc33e57c016fcff80fb5160396e 100644 --- a/src/View/OutputKpAdisTS/Window.py +++ b/src/View/OutputKpAdisTS/Window.py @@ -38,9 +38,6 @@ from PyQt5.QtWidgets import ( from View.Tools.Plot.PamhyrCanvas import MplCanvas from View.Tools.Plot.PamhyrToolbar import PamhyrPlotToolbar -from View.OutputKpAdisTS.PlotAC import PlotAC -from View.OutputKpAdisTS.PlotKPC import PlotKPC - from View.OutputKpAdisTS.Table import ( TableModel, ComboBoxDelegate ) @@ -71,14 +68,13 @@ class OutputKpAdisTSWindow(PamhyrWindow): parent=parent ) - self._hs_lst = self._study.river._hydraulic_structures + self._outputkp_lst = self._study.river._Output_kp_adists self.setup_table() - #self.setup_checkbox() - #self.setup_plots() + self.setup_checkbox() self.setup_connections() - #self.update() + self.update() def setup_table(self): self._table = None @@ -100,7 +96,7 @@ class OutputKpAdisTSWindow(PamhyrWindow): self._table = TableModel( table_view=table, table_headers=self._trad.get_dict("table_headers"), - editable_headers=["name", "reach", "kp"], + editable_headers=["title", "reach", "kp"], delegates={ "reach": self._delegate_reach, "kp": self._delegate_kp, @@ -125,45 +121,6 @@ class OutputKpAdisTSWindow(PamhyrWindow): self._checkbox = self.find(QCheckBox, f"checkBox") self._set_checkbox_state() - def setup_plots(self): - self.canvas = MplCanvas(width=5, height=4, dpi=100) - self.canvas.setObjectName("canvas") - self.toolbar = PamhyrPlotToolbar( - self.canvas, self - ) - self.plot_layout = self.find(QVBoxLayout, "verticalLayout") - self.plot_layout.addWidget(self.toolbar) - self.plot_layout.addWidget(self.canvas) - - self.plot_kpc = PlotKPC( - canvas=self.canvas, - river=self._study.river, - reach=None, - profile=None, - trad=self._trad, - toolbar=self.toolbar - ) - self.plot_kpc.draw() - - self.canvas_2 = MplCanvas(width=5, height=4, dpi=100) - self.canvas_2.setObjectName("canvas_2") - self.toolbar_2 = PamhyrPlotToolbar( - self.canvas_2, self - ) - self.plot_layout_2 = self.find(QVBoxLayout, "verticalLayout_2") - self.plot_layout_2.addWidget(self.toolbar_2) - self.plot_layout_2.addWidget(self.canvas_2) - - self.plot_ac = PlotAC( - canvas=self.canvas_2, - river=self._study.river, - reach=None, - profile=None, - trad=self._trad, - toolbar=self.toolbar_2 - ) - self.plot_ac.draw() - def setup_connections(self): self.find(QAction, "action_add").triggered.connect(self.add) self.find(QAction, "action_delete").triggered.connect(self.delete) @@ -210,7 +167,7 @@ class OutputKpAdisTSWindow(PamhyrWindow): def add(self): rows = self.index_selected_rows() - if len(self._hs_lst) == 0 or len(rows) == 0: + if len(self._outputkp_lst) == 0 or len(rows) == 0: self._table.add(0) else: self._table.add(rows[0]) @@ -237,7 +194,7 @@ class OutputKpAdisTSWindow(PamhyrWindow): def edit(self): rows = self.index_selected_rows() for row in rows: - data = self._hs_lst.get(row) + data = self._outputkp_lst.get(row) if self.sub_window_exists( BasicHydraulicStructuresWindow, @@ -259,7 +216,7 @@ class OutputKpAdisTSWindow(PamhyrWindow): self._checkbox.setChecked(True) else: self._checkbox.setEnabled(True) - self._checkbox.setChecked(self._hs_lst.get(row).enabled) + self._checkbox.setChecked(self._outputkp_lst.get(row).enabled) def _set_structure_state(self): rows = self.index_selected_rows() @@ -273,43 +230,3 @@ class OutputKpAdisTSWindow(PamhyrWindow): def update(self): self._set_checkbox_state() - self._update_clear_plot() - - def _update_clear_plot(self): - rows = self.index_selected_rows() - - if len(rows) == 0 or len(self._hs_lst) == 0: - self._update_clear_all() - return - - reach = self._hs_lst.get(rows[0]).input_reach - if reach is not None: - self.plot_kpc.set_reach(reach) - self.plot_ac.set_reach(reach) - - profile_kp = self._hs_lst.get(rows[0]).input_kp - if profile_kp is not None: - profiles = reach.reach\ - .get_profiles_from_kp( - float(profile_kp) - ) - - if len(profiles) != 0 and profiles is not None: - profile = profiles[0] - - self.plot_kpc.set_profile(profile) - self.plot_ac.set_profile(profile) - else: - self._update_clear_profile() - else: - self._update_clear_profile() - else: - self._update_clear_all() - - def _update_clear_all(self): - self.plot_kpc.clear() - self.plot_ac.clear() - - def _update_clear_profile(self): - self.plot_ac.clear() - self.plot_kpc.clear_profile() diff --git a/src/View/Translate.py b/src/View/Translate.py index fc91a5160dd89b3d32a5e8b021839910f4c97d00..7d22a04269e9e6f0923f5a0c2ba2270495a2a469 100644 --- a/src/View/Translate.py +++ b/src/View/Translate.py @@ -28,6 +28,7 @@ class CommonWordTranslate(PamhyrTranslate): super(CommonWordTranslate, self).__init__() self._dict["name"] = _translate("CommonWord", "Name") + self._dict["title"] = _translate("CommonWord", "Title") self._dict["type"] = _translate("CommonWord", "Type") self._dict["value"] = _translate("CommonWord", "Value") self._dict["comment"] = _translate("CommonWord", "Comment")