def __init__(self): super(FenPartWidget, self).__init__() self.item = self.item_class() button = GraphicsButton(self.item) button.setParentItem(self) button.clicked.connect(self.onClicked)
def __init__(self, default, minimum, maximum): super(IntegerWidget, self).__init__() self.minimum = int(minimum) self.maximum = int(maximum) int(default) self.item = CharacterItem(str(default)) button = GraphicsButton(self.item) button.setParentItem(self)
def __init__(self, font): super(CastleRightsWidget, self).__init__() self._buttons = [] layout = QtGui.QGraphicsLinearLayout() for idx, symbol in enumerate(self.default): piece = PieceItem(font[symbol]) piece.scaleTo(self.side) button = GraphicsButton(piece, checkable=True, data=symbol) button.checked = True button.toggled.connect(self.onToggled) self._buttons.append(button) layout.addItem(button) self.setLayout(layout)