Commit b5976aa5 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix positionning issues when loading

parent 61fa2ebe
......@@ -545,7 +545,6 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
G_SYMBOLS.add(each)
# Refreshing the scene may result in resizing some symbols
dest_scene.refresh()
for each in dest_scene.floating_symb:
# Once everything is rendered, adjust position of each
# symbol to the value from the AST (positions may be
# slightly altered by the reshaping functions)
......@@ -554,8 +553,13 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
if symbol.ast.pos_x and symbol.ast.pos_y:
relpos = symbol.mapFromScene(symbol.ast.pos_x,
symbol.ast.pos_y)
symbol.pos_x += relpos.x()
symbol.pos_y += relpos.y()
#symbol.pos_x += relpos.x()
#symbol.pos_y += relpos.y()
if not symbol.hasParent:
symbol.pos_x = symbol.ast.pos_x
symbol.pos_y = symbol.ast.pos_y
else:
symbol.position += relpos
symbol.update_connections()
# Update_position is called here because it
# is not possible to be sure that the
......@@ -571,7 +575,6 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
symbol.parent.boundingRect().width() + 15
symbol.pos_y = 0
if not symbol.hasParent:
#print 'Positionning', unicode(symbol)[slice(0,20)]
sc_br = dest_scene.itemsBoundingRect()
sy_br = symbol.mapRectToScene(
symbol.boundingRect() |
......@@ -588,7 +591,7 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
fix_pos_from_ast(branch)
fix_pos_from_ast(symbol.next_aligned_symbol())
fix_pos_from_ast(symbol.comment)
fix_pos_from_ast(each)
map(fix_pos_from_ast, dest_scene.floating_symb)
except TypeError:
LOG.error(traceback.format_exc())
......@@ -691,8 +694,8 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
in order to avoid negative coordinates
'''
try:
min_x = min(item.x() for item in self.floating_symb)
min_y = min(item.y() for item in self.floating_symb)
min_x = min(item.x() for item in self.visible_symb)
min_y = min(item.y() for item in self.visible_symb)
except ValueError:
# No item in the scene
return 0, 0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment