Website exporter in progress - completed home page
[biaweb_qt.git] / generate_dialog.py
index d1882d2..dc0448b 100644 (file)
@@ -5,6 +5,7 @@ import PyQt4
 import os
 import os.path
 import ui_generate_dialog
+import biaweb_exporter
 
 class GenerateDialog (PyQt4.QtGui.QDialog, ui_generate_dialog.Ui_SiteGenerateDialog):
        def __init__ (self, master, currentdb):
@@ -38,6 +39,29 @@ class GenerateDialog (PyQt4.QtGui.QDialog, ui_generate_dialog.Ui_SiteGenerateDia
        def onSiteGenerate (self):
                files_list = self.get_list_from_tree (self.additional_files)
                folder_list = self.get_list_from_tree (self.additional_folders)
+               if self.fulltextindex.isChecked ():
+                       searchtype = True
+               else:
+                       searchtype = False
+
+               # confirm whether to delete the destination tree and work afresh
+               ans = PyQt4.QtGui.QMessageBox.question (self, "Confirm",
+                                       "This will delete the destination tree completely \
+and recreate the website. Are you sure you wish to proceed?",
+                               PyQt4.QtGui.QMessageBox.Yes, PyQt4.QtGui.QMessageBox.No)
+
+               # if confirmed
+               if ans == PyQt4.QtGui.QMessageBox.Yes:
+                       # call the main exporter to do our work
+                       ret = biaweb_exporter.generate_site (self.current_db, files_list, folder_list, searchtype)
+
+                       # if failed to generate site or any part thereof
+                       if ret == False:
+                               PyQt4.QtGui.QMessageBox.critical (self, "Error",
+                                                       "System or SQLite 3 error in generating website or parts thereof")
+                       else:
+                               PyQt4.QtGui.QMessageBox.information (self, "Success",
+                                                       "Successfully generated website in destination path!")
 
        # when folder add is clicked
        def onFolderAdd (self):