-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuttonCard.py
More file actions
30 lines (24 loc) · 844 Bytes
/
buttonCard.py
File metadata and controls
30 lines (24 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys
from PyQt4 import QtGui, QtCore
from card import *
class ButtonCard(QtGui.QAbstractButton):
def __init__(self, parent,pixmap,gparent,type):
super(ButtonCard, self).__init__(parent)
self.pixmap = pixmap
self.card=None
self.type=type
self.gparent=gparent
def paintEvent(self, event):
painter = QtGui.QPainter(self)
painter.drawPixmap(event.rect(), self.pixmap)
def setPic(self,p,card):
self.pixmap=p
self.card=card
def sizeHint(self):
return self.pixmap.size()
def mousePressEvent(self,event):
if self.isVisible():
if self.type==1: #Board.TYPE
self.gparent.chosenBoard(self.card)
elif self.type==0: #HandPlr.TYPE
self.gparent.chosenHand(self.card)