示例#1
0
    def __init__(self, parent, tile_width, use_svg):

        super(SpellWidget, self).__init__(parent)

        self.animation = FadeInOutAnimation(self)
        self.item = self.spell_klass(self, tile_width)
        if use_svg:
            self.svg_item = SvgSpellItem(self, tile_width)
        else:
            self.svg_item = None
示例#2
0
class SpellWidget(QtGui.QGraphicsWidget):
    
    spell_klass = SpellItem

    def __init__(self, parent, tile_width, use_svg):

        super(SpellWidget, self).__init__(parent)

        self.animation = FadeInOutAnimation(self)
        self.item = self.spell_klass(self, tile_width)
        if use_svg:
            self.svg_item = SvgSpellItem(self, tile_width)
        else:
            self.svg_item = None

    def show(self, spell):
        self.item.reset(spell)
        self.svg_item and self.svg_item.reset(spell)
        self.animation.fade()

    def offset(self):
        return self.parentItem().offset()