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
ce6169a1
Commit
ce6169a1
authored
Sep 02, 2014
by
Maxime Perrotin
Browse files
Signallist fully editable (changes not saved yet)
parent
d06600f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Connectors.py
View file @
ce6169a1
...
...
@@ -18,7 +18,7 @@
import
math
import
logging
from
PySide.QtCore
import
Qt
,
QPointF
,
QLineF
from
PySide.QtCore
import
Qt
,
QPointF
,
QLineF
,
Slot
from
PySide.QtGui
import
QGraphicsPathItem
,
QPainterPath
,
QGraphicsItem
,
QPen
,
\
QPainter
,
QFont
,
QGraphicsTextItem
,
QColor
,
\
...
...
@@ -253,9 +253,14 @@ class SignalList(EditableText):
pass
def
try_resize
(
self
):
''' Resizing of the parent when size expands - ignore
for now
'''
''' Resizing of the parent when size expands - ignore '''
pass
# pylint: disable=C0103
def
focusOutEvent
(
self
,
event
):
''' Redefined function - update in_sig and out_sig in parent '''
super
(
SignalList
,
self
).
focusOutEvent
(
event
)
class
Signalroute
(
Connection
):
''' Subclass of Connection used to draw channels between processes '''
...
...
@@ -264,8 +269,6 @@ class Signalroute(Connection):
''' Set generic parameters from Connection class '''
super
(
Signalroute
,
self
).
__init__
(
process
,
process
)
self
.
parser
=
ogParser
# self.label_in = QGraphicsTextItem('[]', parent=self)
# self.label_out = QGraphicsTextItem('[]', parent=self)
self
.
completion_list
=
[]
self
.
blackbold
=
()
self
.
redbold
=
()
...
...
@@ -284,13 +287,26 @@ class Signalroute(Connection):
for
sig
in
process
.
output_signals
))
self
.
label_in
.
setPlainText
(
'[{}]'
.
format
(
self
.
in_sig
))
self
.
label_out
.
setPlainText
(
'[{}]'
.
format
(
self
.
out_sig
))
#font = QFont('Ubuntu', pointSize=8)
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.setFont(font)
each
.
show
()
self
.
process
=
process
self
.
reshape
()
@
Slot
()
def
change_siglist
(
self
):
''' Called when user modified the text of label_in or label_out '''
for
each
in
self
.
label_in
,
self
.
label_out
:
if
not
each
.
hasFocus
():
if
not
unicode
(
each
).
startswith
(
'['
):
each
.
setPlainText
(
'[{}'
.
format
(
unicode
(
each
)))
if
not
unicode
(
each
).
endswith
(
']'
):
each
.
setPlainText
(
'{}]'
.
format
(
unicode
(
each
)))
Signalroute
.
in_sig
=
unicode
(
self
.
label_in
)[
1
:
-
1
]
Signalroute
.
out_sig
=
unicode
(
self
.
label_out
)[
1
:
-
1
]
@
property
def
start_point
(
self
):
''' Compute connection origin - redefined function '''
...
...
@@ -315,9 +331,6 @@ class Signalroute(Connection):
''' Redefine shape function to add the text areas '''
super
(
Signalroute
,
self
).
reshape
()
#self.label_in.setPlainText('[{}]'.format(self.in_sig))
#self.label_out.setPlainText('[{}]'.format(self.out_sig))
width_in
=
self
.
label_in
.
boundingRect
().
width
()
self
.
label_in
.
setX
(
self
.
start_point
.
x
()
-
width_in
)
...
...
@@ -337,7 +350,7 @@ class Signalroute(Connection):
def
update_completion_list
(
self
,
pr_text
):
''' Called after text has been edited '''
p
rint
pr_text
p
ass
def
resize_item
(
self
,
new_rect
):
''' Called after signallist text has been edited '''
...
...
sdlSymbols.py
View file @
ce6169a1
...
...
@@ -738,7 +738,8 @@ class Process(HorizontalSymbol):
def
insert_symbol
(
self
,
parent
,
x
,
y
):
''' Redefinition - adds connection line to env '''
super
(
Process
,
self
).
insert_symbol
(
parent
,
x
,
y
)
self
.
connection
=
self
.
connect_to_parent
()
if
not
self
.
connection
:
self
.
connection
=
self
.
connect_to_parent
()
def
connect_to_parent
(
self
):
''' Redefinition: creates connection to env with a signalroute '''
...
...
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