c1d8b9394f8971163d9aa6ec6bae811a2f5a4a91
[sface.git] / sfascreen.py
1 import sys
2
3 from PyQt4.QtCore import *
4 from PyQt4.QtGui import *
5
6 class SfaScreen(QWidget):
7     instances = []
8
9     def __init__(self, parent):
10         SfaScreen.instances.append(self)
11         QWidget.__init__(self, parent)
12         self.mainwin = parent
13         self.name = self.title = self.widget = None
14
15     def __del__(self):
16         SfaScreen.instances.remove(self)
17
18     def init(self, widget, name, title):
19         if self.widget:
20             sys.stderr.write("Screen is already initialized\n")
21             return
22
23         self.name = name
24         self.title = title
25         self.widget = widget
26
27         layout = QVBoxLayout(self)
28         layout.addWidget(self.widget)
29         self.setLayout(layout)
30
31     def getLinkText(self):
32         return "<a href='%s'>%s</a>" % (self.name, self.name)
33
34     def getTitleText(self):
35         return "<b>%s</b>" % self.title
36
37     def setStatus(self, msg, timeout):
38         self.mainwin.setStatus(msg, timeout)
39
40     def signalAll(self, action):
41         for i in SfaScreen.instances:
42             getattr(i, action)()
43
44     def rspecUpdated(self):
45         pass
46
47     def configurationChanged(self):
48         pass
49
50     def canClose(self):
51         return True
52
53     def mainWindowClose(self):
54         pass