From: smbaker Date: Wed, 8 Aug 2012 01:28:45 +0000 (-0700) Subject: add addMainScreenButton to allow other screens to attach buttons to mainscreen X-Git-Tag: sface-0.9-9~1 X-Git-Url: http://git.onelab.eu/?p=sface.git;a=commitdiff_plain;h=4813cee39486920b72900197aae6b14204892af2 add addMainScreenButton to allow other screens to attach buttons to mainscreen --- diff --git a/sface/screens/mainscreen.py b/sface/screens/mainscreen.py index 9bb94cc..910fd73 100644 --- a/sface/screens/mainscreen.py +++ b/sface/screens/mainscreen.py @@ -359,6 +359,7 @@ class SliceWidget(QWidget): bottomlayout.addWidget(renew, 0, Qt.AlignLeft) bottomlayout.addStretch() bottomlayout.addWidget(submit, 0, Qt.AlignRight) + self.bottomlayout = bottomlayout layout = QVBoxLayout() layout.addLayout(toplayout) @@ -754,3 +755,11 @@ class MainScreen(SfaScreen): # rspec. QTimer.singleShot(2500, self.sliceWidget.refresh) + def addMainScreenButton(self, caption, action): + # allows another screen to add a button to mainscreen + button = QPushButton(caption, self) + self.sliceWidget.bottomlayout.insertWidget(2, button) + self.sliceWidget.connect(button, SIGNAL('clicked()'), action) + return button + + diff --git a/sface/screens/sfascreen.py b/sface/screens/sfascreen.py index 1563468..9ee0aa0 100644 --- a/sface/screens/sfascreen.py +++ b/sface/screens/sfascreen.py @@ -37,11 +37,13 @@ class SfaScreen(QWidget): def setStatus(self, msg, timeout): self.mainwin.setStatus(msg, timeout) - def signalAll(self, action): + def signalAll(self, action, *args): + results=[] for i in SfaScreen.instances: method = getattr(i, action, None) if method: - method() + results.append(method(*args)) + return results def rspecUpdated(self): pass