New Site dialog implemented
[biaweb_qt.git] / site_configuration_dialog.py
index 2ba99bb..3b74ded 100644 (file)
@@ -2,9 +2,29 @@
 # Site Configuration Dialog class
 
 import PyQt4
+import os.path
 import ui_site_configuration_dialog as uscd
 
 class SiteConfigDialog (PyQt4.QtGui.QDialog, uscd.Ui_SiteConfigDialog):
        def __init__ (self, parent):
                PyQt4.QtGui.QDialog.__init__ (self, parent)
                self.setupUi (self)
+
+       def on_browse (self):
+               destpath = PyQt4.QtGui.QFileDialog.getExistingDirectory (self, "Select destination directory",
+                                                               os.path.expanduser ("~") )
+               if destpath:
+                       self.destination.setText (destpath)
+
+       def accept (self):
+               site_title = str (self.site_title.text ()).strip ()
+               site_url = str (self.site_url.text ()).strip ()
+               keywords = str (self.keywords.text ()).strip ()
+               destination = str (self.destination.text ()).strip ()
+               description = str (self.description.toPlainText ()).strip ()
+
+               # site title, url, description, keywords and destination folder are required
+               if site_title <> "" and site_url <> "" and keywords <> "" and destination <> "" and description <> "":
+                       PyQt4.QtGui.QDialog.accept (self)
+               else:
+                       PyQt4.QtGui.QMessageBox.critical (self, "Missing Fields", "Some required fields are missing")