Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyAmak - IHM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMAC
AMAK
Python
PyAMAK
pyAmak - IHM
Commits
6023079f
Commit
6023079f
authored
4 years ago
by
Jdrezen
Browse files
Options
Downloads
Patches
Plain Diff
Modification de la portée des attributs de plotChart pour les utiliser dans la classe fille
parent
8d9b44c8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyAmakIHM/classes/panelLimitedPlotChart.py
+34
-9
34 additions, 9 deletions
pyAmakIHM/classes/panelLimitedPlotChart.py
pyAmakIHM/classes/panelPlotChart.py
+47
-47
47 additions, 47 deletions
pyAmakIHM/classes/panelPlotChart.py
with
81 additions
and
56 deletions
pyAmakIHM/classes/panelLimitedPlotChart.py
+
34
−
9
View file @
6023079f
...
...
@@ -3,6 +3,7 @@ Class PanelLimitedPlotChart
"""
from
pyAmakIHM.classes.panelPlotChart
import
PanelPlotChart
from
tkinter
import
Toplevel
class
PanelLimitedPlotChart
(
PanelPlotChart
):
"""
...
...
@@ -21,18 +22,42 @@ class PanelLimitedPlotChart(PanelPlotChart):
self
.
__limited
=
False
def
addPoint
(
self
,
id
:
int
,
x
:
int
,
y
:
int
):
self
.
_
_
axis
.
clear
()
self
.
_
_
xAxis
[
id
].
append
(
x
)
self
.
_
_
yAxis
[
id
].
append
(
y
)
self
.
_axis
.
clear
()
self
.
_xAxis
[
id
].
append
(
x
)
self
.
_yAxis
[
id
].
append
(
y
)
if
(
self
.
__limited
):
del
self
.
_
_
xAxis
[
0
]
del
self
.
_
_
yAxis
[
0
]
del
self
.
_xAxis
[
id
][
0
]
del
self
.
_yAxis
[
id
][
0
]
else
:
self
.
__limited
=
self
.
isLimited
()
self
.
__limited
=
self
.
isLimited
(
id
)
self
.
_
_
rebuild
()
self
.
_rebuild
()
def
isLimited
(
self
):
return
len
(
self
.
__xAxis
)
>
self
.
__limit
def
isLimited
(
self
,
id
):
return
len
(
self
.
_xAxis
[
id
])
>
self
.
__limit
def
createCopy
(
self
,
name
:
str
,
id
:
int
)
->
'
PanelPlotChart
'
:
window
=
Toplevel
()
window
.
title
(
name
)
self
.
_copy
=
PanelLimitedPlotChart
(
window
,
id
,
self
.
__limit
)
self
.
_copy
.
pack
(
fill
=
'
both
'
,
expand
=
'
yes
'
)
self
.
_copyWidget
()
self
.
_copy
.
_rebuild
()
self
.
_copy
.
_copy
=
self
self
.
_copy
.
_observer
=
self
.
_observer
window
.
protocol
(
"
WM_DELETE_WINDOW
"
,
self
.
_copy
.
on_closing
)
window
.
geometry
(
"
+900+0
"
)
return
self
.
_copy
def
_copyWidget
(
self
):
super
().
_copyWidget
()
self
.
_copy
.
__limit
=
self
.
__limit
self
.
_copy
.
__limited
=
self
.
__limited
This diff is collapsed.
Click to expand it.
pyAmakIHM/classes/panelPlotChart.py
+
47
−
47
View file @
6023079f
...
...
@@ -22,11 +22,11 @@ class PanelPlotChart(Frame):
self
.
__root
=
root
self
.
__fig
=
Figure
()
self
.
_
_
axis
=
self
.
__fig
.
add_subplot
()
self
.
_
_
xAxis
=
[[]]
self
.
_
_
yAxis
=
[[]]
self
.
_axis
=
self
.
__fig
.
add_subplot
()
self
.
_xAxis
=
[[]]
self
.
_yAxis
=
[[]]
self
.
_
_
axis
.
plot
(
self
.
_
_
xAxis
,
self
.
_
_
yAxis
)
self
.
_axis
.
plot
(
self
.
_xAxis
,
self
.
_yAxis
)
self
.
__graphique
=
FigureCanvasTkAgg
(
self
.
__fig
,
master
=
self
)
self
.
__graphique
.
get_tk_widget
().
pack
(
fill
=
'
both
'
,
expand
=
'
yes
'
)
...
...
@@ -38,59 +38,59 @@ class PanelPlotChart(Frame):
self
.
__id
=
id
self
.
_
_
copy
=
None
self
.
_
_
observer
=
None
self
.
_copy
=
None
self
.
_observer
=
None
"""
Attach a observer to the object
"""
def
attach
(
self
,
obs
:
'
Fenetre
'
)
->
None
:
self
.
_
_
observer
=
obs
self
.
_observer
=
obs
"""
Notify the observer about an event
"""
def
notify
(
self
,
panel
:
'
PanelBarChart
'
,
id
:
int
)
->
None
:
self
.
_
_
observer
.
updateGraphique
(
panel
,
id
)
self
.
_observer
.
updateGraphique
(
panel
,
id
)
"""
Set the drawing policy for the curve identified by idCurve
"""
def
setPolicy
(
self
,
idCurve
:
int
,
policy
:
str
)
->
None
:
self
.
_
_
axis
.
clear
()
self
.
_axis
.
clear
()
self
.
__policy
[
idCurve
]
=
policy
self
.
_
_
rebuild
()
self
.
_rebuild
()
"""
Set the title to the chart
"""
def
setTitle
(
self
,
name
:
str
)
->
None
:
self
.
_
_
axis
.
clear
()
self
.
_axis
.
clear
()
self
.
__title
=
name
self
.
_
_
rebuild
()
self
.
_rebuild
()
"""
Set the label on the x axis to the chart
"""
def
setXLabel
(
self
,
name
:
str
)
->
None
:
self
.
_
_
axis
.
clear
()
self
.
_axis
.
clear
()
self
.
__XLabel
=
name
self
.
_
_
rebuild
()
self
.
_rebuild
()
"""
Set the label on the y axis to the chart
"""
def
setYLabel
(
self
,
name
:
str
)
->
None
:
self
.
_
_
axis
.
clear
()
self
.
_axis
.
clear
()
self
.
__YLabel
=
name
self
.
_
_
rebuild
()
self
.
_rebuild
()
"""
Add a curve to the plot with the given policy
"""
def
addCurve
(
self
,
policy
:
str
)
->
None
:
self
.
_
_
xAxis
.
append
([])
self
.
_
_
yAxis
.
append
([])
self
.
_xAxis
.
append
([])
self
.
_yAxis
.
append
([])
self
.
__policy
.
append
(
policy
)
...
...
@@ -98,22 +98,22 @@ class PanelPlotChart(Frame):
Add a point to the id curve with x,y coords
"""
def
addPoint
(
self
,
id
:
int
,
x
:
int
,
y
:
int
):
self
.
_
_
axis
.
clear
()
self
.
_
_
xAxis
[
id
].
append
(
x
)
self
.
_
_
yAxis
[
id
].
append
(
y
)
self
.
_axis
.
clear
()
self
.
_xAxis
[
id
].
append
(
x
)
self
.
_yAxis
[
id
].
append
(
y
)
self
.
_
_
rebuild
()
self
.
_rebuild
()
"""
Rebuild the figure after any modification
"""
def
_
_rebuild
(
self
)
->
None
:
for
i
in
range
(
len
(
self
.
_
_
xAxis
)):
self
.
_
_
axis
.
plot
(
self
.
_
_
xAxis
[
i
],
self
.
_
_
yAxis
[
i
],
self
.
__policy
[
i
])
def
_rebuild
(
self
)
->
None
:
for
i
in
range
(
len
(
self
.
_xAxis
)):
self
.
_axis
.
plot
(
self
.
_xAxis
[
i
],
self
.
_yAxis
[
i
],
self
.
__policy
[
i
])
self
.
_
_
axis
.
title
.
set_text
(
self
.
__title
)
self
.
_
_
axis
.
set_xlabel
(
self
.
__XLabel
)
self
.
_
_
axis
.
set_ylabel
(
self
.
__YLabel
)
self
.
_axis
.
title
.
set_text
(
self
.
__title
)
self
.
_axis
.
set_xlabel
(
self
.
__XLabel
)
self
.
_axis
.
set_ylabel
(
self
.
__YLabel
)
self
.
__graphique
.
draw
()
"""
...
...
@@ -123,38 +123,38 @@ class PanelPlotChart(Frame):
window
=
Toplevel
()
window
.
title
(
name
)
self
.
_
_
copy
=
PanelPlotChart
(
window
,
id
)
self
.
_
_
copy
.
pack
(
fill
=
'
both
'
,
expand
=
'
yes
'
)
self
.
_copy
=
PanelPlotChart
(
window
,
id
)
self
.
_copy
.
pack
(
fill
=
'
both
'
,
expand
=
'
yes
'
)
self
.
_
_
copyWidget
()
self
.
_copyWidget
()
self
.
_
_
copy
.
_
_
rebuild
()
self
.
_copy
.
_rebuild
()
self
.
_
_
copy
.
_
_
copy
=
self
self
.
_
_
copy
.
_
_
observer
=
self
.
_
_
observer
self
.
_copy
.
_copy
=
self
self
.
_copy
.
_observer
=
self
.
_observer
window
.
protocol
(
"
WM_DELETE_WINDOW
"
,
self
.
_
_
copy
.
on_closing
)
window
.
protocol
(
"
WM_DELETE_WINDOW
"
,
self
.
_copy
.
on_closing
)
window
.
geometry
(
"
+900+0
"
)
return
self
.
_
_
copy
return
self
.
_copy
"""
Copy the object
"""
def
_
_copyWidget
(
self
)
->
None
:
self
.
_
_
copy
.
__id
=
self
.
__id
self
.
_
_
copy
.
__policy
=
self
.
__policy
self
.
_
_
copy
.
_
_
xAxis
=
self
.
_
_
xAxis
self
.
_
_
copy
.
_
_
yAxis
=
self
.
_
_
yAxis
self
.
_
_
copy
.
__title
=
self
.
__title
self
.
_
_
copy
.
__XLabel
=
self
.
__XLabel
self
.
_
_
copy
.
__YLabel
=
self
.
__YLabel
def
_copyWidget
(
self
)
->
None
:
self
.
_copy
.
__id
=
self
.
__id
self
.
_copy
.
__policy
=
self
.
__policy
self
.
_copy
.
_xAxis
=
self
.
_xAxis
self
.
_copy
.
_yAxis
=
self
.
_yAxis
self
.
_copy
.
__title
=
self
.
__title
self
.
_copy
.
__XLabel
=
self
.
__XLabel
self
.
_copy
.
__YLabel
=
self
.
__YLabel
"""
Send the original object to the main window when the window is closing
"""
def
on_closing
(
self
)
->
None
:
self
.
_
_
copyWidget
()
self
.
_
_
copy
.
_
_
rebuild
()
self
.
_copyWidget
()
self
.
_copy
.
_rebuild
()
self
.
__root
.
destroy
()
self
.
notify
(
self
.
_
_
copy
,
self
.
_
_
copy
.
__id
)
self
.
notify
(
self
.
_copy
,
self
.
_copy
.
__id
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment