Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
4f511f5d
Commit
4f511f5d
authored
Dec 12, 2014
by
Maxime Perrotin
Browse files
Add SDL handler using Opengeode API to display a statechart
parent
1a2d275e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
4f511f5d
...
...
@@ -8,7 +8,7 @@ install: compile-all
@
for
f
in
ColorFormatter.py TasteMainWindow.py asn1_python.py
\
errCode.py mscHandler.py plotmanager.py tasteplot.py
\
vn.py Scenario.py __init__.py asn1_value_editor.py gui.py
\
mscStreamingScene.py standalone_editor.py
\
mscStreamingScene.py standalone_editor.py
sdlHandler.py
\
udpcontroller.py resources.py
;
\
do
echo
Installing
$$
f
&&
cp
$$
f asn1_value_editor
;
\
done
...
...
gui.py
View file @
4f511f5d
...
...
@@ -56,6 +56,7 @@ except ImportError:
import
resources
from
mscHandler
import
mscHandler
from
sdlHandler
import
sdlHandler
from
PySide.QtCore
import
QThread
,
QFile
,
Qt
,
Signal
,
QObject
from
PySide.QtGui
import
(
QApplication
,
QStatusBar
,
QLabel
,
QWidget
,
...
...
@@ -277,6 +278,17 @@ def gui():
mscButton
.
triggered
.
connect
(
msc
.
startStop
)
myWidget
.
mscTrigger
.
connect
(
msc
.
startStop
)
# Create a dock to handle the display of SDL diagrams
try
:
sdl
=
sdlHandler
(
myWidget
)
except
IOError
:
log
.
info
(
'SDL viewer not available'
)
pass
else
:
sdlButton
=
toolbar
.
addAction
(
'SDL'
)
sdlButton
.
triggered
.
connect
(
sdl
.
startStop
)
# find dockable widgets (containing TM and TC editors)
docks
=
myWidget
.
findChildren
(
QDockWidget
)
firstTC
=
None
...
...
resources.py
View file @
4f511f5d
...
...
@@ -2,7 +2,7 @@
# Resource object code
#
# Created: Fri
Nov 21 16:43:11
2014
# Created: Fri
Dec 12 21:30:00
2014
# by: The Resource Compiler for PySide (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
...
...
sdlHandler.py
0 → 100644
View file @
4f511f5d
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=C0302
"""
TASTE GUI - SDL Statechart handler
Connect to OpenGEODE and display the statechart during the simulation
Copyright (c) 2012-2015 European Space Agency
Designed and implemented by Maxime Perrotin
Contact: maxime.perrotin@esa.int
"""
import
os
from
PySide.QtGui
import
QDockWidget
from
PySide.QtCore
import
Slot
,
Qt
try
:
import
opengeode
except
ImportError
:
print
'OpenGEODE module is not available'
class
sdlHandler
(
object
):
'''
Class managing SDL models
'''
def
__init__
(
self
,
parent
):
''' Startup: check if there are some SDL files in
the directory and try to parse them and build the widget '''
all_files
=
os
.
listdir
(
'.'
)
pr_files
=
[]
for
each
in
all_files
:
if
each
.
endswith
(
'.pr'
):
pr_files
.
append
(
each
)
if
not
pr_files
:
raise
IOError
(
'SDL Handler failed to initialize'
)
self
.
ast
=
opengeode
.
parse
(
pr_files
)
try
:
root_ast
=
self
.
ast
[
0
]
proc
=
root_ast
.
processes
[
0
]
except
IndexError
:
raise
IOError
(
'SDL Handler failed to initialize'
)
opengeode
.
Helper
.
flatten
(
proc
)
graph
=
opengeode
.
Statechart
.
create_dot_graph
(
proc
)
self
.
sdl_scene
=
opengeode
.
SDL_Scene
(
'statechart'
)
self
.
sdl_view
=
opengeode
.
SDL_View
(
self
.
sdl_scene
)
opengeode
.
Statechart
.
render_statechart
(
self
.
sdl_scene
,
graph
)
self
.
sdl_view
.
refresh
()
self
.
dock
=
QDockWidget
(
'SDL/Statechart Viewer'
,
parent
)
self
.
dock
.
setFloating
(
True
)
self
.
dock
.
setObjectName
(
'SDLViewer'
)
parent
.
addDockWidget
(
Qt
.
RightDockWidgetArea
,
self
.
dock
)
self
.
dock
.
setAllowedAreas
(
Qt
.
NoDockWidgetArea
)
self
.
sdl_view
.
show
()
self
.
dock
.
setWidget
(
self
.
sdl_view
)
self
.
running
=
False
self
.
dock
.
hide
()
@
Slot
()
def
startStop
(
self
):
''' Trigger or stop the SDL display '''
self
.
running
=
not
self
.
running
if
self
.
running
:
self
.
dock
.
show
()
else
:
self
.
dock
.
hide
()
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment