From 9aa733bc55ede2589ab2d55ad33fa805a77e1f82 Mon Sep 17 00:00:00 2001 From: Harishankar Date: Wed, 30 Nov 2011 12:44:46 +0530 Subject: [PATCH] Delete education qualification from list Implemented deleting educational qualification from the list --- biacv_mainwindow.py | 22 +++++++++++++++++++++- biacv_mainwindow.ui | 30 ++++++++++++++++++++++++++++-- biacv_mainwindow_ui.py | 14 +++++++++----- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index 3133477..ac393f7 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -7,7 +7,27 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): def __init__ (self): PyQt4.QtGui.QMainWindow.__init__ (self) self.setupUi (self) + self.currentfile = None + # delete educational qualification + def on_delete_education (self): + # get the selected items in the education list + selitems = self.educationlist.selectedItems () + # if no items are selected + if selitems == []: + PyQt4.QtGui.QMessageBox.critical (self, "Cannot delete", "No items selected.") + # delete the items after confirmation + else: + ans = PyQt4.QtGui.QMessageBox.question (self, "Confirm", + "Are you sure you wish to delete selected item?", + PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No) + if ans == PyQt4.QtGui.QMessageBox.Yes: + # remove the item selected + for item in selitems: + self.educationlist.takeTopLevelItem (self.educationlist.indexOfTopLevelItem (item)) + + + # add educational qualification button def on_add_education (self): # check if the qualification title is set if self.degree_name.text () == "": @@ -21,4 +41,4 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): self.grade.text (), str (self.percentage.value ()) ]) - self.educationlist.addTopLevelItem (educationitem) \ No newline at end of file + self.educationlist.addTopLevelItem (educationitem) diff --git a/biacv_mainwindow.ui b/biacv_mainwindow.ui index 804b43b..7abd581 100644 --- a/biacv_mainwindow.ui +++ b/biacv_mainwindow.ui @@ -423,9 +423,9 @@ - + - &Edit + &Update @@ -444,6 +444,15 @@ 0 + + true + + + false + + + true + Degree @@ -866,8 +875,25 @@ + + deleteeducation + clicked() + biacv_mainwindow + on_delete_education() + + + 677 + 198 + + + 728 + 437 + + + on_add_education() + on_delete_education() diff --git a/biacv_mainwindow_ui.py b/biacv_mainwindow_ui.py index 5fa55f0..b98aa3d 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: Wed Nov 30 10:52:18 2011 +# Created: Wed Nov 30 12:43:29 2011 # by: PyQt4 UI code generator 4.8.6 # # WARNING! All changes made in this file will be lost! @@ -258,10 +258,10 @@ class Ui_biacv_mainwindow(object): self.addeducation.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Add", None, QtGui.QApplication.UnicodeUTF8)) self.addeducation.setObjectName(_fromUtf8("addeducation")) self.gridLayout_3.addWidget(self.addeducation, 4, 4, 1, 2) - self.editeducation = QtGui.QPushButton(self.tab_2) - self.editeducation.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Edit", None, QtGui.QApplication.UnicodeUTF8)) - self.editeducation.setObjectName(_fromUtf8("editeducation")) - self.gridLayout_3.addWidget(self.editeducation, 4, 6, 1, 1) + self.updateeducation = QtGui.QPushButton(self.tab_2) + self.updateeducation.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Update", None, QtGui.QApplication.UnicodeUTF8)) + self.updateeducation.setObjectName(_fromUtf8("updateeducation")) + self.gridLayout_3.addWidget(self.updateeducation, 4, 6, 1, 1) self.deleteeducation = QtGui.QPushButton(self.tab_2) self.deleteeducation.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8)) self.deleteeducation.setObjectName(_fromUtf8("deleteeducation")) @@ -272,6 +272,9 @@ class Ui_biacv_mainwindow(object): sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.educationlist.sizePolicy().hasHeightForWidth()) self.educationlist.setSizePolicy(sizePolicy) + self.educationlist.setAlternatingRowColors(True) + self.educationlist.setRootIsDecorated(False) + self.educationlist.setUniformRowHeights(True) self.educationlist.setObjectName(_fromUtf8("educationlist")) self.educationlist.headerItem().setText(0, QtGui.QApplication.translate("biacv_mainwindow", "Degree", None, QtGui.QApplication.UnicodeUTF8)) self.educationlist.headerItem().setText(1, QtGui.QApplication.translate("biacv_mainwindow", "Graduation date", None, QtGui.QApplication.UnicodeUTF8)) @@ -509,6 +512,7 @@ class Ui_biacv_mainwindow(object): self.retranslateUi(biacv_mainwindow) self.pages.setCurrentIndex(0) QtCore.QObject.connect(self.addeducation, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_add_education) + QtCore.QObject.connect(self.deleteeducation, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_delete_education) QtCore.QMetaObject.connectSlotsByName(biacv_mainwindow) def retranslateUi(self, biacv_mainwindow): -- 2.20.1