Update professional history
authorHarishankar <v.harishankar@gmail.com>
Wed, 30 Nov 2011 14:48:59 +0000 (20:18 +0530)
committerHarishankar <v.harishankar@gmail.com>
Wed, 30 Nov 2011 14:48:59 +0000 (20:18 +0530)
Update professional history in list implemented.

biacv_mainwindow.py
biacv_mainwindow.ui
biacv_mainwindow_ui.py

index e58aa37..0af93bc 100644 (file)
@@ -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 (
index 720aed2..fd9d129 100644 (file)
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>updatehistory</sender>
+   <signal>clicked()</signal>
+   <receiver>biacv_mainwindow</receiver>
+   <slot>on_update_profession()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>510</x>
+     <y>230</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>726</x>
+     <y>323</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>on_add_education()</slot>
   <slot>on_add_profession()</slot>
   <slot>on_select_profession()</slot>
   <slot>on_delete_profession()</slot>
+  <slot>on_update_profession()</slot>
  </slots>
 </ui>
index ce4a164..a59164b 100644 (file)
@@ -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):