X-Git-Url: https://harishankar.org/repos/?p=biacv.git;a=blobdiff_plain;f=biacv_mainwindow.py;fp=biacv_mainwindow.py;h=0ceebde6c327263447e164553d32f2d8e161993b;hp=65ed3feca692af8babb344047a4ca58b184c97bf;hb=cb541b4d71d0e35448dfbd4e1cb6498e9cf876b7;hpb=12735f250b64468c4fb88d37d1952e99e7da3594 diff --git a/biacv_mainwindow.py b/biacv_mainwindow.py index 65ed3fe..0ceebde 100644 --- a/biacv_mainwindow.py +++ b/biacv_mainwindow.py @@ -7,6 +7,7 @@ import sys import biacv_mainwindow_ui as bui import biacv_lang as lang import biacv_data as data +import biacv_exporter as exporter class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): def __init__ (self): @@ -37,7 +38,33 @@ class Biacv_mainwindow (PyQt4.QtGui.QMainWindow, bui.Ui_biacv_mainwindow): # on file export - export current document to any external format based on # a template def on_file_export (self): - pass + # get the template directory + templatedir = PyQt4.QtGui.QFileDialog.getExistingDirectory (self, + lang.OPEN_TEMPLATE_TITLE) + if templatedir == "": + return + + # get the output file path + outputfile = PyQt4.QtGui.QFileDialog.getSaveFileName (self, + lang.EXPORT_TITLE) + + if outputfile == "": + 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")) + + # 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):