self.setupUi (self)
self.currentfile = None
+ # delete professional history button is clicked
+ def on_delete_profession (self):
+ # get the selected items
+ selitems = self.professionlist.selectedItems ()
+ if selitems == []:
+ PyQt4.QtGui.QMessageBox.critical (self, "Cannot delete", "No item selected.")
+ return
+ # confirm deletion
+ ans = PyQt4.QtGui.QMessageBox.question (self, "Confirm",
+ "Are you sure you wish to delete the selected item?",
+ PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
+ # if confirmed
+ if ans == PyQt4.QtGui.QMessageBox.Yes:
+ for item in selitems:
+ self.professionlist.takeTopLevelItem (self.professionlist.indexOfTopLevelItem (item))
+ self.reset_profession_fields ()
+
# add professional history button is clicked
def on_add_profession (self):
if self.designation.text () == "":
self.reset_profession_fields ()
+ # when selection of profession list is changed
+ def on_select_profession (self):
+ self.set_profession_fields ()
+
+ # set the profession fields from the selected item in profession list
+ def set_profession_fields (self):
+ selitems = self.professionlist.selectedItems ()
+ if selitems == []:
+ return
+ selitem = selitems[0]
+ self.designation.setText (selitem.text (0))
+ self.joindate.setDate (PyQt4.QtCore.QDate.fromString (selitem.text(1), "dd MMM, yyyy"))
+ if selitem.text (2) == "current":
+ self.leavedate.setEnabled (False)
+ self.currentemployment.setChecked (True)
+ else:
+ self.leavedate.setDate (PyQt4.QtCore.QDate.fromString (selitem.text (2), "dd MMM, yyyy"))
+ self.leavedate.setEnabled (True)
+ self.currentemployment.setChecked (False)
+
+ self.organization.setText (selitem.text (3))
+ self.additionalinfo.setText (selitem.text (4))
+
def reset_profession_fields (self):
self.designation.setText ("")
self.joindate.setDate (PyQt4.QtCore.QDate (2000, 1, 1))
</widget>
</item>
<item row="5" column="3">
- <widget class="QPushButton" name="edithistory">
+ <widget class="QPushButton" name="updatehistory">
<property name="text">
- <string>&Edit</string>
+ <string>&Update</string>
</property>
</widget>
</item>
</hint>
</hints>
</connection>
+ <connection>
+ <sender>professionlist</sender>
+ <signal>itemSelectionChanged()</signal>
+ <receiver>biacv_mainwindow</receiver>
+ <slot>on_select_profession()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>553</x>
+ <y>351</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>727</x>
+ <y>379</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>professionlist</sender>
+ <signal>activated(QModelIndex)</signal>
+ <receiver>biacv_mainwindow</receiver>
+ <slot>on_select_profession()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>420</x>
+ <y>323</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>729</x>
+ <y>422</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>deletehistory</sender>
+ <signal>clicked()</signal>
+ <receiver>biacv_mainwindow</receiver>
+ <slot>on_delete_profession()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>621</x>
+ <y>223</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>729</x>
+ <y>187</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
<slots>
<slot>on_add_education()</slot>
<slot>on_update_education()</slot>
<slot>on_change_currentemployment()</slot>
<slot>on_add_profession()</slot>
+ <slot>on_select_profession()</slot>
+ <slot>on_delete_profession()</slot>
</slots>
</ui>
# Form implementation generated from reading ui file 'biacv_mainwindow.ui'
#
-# Created: Wed Nov 30 15:47:09 2011
+# Created: Wed Nov 30 18:36:56 2011
# by: PyQt4 UI code generator 4.8.6
#
# WARNING! All changes made in this file will be lost!
self.addhistory.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Add", None, QtGui.QApplication.UnicodeUTF8))
self.addhistory.setObjectName(_fromUtf8("addhistory"))
self.gridLayout_4.addWidget(self.addhistory, 5, 2, 1, 1)
- self.edithistory = QtGui.QPushButton(self.tab_3)
- self.edithistory.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Edit", None, QtGui.QApplication.UnicodeUTF8))
- self.edithistory.setObjectName(_fromUtf8("edithistory"))
- self.gridLayout_4.addWidget(self.edithistory, 5, 3, 1, 1)
+ self.updatehistory = QtGui.QPushButton(self.tab_3)
+ self.updatehistory.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Update", None, QtGui.QApplication.UnicodeUTF8))
+ self.updatehistory.setObjectName(_fromUtf8("updatehistory"))
+ self.gridLayout_4.addWidget(self.updatehistory, 5, 3, 1, 1)
self.deletehistory = QtGui.QPushButton(self.tab_3)
self.deletehistory.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8))
self.deletehistory.setObjectName(_fromUtf8("deletehistory"))
QtCore.QObject.connect(self.educationlist, QtCore.SIGNAL(_fromUtf8("activated(QModelIndex)")), biacv_mainwindow.on_select_education)
QtCore.QObject.connect(self.currentemployment, QtCore.SIGNAL(_fromUtf8("toggled(bool)")), biacv_mainwindow.on_change_currentemployment)
QtCore.QObject.connect(self.addhistory, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_add_profession)
+ 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.QMetaObject.connectSlotsByName(biacv_mainwindow)
def retranslateUi(self, biacv_mainwindow):