From db696bd1b54b7daf56d6d3d3049e8a35394536aa Mon Sep 17 00:00:00 2001 From: Harishankar Date: Thu, 8 Dec 2011 14:10:40 +0530 Subject: [PATCH] Added Profile highlights as an additional field Added an additional field - profile highlights. Updated export templates. Also made a few small changes to fix unicode support. --- biacv_data.py | 4 + biacv_exporter.py | 33 +++++-- biacv_mainwindow.py | 18 ++++ biacv_mainwindow.ui | 37 ++++++++ biacv_mainwindow_ui.py | 17 +++- templates/default_fodt/language_bit.tpl | 2 +- templates/default_fodt/main.tpl | 121 ++---------------------- templates/default_fodt/profile_bit.tpl | 3 + templates/default_xhtml/main.tpl | 6 ++ templates/default_xhtml/profile_bit.tpl | 1 + 10 files changed, 121 insertions(+), 121 deletions(-) create mode 100644 templates/default_fodt/profile_bit.tpl create mode 100644 templates/default_xhtml/profile_bit.tpl diff --git a/biacv_data.py b/biacv_data.py index 3fc5830..2d94801 100644 --- a/biacv_data.py +++ b/biacv_data.py @@ -40,6 +40,10 @@ class BiaCVData: self.data["email"] = email self.data["maritalstatus"] = maritalstatus + # set the profile highlights + def set_profile (self, listofprofilehighlights): + self.data["profile"] = listofprofilehighlights + # set the educational qualifications def set_educational_qualifications (self, listofqualifications): self.data["educationalqualifications"] = listofqualifications diff --git a/biacv_exporter.py b/biacv_exporter.py index 8ba3c24..2f9b522 100644 --- a/biacv_exporter.py +++ b/biacv_exporter.py @@ -21,6 +21,9 @@ class BiaCVExporter: # fill education data template bit str_education = self._get_education () + # fill the profile highlight template bit + str_profile = self._get_profile () + # fill the professional history template bit str_profession = self._get_profession () @@ -35,6 +38,7 @@ class BiaCVExporter: # fill the main template str_main = self._get_main ( + str_profile, str_education, str_profession, str_shorttermobjectives, @@ -46,7 +50,7 @@ class BiaCVExporter: codecs.open (self.file_output, "w", "utf-8").write (str_main) # fill up the main template - def _get_main (self, education, profession, shortterm, longterm, skills, languages): + def _get_main (self, profile, education, profession, shortterm, longterm, skills, languages): # main template tpl_main = string.Template (codecs.open (self.fil_main, "r", "utf-8").read ()) @@ -64,6 +68,7 @@ class BiaCVExporter: lastname = self.data["lastname"], dateofbirth = self.data["dateofbirth"], maritalstatus = str_marital, + profile = profile, shortterm = shortterm, longterm = longterm, skills = skills, @@ -85,6 +90,20 @@ class BiaCVExporter: return str_main + # get the profile highlights list + def _get_profile (self): + tpl_profile = string.Template (codecs.open (self.fil_profile, "r", "utf-8").read ()) + + lst_profile = [] + # loop through each item + for item in self.data["profile"]: + str_profile = tpl_profile.safe_substitute ( + profile_item = item + ) + lst_profile.append (str_profile) + + return u'\n'.join (lst_profile) + # get the language list def _get_languages (self): tpl_language = string.Template (codecs.open (self.fil_language, "r", "utf-8").read ()) @@ -106,7 +125,7 @@ class BiaCVExporter: ) lst_languages.append (str_lang) - return "\n".join (lst_languages) + return u'\n'.join (lst_languages) # get the skills def _get_skills (self): @@ -122,7 +141,7 @@ class BiaCVExporter: ) lst_skills.append (str_skill) - return "\n".join (lst_skills) + return u'\n'.join (lst_skills) # get short term career objectives def _get_career (self): @@ -144,7 +163,7 @@ class BiaCVExporter: ) lst_longtermgoals.append (str_career) - return "\n".join (lst_shorttermcareer), "\n".join (lst_longtermgoals) + return u'\n'.join (lst_shorttermcareer), u'\n'.join (lst_longtermgoals) # fill the professional history template def _get_profession (self): @@ -167,7 +186,7 @@ class BiaCVExporter: ) lst_profession.append (str_profession) - return "\n".join (lst_profession) + return u'\n'.join (lst_profession) # fill the education template def _get_education (self): @@ -187,7 +206,7 @@ class BiaCVExporter: ) lst_education.append (str_education) - return "\n".join (lst_education) + return u'\n'.join (lst_education) # set the template directory and the files within def set_template_directory (self, templatedir): @@ -205,6 +224,8 @@ class BiaCVExporter: self.fil_skills = os.path.join (templatedir, "skill_bit.tpl") # languages learned bit self.fil_language = os.path.join (templatedir, "language_bit.tpl") + # profile bit + self.fil_profile = os.path.join (templatedir, "profile_bit.tpl") # load language strings lang_str = codecs.open (os.path.join (templatedir, "misc_strings.txt"), "r", "utf-8").read () diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index 8e4eb5f..72c6bc3 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -93,6 +93,9 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): # set the personal information fields from document data self.set_personal_info (docdata) + # set the profile highlights + self.set_profile_highlights (docdata) + # set the educational qualifications self.set_educational_qualifications (docdata) @@ -182,6 +185,11 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): unicode (self.email.text ().toUtf8 (), "utf-8"), maritalstatus ) + + # set the profile highlights + profile_highlights = unicode (self.profile.toPlainText ().toUtf8 ()).splitlines () + docdata.set_profile (profile_highlights) + # get the list of educational qualifications from the treewidget education = [] i = 0 @@ -271,6 +279,15 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): self.email.setText ("") self.areacode.setText ("") self.unspecified.setChecked (True) + self.country.setText ("") + + # function to set the profile highlights in the GUI from document data + def set_profile_highlights (self, docdata): + self.profile.setPlainText (u'\n'.join (docdata.data["profile"])) + + # function to reset profile highlights data in GUI + def reset_profile_highlights (self): + self.profile.setPlainText ("") # function to set personal information data in the GUI from document data def set_personal_info (self, docdata): @@ -408,6 +425,7 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): self.title.setText ("") self.reset_personal_info () + self.reset_profile_highlights () self.reset_professional_history () self.reset_educational_qualifications () self.reset_career_objectives () diff --git a/biacv_mainwindow.ui b/biacv_mainwindow.ui index 6ddaa9a..57b1074 100644 --- a/biacv_mainwindow.ui +++ b/biacv_mainwindow.ui @@ -352,6 +352,27 @@ + + + Profile + + + + + + Profile main highlights (one per line) + + + + + + + Qt::ScrollBarAlwaysOn + + + + + Educational Qualifications @@ -1816,6 +1837,22 @@ + + profile + textChanged() + biacv_mainwindow + on_document_modified() + + + 287 + 242 + + + 461 + -11 + + + on_add_education() diff --git a/biacv_mainwindow_ui.py b/biacv_mainwindow_ui.py index d2cc9c8..deaba45 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 Dec 7 16:47:43 2011 +# Created: Thu Dec 8 12:53:37 2011 # by: PyQt4 UI code generator 4.8.6 # # WARNING! All changes made in this file will be lost! @@ -216,6 +216,19 @@ class Ui_biacv_mainwindow(object): self.unspecified.setObjectName(_fromUtf8("unspecified")) self.gridLayout.addWidget(self.unspecified, 8, 5, 1, 1) self.pages.addTab(self.tab, _fromUtf8("")) + self.tab_7 = QtGui.QWidget() + self.tab_7.setObjectName(_fromUtf8("tab_7")) + self.gridLayout_9 = QtGui.QGridLayout(self.tab_7) + self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9")) + self.label_38 = QtGui.QLabel(self.tab_7) + self.label_38.setText(QtGui.QApplication.translate("biacv_mainwindow", "Profile main highlights (one per line)", None, QtGui.QApplication.UnicodeUTF8)) + self.label_38.setObjectName(_fromUtf8("label_38")) + self.gridLayout_9.addWidget(self.label_38, 0, 0, 1, 1) + self.profile = QtGui.QPlainTextEdit(self.tab_7) + self.profile.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) + self.profile.setObjectName(_fromUtf8("profile")) + self.gridLayout_9.addWidget(self.profile, 1, 0, 1, 1) + self.pages.addTab(self.tab_7, _fromUtf8("")) self.tab_2 = QtGui.QWidget() self.tab_2.setObjectName(_fromUtf8("tab_2")) self.gridLayout_3 = QtGui.QGridLayout(self.tab_2) @@ -622,10 +635,12 @@ class Ui_biacv_mainwindow(object): QtCore.QObject.connect(self.action_About, QtCore.SIGNAL(_fromUtf8("triggered()")), biacv_mainwindow.on_help_about) QtCore.QObject.connect(self.action_Export, QtCore.SIGNAL(_fromUtf8("triggered()")), biacv_mainwindow.on_file_export) QtCore.QObject.connect(self.country, QtCore.SIGNAL(_fromUtf8("textChanged(QString)")), biacv_mainwindow.on_document_modified) + QtCore.QObject.connect(self.profile, QtCore.SIGNAL(_fromUtf8("textChanged()")), biacv_mainwindow.on_document_modified) 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_7), QtGui.QApplication.translate("biacv_mainwindow", "Profile", 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)) diff --git a/templates/default_fodt/language_bit.tpl b/templates/default_fodt/language_bit.tpl index 99bf475..976704a 100644 --- a/templates/default_fodt/language_bit.tpl +++ b/templates/default_fodt/language_bit.tpl @@ -1,3 +1,3 @@ - ${language} - ${canspeak}; ${canreadwrite}; ${proficient}; + ${language} - ${canspeak} ${canreadwrite} ${proficient}; \ No newline at end of file diff --git a/templates/default_fodt/main.tpl b/templates/default_fodt/main.tpl index 438a614..b628daa 100644 --- a/templates/default_fodt/main.tpl +++ b/templates/default_fodt/main.tpl @@ -1,116 +1,7 @@ - 2011-12-07T21:58:352011-12-08T10:03:59PT57M26S35LibreOffice/3.4$Unix LibreOffice_project/340m1$Build-402 - - - 13640 - 0 - 26100 - 11474 - true - false - - - view2 - 21429 - 19743 - 0 - 13640 - 26099 - 25112 - 0 - 1 - false - 125 - false - - - - - true - true - true - false - true - false - true - true - false - false - false - false - false - - false - false - 0 - true - false - false - false - false - true - false - false - true - false - false - true - false - false - true - true - false - true - high-resolution - 1 - 0 - false - - - true - - false - false - true - false - true - false - false - false - - true - true - false - true - true - true - false - - false - false - 0 - false - false - - - - - - - - - - - - - - - - - - + @@ -687,13 +578,17 @@ ${title} + Profile Highlights + + ${profile} + Career Objectives Short Term Objectives - + ${shortterm} Long Term Goals - + ${longterm} Skill Sets @@ -732,7 +627,7 @@ ${education} Languages Known - + ${languages} Personal Information diff --git a/templates/default_fodt/profile_bit.tpl b/templates/default_fodt/profile_bit.tpl new file mode 100644 index 0000000..51cd39f --- /dev/null +++ b/templates/default_fodt/profile_bit.tpl @@ -0,0 +1,3 @@ + + ${profile_item} + \ No newline at end of file diff --git a/templates/default_xhtml/main.tpl b/templates/default_xhtml/main.tpl index 75fac62..c773269 100644 --- a/templates/default_xhtml/main.tpl +++ b/templates/default_xhtml/main.tpl @@ -39,6 +39,12 @@ + +

Profile highlights

+
    + ${profile} +
+

Career Objectives

Short Term Objectives

diff --git a/templates/default_xhtml/profile_bit.tpl b/templates/default_xhtml/profile_bit.tpl new file mode 100644 index 0000000..3b0e7b2 --- /dev/null +++ b/templates/default_xhtml/profile_bit.tpl @@ -0,0 +1 @@ +
  • ${profile_item}
  • \ No newline at end of file -- 2.20.1