Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gryphon
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
Container Registry
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Monterey Phoenix
User Interfaces
Gryphon
Commits
a72410f3
Commit
a72410f3
authored
4 years ago
by
Allen, Bruce (CIV)
Browse files
Options
Downloads
Patches
Plain Diff
adjust graph bounds
parent
be3fd68e
No related branches found
No related tags found
No related merge requests found
Pipeline
#4997
failed
4 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/views/activity_diagram.py
+21
-9
21 additions, 9 deletions
python/views/activity_diagram.py
with
21 additions
and
9 deletions
python/views/activity_diagram.py
+
21
−
9
View file @
a72410f3
...
...
@@ -6,8 +6,8 @@ from PyQt5.QtWidgets import QGraphicsItem
from
next_graphics_index
import
next_graphics_index
# see also typical settings_manager values
TITLE_Y
=
1
5
TITLE_SPACING
=
25
TITLE_Y
=
5
TITLE_
Y_
SPACING
=
30
ACTIVITY_W
=
127
ACTIVITY_H
=
17
DECISION_W
=
14
...
...
@@ -18,10 +18,15 @@ END_D2 = 3
H_SPACING
=
165
V_SPACING
=
55
def
_text_width
(
text
):
fm
=
QFontMetrics
(
QFont
())
# use default font since we do not set it
width
=
fm
.
horizontalAdvance
(
text
)
return
width
def
_xy
(
json_node
):
# node center point
x
=
json_node
[
2
]
*
H_SPACING
y
=
json_node
[
3
]
*
V_SPACING
+
TITLE_SPACING
x
=
json_node
[
2
]
*
H_SPACING
+
ACTIVITY_W
/
2
y
=
json_node
[
3
]
*
V_SPACING
+
TITLE_
Y_
SPACING
return
x
,
y
def
_xy_in
(
json_node
):
...
...
@@ -109,6 +114,9 @@ class ActivityDiagram(QGraphicsItem):
self
.
nodes
=
data
[
1
]
edges
=
data
[
2
]
# title width
self
.
title_width
=
_text_width
(
self
.
title
)
# indexed nodes for edges
indexed_nodes
=
dict
()
...
...
@@ -126,11 +134,14 @@ class ActivityDiagram(QGraphicsItem):
indexed_nodes
[
json_edge
[
1
]],
self
.
painter_path
)
# rectangle
for mouse sens
e
# rectangle
, adjusted for titl
e
self
.
bounding_path
=
QPainterPath
()
bounding_rect
=
self
.
painter_path
.
boundingRect
()
bounding_rect
.
setTop
(
0
)
self
.
bounding_path
.
addRect
(
bounding_rect
)
self
.
bounding_rect
=
self
.
painter_path
.
boundingRect
()
self
.
bounding_rect
.
adjust
(
0
,
-
TITLE_Y_SPACING
,
0
,
0
)
w
=
_text_width
(
self
.
title
)
if
w
>
self
.
bounding_rect
.
width
():
self
.
bounding_rect
.
adjust
(
0
,
0
,
w
-
self
.
bounding_rect
.
width
(),
0
)
self
.
bounding_path
.
addRect
(
self
.
bounding_rect
)
def
json_data
(
self
):
self
.
_json_data
[
"
x
"
]
=
self
.
x
()
...
...
@@ -152,9 +163,10 @@ class ActivityDiagram(QGraphicsItem):
w
=
ACTIVITY_W
h
=
ACTIVITY_H
title_w
=
self
.
bounding_rect
.
width
()
# title
painter
.
drawText
(
QRectF
(
0
,
TITLE_Y
,
w
,
h
),
Qt
.
AlignCenter
,
painter
.
drawText
(
QRectF
(
0
,
TITLE_Y
,
title_
w
,
h
),
Qt
.
AlignCenter
,
self
.
title
)
# painter_path of nodes and edges
...
...
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