From d9e350c83c69e02272f44c8ea7cb4e329225e758 Mon Sep 17 00:00:00 2001 From: Harishankar Date: Thu, 1 Dec 2011 15:47:46 +0530 Subject: [PATCH] Delete skill set implemented Deleting a skill set from the list of skills is implemented. --- biacv_mainwindow.py | 20 +++++++++++++++++++- biacv_mainwindow.ui | 19 ++++++++++++++++++- biacv_mainwindow_ui.py | 6 +++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index dbcbc05..99e6b7c 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -9,6 +9,24 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): self.setupUi (self) self.currentfile = None + # delete skill set button is clicked + def on_delete_skill (self): + # get the selected items + selitems = self.skillslist.selectedItems () + if selitems == []: + PyQt4.QtGui.QMessageBox.critical (self, "Cannot delete", "No items selected.") + return + # confirm + ans = PyQt4.QtGui.QMessageBox.question (self, "Confirm", + "Are you sure you wish to delete the selected item?", + PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No) + # answer is yes + if ans == PyQt4.QtGui.QMessageBox.Yes: + for item in selitems: + self.skillslist.takeTopLevelItem (self.skillslist.indexOfTopLevelItem (item)) + + self.reset_skillset_fields () + # add skill set button is clicked def on_add_skill (self): # if the skill title is blank @@ -26,7 +44,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): # clear the skill set fields def reset_skillset_fields (self): - self.skillsetitle.setText ("") + self.skillsettitle.setText ("") self.skilldescription.setPlainText ("") # update professional history button is clicked diff --git a/biacv_mainwindow.ui b/biacv_mainwindow.ui index f8ffb74..156dd06 100644 --- a/biacv_mainwindow.ui +++ b/biacv_mainwindow.ui @@ -31,7 +31,7 @@ QTabWidget::Rounded - 4 + 0 true @@ -1174,6 +1174,22 @@ + + deleteskill + clicked() + biacv_mainwindow + on_delete_skill() + + + 598 + 238 + + + 728 + 174 + + + on_add_education() @@ -1186,5 +1202,6 @@ on_delete_profession() on_update_profession() on_add_skill() + on_delete_skill() diff --git a/biacv_mainwindow_ui.py b/biacv_mainwindow_ui.py index 18d27e1..fa451f8 100644 --- a/biacv_mainwindow_ui.py +++ b/biacv_mainwindow_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'biacv_mainwindow.ui' # -# Created: Thu Dec 1 10:10:58 2011 +# Created: Thu Dec 1 15:41:51 2011 # by: PyQt4 UI code generator 4.8.6 # # WARNING! All changes made in this file will be lost! @@ -418,6 +418,9 @@ class Ui_biacv_mainwindow(object): self.deleteskill.setObjectName(_fromUtf8("deleteskill")) self.gridLayout_5.addWidget(self.deleteskill, 2, 3, 1, 1) self.skillslist = QtGui.QTreeWidget(self.tab_4) + self.skillslist.setAlternatingRowColors(True) + self.skillslist.setRootIsDecorated(False) + self.skillslist.setUniformRowHeights(True) self.skillslist.setObjectName(_fromUtf8("skillslist")) self.skillslist.headerItem().setText(0, QtGui.QApplication.translate("biacv_mainwindow", "Skill set", None, QtGui.QApplication.UnicodeUTF8)) self.skillslist.headerItem().setText(1, QtGui.QApplication.translate("biacv_mainwindow", "Description", None, QtGui.QApplication.UnicodeUTF8)) @@ -565,6 +568,7 @@ class Ui_biacv_mainwindow(object): QtCore.QObject.connect(self.deletehistory, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_delete_profession) QtCore.QObject.connect(self.updatehistory, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_update_profession) QtCore.QObject.connect(self.addskill, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_add_skill) + QtCore.QObject.connect(self.deleteskill, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_delete_skill) QtCore.QMetaObject.connectSlotsByName(biacv_mainwindow) def retranslateUi(self, biacv_mainwindow): -- 2.20.1