Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
eab0ad4d
Commit
eab0ad4d
authored
Oct 11, 2020
by
Maxime Perrotin
Browse files
Cleanup and fix bug with connections in branches
parent
af54db66
Changes
11
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
eab0ad4d
...
...
@@ -124,6 +124,9 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
**3.3.4 (10/2020)**
-
Fix bug when drawing connections in decision branches
**3.3.3 (10/2020)**
-
Refactoring : Generate all data types in ASN.1
...
...
opengeode/Connectors.py
View file @
eab0ad4d
...
...
@@ -36,7 +36,7 @@ class Connection(QGraphicsPathItem):
def
__init__
(
self
,
parent
,
child
):
''' Create a new connection between a parent and a child item '''
super
(
Connection
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
parent
=
parent
self
.
child
=
child
self
.
_start_point
=
None
...
...
@@ -179,7 +179,7 @@ class JoinConnection(Connection):
if
self
.
parentItem
().
terminal_symbol
:
self
.
setPath
(
QPainterPath
())
else
:
super
(
JoinConnection
,
self
).
reshape
()
super
().
reshape
()
@
property
def
start_point
(
self
):
...
...
@@ -256,7 +256,7 @@ class SignalList(EditableText):
''' Simplified text editor for signal lists '''
def
__init__
(
self
,
parent
,
text
=
''
,
hyperlink
=
None
):
''' Smaller font than normal text '''
super
(
SignalList
,
self
).
__init__
(
parent
,
text
)
super
().
__init__
(
parent
,
text
)
self
.
setFont
(
QFont
(
'Ubuntu'
,
pointSize
=
8
))
def
set_text_alignment
(
self
):
...
...
@@ -274,7 +274,7 @@ class SignalList(EditableText):
# pylint: disable=C0103
def
focusOutEvent
(
self
,
event
):
''' Redefined function - update in_sig and out_sig in parent '''
super
(
SignalList
,
self
).
focusOutEvent
(
event
)
super
().
focusOutEvent
(
event
)
class
Signalroute
(
Connection
):
...
...
@@ -284,7 +284,7 @@ class Signalroute(Connection):
def
__init__
(
self
,
parent
,
child
=
None
):
''' Set generic parameters from Connection class '''
super
(
Signalroute
,
self
).
__init__
(
parent
,
child
or
parent
)
super
().
__init__
(
parent
,
child
or
parent
)
self
.
parser
=
ogParser
self
.
blackbold
=
()
self
.
redbold
=
()
...
...
@@ -347,7 +347,7 @@ class Signalroute(Connection):
def
reshape
(
self
):
''' Redefine shape function to add the text areas '''
super
(
Signalroute
,
self
).
reshape
()
super
().
reshape
()
width_in
=
self
.
label_in
.
boundingRect
().
width
()
...
...
@@ -466,7 +466,7 @@ class Channel(Signalroute):
def
paint
(
self
,
painter
,
_
,
___
):
''' Apply anti-aliasing '''
painter
.
setRenderHint
(
QPainter
.
Antialiasing
,
True
)
super
(
Channel
,
self
).
paint
(
painter
,
_
,
___
)
super
().
paint
(
painter
,
_
,
___
)
...
...
@@ -477,7 +477,7 @@ class Controlpoint(QGraphicsPathItem):
''' Set the original control point - with color, shape '''
path
=
QPainterPath
()
path
.
addEllipse
(
pos
.
x
()
-
5
,
pos
.
y
()
-
5
,
10
,
10
)
super
(
Controlpoint
,
self
).
__init__
(
path
,
parent
=
edge
)
super
().
__init__
(
path
,
parent
=
edge
)
self
.
setPen
(
QColor
(
50
,
100
,
120
,
200
))
self
.
setBrush
(
QColor
(
200
,
200
,
210
,
120
))
self
.
setFlags
(
QGraphicsItem
.
ItemIsSelectable
|
...
...
@@ -492,7 +492,7 @@ class Controlpoint(QGraphicsPathItem):
def
mouseMoveEvent
(
self
,
event
):
''' When user moves a control point, update the connection shape '''
super
(
Controlpoint
,
self
).
mouseMoveEvent
(
event
)
super
().
mouseMoveEvent
(
event
)
self
.
edge
.
reshape
()
...
...
@@ -504,7 +504,7 @@ class Connectionpoint(Controlpoint):
'''
def
__init__
(
self
,
pos
,
edge
,
symbol
):
''' Create the point - as a small, lightblue box '''
super
(
Connectionpoint
,
self
).
__init__
(
pos
,
edge
=
edge
)
super
().
__init__
(
pos
,
edge
=
edge
)
path
=
QPainterPath
()
path
.
addRect
(
0
,
0
,
10
,
10
)
self
.
setPath
(
path
)
...
...
@@ -538,7 +538,7 @@ class Connectionpoint(Controlpoint):
where the actual connection point should be placed
'''
# calling super function moves to the new point
super
(
Connectionpoint
,
self
).
mouseMoveEvent
(
event
)
super
().
mouseMoveEvent
(
event
)
# Then compute a valid position, based on the owning symbol
self
.
update_position
()
...
...
@@ -548,7 +548,7 @@ class Edge(Connection):
def
__init__
(
self
,
edge
,
graph
):
''' Set generic parameters from Connection class '''
self
.
text_label
=
None
super
(
Edge
,
self
).
__init__
(
edge
[
'source'
],
edge
[
'target'
])
super
().
__init__
(
edge
[
'source'
],
edge
[
'target'
])
self
.
edge
=
edge
self
.
graph
=
graph
# Set connection points as not visible, by default
...
...
@@ -670,7 +670,7 @@ class Edge(Connection):
def
paint
(
self
,
painter
,
option
,
widget
):
''' Apply anti-aliasing to Edge Connections '''
painter
.
setRenderHint
(
QPainter
.
Antialiasing
,
True
)
super
(
Edge
,
self
).
paint
(
painter
,
option
,
widget
)
super
().
paint
(
painter
,
option
,
widget
)
# Draw lines between connection points, if visible
if
self
.
bezier_visible
:
painter
.
setPen
(
...
...
opengeode/Lander.py
View file @
eab0ad4d
...
...
@@ -48,7 +48,7 @@ class Rocket(genericSymbols.Symbol, object):
def
__init__
(
self
):
''' Initialization: compute the polygon shape '''
super
(
Rocket
,
self
).
__init__
(
parent
=
None
)
super
().
__init__
(
parent
=
None
)
self
.
set_shape
(
30
,
60
)
self
.
setBrush
(
QtGui
.
QBrush
(
QtGui
.
QColor
(
255
,
255
,
202
)))
# Set the rotation origin point
...
...
@@ -76,7 +76,7 @@ class Rocket(genericSymbols.Symbol, object):
path
.
lineTo
(
width
-
width
/
3
,
height
)
path
.
lineTo
(
width
-
width
/
3
,
height
-
height
/
6
)
self
.
setPath
(
path
)
super
(
Rocket
,
self
).
set_shape
(
width
,
height
)
super
().
set_shape
(
width
,
height
)
def
_rotation
(
self
):
''' Qt Property that can be used in animations '''
...
...
opengeode/Pr.py
View file @
eab0ad4d
...
...
@@ -33,7 +33,7 @@ class Indent(deque):
def
append
(
self
,
string
):
''' Redefinition of the append to insert the indent pattern '''
super
(
Indent
,
self
).
append
(
' '
*
Indent
.
indent
+
string
)
super
().
append
(
' '
*
Indent
.
indent
+
string
)
def
parse_scene
(
scene
,
full_model
=
False
):
...
...
@@ -55,7 +55,7 @@ def parse_scene(scene, full_model=False):
pr
=
generate
(
each
)
pr_data
.
extend
(
pr
)
for
pro
in
processes
:
if
isinstance
(
pro
,
sdlSymbols
.
ProcessType
):
if
isinstance
(
pro
,
sdlSymbols
.
ProcessType
)
or
not
pro
.
connection
:
# process type does not have connections
continue
to_env
=
pro
.
connection
.
out_sig
...
...
opengeode/Statechart.py
View file @
eab0ad4d
...
...
@@ -65,7 +65,7 @@ class Record(genericSymbols.HorizontalSymbol):
def
__init__
(
self
,
node
,
graph
):
''' Initialization: compute the polygon shape '''
self
.
name
=
node
[
'name'
]
super
(
Record
,
self
).
__init__
(
x
=
node
[
'pos'
][
0
],
super
().
__init__
(
x
=
node
[
'pos'
][
0
],
y
=
node
[
'pos'
][
1
],
text
=
self
.
name
)
self
.
set_shape
(
node
[
'width'
],
node
[
'height'
])
self
.
setBrush
(
QBrush
(
QColor
(
255
,
255
,
202
)))
...
...
@@ -87,7 +87,7 @@ class Record(genericSymbols.HorizontalSymbol):
self
.
setPath
(
path
)
LOG
.
debug
(
"Set shape of state "
+
str
(
self
))
#LOG.debug(traceback.print_stack())
super
(
Record
,
self
).
set_shape
(
width
,
height
)
super
().
set_shape
(
width
,
height
)
def
resize_item
(
self
,
_
):
''' Redefine the resizing function - forbid resizing '''
...
...
@@ -128,7 +128,7 @@ class Point(genericSymbols.HorizontalSymbol):
label
=
self
.
name
[
0
:
-
6
]
else
:
label
=
''
super
(
Point
,
self
).
__init__
(
x
=
node
[
'pos'
][
0
],
y
=
node
[
'pos'
][
1
],
super
().
__init__
(
x
=
node
[
'pos'
][
0
],
y
=
node
[
'pos'
][
1
],
text
=
label
)
self
.
set_shape
(
node
[
'width'
],
node
[
'height'
])
self
.
setBrush
(
QBrush
(
Qt
.
black
))
...
...
@@ -141,7 +141,7 @@ class Point(genericSymbols.HorizontalSymbol):
path
=
QPainterPath
()
path
.
addEllipse
(
0
,
0
,
width
,
height
)
self
.
setPath
(
path
)
super
(
Point
,
self
).
set_shape
(
width
,
height
)
super
().
set_shape
(
width
,
height
)
def
resize_item
(
self
,
_
):
''' Redefine the resizing function - forbid resizing '''
...
...
@@ -175,7 +175,7 @@ class Diamond(genericSymbols.HorizontalSymbol):
def
__init__
(
self
,
node
,
graph
):
''' Initialization: compute the polygon shape '''
self
.
name
=
node
[
'name'
]
super
(
Diamond
,
self
).
__init__
(
x
=
node
[
'pos'
][
0
],
y
=
node
[
'pos'
][
1
])
super
().
__init__
(
x
=
node
[
'pos'
][
0
],
y
=
node
[
'pos'
][
1
])
self
.
set_shape
(
node
[
'width'
],
node
[
'height'
])
self
.
graph
=
graph
...
...
@@ -188,7 +188,7 @@ class Diamond(genericSymbols.HorizontalSymbol):
path
.
lineTo
(
0
,
height
/
2
)
path
.
lineTo
(
width
/
2
,
0
)
self
.
setPath
(
path
)
super
(
Diamond
,
self
).
set_shape
(
width
,
height
)
super
().
set_shape
(
width
,
height
)
def
resize_item
(
self
,
_
):
''' Redefine the resizing function - forbid resizing '''
...
...
@@ -222,7 +222,7 @@ class Stop(genericSymbols.HorizontalSymbol):
def
__init__
(
self
,
node
,
graph
):
''' Initialization: compute the polygon shape '''
self
.
name
=
node
[
'name'
]
super
(
Stop
,
self
).
__init__
(
x
=
node
[
'pos'
][
0
],
y
=
node
[
'pos'
][
1
],
super
().
__init__
(
x
=
node
[
'pos'
][
0
],
y
=
node
[
'pos'
][
1
],
text
=
self
.
name
)
self
.
set_shape
(
node
[
'width'
],
node
[
'height'
])
self
.
graph
=
graph
...
...
@@ -237,7 +237,7 @@ class Stop(genericSymbols.HorizontalSymbol):
path
.
moveTo
(
width
,
0
)
path
.
lineTo
(
0
,
height
)
self
.
setPath
(
path
)
super
(
Stop
,
self
).
set_shape
(
width
,
height
)
super
().
set_shape
(
width
,
height
)
def
resize_item
(
self
,
_
):
''' Redefine the resizing function - forbid resizing '''
...
...
opengeode/TextInteraction.py
View file @
eab0ad4d
...
...
@@ -7,7 +7,7 @@
- Syntax highlighing
- Automatic placement
Copyright (c) 2012-20
19
European Space Agency
Copyright (c) 2012-20
20
European Space Agency
Designed and implemented by Maxime Perrotin for the TASTE project
...
...
@@ -32,7 +32,7 @@ class Completer(QGraphicsProxyWidget):
def
__init__
(
self
,
parent
):
''' Create an autocompletion list popup '''
widget
=
QListWidget
()
super
(
Completer
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
setWidget
(
widget
)
self
.
string_list
=
QStringListModel
()
self
.
_completer
=
QCompleter
()
...
...
@@ -73,7 +73,7 @@ class Completer(QGraphicsProxyWidget):
# pylint: disable=C0103
def
keyPressEvent
(
self
,
e
):
super
(
Completer
,
self
).
keyPressEvent
(
e
)
super
().
keyPressEvent
(
e
)
if
e
.
key
()
==
Qt
.
Key_Escape
:
self
.
parentItem
().
setFocus
()
# Consume the event so that it is not repeated at EditableText level
...
...
@@ -82,7 +82,7 @@ class Completer(QGraphicsProxyWidget):
# pylint: disable=C0103
def
focusOutEvent
(
self
,
event
):
''' When the user leaves the popup, return focus to parent '''
super
(
Completer
,
self
).
focusOutEvent
(
event
)
super
().
focusOutEvent
(
event
)
self
.
hide
()
self
.
resize
(
0
,
0
)
self
.
parentItem
().
setFocus
()
...
...
@@ -93,7 +93,7 @@ class Highlighter(QSyntaxHighlighter):
''' Class for handling syntax highlighting in editable text '''
def
__init__
(
self
,
parent
,
blackbold_patterns
,
redbold_patterns
):
''' Define highlighting rules - inputs = lists of patterns '''
super
(
Highlighter
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
highlighting_rules
=
[]
# Black bold items (allowed keywords)
...
...
@@ -138,7 +138,7 @@ class EditableText(QGraphicsTextItem):
word_under_cursor
=
Signal
(
str
)
def
__init__
(
self
,
parent
,
text
=
'...'
,
hyperlink
=
None
):
super
(
EditableText
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
parent
=
parent
self
.
setFont
(
QFont
(
'Ubuntu'
,
10
))
self
.
completer
=
Completer
(
self
)
...
...
@@ -278,7 +278,7 @@ class EditableText(QGraphicsTextItem):
'''
Activate the autocompletion window if relevant
'''
super
(
EditableText
,
self
).
keyPressEvent
(
event
)
super
().
keyPressEvent
(
event
)
# Typing Esc allows to stop editing text:
if
event
.
key
()
==
Qt
.
Key_Escape
:
self
.
clearFocus
()
...
...
@@ -342,7 +342,7 @@ class EditableText(QGraphicsTextItem):
if
self
.
completer
.
isVisible
():
self
.
completer
.
hide
()
self
.
completer
.
resize
(
0
,
0
)
super
(
EditableText
,
self
).
mousePressEvent
(
event
)
super
().
mousePressEvent
(
event
)
# pylint: disable=C0103
def
focusOutEvent
(
self
,
event
):
...
...
@@ -352,7 +352,7 @@ class EditableText(QGraphicsTextItem):
that got the focus.
'''
if
not
self
.
editing
:
return
super
(
EditableText
,
self
).
focusOutEvent
(
event
)
return
super
().
focusOutEvent
(
event
)
if
self
.
completer
and
not
self
.
completer_has_focus
:
self
.
completer
.
hide
()
self
.
completer
.
resize
(
0
,
0
)
...
...
@@ -407,12 +407,12 @@ class EditableText(QGraphicsTextItem):
top_level
=
self
.
parent
.
top_level
()
top_level
.
setZValue
(
top_level
.
zValue
()
-
1
)
self
.
parent
.
setZValue
(
self
.
parent
.
zValue
()
-
1
)
super
(
EditableText
,
self
).
focusOutEvent
(
event
)
super
().
focusOutEvent
(
event
)
# pylint: disable=C0103
def
focusInEvent
(
self
,
event
):
''' When user starts editing text, save previous state for Undo '''
super
(
EditableText
,
self
).
focusInEvent
(
event
)
super
().
focusInEvent
(
event
)
# Change the Z-value of items to make sure the
# completer is always be on top of other symbols
top_level
=
self
.
parent
.
top_level
()
...
...
opengeode/genericSymbols.py
View file @
eab0ad4d
...
...
@@ -41,7 +41,7 @@
For a complete example, look at the "sdlSymbols.py" module, that
provide symbol definitions that correspond to an SDL editor.
Copyright (c) 2012-20
19
European Space Agency
Copyright (c) 2012-20
20
European Space Agency
Designed and implemented by Maxime Perrotin for the TASTE project
...
...
@@ -133,7 +133,7 @@ class Symbol(QObject, QGraphicsPathItem):
Create top level symbol and propagate important properties
from parent items
'''
super
(
Symbol
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
QGraphicsPathItem
.
__init__
(
self
,
parent
)
# Current mode, can be empty string, "Resize", or "Move"
self
.
mode
=
''
...
...
@@ -353,7 +353,7 @@ class Symbol(QObject, QGraphicsPathItem):
def
paint
(
self
,
painter
,
_
,
___
):
''' Apply anti-aliasing or not (symbol attribute) '''
painter
.
setRenderHint
(
QPainter
.
Antialiasing
,
self
.
_antialiasing
)
super
(
Symbol
,
self
).
paint
(
painter
,
_
,
___
)
super
().
paint
(
painter
,
_
,
___
)
def
update_position
(
self
):
''' VIRTUAL - implemented in subclasses '''
...
...
@@ -514,7 +514,7 @@ class Symbol(QObject, QGraphicsPathItem):
''' resize item, e.g. when editing text - move children accordingly '''
# Call stack:
# scene_refresh() => Text_Interaction.try_resize() => resize_item()
LOG
.
debug
(
"resize item"
)
#
LOG.debug("resize item")
#LOG.debug(traceback.print_stack())
if
not
self
.
resizeable
:
return
...
...
@@ -550,7 +550,8 @@ class Symbol(QObject, QGraphicsPathItem):
pass
try
:
self
.
branch_entrypoint
.
parent
.
update_connections
()
except
AttributeError
:
except
AttributeError
as
err
:
# All symbols that have no branch entrypoint
pass
def
set_shape
(
self
,
width
,
height
):
...
...
@@ -774,7 +775,7 @@ class Comment(Symbol):
def
__init__
(
self
,
parent
=
None
,
ast
=
None
):
ast
=
ast
or
ogAST
.
Comment
()
self
.
ast
=
ast
super
(
Comment
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
connection
=
None
self
.
set_shape
(
ast
.
width
,
ast
.
height
)
self
.
text
=
EditableText
(
parent
=
self
,
...
...
@@ -799,7 +800,7 @@ class Comment(Symbol):
if
not
parent
:
return
parent
.
comment
=
self
super
(
Comment
,
self
).
insert_symbol
(
parent
,
x
,
y
)
super
().
insert_symbol
(
parent
,
x
,
y
)
self
.
pos_x
=
x
if
x
is
not
None
else
parent
.
boundingRect
().
width
()
+
20
self
.
pos_y
=
y
if
y
is
not
None
else
(
parent
.
boundingRect
().
height
()
-
self
.
boundingRect
().
height
())
/
2
...
...
@@ -821,7 +822,7 @@ class Comment(Symbol):
reset comment field in parent
'''
self
.
parentItem
().
comment
=
None
super
(
Comment
,
self
).
delete_symbol
()
super
().
delete_symbol
()
def
resize_item
(
self
,
rect
):
'''
...
...
@@ -839,7 +840,7 @@ class Comment(Symbol):
path
=
QPainterPath
()
path
.
addRect
(
0
,
0
,
width
,
height
)
self
.
setPath
(
path
)
super
(
Comment
,
self
).
set_shape
(
width
,
height
)
super
().
set_shape
(
width
,
height
)
def
paint
(
self
,
painter
,
_
,
___
):
''' Draw the comment symbol '''
...
...
@@ -860,7 +861,7 @@ class Comment(Symbol):
def
mouse_move
(
self
,
event
):
''' Handle item move '''
super
(
Comment
,
self
).
mouse_move
(
event
)
super
().
mouse_move
(
event
)
if
self
.
mode
==
'Move'
:
self
.
pos_y
+=
event
.
pos
().
y
()
-
event
.
lastPos
().
y
()
self
.
pos_x
+=
event
.
pos
().
x
()
-
event
.
lastPos
().
x
()
...
...
@@ -878,7 +879,7 @@ class Comment(Symbol):
if
not
move_accepted
:
self
.
position
=
self
.
coord
self
.
update_connections
()
return
super
(
Comment
,
self
).
mouse_release
(
event
)
return
super
().
mouse_release
(
event
)
def
updateConnectionPoints
(
self
):
'''
...
...
@@ -901,7 +902,7 @@ class Cornergrabber(QGraphicsPolygonItem):
def
__init__
(
self
,
parent
):
''' Create the grabber '''
super
(
Cornergrabber
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
setParentItem
(
parent
)
self
.
parent
=
parent
self
.
setFlags
(
QGraphicsItem
.
ItemIsSelectable
|
...
...
@@ -929,7 +930,7 @@ class Cornergrabber(QGraphicsPolygonItem):
def
mousePressEvent
(
self
,
event
):
''' Handle Qt event '''
self
.
parent
.
mouse_click
(
event
)
super
(
Cornergrabber
,
self
).
mousePressEvent
(
event
)
super
().
mousePressEvent
(
event
)
def
mouseMoveEvent
(
self
,
event
):
''' Handle Qt event '''
...
...
@@ -993,7 +994,7 @@ class HorizontalSymbol(Symbol):
'''
def
__init__
(
self
,
parent
=
None
,
text
=
'...'
,
x
=
None
,
y
=
None
,
hyperlink
=
None
):
super
(
HorizontalSymbol
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
minDistanceToSymbolAbove
=
20
self
.
connection
=
None
if
self
.
has_text_area
:
...
...
@@ -1015,7 +1016,7 @@ class HorizontalSymbol(Symbol):
def
set_valid_pos
(
self
,
pos
):
''' Redefined function - make sure symbol is below its parent '''
if
not
self
.
hasParent
:
super
(
HorizontalSymbol
,
self
).
set_valid_pos
(
pos
)
super
().
set_valid_pos
(
pos
)
else
:
new_y
=
max
(
pos
.
y
(),
self
.
parent
.
boundingRect
().
height
()
+
self
.
minDistanceToSymbolAbove
)
...
...
@@ -1026,7 +1027,7 @@ class HorizontalSymbol(Symbol):
if
not
parent
:
self
.
position
=
QPointF
(
pos_x
or
0
,
pos_y
or
0
)
return
super
(
HorizontalSymbol
,
self
).
insert_symbol
(
parent
,
pos_x
,
pos_y
)
super
().
insert_symbol
(
parent
,
pos_x
,
pos_y
)
if
pos_x
is
None
or
pos_y
is
None
:
# Usually for first insertion when item is created:
# compute position and (if relevant) move siblings
...
...
@@ -1069,7 +1070,7 @@ class HorizontalSymbol(Symbol):
Redefined from Symbol class
Horizontal symbols may have siblings - check their shape.
'''
super
(
HorizontalSymbol
,
self
).
update_connections
()
super
().
update_connections
()
try
:
for
sibling
in
self
.
siblings
():
for
cnx
in
sibling
.
last_branch_item
.
connections
():
...
...
@@ -1104,7 +1105,7 @@ class HorizontalSymbol(Symbol):
new_x
=
self
.
pos_x
+
(
event_pos
.
x
()
-
event
.
lastPos
().
x
())
self
.
position
=
QPointF
(
new_x
,
new_y
)
self
.
update_connections
()
super
(
HorizontalSymbol
,
self
).
mouse_move
(
event
)
super
().
mouse_move
(
event
)
def
cam
(
self
,
old_pos
,
new_pos
,
ignore
=
None
):
'''
...
...
@@ -1160,7 +1161,7 @@ class HorizontalSymbol(Symbol):
# If there is no scene or no undo stack
pass
sibling
.
cam
(
sibling
.
position
,
sibling
.
position
)
super
(
HorizontalSymbol
,
self
).
cam
(
old_pos
,
new_pos
,
ignore
)
super
().
cam
(
old_pos
,
new_pos
,
ignore
)
# Recursively call the cam of the parent
try
:
self
.
parentItem
().
cam
(
self
.
parentItem
().
position
,
...
...
@@ -1177,7 +1178,7 @@ class VerticalSymbol(Symbol):
'''
def
__init__
(
self
,
parent
=
None
,
text
=
'...'
,
x
=
None
,
y
=
None
,
hyperlink
=
None
):
super
(
VerticalSymbol
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
connection
=
None
if
self
.
has_text_area
:
self
.
text
=
EditableText
(
parent
=
self
,
...
...
@@ -1204,7 +1205,7 @@ class VerticalSymbol(Symbol):
def
set_valid_pos
(
self
,
pos
):
''' Redefined function - make sure symbol is well aligned '''
if
not
self
.
hasParent
:
super
(
VerticalSymbol
,
self
).
set_valid_pos
(
pos
)
super
().
set_valid_pos
(
pos
)
else
:
# 'or self.parent' because of pyside/qt bug
parent
=
self
.
parentItem
()
or
self
.
parent
...
...
@@ -1228,7 +1229,7 @@ class VerticalSymbol(Symbol):
if
x
is
not
None
and
y
is
not
None
:
self
.
position
=
QPointF
(
x
,
y
)
return
super
(
VerticalSymbol
,
self
).
insert_symbol
(
parent
,
x
,
y
)
super
().
insert_symbol
(
parent
,
x
,
y
)
# in a branch (e.g. DECISION) all items must know the first element
# (used for computing the branch size and the connection point)
self
.
branch_entrypoint
=
parent
.
branch_entrypoint
...
...
@@ -1296,7 +1297,7 @@ class VerticalSymbol(Symbol):
def
mouse_move
(
self
,
event
):
''' Click and move: forbid symbol to move on the x axis '''
super
(
VerticalSymbol
,
self
).
mouse_move
(
event
)
super
().
mouse_move
(
event
)
if
self
.
mode
==
'Move'
:
new_y
=
self
.
pos_y
+
event
.
pos
().
y
()
-
event
.
lastPos
().
y
()
new_x
=
self
.
pos_x
+
event
.
pos
().
x
()
-
event
.
lastPos
().
x
()
...
...
@@ -1315,4 +1316,4 @@ class VerticalSymbol(Symbol):
branch_entry
=
branch_entry
.
parentItem
()
or
branch_entry
.
parent
branch_entry
.
cam
(
branch_entry
.
position
,
branch_entry
.
position
)
else
:
super
(
VerticalSymbol
,
self
).
cam
(
old_pos
,
new_pos
,
ignore
)
super
().
cam
(
old_pos
,
new_pos
,
ignore
)
opengeode/ogAST.py
View file @
eab0ad4d
...
...
@@ -548,7 +548,7 @@ class Floating_label(Label):
''' AST Entry for a floating label '''
def
__init__
(
self
,
label
=
None
):
''' Initialize the floating label attributes '''
super
(
Floating_label
,
self
).
__init__
()
super
().
__init__
()
if
label
:
self
.
inputString
=
label
.
inputString
self
.
pos_x
=
label
.
pos_x
...
...
@@ -630,7 +630,7 @@ class Connect(Input):
''' AST Entry for the CONNECT part (transition below a nested state) '''
def
__init__
(
self
):
''' Only one difference with INPUT: the connect_list attribute '''
super
(
Connect
,
self
).
__init__
()
super
().
__init__
()
# List of strings
self
.
connect_list
=
[]
self
.
width
=
1
...
...
@@ -644,7 +644,7 @@ class ContinuousSignal(Input):
''' AST Entry for the Continuous Signal '''
def
__init__
(
self
):
''' Difference with Input: trigger is an expression '''
super
(
ContinuousSignal
,
self
).
__init__
()
super
().
__init__
()
# Decision triggering the transition
self
.
trigger
=
None
# Priority (integer)
...
...
@@ -949,7 +949,7 @@ class CompositeState(Process):
- entry and exit procedures
'''
def
__init__
(
self
):
super
(
CompositeState
,
self
).
__init__
()
super
().
__init__
()
self
.
statename
=
''
self
.
state_entrypoints
=
set
()
self
.
state_exitpoints
=
set
()
...
...
@@ -976,7 +976,7 @@ class StateAggregation(CompositeState):
But no state machine definition
'''
def
__init__
(
self
):
super
(
StateAggregation
,
self
).
__init__
()
super
().
__init__
()
# List of partition connections:
# [{'outer': {'state_part_id': str, 'point': str},
# 'inner': {'state_part_id': str, 'point': str}}]
...
...
opengeode/opengeode.py
View file @
eab0ad4d
...
...
@@ -26,6 +26,7 @@ import pprint
import
random
from
functools
import
partial
from
itertools
import
chain
from
importlib
import
reload
# To freeze the application on Windows, all modules must be imported even
# when they are not directly used from this module (py2exe bug)
...
...
@@ -140,7 +141,7 @@ except ImportError:
__all__
=
[
'opengeode'
,
'SDL_Scene'
,
'SDL_View'
,
'parse'
]
__version__
=
'3.3.
3
'
__version__
=
'3.3.
4
'
if
hasattr
(
sys
,
'frozen'
):
# Detect if we are running on Windows (py2exe-generated)
...
...
@@ -232,13 +233,13 @@ class Vi_bar(QLineEdit, object):
''' Line editor for the Vi-like command mode '''
def
__init__
(
self
):
''' Create the bar - no need for parent '''
super
(
Vi_bar
,
self
).
__init__
()
super
().
__init__
()
self
.
history
=
[]
self
.
pointer
=
0
def
keyPressEvent
(
self
,
key_event
):
''' Handle key press - Escape, command history '''
super
(
Vi_bar
,
self
).
keyPressEvent
(
key_event
)
super
().
keyPressEvent
(
key_event
)
if
key_event
.
key
()
==
Qt
.
Key_Escape
:
self
.
clearFocus
()
self
.
pointer
=
len
(
self
.
history
)
...
...
@@ -266,7 +267,7 @@ class File_toolbar(QToolBar, object):
''' Toolbar with file open, save, etc '''
def
__init__
(
self
,
parent
):
''' Create the toolbar using standard icons '''
super
(
File_toolbar
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
setObjectName
(
"File Toolbar"
)
# needed to save geometry
self
.
setMovable
(
False
)
self
.
setFloatable
(
False
)
...
...
@@ -295,7 +296,7 @@ class Sdl_toolbar(QToolBar, object):
'''
def
__init__
(
self
,
parent
):
''' Create the toolbar, get icons and link actions '''
super
(
Sdl_toolbar
,
self
).
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
setObjectName
(
"SDL Toolbar"
)
# needed to save geometry
self
.
setMovable
(
False
)
self
.
setFloatable
(
False
)
...
...
@@ -386,7 +387,7 @@ class SDL_Scene(QGraphicsScene):