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
b0381eae
Commit
b0381eae
authored
4 years ago
by
shined day
Browse files
Options
Downloads
Plain Diff
Merge branch 'enhance_threading' into 'master'
Enhance threading See merge request be-pyamak/pyamak-ihm!3
parents
b73c8f8a
160594e9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyAmakIHM/classes/controleur.py
+18
-12
18 additions, 12 deletions
pyAmakIHM/classes/controleur.py
with
18 additions
and
12 deletions
pyAmakIHM/classes/controleur.py
+
18
−
12
View file @
b0381eae
...
@@ -18,13 +18,16 @@ class Controleur:
...
@@ -18,13 +18,16 @@ class Controleur:
def
__init__
(
def
__init__
(
self
,
self
,
fenetre
:
'
Fenetre
'
,
fenetre
:
'
Fenetre
'
,
amas
:
'
Amas
'
scheduler
:
'
SchedulerIHM
'
)
->
None
:
)
->
None
:
self
.
__th
=
None
self
.
__th
=
None
self
.
__fenetre
=
fenetre
self
.
__fenetre
=
fenetre
self
.
__fenetre
.
attach
(
self
)
self
.
__fenetre
.
attach
(
self
)
self
.
__amas
=
amas
self
.
__amas
.
attach
(
self
)
self
.
__scheduler
=
scheduler
self
.
__scheduler
.
attach
(
self
)
self
.
__amas
=
scheduler
.
get_amas
()
self
.
__is_run
=
False
self
.
__is_run
=
False
def
get_fenetre
(
self
)
->
'
Fenetre
'
:
def
get_fenetre
(
self
)
->
'
Fenetre
'
:
...
@@ -33,6 +36,9 @@ class Controleur:
...
@@ -33,6 +36,9 @@ class Controleur:
def
get_amas
(
self
)
->
'
Amas
'
:
def
get_amas
(
self
)
->
'
Amas
'
:
return
self
.
__amas
return
self
.
__amas
def
get_scheduler
(
self
)
->
'
SchedulerIHM
'
:
return
self
.
__scheduler
"""
"""
Draw a rectangle with x,y coords, height, width and color
Draw a rectangle with x,y coords, height, width and color
"""
"""
...
@@ -215,26 +221,26 @@ class Controleur:
...
@@ -215,26 +221,26 @@ class Controleur:
Set the execution speed of amas
Set the execution speed of amas
"""
"""
def
updateScale
(
self
,
value
:
int
)
->
None
:
def
updateScale
(
self
,
value
:
int
)
->
None
:
self
.
__
amas
.
set_sleep
(
int
(
value
))
self
.
__
scheduler
.
set_sleep
(
int
(
value
))
"""
"""
Start or Stop the execution depending on the current state
Start or Stop the execution depending on the current state
"""
"""
def
updateStartStop
(
self
)
->
None
:
def
updateStartStop
(
self
)
->
None
:
if
(
self
.
__is_run
)
:
if
self
.
__is_run
:
self
.
__is_run
=
False
self
.
__is_run
=
False
self
.
__
amas
.
take_token
()
self
.
__
scheduler
.
stop
()
else
:
else
:
self
.
__is_run
=
True
self
.
__is_run
=
True
self
.
__
amas
.
put_token
()
self
.
__
scheduler
.
start
()
def
updateCycle
(
self
,
env
,
amas
)
->
None
:
def
updateCycle
(
self
)
->
None
:
try
:
try
:
self
.
updateWindow
(
env
,
amas
)
self
.
updateWindow
()
except
:
except
:
return
return
def
updateWindow
(
env
,
amas
):
def
updateWindow
(
self
):
pass
pass
def
initialisation
(
self
)
->
None
:
def
initialisation
(
self
)
->
None
:
...
@@ -245,9 +251,9 @@ class Controleur:
...
@@ -245,9 +251,9 @@ class Controleur:
"""
"""
def
start
(
self
)
->
None
:
def
start
(
self
)
->
None
:
self
.
initialisation
()
self
.
initialisation
()
self
.
__th
=
Thread
(
target
=
self
.
__
amas
.
start
)
self
.
__th
=
Thread
(
target
=
self
.
__
scheduler
.
run
)
self
.
__th
.
start
()
self
.
__th
.
start
()
self
.
__fenetre
.
display
()
self
.
__fenetre
.
display
()
def
updateClosing
(
self
):
def
updateClosing
(
self
):
self
.
__
amas
.
exit_program
()
self
.
__
scheduler
.
exit_program
()
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