Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pymsc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TASTE
pymsc
Commits
865f0c0a
Commit
865f0c0a
authored
Nov 21, 2014
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve support for condition boxes
parent
50944e65
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
23 deletions
+15
-23
mscgraphics/basicmscgraph/mscGraphBasicMSCScene.py
mscgraphics/basicmscgraph/mscGraphBasicMSCScene.py
+6
-5
mscgraphics/basicmscgraph/mscGraphCondition.py
mscgraphics/basicmscgraph/mscGraphCondition.py
+9
-13
mscgraphics/basicmscgraph/mscGraphMessage.py
mscgraphics/basicmscgraph/mscGraphMessage.py
+0
-5
No files found.
mscgraphics/basicmscgraph/mscGraphBasicMSCScene.py
View file @
865f0c0a
...
@@ -228,14 +228,15 @@ class MscGraphBasicMSCScene(QGraphicsScene):
...
@@ -228,14 +228,15 @@ class MscGraphBasicMSCScene(QGraphicsScene):
self
.
removeItem
(
comment
)
self
.
removeItem
(
comment
)
#--------------- Conditions
#--------------- Conditions
def
addCondition
(
self
,
instance
,
pos
=
None
,
label
=
''
):
def
addCondition
(
self
,
instance
,
y
=
None
,
label
=
''
):
u"""
u"""
Add new "condition" to the scene and position it in
"pos"
if any
Add new "condition" to the scene and position it in
y pos
if any
"""
"""
condition
=
MscGraphCondition
(
label
=
label
,
parent
=
self
.
bmsc
())
condition
=
MscGraphCondition
(
label
=
label
,
y
=
y
,
parent
=
self
.
bmsc
(),
instance
=
instance
)
instance
.
addEvent
(
condition
)
instance
.
addEvent
(
condition
)
if
pos
is
not
None
:
if
y
is
not
None
:
condition
.
set
Pos
(
pos
)
condition
.
set
Y
(
instance
.
mapFromScene
(
0
,
y
).
y
()
)
condition
.
itemSelected
.
connect
(
self
.
itemSelected
)
condition
.
itemSelected
.
connect
(
self
.
itemSelected
)
self
.
itemInserted
.
emit
(
condition
)
self
.
itemInserted
.
emit
(
condition
)
return
condition
return
condition
...
...
mscgraphics/basicmscgraph/mscGraphCondition.py
View file @
865f0c0a
...
@@ -41,12 +41,10 @@ class MscGraphCondition(MscGraphItem):
...
@@ -41,12 +41,10 @@ class MscGraphCondition(MscGraphItem):
DefaultWidth
=
150
DefaultWidth
=
150
DefaultHeight
=
30
DefaultHeight
=
30
def
__init__
(
self
,
data
=
None
,
y
=
0
,
label
=
None
,
parent
=
None
):
def
__init__
(
self
,
data
=
None
,
y
=
0
,
label
=
None
,
parent
=
None
,
instance
=
None
):
u"""
Initize
"""
super
(
MscGraphCondition
,
self
).
__init__
(
parent
)
super
(
MscGraphCondition
,
self
).
__init__
(
parent
)
self
.
setFlag
(
super
(
MscGraphCondition
,
self
).
ItemIsMovable
,
True
)
self
.
setFlag
(
super
(
MscGraphCondition
,
self
).
ItemIsMovable
,
True
)
self
.
instance
=
instance
if
label
is
None
:
if
label
is
None
:
label
=
"Condition"
label
=
"Condition"
...
@@ -63,6 +61,7 @@ class MscGraphCondition(MscGraphItem):
...
@@ -63,6 +61,7 @@ class MscGraphCondition(MscGraphItem):
# Create Path
# Create Path
self
.
createPath
()
self
.
createPath
()
self
.
setPos
(
self
.
pos
().
x
(),
y
or
0
)
#**************************************************************************
#**************************************************************************
# Data Functions
# Data Functions
...
@@ -100,30 +99,27 @@ class MscGraphCondition(MscGraphItem):
...
@@ -100,30 +99,27 @@ class MscGraphCondition(MscGraphItem):
def
updateLabelPosition
(
self
):
def
updateLabelPosition
(
self
):
self
.
label
.
setCenterPos
(
QPointF
(
0
,
15
))
self
.
label
.
setCenterPos
(
QPointF
(
0
,
15
))
#self.label.setPos(self.x() + 10,
# -self.label.boundingRect().height() / 2)
#**************************************************************************
#**************************************************************************
# Item Change
# Item Change
#**************************************************************************
#**************************************************************************
def
limitsOfItem
(
self
,
value
):
def
limitsOfItem
(
self
,
value
):
u""" Check the limits of the event area of parent """
u""" Check the limits of the event area of parent """
parent
=
self
.
parentItem
()
parent
=
self
.
instance
if
parent
==
None
:
if
parent
==
None
:
return
value
return
value
upperY
=
parent
.
upperLimit
().
y
()
upperY
=
parent
.
upperLimit
().
y
()
bottomY
=
parent
.
bottomLimit
().
y
()
#
bottomY = parent.bottomLimit().y()
valueY
=
value
.
y
()
valueY
=
value
.
y
()
if
valueY
<
upperY
:
if
valueY
<
upperY
:
valueY
=
upperY
valueY
=
upperY
new_pos
=
QPointF
(
self
.
pos
().
x
(),
valueY
)
value
.
setX
(
self
.
pos
().
x
())
return
new_pos
value
.
setY
(
valueY
)
return
value
def
itemChange
(
self
,
change
,
value
):
def
itemChange
(
self
,
change
,
value
):
''' On position change, check that item stays in an allowed area '''
if
(
change
==
super
(
MscGraphCondition
,
self
).
ItemPositionChange
):
if
(
change
==
super
(
MscGraphCondition
,
self
).
ItemPositionChange
):
value
=
self
.
limitsOfItem
(
value
)
value
=
self
.
limitsOfItem
(
value
)
...
@@ -131,7 +127,7 @@ class MscGraphCondition(MscGraphItem):
...
@@ -131,7 +127,7 @@ class MscGraphCondition(MscGraphItem):
self
.
mscData
().
setAbsPos
(
self
.
mapToScene
(
0
,
0
).
y
())
self
.
mscData
().
setAbsPos
(
self
.
mapToScene
(
0
,
0
).
y
())
self
.
yHasChanged
.
emit
(
self
)
self
.
yHasChanged
.
emit
(
self
)
return
MscGraphItem
.
itemChange
(
self
,
change
,
value
)
return
value
#
MscGraphItem.itemChange(self, change, value)
#**************************************************************************
#**************************************************************************
# Paint Functions
# Paint Functions
...
...
mscgraphics/basicmscgraph/mscGraphMessage.py
View file @
865f0c0a
...
@@ -206,11 +206,6 @@ class MscGraphMessage(MscGraphItem):
...
@@ -206,11 +206,6 @@ class MscGraphMessage(MscGraphItem):
if
value
.
y
()
<
recvStart
.
y
():
if
value
.
y
()
<
recvStart
.
y
():
value
.
setY
(
recvStart
.
y
())
value
.
setY
(
recvStart
.
y
())
# # Message are not below the instances
# if value.y() > sendEnd.y():
# value.setY(sendEnd.y())
# if value.y() > recvEnd.y():
# value.setY(recvEnd.y())
value
.
setX
(
self
.
pos
().
x
())
value
.
setX
(
self
.
pos
().
x
())
return
value
return
value
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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