Initial commit (Vesion 0.1)
[tablet-suite] / src / ui / pcscustombuttons.py
diff --git a/src/ui/pcscustombuttons.py b/src/ui/pcscustombuttons.py
new file mode 100644 (file)
index 0000000..cdbe15f
--- /dev/null
@@ -0,0 +1,35 @@
+# Authors: Amaury Medeiros and Paulo Ouriques
+# Software License: GPL
+
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+class PcsCustomButton(QLabel):
+    def __init__(self, image, pressedImage, text = "", parent = None):
+        super(QLabel, self).__init__(parent)
+        
+        self.panel = QLabel()
+        self.layout = QHBoxLayout()
+        self.text = QLabel(text)
+        self.defaultPixmap = QPixmap(image)
+        self.pressedPixmap = QPixmap(pressedImage)
+        self.panel.setPixmap(self.defaultPixmap)
+        self.panel.setGeometry(self.defaultPixmap.rect())
+        self.layout.addWidget(self.panel)
+        if(text <> ""):
+            self.layout.addWidget(self.text)
+        self.setLayout(self.layout)
+        
+        
+    def mouseReleaseEvent(self,event):
+        self.panel.setPixmap(self.defaultPixmap)
+        self.emit(SIGNAL("clicked()"))
+        
+    def mousePressEvent(self, event):
+        self.panel.setPixmap(self.pressedPixmap)
+        
+    def setTextVisible(self, flag):
+        if flag:
+            pass 
+
+