1 # class for main window
4 import biacv_mainwindow_ui
as bui
6 class Biacv_mainwindow (PyQt4
.QtGui
.QMainWindow
, bui
.Ui_biacv_mainwindow
):
8 PyQt4
.QtGui
.QMainWindow
.__init
__ (self
)
10 self
.currentfile
= None
12 # delete educational qualification
13 def on_delete_education (self
):
14 # get the selected items in the education list
15 selitems
= self
.educationlist
.selectedItems ()
16 # if no items are selected
18 PyQt4
.QtGui
.QMessageBox
.critical (self
, "Cannot delete", "No items selected.")
19 # delete the items after confirmation
21 ans
= PyQt4
.QtGui
.QMessageBox
.question (self
, "Confirm",
22 "Are you sure you wish to delete selected item?",
23 PyQt4
.QtGui
.QMessageBox
.Yes
, PyQt4
.QtGui
.QMessageBox
.No
)
24 if ans
== PyQt4
.QtGui
.QMessageBox
.Yes
:
25 # remove the item selected
27 self
.educationlist
.takeTopLevelItem (self
.educationlist
.indexOfTopLevelItem (item
))
30 # add educational qualification button
31 def on_add_education (self
):
32 # check if the qualification title is set
33 if self
.degree_name
.text () == "":
34 PyQt4
.QtGui
.QMessageBox
.critical (self
, "Cannot add", "Some required fields are missing.")
36 educationitem
= PyQt4
.QtGui
.QTreeWidgetItem ([
37 self
.degree_name
.text (),
38 self
.yearofpassing
.date ().toString ("MMM, yyyy"),
39 self
.institution
.text (),
40 self
.university
.text (),
42 str (self
.percentage
.value ())
44 self
.educationlist
.addTopLevelItem (educationitem
)