def __init__(self, parent, tile_width, use_svg): super(CharFeatureItem, self).__init__(parent) ResetItem.__init__(self, tile_width) self._use_svg = use_svg if use_svg: self.item = SvgItem(self, tile_width) else: self.item = CharItem(self, tile_width) self.svg_item = None
class CharFeatureItem(QtGui.QGraphicsWidget, ResetItem): attrs = ('color', 'name') def __init__(self, parent, tile_width, use_svg): super(CharFeatureItem, self).__init__(parent) ResetItem.__init__(self, tile_width) self._use_svg = use_svg if use_svg: self.item = SvgItem(self, tile_width) else: self.item = CharItem(self, tile_width) self.svg_item = None def reset(self, tile): super(CharFeatureItem, self).reset(tile) self.item.reset(tile) def center(self): return self.parentItem().center() def offset(self): return self.parentItem().offset()