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
3d2940c8
Commit
3d2940c8
authored
Dec 12, 2014
by
Maxime Perrotin
Browse files
Fix positionning errors
parent
ce588ce2
Changes
3
Hide whitespace changes
Inline
Side-by-side
genericSymbols.py
View file @
3d2940c8
...
...
@@ -155,18 +155,24 @@ class Symbol(QObject, QGraphicsPathItem, object):
# List of visible connection points (that can move)
self
.
movable_points
=
[]
def
set_valid_pos
(
self
,
pos
):
''' Hook that can be redefined by sub classes to forbid wrong
placements on the fly, before calling the actual setPos() from Qt '''
self
.
setPos
(
pos
)
# The "position" property cannot be defined as a standard Python
# property because it is used in a QPropertyAnimation, which only
# works using Qt properties. However it behaves the same way.
position
=
Property
(
QPointF
,
lambda
self
:
self
.
pos
(),
lambda
self
,
val
:
self
.
set
P
os
(
val
))
lambda
self
,
val
:
self
.
set
_valid_p
os
(
val
))
pos_x
=
Property
(
float
,
lambda
self
:
self
.
x
(),
lambda
self
,
val
:
self
.
setX
(
val
))
lambda
self
,
val
:
self
.
set_valid_pos
(
QPointF
(
val
,
self
.
y
())))
pos_y
=
Property
(
float
,
lambda
self
:
self
.
y
(),
lambda
self
,
val
:
self
.
setY
(
val
))
lambda
self
,
val
:
self
.
set_valid_pos
(
QPointF
(
self
.
x
(),
val
)))
def
is_composite
(
self
):
''' Return True if nested scene has something in it '''
...
...
@@ -929,6 +935,15 @@ class HorizontalSymbol(Symbol, object):
''' Redefined: connect to parent item '''
return
RakeConnection
(
self
.
parent
,
self
)
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
)
else
:
new_y
=
max
(
pos
.
y
(),
self
.
parent
.
boundingRect
().
height
()
+
self
.
minDistanceToSymbolAbove
)
self
.
setPos
(
pos
.
x
(),
new_y
)
def
insert_symbol
(
self
,
parent
,
pos_x
,
pos_y
):
''' Insert the symbol in the scene - Align below the parent '''
if
not
parent
:
...
...
opengeode.py
View file @
3d2940c8
...
...
@@ -437,16 +437,19 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
symbol
.
pos_x
+=
relpos
.
x
()
symbol
.
pos_y
+=
relpos
.
y
()
symbol
.
update_connections
()
for
child
in
symbol
.
childItems
():
fix_pos_from_ast
(
child
)
#
Update the position anyway, becaus
e
#
depending
on the host pla
t
form
, the exact
#
pixel position and size of symbols can
#
vary - due to font rendering, etc
.
child
.
update_position
()
# Update_position is called here because it
# is not possible to be sure that the
#
positionning stored in the file will b
e
#
rendered correctly
on the host plaform
.
#
Font rendering may cause slight differences
#
between Linux and Windows for example
.
symbol
.
update_position
()
except
AttributeError
:
# no AST
# no AST
, ignore (e.g. Connections, Cornergrabbers)
pass
else
:
fix_pos_from_ast
(
symbol
.
next_aligned_symbol
())
fix_pos_from_ast
(
symbol
.
comment
)
fix_pos_from_ast
(
each
)
except
TypeError
:
LOG
.
error
(
traceback
.
format_exc
())
...
...
tests/regression/test-debug/orchestrator.pr
View file @
3d2940c8
...
...
@@ -37,10 +37,10 @@ dcl opt SeqOpt := { A TRUE, b FALSE }; -- test optional fields
ENDDECISION;
/* CIF DECISION (135, 240), (122, 50) */
DECISION num(myenum);
/* CIF ANSWER (163,
235
), (70, 23) */
/* CIF ANSWER (163,
310
), (70, 23) */
else:
ENDDECISION;
/* CIF RETURN (178,
273
), (35, 35) */
/* CIF RETURN (178,
348
), (35, 35) */
RETURN ;
ENDPROCEDURE;
/* CIF START (596, 224), (80, 36) */
...
...
@@ -58,98 +58,98 @@ dcl opt SeqOpt := { A TRUE, b FALSE }; -- test optional fields
ENDDECISION;
/* CIF DECISION (575, 433), (122, 50) */
DECISION num(myenum);
/* CIF ANSWER (547,
47
3), (70, 23) */
/* CIF ANSWER (547,
50
3), (70, 23) */
(0):
/* CIF ANSWER (644,
47
3), (70, 23) */
/* CIF ANSWER (644,
50
3), (70, 23) */
else:
ENDDECISION;
/* CIF DECISION (586, 5
1
1), (99, 50) */
/* CIF DECISION (586, 5
4
1), (99, 50) */
DECISION 'informal'
/* CIF COMMENT (7
1
6,
476
), (179, 53) */
/* CIF COMMENT (7
4
6,
540
), (179, 53) */
COMMENT 'Informal decision -
check that it is ignored
by the code generator';
/* CIF ANSWER (543,
55
1), (70, 33) */
/* CIF ANSWER (543,
61
1), (70, 33) */
('a'):
/* CIF ANSWER (647,
55
1), (70, 33) */
/* CIF ANSWER (647,
61
1), (70, 33) */
('2'):
ENDDECISION;
/* CIF TASK (524, 5
9
9), (223, 38) */
/* CIF TASK (524,
6
59), (223, 38) */
TASK seqboolean := {true, false},
seqboolean := not {true, false};
/* CIF TASK (532,
65
2), (208, 83) */
/* CIF TASK (532,
71
2), (208, 83) */
TASK for x in seqen:
call writeln(num(x));
call writeln(num(myenum));
call writeln(num(myenum));
endfor
/* CIF COMMENT (7
60, 676
), (174, 38) */
/* CIF COMMENT (7
74, 734
), (174, 38) */
COMMENT 'Check that num is not
declared twice';
/* CIF TASK (554,
75
0), (164, 53) */
/* CIF TASK (554,
81
0), (164, 53) */
TASK for x in seqen2:
call writeln(num(x));
endfor;
/* CIF TASK (555, 8
1
8), (162, 53) */
/* CIF TASK (555, 8
7
8), (162, 53) */
TASK for x in seqboolean:
call writeln(x);
endfor
/* CIF COMMENT (7
3
7, 8
27
), (168, 38) */
/* CIF COMMENT (7
4
7, 8
85
), (168, 38) */
COMMENT 'FOR with a basic type';
/* CIF TASK (525,
88
6), (222, 35) */
/* CIF TASK (525,
94
6), (222, 35) */
TASK seqboolean := not seqboolean
/* CIF COMMENT (7
67, 88
6), (279, 35) */
/* CIF COMMENT (7
81, 94
6), (279, 35) */
COMMENT 'check NOT on a SEQUENCE of BOOLEAN';
/* CIF TASK (555, 9
3
6), (162, 53) */
/* CIF TASK (555, 9
9
6), (162, 53) */
TASK for x in seqboolean:
call writeln(x);
endfor;
/* CIF TASK (573, 10
0
4), (126, 38) */
/* CIF TASK (573, 10
6
4), (126, 38) */
TASK fixed := 'hello';
/* CIF TASK (561, 1
05
7), (149, 35) */
/* CIF TASK (561, 1
11
7), (149, 35) */
TASK variable := 'HELLO';
/* CIF PROCEDURECALL (548, 11
0
7), (176, 35) */
/* CIF PROCEDURECALL (548, 11
6
7), (176, 35) */
CALL writeln(variable // '!!!');
/* CIF PROCEDURECALL (500, 11
5
7), (272, 35) */
/* CIF PROCEDURECALL (500, 1
2
17), (272, 35) */
CALL writeln(variable // variable // variable);
/* CIF TASK (590, 12
0
7), (91, 35) */
/* CIF TASK (590, 12
6
7), (91, 35) */
TASK seq := {1};
/* CIF TASK (559, 1
25
7), (153, 35) */
/* CIF TASK (559, 1
31
7), (153, 35) */
TASK seq := {1} // {2} // {3};
/* CIF TASK (550, 13
0
7), (172, 35) */
/* CIF TASK (550, 13
6
7), (172, 35) */
TASK seq := seq // {2} // {1};
/* CIF DECISION (601, 1
35
7), (70, 50) */
/* CIF DECISION (601, 1
41
7), (70, 50) */
DECISION any;
/* CIF ANSWER (556, 14
2
7), (70, 23) */
/* CIF ANSWER (556, 14
8
7), (70, 23) */
('a'):
/* CIF ANSWER (646, 14
2
7), (70, 23) */
/* CIF ANSWER (646, 14
8
7), (70, 23) */
('b'):
ENDDECISION;
/* CIF DECISION (591, 1
46
5), (89, 50) */
/* CIF DECISION (591, 1
52
5), (89, 50) */
DECISION myenum
/* CIF COMMENT (7
00
, 1
472
), (183, 35) */
/* CIF COMMENT (7
18
, 1
533
), (183, 35) */
COMMENT 'Check case insensitivity';
/* CIF ANSWER (408, 15
3
5), (70, 23) */
/* CIF ANSWER (408, 15
9
5), (70, 23) */
(a):
/* CIF ANSWER (488, 15
3
5), (70, 23) */
/* CIF ANSWER (488, 15
9
5), (70, 23) */
(B):
/* CIF ANSWER (568, 15
3
5), (70, 23) */
/* CIF ANSWER (568, 15
9
5), (70, 23) */
(c):
/* CIF ANSWER (646, 15
3
5), (70, 23) */
/* CIF ANSWER (646, 15
9
5), (70, 23) */
(d):
/* CIF ANSWER (73
4
, 15
3
5), (70, 23) */
/* CIF ANSWER (73
5
, 15
9
5), (70, 23) */
(Ee):
ENDDECISION;
/* CIF DECISION (567, 1
57
3), (138, 50) */
/* CIF DECISION (567, 1
63
3), (138, 50) */
DECISION present(choice)
/* CIF COMMENT (7
2
4, 1
580
), (183, 35) */
/* CIF COMMENT (74
3
, 1
641
), (183, 35) */
COMMENT 'Check case insensitivity';
/* CIF ANSWER (519, 1
64
3), (70, 23) */
/* CIF ANSWER (519, 1
70
3), (70, 23) */
(cde2):
/* CIF ANSWER (690, 1
64
3), (70, 23) */
/* CIF ANSWER (690, 1
70
3), (70, 23) */
ELSE:
ENDDECISION;
/* CIF NEXTSTATE (57
7
, 1
68
1), (116, 33) */
/* CIF NEXTSTATE (57
8
, 1
74
1), (116, 33) */
NEXTSTATE Wait_for_GUI;
/* CIF STATE (1063, 119), (116, 33) */
STATE Wait_for_GUI;
...
...
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