X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fscreens%2Fmainscreen.py;h=910fd73322a5a443ddbfd668646a5568c9aabb5c;hp=4fc6288629f02daf7b5b1d0e7141d250de075c88;hb=HEAD;hpb=93fafc17c71f94d625e79990a89380317e64a70b diff --git a/sface/screens/mainscreen.py b/sface/screens/mainscreen.py index 4fc6288..910fd73 100644 --- a/sface/screens/mainscreen.py +++ b/sface/screens/mainscreen.py @@ -176,7 +176,10 @@ class NodeNameDelegate(QStyledItemDelegate): QStyledItemDelegate.__init__(self, parent) def displayText(self, value, locale): - data = str(QStyledItemDelegate.displayText(self, value, locale)) + try: + data = str(QStyledItemDelegate.displayText(self, value, locale)) + except UnicodeEncodeError: + data = "" if (len(data)>NAME_MAX_LEN): data = data[:(NAME_MAX_LEN-3)] + "..." return QString(data) @@ -356,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) @@ -751,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 + +