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

Make placements more accurate

parent b18720bd
......@@ -1142,9 +1142,12 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
return subscene
def place_symbol(self, item_type, parent, pos=None):
def place_symbol(self, item_type, parent, pos=None, rect=None):
''' Draw a symbol on the scene '''
item = item_type()
if rect is not None:
# Optionally size the new item
item.set_shape(rect.width(), rect.height())
# Add the item to the scene
if item not in self.items():
self.addItem(item)
......@@ -1286,9 +1289,9 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
ACTIONS.get(self.context, []))
def add_symbol(sort, rect):
symb = self.place_symbol(sort, parent=None, pos=rect.topLeft())
if symb.default_size == "any":
symb.resize_item(rect)
size = rect if sort.default_size == "any" else None
symb = self.place_symbol(sort, parent=None, pos=rect.topLeft(),
rect=size)
def setup_action(sort):
name = sort.__name__
......
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