Commit 3f0014e9 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix position saving and rendering issues

1) translate_to_origin was using symbol coordinates instead of scene
coordinates so there could still be negative coordinates
2) render_everything was badly testing the input ast coordinates
parent 3a135200
......@@ -39,7 +39,6 @@ class Indent(deque):
def parse_scene(scene, full_model=False):
''' Return the PR string for a complete scene
Optionally, also generate the SYSTEM structure, with channels, etc. '''
#pr_data = deque()
pr_data = Indent()
if full_model:
# Generate a complete SDL system - to have everything in a single file
......
......@@ -550,7 +550,8 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
# slightly altered by the reshaping functions)
def fix_pos_from_ast(symbol):
try:
if symbol.ast.pos_x and symbol.ast.pos_y:
if(symbol.ast.pos_x is not None
and symbol.ast.pos_y is not None):
relpos = symbol.mapFromScene(symbol.ast.pos_x,
symbol.ast.pos_y)
#symbol.pos_x += relpos.x()
......@@ -694,8 +695,8 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
in order to avoid negative coordinates
'''
try:
min_x = min(item.x() for item in self.visible_symb)
min_y = min(item.y() for item in self.visible_symb)
min_x = min(item.scenePos().x() for item in self.visible_symb)
min_y = min(item.scenePos().y() for item in self.visible_symb)
except ValueError:
# No item in the scene
return 0, 0
......
This diff is collapsed.
Markdown is supported
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