+ self.setWindowTitle ("BiaCV - untitled")
+
+ # on window closing
+ def closeEvent (self, event):
+ if self.ismodified is True:
+ ans = PyQt4.QtGui.QMessageBox.question (self, lang.CONFIRM, lang.CONFIRM_DISCARD_SAVE,
+ PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
+ # ignore event if not confirmed
+ if ans <> PyQt4.QtGui.QMessageBox.Yes:
+ event.ignore ()
+
+ # on help about dialog box
+ def on_help_about (self):
+ PyQt4.QtGui.QMessageBox.about (self, lang.ABOUT_TITLE, lang.ABOUT_TEXT)
+
+ # on file exit
+ def on_exit (self):
+ # 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):
+ # get the template directory
+ templatedir = PyQt4.QtGui.QFileDialog.getExistingDirectory (self,
+ lang.OPEN_TEMPLATE_TITLE)
+ if templatedir == "":
+ return
+
+ # create a new exporter object
+ exp = exporter.BiaCVExporter ()
+
+ # set the document data
+ exp.set_data (self.get_document_data ().data)
+
+ # set the template directory
+ exp.set_template_directory (unicode (templatedir.toUtf8(), "utf-8"))
+
+ # get the output file path
+ outputfile = PyQt4.QtGui.QFileDialog.getSaveFileName (self,
+ exp.exporter_name, filter=exp.export_filter)
+
+ if outputfile == "":
+ return
+
+
+ # set the output file
+ exp.set_output (unicode (outputfile.toUtf8(), "utf-8"))
+
+ # carry out the export function
+ exp.export ()
+
+ # function to open a file
+ def on_file_open (self):
+ # if modified, confirm
+ if self.ismodified is True:
+ ans = PyQt4.QtGui.QMessageBox.question (self, lang.CONFIRM, lang.CONFIRM_DISCARD_SAVE,
+ PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
+ # if no, then don't open the file
+ if ans <> PyQt4.QtGui.QMessageBox.Yes:
+ return
+
+ # open file dialog
+ openfilename = PyQt4.QtGui.QFileDialog.getOpenFileName (self, lang.OPEN_TITLE,
+ filter = lang.BIACV_FILE_FILTER)
+ # if no open file name then return
+ if openfilename == "":
+ return
+
+ # load the document data from open file name
+ docdata = data.BiaCVData ()
+ docdata.load_data (openfilename)
+
+ # set the title
+ self.title.setText (docdata.data["title"])
+
+ # 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)
+
+ # set the professional history
+ self.set_professional_history (docdata)
+
+ # set the career objectives
+ self.set_career_objectives (docdata)
+
+ # set the skills list
+ self.set_skillsets_info (docdata)
+
+ # set the additional information
+ self.set_additional_info (docdata)
+
+ # set the current document
+ self.currentfile = openfilename
+ self.ismodified = False
+
+ # set the window title
+ self.setWindowTitle ("BiaCV - " + self.currentfile)
+
+ # function to save a file as a new document
+ def on_file_save_as (self):
+ savefilename = PyQt4.QtGui.QFileDialog.getSaveFileName (self,
+ lang.SAVE_TITLE, filter=lang.BIACV_FILE_FILTER)
+
+ # if save file name is not none
+ if savefilename <> "":
+ mydata = self.get_document_data ()
+ mydata.save_data (savefilename)
+ self.ismodified = False
+ self.currentfile = savefilename
+ self.setWindowTitle ("BiaCV - " + self.currentfile)