From: Harishankar Date: Wed, 7 Dec 2011 05:13:46 +0000 (+0530) Subject: Completed default XHTML template for exporter X-Git-Url: https://harishankar.org/repos/?p=biacv.git;a=commitdiff_plain;h=12735f250b64468c4fb88d37d1952e99e7da3594 Completed default XHTML template for exporter Started working on exporter and completed the default XHTML template for the exporter --- diff --git a/biacv_exporter.py b/biacv_exporter.py new file mode 100644 index 0000000..43bc635 --- /dev/null +++ b/biacv_exporter.py @@ -0,0 +1,36 @@ +# class to export data in BiaCV native format to any external format as +# specified by a template set. The final document is produced by putting +# together the template "bits" into a single document and filling in the +# document fields. + +import string.Template + +class BiaCVExporter: + def __init__ (self): + self.data = {} + + # set the document data + def set_data (self, data): + # document data + self.data = data + + # set the template directory and the files within + def set_template_directory (self, templatedir): + # set the template file names + + # main document template + self.fil_main = os.path.join (templatedir, "main.tpl") + # education qualification bit + self.fil_education = os.path.join (templatedir, "education_bit.tpl") + # profession history bit + self.fil_profession = os.path.join (templatedir, "profession_bit.tpl") + # career list bit + self.fil_career = os.path.join (templatedir, "career_bit.tpl") + # skills bit + self.fil_skills = os.path.join (templatedir, "skill_bit.tpl") + # languages learned bit + self.fil_language = os.path.join (templatedir, "language_bit.tpl") + + # set the output file + def set_output (self, output): + self.file_output = output diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index b33d689..65ed3fe 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -34,6 +34,11 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): # call the close event self.close() + # on file export - export current document to any external format based on + # a template + def on_file_export (self): + pass + # function to open a file def on_file_open (self): # if modified, confirm diff --git a/biacv_mainwindow.ui b/biacv_mainwindow.ui index ceae00c..8f20bf2 100644 --- a/biacv_mainwindow.ui +++ b/biacv_mainwindow.ui @@ -926,22 +926,12 @@ &File - - - Export as HTML document - - - &Export - - - - - + @@ -1019,6 +1009,11 @@ Show program information + + + &Export... + + @@ -1031,8 +1026,8 @@ on_add_education() - 70 - 98 + 430 + 212 730 @@ -1047,8 +1042,8 @@ on_delete_education() - 100 - 98 + 662 + 212 728 @@ -1063,8 +1058,8 @@ on_select_education() - 100 - 102 + 104 + 293 726 @@ -1079,8 +1074,8 @@ on_update_education() - 85 - 98 + 583 + 212 728 @@ -1095,8 +1090,8 @@ on_select_education() - 100 - 102 + 104 + 293 729 @@ -1111,8 +1106,8 @@ on_change_currentemployment() - 80 - 88 + 332 + 156 728 @@ -1127,8 +1122,8 @@ on_add_profession() - 61 - 99 + 313 + 239 729 @@ -1143,8 +1138,8 @@ on_select_profession() - 99 - 103 + 103 + 320 727 @@ -1159,8 +1154,8 @@ on_select_profession() - 99 - 103 + 103 + 320 729 @@ -1175,8 +1170,8 @@ on_delete_profession() - 99 - 99 + 600 + 239 729 @@ -1191,8 +1186,8 @@ on_update_profession() - 80 - 99 + 457 + 239 726 @@ -1207,8 +1202,8 @@ on_add_skill() - 51 - 96 + 211 + 255 730 @@ -1223,8 +1218,8 @@ on_delete_skill() - 99 - 96 + 570 + 255 728 @@ -1239,8 +1234,8 @@ on_select_skill() - 99 - 102 + 103 + 338 730 @@ -1255,8 +1250,8 @@ on_select_skill() - 99 - 102 + 103 + 338 726 @@ -1271,8 +1266,8 @@ on_update_skill() - 75 - 96 + 390 + 255 728 @@ -1287,8 +1282,8 @@ on_add_lang() - 107 - 110 + 551 + 155 729 @@ -1303,8 +1298,8 @@ on_delete_lang() - 107 - 110 + 716 + 155 733 @@ -1319,8 +1314,8 @@ on_select_lang() - 107 - 110 + 116 + 266 730 @@ -1335,8 +1330,8 @@ on_select_lang() - 107 - 110 + 116 + 266 730 @@ -1351,8 +1346,8 @@ on_update_lang() - 107 - 110 + 644 + 155 729 @@ -1639,8 +1634,8 @@ on_document_modified() - 99 - 89 + 103 + 178 0 @@ -1655,8 +1650,8 @@ on_document_modified() - 94 - 102 + 98 + 374 2 @@ -1671,8 +1666,8 @@ on_document_modified() - 98 - 103 + 102 + 410 1 @@ -1776,6 +1771,22 @@ + + action_Export + triggered() + biacv_mainwindow + on_file_export() + + + -1 + -1 + + + 364 + 248 + + + on_add_education() @@ -1802,5 +1813,6 @@ on_file_save_as() on_exit() on_help_about() + on_file_export() diff --git a/biacv_mainwindow_ui.py b/biacv_mainwindow_ui.py index 5665929..b0dbee9 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: Tue Dec 6 14:03:31 2011 +# Created: Tue Dec 6 18:21:16 2011 # by: PyQt4 UI code generator 4.8.6 # # WARNING! All changes made in this file will be lost! @@ -509,10 +509,6 @@ class Ui_biacv_mainwindow(object): self.menu_File = QtGui.QMenu(self.menubar) self.menu_File.setTitle(QtGui.QApplication.translate("biacv_mainwindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.menu_File.setObjectName(_fromUtf8("menu_File")) - self.menu_Export = QtGui.QMenu(self.menu_File) - self.menu_Export.setStatusTip(QtGui.QApplication.translate("biacv_mainwindow", "Export as HTML document", None, QtGui.QApplication.UnicodeUTF8)) - self.menu_Export.setTitle(QtGui.QApplication.translate("biacv_mainwindow", "&Export", None, QtGui.QApplication.UnicodeUTF8)) - self.menu_Export.setObjectName(_fromUtf8("menu_Export")) self.menu_Help = QtGui.QMenu(self.menubar) self.menu_Help.setTitle(QtGui.QApplication.translate("biacv_mainwindow", "&Help", None, QtGui.QApplication.UnicodeUTF8)) self.menu_Help.setObjectName(_fromUtf8("menu_Help")) @@ -552,14 +548,15 @@ class Ui_biacv_mainwindow(object): self.action_About.setText(QtGui.QApplication.translate("biacv_mainwindow", "&About", None, QtGui.QApplication.UnicodeUTF8)) self.action_About.setStatusTip(QtGui.QApplication.translate("biacv_mainwindow", "Show program information", None, QtGui.QApplication.UnicodeUTF8)) self.action_About.setObjectName(_fromUtf8("action_About")) - self.menu_Export.addAction(self.action_HTML) - self.menu_Export.addAction(self.actionOpenDocument_ODT) + self.action_Export = QtGui.QAction(biacv_mainwindow) + self.action_Export.setText(QtGui.QApplication.translate("biacv_mainwindow", "&Export...", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Export.setObjectName(_fromUtf8("action_Export")) self.menu_File.addAction(self.action_New) self.menu_File.addAction(self.action_Open) self.menu_File.addSeparator() self.menu_File.addAction(self.action_Save) self.menu_File.addAction(self.actionSave_As) - self.menu_File.addAction(self.menu_Export.menuAction()) + self.menu_File.addAction(self.action_Export) self.menu_File.addSeparator() self.menu_File.addAction(self.actionE_xit) self.menu_Help.addAction(self.action_About) @@ -615,6 +612,7 @@ class Ui_biacv_mainwindow(object): QtCore.QObject.connect(self.actionSave_As, QtCore.SIGNAL(_fromUtf8("triggered()")), biacv_mainwindow.on_file_save_as) QtCore.QObject.connect(self.actionE_xit, QtCore.SIGNAL(_fromUtf8("triggered()")), biacv_mainwindow.on_exit) 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.QMetaObject.connectSlotsByName(biacv_mainwindow) def retranslateUi(self, biacv_mainwindow): diff --git a/biacv_res_rc.py b/biacv_res_rc.py index a4cc8e9..4e0ffaf 100644 --- a/biacv_res_rc.py +++ b/biacv_res_rc.py @@ -2,7 +2,7 @@ # Resource object code # -# Created: Tue Dec 6 14:04:06 2011 +# Created: Tue Dec 6 18:17:10 2011 # by: The Resource Compiler for PyQt (Qt v4.7.3) # # WARNING! All changes made in this file will be lost! diff --git a/templates/default_xhtml/career_bit.tpl b/templates/default_xhtml/career_bit.tpl new file mode 100644 index 0000000..53a3cd3 --- /dev/null +++ b/templates/default_xhtml/career_bit.tpl @@ -0,0 +1 @@ +
  • ${careerobjective_item}
  • \ No newline at end of file diff --git a/templates/default_xhtml/education_bit.tpl b/templates/default_xhtml/education_bit.tpl new file mode 100644 index 0000000..8ed3b10 --- /dev/null +++ b/templates/default_xhtml/education_bit.tpl @@ -0,0 +1,8 @@ + + ${degree} + ${dateofpassing} + ${institution} + ${university} + ${grade} + ${percentage} + \ No newline at end of file diff --git a/templates/default_xhtml/language_bit.tpl b/templates/default_xhtml/language_bit.tpl new file mode 100644 index 0000000..e633267 --- /dev/null +++ b/templates/default_xhtml/language_bit.tpl @@ -0,0 +1 @@ +
  • ${language} - ${languagedesc}
  • \ No newline at end of file diff --git a/templates/default_xhtml/main.tpl b/templates/default_xhtml/main.tpl new file mode 100644 index 0000000..65eda93 --- /dev/null +++ b/templates/default_xhtml/main.tpl @@ -0,0 +1,108 @@ + + + + + + ${title} + + + +

    ${title}

    + + + + + + + + + + + + + + + +
    Name${nametitle} ${lastname}, ${firstname}
    Date of birth${dateofbirth}
    Marital status${maritalstatus}
    + + +

    Career Objectives

    +

    Short Term Objectives

    +
      + ${shortterm} +
    +

    Long Term Goals

    +
      + ${longterm} +
    + + +

    Skill Sets

    +
    + ${skills} +
    + + +

    Professional experience

    + ${profession} + + +

    Educational qualifications

    + + + + + + + + + + + ${education} + +
    Qualification/DegreeMonth & year of passingName of InstitutionUniversityClass/GradePercentage
    + +

    Languages known

    +
      + ${languages} +
    + +

    Contact information

    + + + + + + + + + + + + + + + + + +
    Residential address${street},
    ${area},
    ${city} - ${areacode}
    Landline${countrycode_landline} - ${landline}
    Mobile${countrycode_mobile} - ${mobile}
    Email address${email}
    + +

    ${additionalinformation}

    + +

    ${lastname}, ${firstname}

    + + \ No newline at end of file diff --git a/templates/default_xhtml/profession_bit.tpl b/templates/default_xhtml/profession_bit.tpl new file mode 100644 index 0000000..341c80a --- /dev/null +++ b/templates/default_xhtml/profession_bit.tpl @@ -0,0 +1,3 @@ +

    ${dateofjoining} - ${dateofleaving} (with ${organization}) +

    Worked as ${designation}.

    +

    ${additionalinfo}

    \ No newline at end of file diff --git a/templates/default_xhtml/skill_bit.tpl b/templates/default_xhtml/skill_bit.tpl new file mode 100644 index 0000000..3f5455c --- /dev/null +++ b/templates/default_xhtml/skill_bit.tpl @@ -0,0 +1,2 @@ +
    ${skilltitle}
    +
    ${skilldesc}