Added the template editor dialog
[biaweb_qt.git] / site_configuration_dialog.py
1 # BiaWeb Website content manager (c) 2010 V.Harishankar
2 # Site Configuration Dialog class
3
4 import PyQt4
5 import os.path
6 import ui_site_configuration_dialog as uscd
7
8 class SiteConfigDialog (PyQt4.QtGui.QDialog, uscd.Ui_SiteConfigDialog):
9 def __init__ (self, parent):
10 PyQt4.QtGui.QDialog.__init__ (self, parent)
11 self.setupUi (self)
12
13 def on_browse (self):
14 destpath = PyQt4.QtGui.QFileDialog.getExistingDirectory (self, "Select destination directory",
15 os.path.expanduser ("~") )
16 if destpath:
17 self.destination.setText (destpath)
18
19 def accept (self):
20 # check the required fields before accepting
21 site_title = str (self.site_title.text ()).strip ()
22 site_url = str (self.site_url.text ()).strip ()
23 keywords = str (self.keywords.text ()).strip ()
24 destination = str (self.destination.text ()).strip ()
25 description = str (self.description.toPlainText ()).strip ()
26
27 # site title, url, description, keywords and destination folder are required
28 if site_title <> "" and site_url <> "" and keywords <> "" and destination <> "" and description <> "":
29 PyQt4.QtGui.QDialog.accept (self)
30 else:
31 PyQt4.QtGui.QMessageBox.critical (self, "Missing Fields", "Some required fields are missing")