Improve modules hierarchy.
[sface.git] / sface / screens / sfascreen.py
diff --git a/sface/screens/sfascreen.py b/sface/screens/sfascreen.py
new file mode 100644 (file)
index 0000000..cb8a266
--- /dev/null
@@ -0,0 +1,29 @@
+import sys
+
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+
+class SfaScreen(QWidget):
+    def __init__(self, parent):
+        QWidget.__init__(self, parent)
+        self.name = self.title = self.widget = None
+
+    def init(self, widget, name, title):
+        if self.widget:
+            sys.stderr.write("Screen is already initialized\n")
+            return
+
+        self.name = name
+        self.title = title
+        self.widget = widget
+        self.label = QLabel("<b>%s</b>" % self.title, self)
+        self.label.setScaledContents(False)
+
+        layout = QVBoxLayout(self)
+        layout.addWidget(self.label)
+        layout.addWidget(self.widget)
+
+        self.setLayout(layout)
+
+    def getLabelText(self):
+        return "<a href='%s'>Go to %s</a>" % (self.name, self.name)