X-Git-Url: https://harishankar.org/repos/?p=biacv.git;a=blobdiff_plain;f=biacv_mainwindow.py;h=f33a265b3021c223a70adc707750ed1315ef7b36;hp=18dc486925719ec351351c609901ac5ed0b7e38b;hb=d4d1c35dac0338dec51b3616e594d6b7366a8da1;hpb=4bb46b8b31777371863b0854225b8115e3882f5a diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index 18dc486..f33a265 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -9,6 +9,46 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): self.setupUi (self) self.currentfile = None + # add professional history button is clicked + def on_add_profession (self): + if self.designation.text () == "": + PyQt4.QtGui.QMessageBox.critical (self, "Cannot add", "A required field is missing.") + return + + if self.currentemployment.isChecked (): + leavedatestr = "current" + else: + leavedatestr = self.leavedate.date ().toString ("dd MMM, yyyy") + + professionitem = PyQt4.QtGui.QTreeWidgetItem ( + [ + self.designation.text (), + self.joindate.date ().toString ("dd MMM, yyyy"), + leavedatestr, + self.organization.text (), + self.additionalinfo.text () + ] + ) + + self.professionlist.addTopLevelItem (professionitem) + + self.reset_profession_fields () + + def reset_profession_fields (self): + self.designation.setText ("") + self.joindate.setDate (PyQt4.QtCore.QDate (2000, 1, 1)) + self.leavedate.setDate (PyQt4.QtCore.QDate (2003, 1, 1)) + self.currentemployment.setChecked (False) + self.organization.setText ("") + self.additionalinfo.setText ("") + + # current employment check box is changed + def on_change_currentemployment (self, val): + if val == True: + self.leavedate.setEnabled (False) + else: + self.leavedate.setEnabled (True) + # delete educational qualification def on_delete_education (self): # get the selected items in the education list @@ -56,18 +96,18 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): # check if the qualification title is set if self.degree_name.text () == "": PyQt4.QtGui.QMessageBox.critical (self, "Cannot add", "A required fields is missing.") - else: - educationitem = PyQt4.QtGui.QTreeWidgetItem ([ - self.degree_name.text (), - self.yearofpassing.date ().toString ("MMM, yyyy"), - self.institution.text (), - self.university.text (), - self.grade.text (), - str (self.percentage.value ()) + return + educationitem = PyQt4.QtGui.QTreeWidgetItem ([ + self.degree_name.text (), + self.yearofpassing.date ().toString ("MMM, yyyy"), + self.institution.text (), + self.university.text (), + self.grade.text (), + str (self.percentage.value ()) ]) - self.educationlist.addTopLevelItem (educationitem) - # clear the fields - self.reset_education_fields () + self.educationlist.addTopLevelItem (educationitem) + # clear the fields + self.reset_education_fields () # set fields in the education tab from current selected item def set_education_fields (self):