From d4d1c35dac0338dec51b3616e594d6b7366a8da1 Mon Sep 17 00:00:00 2001 From: Harishankar Date: Wed, 30 Nov 2011 15:51:33 +0530 Subject: [PATCH] Add professional qualification Completed the add professional qualification functionality. --- biacv_mainwindow.py | 62 ++++++++++++++++++---- biacv_mainwindow.ui | 118 +++++++++++++++++++++++++++++++++++++++-- biacv_mainwindow_ui.py | 58 +++++++++++++++----- 3 files changed, 211 insertions(+), 27 deletions(-) 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): diff --git a/biacv_mainwindow.ui b/biacv_mainwindow.ui index 4fb9cc8..812e7a8 100644 --- a/biacv_mainwindow.ui +++ b/biacv_mainwindow.ui @@ -27,8 +27,14 @@ + + QTabWidget::Rounded + - 1 + 0 + + + true @@ -500,7 +506,7 @@ - + @@ -544,7 +550,7 @@ - + Current employment @@ -592,7 +598,77 @@ - + + + true + + + false + + + true + + + + Job title + + + + + Date of joining + + + + + Date of leaving + + + + + Organization + + + + + Additional info + + + + + + + + + Career objectives + + + + + + Short term career objectives (one per line) + + + + + + + Qt::ScrollBarAlwaysOn + + + + + + + Long term career goals (one per line) + + + + + + + Qt::ScrollBarAlwaysOn + + @@ -939,11 +1015,45 @@ + + currentemployment + toggled(bool) + biacv_mainwindow + on_change_currentemployment() + + + 368 + 140 + + + 728 + 246 + + + + + addhistory + clicked() + biacv_mainwindow + on_add_profession() + + + 391 + 222 + + + 729 + 289 + + + on_add_education() on_delete_education() on_select_education() on_update_education() + on_change_currentemployment() + on_add_profession() diff --git a/biacv_mainwindow_ui.py b/biacv_mainwindow_ui.py index 9d60bad..5760b36 100644 --- a/biacv_mainwindow_ui.py +++ b/biacv_mainwindow_ui.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'biacv_mainwindow.ui' # -# Created: Wed Nov 30 14:34:55 2011 +# Created: Wed Nov 30 15:47:09 2011 # by: PyQt4 UI code generator 4.8.6 # # WARNING! All changes made in this file will be lost! @@ -31,6 +31,8 @@ class Ui_biacv_mainwindow(object): self.title.setObjectName(_fromUtf8("title")) self.gridLayout_2.addWidget(self.title, 0, 1, 1, 1) self.pages = QtGui.QTabWidget(self.centralwidget) + self.pages.setTabShape(QtGui.QTabWidget.Rounded) + self.pages.setDocumentMode(True) self.pages.setObjectName(_fromUtf8("pages")) self.tab = QtGui.QWidget() self.tab.setObjectName(_fromUtf8("tab")) @@ -292,9 +294,9 @@ class Ui_biacv_mainwindow(object): self.label_28.setText(QtGui.QApplication.translate("biacv_mainwindow", "Designation/title", None, QtGui.QApplication.UnicodeUTF8)) self.label_28.setObjectName(_fromUtf8("label_28")) self.gridLayout_4.addWidget(self.label_28, 0, 0, 1, 1) - self.positions = QtGui.QLineEdit(self.tab_3) - self.positions.setObjectName(_fromUtf8("positions")) - self.gridLayout_4.addWidget(self.positions, 0, 1, 1, 4) + self.designation = QtGui.QLineEdit(self.tab_3) + self.designation.setObjectName(_fromUtf8("designation")) + self.gridLayout_4.addWidget(self.designation, 0, 1, 1, 4) self.label_26 = QtGui.QLabel(self.tab_3) self.label_26.setText(QtGui.QApplication.translate("biacv_mainwindow", "Date of joining post", None, QtGui.QApplication.UnicodeUTF8)) self.label_26.setObjectName(_fromUtf8("label_26")) @@ -314,10 +316,10 @@ class Ui_biacv_mainwindow(object): self.leavedate.setCalendarPopup(True) self.leavedate.setObjectName(_fromUtf8("leavedate")) self.gridLayout_4.addWidget(self.leavedate, 2, 1, 1, 1) - self.checkBox = QtGui.QCheckBox(self.tab_3) - self.checkBox.setText(QtGui.QApplication.translate("biacv_mainwindow", "Current employment", None, QtGui.QApplication.UnicodeUTF8)) - self.checkBox.setObjectName(_fromUtf8("checkBox")) - self.gridLayout_4.addWidget(self.checkBox, 2, 2, 1, 2) + self.currentemployment = QtGui.QCheckBox(self.tab_3) + self.currentemployment.setText(QtGui.QApplication.translate("biacv_mainwindow", "Current employment", None, QtGui.QApplication.UnicodeUTF8)) + self.currentemployment.setObjectName(_fromUtf8("currentemployment")) + self.gridLayout_4.addWidget(self.currentemployment, 2, 2, 1, 2) self.label_25 = QtGui.QLabel(self.tab_3) self.label_25.setText(QtGui.QApplication.translate("biacv_mainwindow", "Organization name", None, QtGui.QApplication.UnicodeUTF8)) self.label_25.setObjectName(_fromUtf8("label_25")) @@ -344,10 +346,39 @@ class Ui_biacv_mainwindow(object): self.deletehistory.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8)) self.deletehistory.setObjectName(_fromUtf8("deletehistory")) self.gridLayout_4.addWidget(self.deletehistory, 5, 4, 1, 1) - self.historylist = QtGui.QColumnView(self.tab_3) - self.historylist.setObjectName(_fromUtf8("historylist")) - self.gridLayout_4.addWidget(self.historylist, 6, 0, 1, 5) + self.professionlist = QtGui.QTreeWidget(self.tab_3) + self.professionlist.setAlternatingRowColors(True) + self.professionlist.setRootIsDecorated(False) + self.professionlist.setUniformRowHeights(True) + self.professionlist.setObjectName(_fromUtf8("professionlist")) + self.professionlist.headerItem().setText(0, QtGui.QApplication.translate("biacv_mainwindow", "Job title", None, QtGui.QApplication.UnicodeUTF8)) + self.professionlist.headerItem().setText(1, QtGui.QApplication.translate("biacv_mainwindow", "Date of joining", None, QtGui.QApplication.UnicodeUTF8)) + self.professionlist.headerItem().setText(2, QtGui.QApplication.translate("biacv_mainwindow", "Date of leaving", None, QtGui.QApplication.UnicodeUTF8)) + self.professionlist.headerItem().setText(3, QtGui.QApplication.translate("biacv_mainwindow", "Organization", None, QtGui.QApplication.UnicodeUTF8)) + self.professionlist.headerItem().setText(4, QtGui.QApplication.translate("biacv_mainwindow", "Additional info", None, QtGui.QApplication.UnicodeUTF8)) + self.gridLayout_4.addWidget(self.professionlist, 6, 0, 1, 5) self.pages.addTab(self.tab_3, _fromUtf8("")) + self.tab_6 = QtGui.QWidget() + self.tab_6.setObjectName(_fromUtf8("tab_6")) + self.gridLayout_8 = QtGui.QGridLayout(self.tab_6) + self.gridLayout_8.setObjectName(_fromUtf8("gridLayout_8")) + self.label_35 = QtGui.QLabel(self.tab_6) + self.label_35.setText(QtGui.QApplication.translate("biacv_mainwindow", "Short term career objectives (one per line)", None, QtGui.QApplication.UnicodeUTF8)) + self.label_35.setObjectName(_fromUtf8("label_35")) + self.gridLayout_8.addWidget(self.label_35, 0, 0, 1, 1) + self.shorttermcareer = QtGui.QPlainTextEdit(self.tab_6) + self.shorttermcareer.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) + self.shorttermcareer.setObjectName(_fromUtf8("shorttermcareer")) + self.gridLayout_8.addWidget(self.shorttermcareer, 1, 0, 1, 1) + self.label_36 = QtGui.QLabel(self.tab_6) + self.label_36.setText(QtGui.QApplication.translate("biacv_mainwindow", "Long term career goals (one per line)", None, QtGui.QApplication.UnicodeUTF8)) + self.label_36.setObjectName(_fromUtf8("label_36")) + self.gridLayout_8.addWidget(self.label_36, 2, 0, 1, 1) + self.longtermgoals = QtGui.QPlainTextEdit(self.tab_6) + self.longtermgoals.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) + self.longtermgoals.setObjectName(_fromUtf8("longtermgoals")) + self.gridLayout_8.addWidget(self.longtermgoals, 3, 0, 1, 1) + self.pages.addTab(self.tab_6, _fromUtf8("")) self.tab_4 = QtGui.QWidget() self.tab_4.setObjectName(_fromUtf8("tab_4")) self.gridLayout_5 = QtGui.QGridLayout(self.tab_4) @@ -510,18 +541,21 @@ class Ui_biacv_mainwindow(object): self.menubar.addAction(self.menu_Help.menuAction()) self.retranslateUi(biacv_mainwindow) - self.pages.setCurrentIndex(1) + self.pages.setCurrentIndex(0) QtCore.QObject.connect(self.addeducation, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_add_education) QtCore.QObject.connect(self.deleteeducation, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_delete_education) QtCore.QObject.connect(self.educationlist, QtCore.SIGNAL(_fromUtf8("itemSelectionChanged()")), biacv_mainwindow.on_select_education) QtCore.QObject.connect(self.updateeducation, QtCore.SIGNAL(_fromUtf8("clicked()")), biacv_mainwindow.on_update_education) 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.QMetaObject.connectSlotsByName(biacv_mainwindow) def retranslateUi(self, biacv_mainwindow): self.pages.setTabText(self.pages.indexOf(self.tab), QtGui.QApplication.translate("biacv_mainwindow", "Personal information", None, QtGui.QApplication.UnicodeUTF8)) self.pages.setTabText(self.pages.indexOf(self.tab_2), QtGui.QApplication.translate("biacv_mainwindow", "Educational Qualifications", None, QtGui.QApplication.UnicodeUTF8)) self.pages.setTabText(self.pages.indexOf(self.tab_3), QtGui.QApplication.translate("biacv_mainwindow", "Professional History", None, QtGui.QApplication.UnicodeUTF8)) + self.pages.setTabText(self.pages.indexOf(self.tab_6), QtGui.QApplication.translate("biacv_mainwindow", "Career objectives", None, QtGui.QApplication.UnicodeUTF8)) self.pages.setTabText(self.pages.indexOf(self.tab_4), QtGui.QApplication.translate("biacv_mainwindow", "Skill sets", None, QtGui.QApplication.UnicodeUTF8)) self.pages.setTabText(self.pages.indexOf(self.tab_5), QtGui.QApplication.translate("biacv_mainwindow", "Additional information", None, QtGui.QApplication.UnicodeUTF8)) -- 2.20.1