Я хочу сделать QGraphicsItem
s постоянным, используя sqlalchemy. Простое объединение класса Base с классами PySide дает ошибку о метаклассах. Тема метаклассов — это магия Python, и я не хочу углубляться в нее, если в этом нет необходимости. Есть ли простой способ решить этот конфликт метаклассов?
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
Выдает ошибку:
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
Спасибо, Ричард