Initial commit (Vesion 0.1)
[tablet-suite] / src / ui / pcscustombuttons.py
1 # Authors: Amaury Medeiros and Paulo Ouriques
2 # Software License: GPL
3
4 from PyQt4.QtCore import *
5 from PyQt4.QtGui import *
6
7 class PcsCustomButton(QLabel):
8     def __init__(self, image, pressedImage, text = "", parent = None):
9         super(QLabel, self).__init__(parent)
10         
11         self.panel = QLabel()
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)
19         if(text <> ""):
20             self.layout.addWidget(self.text)
21         self.setLayout(self.layout)
22         
23         
24     def mouseReleaseEvent(self,event):
25         self.panel.setPixmap(self.defaultPixmap)
26         self.emit(SIGNAL("clicked()"))
27         
28     def mousePressEvent(self, event):
29         self.panel.setPixmap(self.pressedPixmap)
30         
31     def setTextVisible(self, flag):
32         if flag:
33             pass 
34
35