Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
9a446880
Commit
9a446880
authored
Sep 09, 2016
by
Maxime Perrotin
Browse files
Work in progress
parent
a1b55582
Changes
4
Hide whitespace changes
Inline
Side-by-side
opengeode/Connectors.py
View file @
9a446880
...
...
@@ -276,9 +276,9 @@ class Signalroute(Connection):
in_sig
=
out_sig
=
None
completion_list
=
set
()
def
__init__
(
self
,
p
rocess
):
def
__init__
(
self
,
p
arent
,
child
=
None
):
''' Set generic parameters from Connection class '''
super
(
Signalroute
,
self
).
__init__
(
p
rocess
,
process
)
super
(
Signalroute
,
self
).
__init__
(
p
arent
,
child
or
parent
)
self
.
parser
=
ogParser
self
.
blackbold
=
()
self
.
redbold
=
()
...
...
@@ -292,16 +292,15 @@ class Signalroute(Connection):
# Needed for the image exporter, that copies the scene to a
# temporary one
Signalroute
.
in_sig
=
'{}'
.
format
(
',
\n
'
.
join
(
sig
[
'name'
]
for
sig
in
p
rocess
.
input_signals
))
for
sig
in
p
arent
.
input_signals
))
Signalroute
.
out_sig
=
'{}'
.
format
(
',
\n
'
.
join
(
sig
[
'name'
]
for
sig
in
p
rocess
.
output_signals
))
for
sig
in
p
arent
.
output_signals
))
self
.
label_in
.
setPlainText
(
'[{}]'
.
format
(
self
.
in_sig
))
self
.
label_out
.
setPlainText
(
'[{}]'
.
format
(
self
.
out_sig
))
self
.
label_in
.
document
().
contentsChanged
.
connect
(
self
.
change_siglist
)
self
.
label_out
.
document
().
contentsChanged
.
connect
(
self
.
change_siglist
)
for
each
in
(
self
.
label_in
,
self
.
label_out
):
each
.
show
()
self
.
process
=
process
self
.
reshape
()
@
Slot
()
...
...
@@ -320,7 +319,7 @@ class Signalroute(Connection):
@
property
def
start_point
(
self
):
''' Compute connection origin - redefined function '''
parent_rect
=
self
.
p
rocess
.
boundingRect
()
parent_rect
=
self
.
p
arent
.
boundingRect
()
return
QPointF
(
parent_rect
.
x
(),
parent_rect
.
height
()
/
2
)
@
property
...
...
@@ -406,6 +405,47 @@ class Signalroute(Connection):
pass
class
Channel
(
Signalroute
):
''' Connection between two processes. Signalroute handles connections
between a function and the environment (edge of the screen). Here the
start, middle and end point are redefined. They are stored with
scene coordinates '''
@
property
def
start_point
(
self
):
''' Compute connection origin - redefined function '''
return
self
.
parent
.
mapFromScene
(
self
.
_start_point
)
@
start_point
.
setter
def
start_point
(
self
,
scene_coord
):
# type: QPointF
''' value is in scene coordinates '''
print
'set start point'
self
.
_start_point
=
scene_coord
@
property
def
end_point
(
self
):
''' Compute connection end point - redefined function '''
return
self
.
parent
.
mapFromScene
(
self
.
_end_point
)
@
end_point
.
setter
def
end_point
(
self
,
scene_coord
):
# type: QPointF
''' value is in scene coordinates '''
self
.
_end_point
=
scene_coord
@
property
def
middle_points
(
self
):
''' Compute connection intermediate points - redefined function '''
for
each
in
self
.
_middle_points
:
yield
self
.
parent
.
mapFromScene
(
each
)
@
middle_points
.
setter
def
middle_points
(
self
,
points_scene_coord
):
self
.
_middle_points
=
points_scene_coord
def
add_point
(
self
,
scene_coord
):
self
.
_middle_points
.
append
(
scene_coord
)
class
Controlpoint
(
QGraphicsPathItem
,
object
):
''' Class handling one edge control point (to change bezier curves) '''
def
__init__
(
self
,
pos
,
edge
):
...
...
opengeode/genericSymbols.py
View file @
9a446880
...
...
@@ -65,7 +65,7 @@ import undoCommands
import
ogAST
import
ogParser
from
Connectors
import
Connection
,
VerticalConnection
,
CommentConnection
,
\
RakeConnection
,
JoinConnection
RakeConnection
,
JoinConnection
,
Channel
from
TextInteraction
import
EditableText
...
...
opengeode/opengeode.py
View file @
9a446880
...
...
@@ -89,7 +89,7 @@ from PySide.QtCore import (Qt, QSize, QFile, QIODevice, QRectF, QTimer, QPoint,
from
PySide.QtUiTools
import
QUiLoader
from
PySide
import
QtSvg
from
genericSymbols
import
(
Symbol
,
Comment
,
Cornergrabber
,
Connection
)
from
genericSymbols
import
(
Symbol
,
Comment
,
Cornergrabber
,
Connection
,
Channel
)
from
sdlSymbols
import
(
Input
,
Output
,
Decision
,
DecisionAnswer
,
Task
,
ProcedureCall
,
TextSymbol
,
State
,
Start
,
Join
,
Label
,
Procedure
,
ProcedureStart
,
ProcedureStop
,
StateStart
,
Connect
,
Process
,
...
...
@@ -1380,14 +1380,18 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
symb
=
self
.
symbol_near
(
point
,
dist
=
1
)
if
symb
:
# Clicked on a symbol: create the actual connector
connector
=
Connection
(
parent
=
self
.
connection_start
,
child
=
symb
)
connector
.
_start_point
=
\
connector
.
mapFromScene
(
self
.
edge_points
[
0
])
connector
.
_middle_points
=
[
connector
.
mapFromScene
(
p
)
for
p
in
self
.
edge_points
[
1
:]]
connector
.
_end_point
=
\
connector
.
mapFromScene
(
self
.
border_point
(
symb
,
point
))
connector
=
Channel
(
parent
=
self
.
connection_start
,
child
=
symb
)
connector
.
start_point
=
self
.
edge_points
[
0
]
connector
.
middle_points
=
self
.
edge_points
[
1
:]
connector
.
end_point
=
self
.
border_point
(
symb
,
point
)
# connector = Connection(parent=self.connection_start,
# child=symb)
# connector._start_point = \
# connector.mapFromScene(self.edge_points[0])
# connector._middle_points = [connector.mapFromScene(p)
# for p in self.edge_points[1:]]
# connector._end_point = \
# connector.mapFromScene(self.border_point(symb, point))
for
each
in
self
.
temp_lines
:
# Just hide to avoid pyside segfaults
each
.
setVisible
(
False
)
...
...
opengeode/sdlSymbols.py
View file @
9a446880
...
...
@@ -1003,7 +1003,7 @@ class Process(HorizontalSymbol):
blackbold
=
SDL_BLACKBOLD
redbold
=
SDL_REDBOLD
completion_list
=
set
()
is_singleton
=
True
#
is_singleton = True
arrow_head
=
'angle'
arrow_tail
=
'angle'
# Process can be connected to other processes by the user
...
...
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