X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sface%2Fsficreate.py;h=adfba5506ac278b9fc7ca884de73f814ca6f48a9;hb=HEAD;hp=0405e3e2b22cd9b9c5fdf7d4f8943fdbec82d82e;hpb=62dde09f684bc81e571f8c0d8439b39ec9b5cf2f;p=sface.git
diff --git a/sface/sficreate.py b/sface/sficreate.py
index 0405e3e..adfba55 100644
--- a/sface/sficreate.py
+++ b/sface/sficreate.py
@@ -33,6 +33,7 @@ class CreateWindow(QDialog):
self.userView = UserView()
self.status = QLabel("")
+ self.status.setMaximumWidth(640)
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttonBox.addButton("refresh", QDialogButtonBox.ActionRole)
@@ -144,3 +145,69 @@ class CreateWindow(QDialog):
self.userView.hideUnusableColumns()
self.userView.resizeColumnToContents(0)
+class RemoveWindow(QDialog):
+ def __init__(self, hrn, parent=None):
+ super(RemoveWindow, self).__init__(parent)
+ self.setWindowTitle("Remove Slice")
+
+ hrnLabel = QLabel("Slice HRN:")
+ self.hrnEdit = QLineEdit()
+ self.status = QLabel("")
+ self.status.setMaximumWidth(640)
+
+ if hrn:
+ self.hrnEdit.setText(hrn)
+
+ self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
+ self.buttonBox.button(QDialogButtonBox.Ok).setDefault(True)
+
+ layout = QVBoxLayout()
+ layout.addWidget(hrnLabel)
+ layout.addWidget(self.hrnEdit)
+ layout.addWidget(self.status)
+ layout.addWidget(self.buttonBox)
+ self.setLayout(layout)
+
+ self.userModel = UserModel(parent=self)
+
+ self.connect(self.buttonBox, SIGNAL("accepted()"), self, SLOT("accept()"))
+ self.connect(self.buttonBox, SIGNAL("rejected()"), self, SLOT("reject()"))
+
+ def accept(self):
+ hrn = self.hrnEdit.text()
+
+ box = QMessageBox(parent=self)
+ box.setText("Confirm deletion of slice %s ?" % hrn)
+ box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
+ ret = box.exec_()
+ if (ret != QMessageBox.Yes):
+ return
+
+ self.setStatus("Removing Slice...")
+
+ self.removeProcess = SfiProcess(self)
+ self.connect(self.removeProcess, SIGNAL('finished()'), self.removeFinished)
+
+ self.buttonBox.setEnabled(False)
+
+ self.removeProcess.removeRecord(hrn)
+
+ def setStatus(self, x):
+ self.status.setText(x)
+
+ def removeFinished(self):
+ faultString = self.removeProcess.getFaultString()
+ if not faultString:
+ self.setStatus("Slice removed.")
+ self.sliceWasCreated = True
+ self.buttonBox.setEnabled(True)
+ self.buttonBox.clear()
+ self.buttonBox.addButton(QDialogButtonBox.Close)
+ else:
+ self.setStatus("Slice removal failed: %s" % (faultString))
+ self.buttonBox.setEnabled(True)
+
+ self.disconnect(self.removeProcess, SIGNAL('finished()'), self.removeFinished)
+ self.removeProcess = None
+
+