From: Harishankar Date: Wed, 30 Nov 2011 14:48:59 +0000 (+0530) Subject: Update professional history X-Git-Url: https://harishankar.org/repos/?a=commitdiff_plain;h=826d66580e6992ca3391cf4fd8a50a10b8aa5b32;p=biacv.git Update professional history Update professional history in list implemented. --- diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index e58aa37..0af93bc 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -9,6 +9,36 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): self.setupUi (self) self.currentfile = None + # update professional history button is clicked + def on_update_profession (self): + # get the selected item + selitems = self.professionlist.selectedItems () + if selitems == []: + PyQt4.QtGui.QMessageBox.critical (self, "Cannot update", "No item selected.") + return + selitem = selitems[0] + # if designation is not set + if self.designation.text () == "": + PyQt4.QtGui.QMessageBox.critical (self, "Cannot update", "A required field is missing.") + return + # if currently employed in that position, leaving date is to be disabled + # and set to "current" + if self.currentemployment.isChecked (): + leavedatestr = "current" + else: + # if the leaving date is < join date + if self.leavedate.date () < self.joindate.date (): + PyQt4.QtGui.QMessageBox.critical (self, "Cannot add", + "Leaving date cannot be earlier than join date.") + return + leavedatestr = self.leavedate.date ().toString ("dd MMM, yyyy") + + selitem.setText (0, self.designation.text ()) + selitem.setText (1, self.joindate.date ().toString ("dd MMM, yyyy")) + selitem.setText (2, leavedatestr) + selitem.setText (3, self.organization.text ()) + selitem.setText (4, self.additionalinfo.text ()) + # delete professional history button is clicked def on_delete_profession (self): # get the selected items @@ -31,10 +61,16 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): if self.designation.text () == "": PyQt4.QtGui.QMessageBox.critical (self, "Cannot add", "A required field is missing.") return - + # if currently employed in that position, leaving date is to be disabled + # and set to "current" if self.currentemployment.isChecked (): leavedatestr = "current" else: + # if the leaving date is < join date + if self.leavedate.date () < self.joindate.date (): + PyQt4.QtGui.QMessageBox.critical (self, "Cannot add", + "Leaving date cannot be earlier than join date.") + return leavedatestr = self.leavedate.date ().toString ("dd MMM, yyyy") professionitem = PyQt4.QtGui.QTreeWidgetItem ( diff --git a/biacv_mainwindow.ui b/biacv_mainwindow.ui index 720aed2..fd9d129 100644 --- a/biacv_mainwindow.ui +++ b/biacv_mainwindow.ui @@ -1095,6 +1095,22 @@ + + updatehistory + clicked() + biacv_mainwindow + on_update_profession() + + + 510 + 230 + + + 726 + 323 + + + on_add_education() @@ -1105,5 +1121,6 @@ on_add_profession() on_select_profession() on_delete_profession() + on_update_profession() diff --git a/biacv_mainwindow_ui.py b/biacv_mainwindow_ui.py index ce4a164..a59164b 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 18:36:56 2011 +# Created: Wed Nov 30 20:11:07 2011 # by: PyQt4 UI code generator 4.8.6 # # WARNING! All changes made in this file will be lost! @@ -552,6 +552,7 @@ class Ui_biacv_mainwindow(object): QtCore.QObject.connect(self.professionlist, QtCore.SIGNAL(_fromUtf8("itemSelectionChanged()")), biacv_mainwindow.on_select_profession) QtCore.QObject.connect(self.professionlist, QtCore.SIGNAL(_fromUtf8("activated(QModelIndex)")), biacv_mainwindow.on_select_profession) 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.QMetaObject.connectSlotsByName(biacv_mainwindow) def retranslateUi(self, biacv_mainwindow):