I want to make QGraphicsItem
s persistant using sqlalchemy. Easily combining the Base class with the PySide classes gives an error about metaclasses. The metaclsses subject are the magic of Python and I do not want to dive into that when this is not needed.
Is there an easy way to solve this metaclass conflict?
class MarketItem(Base, QtGui.QGraphicsEllipseItem, QtGui.QListWidgetItem):
"""
"""
__tablename__ = "marketitem"
Id = Column(Integer(4), primary_key=True)
name = Column(String(40))
x_pos = Column(Integer(4))
y_pos = Column(Integer(4))
def __init__(self, x_pos, y_pos, scene, name, style=QtCore.Qt.SolidLine,
rect=None, matrix=QtGui.QTransform(), cat = None):
super(MarketItem, self).__init__()
self.setFlags(QtGui.QGraphicsItem.ItemIsSelectable|
QtGui.QGraphicsItem.ItemIsMovable|
QtGui.QGraphicsItem.ItemIsFocusable)
self.pos = QtCore.QPoint(x_pos, y_pos)
self.x_pos = x_pos
self.y_pos = y_pos
self.name = name
Gives the error:
File "C:\Users\Richard\Documents\manAmpl\aptana\mampl\pm15ConeModel.py", line 47, in <module>
class MarketItem(Base, QtGui.QGraphicsEllipseItem, QtGui.QListWidgetItem):
TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
Thanks, Richard