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