refactoring: Start refactoring plot.

setup.py
Pierre-Antoine Rouby 2023-09-29 11:17:08 +02:00
parent 245a5057c3
commit ef672798ef
6 changed files with 56 additions and 24 deletions

View File

@ -44,18 +44,18 @@ from View.Configure.Window import ConfigureWindow
from View.Study.Window import NewStudyWindow from View.Study.Window import NewStudyWindow
from View.About.Window import AboutWindow from View.About.Window import AboutWindow
from View.Network.Window import NetworkWindow from View.Network.Window import NetworkWindow
from View.Geometry.Window import GeometryWindow # from View.Geometry.Window import GeometryWindow
from View.BoundaryCondition.Window import BoundaryConditionWindow # from View.BoundaryCondition.Window import BoundaryConditionWindow
from View.LateralContribution.Window import LateralContributionWindow # from View.LateralContribution.Window import LateralContributionWindow
from View.InitialConditions.Window import InitialConditionsWindow # from View.InitialConditions.Window import InitialConditionsWindow
from View.Stricklers.Window import StricklersWindow # from View.Stricklers.Window import StricklersWindow
from View.Frictions.Window import FrictionsWindow # from View.Frictions.Window import FrictionsWindow
from View.SedimentLayers.Window import SedimentLayersWindow # from View.SedimentLayers.Window import SedimentLayersWindow
from View.SedimentLayers.Reach.Window import ReachSedimentLayersWindow # from View.SedimentLayers.Reach.Window import ReachSedimentLayersWindow
from View.SolverParameters.Window import SolverParametersWindow # from View.SolverParameters.Window import SolverParametersWindow
from View.RunSolver.Window import SelectSolverWindow, SolverLogWindow # from View.RunSolver.Window import SelectSolverWindow, SolverLogWindow
from View.CheckList.Window import CheckListWindow # from View.CheckList.Window import CheckListWindow
from View.Results.Window import ResultsWindow # from View.Results.Window import ResultsWindow
from View.Debug.Window import ReplWindow from View.Debug.Window import ReplWindow
from Model.Study import Study from Model.Study import Study

View File

@ -0,0 +1,43 @@
# PamhyrPlot.py -- Pamhyr
# Copyright (C) 2023 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 View.Tools.Plot.APlot import APlot
from View.Tools.Plot.PamhyrCanvas import MplCanvas
from View.Tools.Plot.PamhyrToolbar import PamhyrPlotToolbar
class PamhyrPlot(APlot):
def __init__(self, data=None, trad=None,
canvas=None, toolbar=None,
parent=None):
if canvas is None:
canvas = MplCanvas()
self._trad = trad
self._canvas = canvas
self._toolbar = toolbar
self._parent = parent
super(PamhyrPlot, self).__init__(data = data)
@property
def canvas(self):
return self._canvas
@property
def toolbar(self):
return self._toolbar

View File

@ -19,26 +19,16 @@
from Model.Except import NotImplementedMethodeError from Model.Except import NotImplementedMethodeError
class APlot(object): class APlot(object):
def __init__(self, canvas=None, data=None, toolbar=None): def __init__(self, data=None):
super(APlot, self).__init__() super(APlot, self).__init__()
self._init = False self._init = False
self._canvas = canvas
self._data = data self._data = data
self._toolbar = toolbar
@property
def canvas(self):
return self._canvas
@property @property
def data(self): def data(self):
return self._data return self._data
@property
def toolbar(self):
return self._toolbar
def draw(self): def draw(self):
"""Draw plot """Draw plot

View File

@ -17,7 +17,6 @@
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
from matplotlib.figure import Figure from matplotlib.figure import Figure
class MplCanvas(FigureCanvasQTAgg): class MplCanvas(FigureCanvasQTAgg):
def __init__(self, width=5, height=4, dpi=100): def __init__(self, width=5, height=4, dpi=100):
fig = Figure( fig = Figure(