X-Git-Url: https://harishankar.org/repos/?p=biacv.git;a=blobdiff_plain;f=biacv_mainwindow.py;h=0af93bc98f4a35402be8f10c16258858f7601deb;hp=e58aa37e920a7eae7f7858de4ee264ace98ed7de;hb=826d66580e6992ca3391cf4fd8a50a10b8aa5b32;hpb=2329fe7718e8c0aa0d1c2cc92c56653ec7757e5c 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 (