From 44b07a93a7d804cca19c1df75d0a2c5d2f135fec Mon Sep 17 00:00:00 2001 From: Jdrezen <jeremie.drezen@gmail.com> Date: Mon, 17 May 2021 17:15:57 +0200 Subject: [PATCH] Ajout de commentaires et de typage --- pyAmakIHM/classes/panelLimitedPlotChart.py | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/pyAmakIHM/classes/panelLimitedPlotChart.py b/pyAmakIHM/classes/panelLimitedPlotChart.py index 9cbd3fa..99e28ab 100644 --- a/pyAmakIHM/classes/panelLimitedPlotChart.py +++ b/pyAmakIHM/classes/panelLimitedPlotChart.py @@ -12,16 +12,19 @@ class PanelLimitedPlotChart(PanelPlotChart): def __init__( self, - root, - id, - limit - ) : + root : 'Tk', + id : int, + limit : int + ) -> None : super().__init__(root, id) self.__limit = limit self.__limited = False - def addPoint(self, id : int, x : int, y : int): + """ + Add a point to the id curve with x,y coords + """ + def addPoint(self, id : int, x : int, y : int) -> None: self._axis.clear() self._xAxis[id].append(x) self._yAxis[id].append(y) @@ -35,10 +38,16 @@ class PanelLimitedPlotChart(PanelPlotChart): self._rebuild() - def isLimited(self,id): + """ + Return true if number of points is over the limit + """ + def isLimited(self,id : int) -> bool: return len(self._xAxis[id]) > self.__limit - def createCopy(self, name : str, id : int) -> 'PanelPlotChart': + """ + Return a copy of the object + """ + def createCopy(self, name : str, id : int) -> 'PanelLimitedPlotChart': window = Toplevel() window.title(name) @@ -57,7 +66,10 @@ class PanelLimitedPlotChart(PanelPlotChart): return self._copy - def _copyWidget(self): + """ + Copy the object + """ + def _copyWidget(self) -> None: super()._copyWidget() self._copy.__limit = self.__limit self._copy.__limited = self.__limited -- GitLab