1 # Authors: Amaury Medeiros and Paulo Ouriques
2 # Software License: GPL
4 from PyQt4.QtCore import *
5 from PyQt4.QtGui import *
7 class PcsCustomButton(QLabel):
8 def __init__(self, image, pressedImage, text = "", parent = None):
9 super(QLabel, self).__init__(parent)
12 self.layout = QHBoxLayout()
13 self.text = QLabel(text)
14 self.defaultPixmap = QPixmap(image)
15 self.pressedPixmap = QPixmap(pressedImage)
16 self.panel.setPixmap(self.defaultPixmap)
17 self.panel.setGeometry(self.defaultPixmap.rect())
18 self.layout.addWidget(self.panel)
20 self.layout.addWidget(self.text)
21 self.setLayout(self.layout)
24 def mouseReleaseEvent(self,event):
25 self.panel.setPixmap(self.defaultPixmap)
26 self.emit(SIGNAL("clicked()"))
28 def mousePressEvent(self, event):
29 self.panel.setPixmap(self.pressedPixmap)
31 def setTextVisible(self, flag):