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
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 (
</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>
# 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!
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):