From: Harishankar Date: Thu, 25 Nov 2010 13:27:13 +0000 (+0530) Subject: New Site dialog implemented X-Git-Url: https://harishankar.org/repos/?a=commitdiff_plain;h=859533098a03f0671a18ee0cb4d361c14fb50577;p=biaweb_qt.git New Site dialog implemented New site dialog is now implemented partially to accept the site configuration details --- diff --git a/main_window.py b/main_window.py index d191866..6a856bb 100644 --- a/main_window.py +++ b/main_window.py @@ -10,6 +10,7 @@ class MainWindow (PyQt4.QtGui.QMainWindow, ui_main_window.Ui_MainWindow): def __init__ (self): PyQt4.QtGui.QMainWindow.__init__ (self) self.setupUi (self) + self.current_db = None def onFileNew (self): dlg = scd.SiteConfigDialog (self) diff --git a/main_window.ui b/main_window.ui index ff16abc..451959c 100644 --- a/main_window.ui +++ b/main_window.ui @@ -11,18 +11,11 @@ - BiaWeb + BiaWeb - Static Website Content Manager - - - Categories - - - - Articles in category @@ -30,9 +23,6 @@ - - - @@ -100,6 +90,27 @@ + + + false + + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable + + + Categories + + + 1 + + + + + + + + + Open existing site... @@ -109,71 +120,113 @@ &Quit + + Quit + &Add... + + Add a new category to the website structure + &Edit... + + Edit the selected category + &Delete + + Delete the selected category + &Add... + + Add an article to selected category + &Edit... + + Edit the selected article + &Delete + + Delete the selected article + Generate &Site... + + Export the site into a directory structure with static HTML files + Generate Search &Index... + + Generate full or keyword text database and put it into the generated site structure + &About + + View application information + &New site... + + Create a new website database + &Open site... + + Open an already existing site's database + &Configuration... + + Modify the site configuration + Templates... + + Modify or revert site templates + diff --git a/site_configuration_dialog.py b/site_configuration_dialog.py index 2ba99bb..3b74ded 100644 --- a/site_configuration_dialog.py +++ b/site_configuration_dialog.py @@ -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") diff --git a/site_configuration_dialog.ui b/site_configuration_dialog.ui index 11ee0d3..0b74288 100644 --- a/site_configuration_dialog.ui +++ b/site_configuration_dialog.ui @@ -2,6 +2,9 @@ SiteConfigDialog + + Qt::ApplicationModal + 0 @@ -13,6 +16,9 @@ Site Configuration + + true + @@ -22,19 +28,16 @@ - - - - + - Site URL + My Site - - + + - + Site URL @@ -46,7 +49,11 @@ - + + + some keywords here + + @@ -63,6 +70,9 @@ true + + Your site's description here. This appears in the site header. + @@ -117,7 +127,11 @@ - + + + Copyright (C) year, your name here + + @@ -126,6 +140,13 @@ + + + + example.com + + + @@ -148,8 +169,8 @@ accept() - 248 - 254 + 257 + 357 157 @@ -164,8 +185,8 @@ reject() - 316 - 260 + 325 + 357 286 @@ -173,5 +194,24 @@ + + destination_browse_button + clicked() + SiteConfigDialog + on_browse() + + + 529 + 321 + + + 558 + 310 + + + + + on_browse() + diff --git a/ui_main_window.py b/ui_main_window.py index 749af07..ef57651 100644 --- a/ui_main_window.py +++ b/ui_main_window.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'main_window.ui' # -# Created: Wed Nov 24 16:04:24 2010 +# Created: Thu Nov 25 18:25:57 2010 # by: PyQt4 UI code generator 4.7.4 # # WARNING! All changes made in this file will be lost! @@ -17,18 +17,12 @@ class Ui_MainWindow(object): self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtGui.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") - self.label = QtGui.QLabel(self.centralwidget) - self.label.setObjectName("label") - self.gridLayout.addWidget(self.label, 0, 0, 1, 1) self.label_2 = QtGui.QLabel(self.centralwidget) self.label_2.setObjectName("label_2") - self.gridLayout.addWidget(self.label_2, 0, 2, 1, 1) - self.categories_list = QtGui.QListWidget(self.centralwidget) - self.categories_list.setObjectName("categories_list") - self.gridLayout.addWidget(self.categories_list, 1, 0, 1, 1) + self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1) self.articles_list = QtGui.QListWidget(self.centralwidget) self.articles_list.setObjectName("articles_list") - self.gridLayout.addWidget(self.articles_list, 1, 2, 1, 1) + self.gridLayout.addWidget(self.articles_list, 1, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 633, 25)) @@ -49,6 +43,19 @@ class Ui_MainWindow(object): self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) + self.dockWidget_2 = QtGui.QDockWidget(MainWindow) + self.dockWidget_2.setFloating(False) + self.dockWidget_2.setFeatures(QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetMovable) + self.dockWidget_2.setObjectName("dockWidget_2") + self.dockWidgetContents_2 = QtGui.QWidget() + self.dockWidgetContents_2.setObjectName("dockWidgetContents_2") + self.gridLayout_2 = QtGui.QGridLayout(self.dockWidgetContents_2) + self.gridLayout_2.setObjectName("gridLayout_2") + self.categories_list = QtGui.QListWidget(self.dockWidgetContents_2) + self.categories_list.setObjectName("categories_list") + self.gridLayout_2.addWidget(self.categories_list, 0, 0, 1, 1) + self.dockWidget_2.setWidget(self.dockWidgetContents_2) + MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget_2) self.actionOpen_DB = QtGui.QAction(MainWindow) self.actionOpen_DB.setObjectName("actionOpen_DB") self.action_Quit = QtGui.QAction(MainWindow) @@ -108,8 +115,7 @@ class Ui_MainWindow(object): QtCore.QMetaObject.connectSlotsByName(MainWindow) def retranslateUi(self, MainWindow): - MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "BiaWeb", None, QtGui.QApplication.UnicodeUTF8)) - self.label.setText(QtGui.QApplication.translate("MainWindow", "Categories", None, QtGui.QApplication.UnicodeUTF8)) + MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "BiaWeb - Static Website Content Manager", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("MainWindow", "Articles in category", None, QtGui.QApplication.UnicodeUTF8)) self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.menu_Category.setTitle(QtGui.QApplication.translate("MainWindow", "&Category", None, QtGui.QApplication.UnicodeUTF8)) @@ -117,19 +123,34 @@ class Ui_MainWindow(object): self.menu_Web.setTitle(QtGui.QApplication.translate("MainWindow", "&Web", None, QtGui.QApplication.UnicodeUTF8)) self.menu_About.setTitle(QtGui.QApplication.translate("MainWindow", "&Help", None, QtGui.QApplication.UnicodeUTF8)) self.menu_Settings.setTitle(QtGui.QApplication.translate("MainWindow", "&Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.dockWidget_2.setWindowTitle(QtGui.QApplication.translate("MainWindow", "Categories", None, QtGui.QApplication.UnicodeUTF8)) self.actionOpen_DB.setText(QtGui.QApplication.translate("MainWindow", "Open existing site...", None, QtGui.QApplication.UnicodeUTF8)) self.action_Quit.setText(QtGui.QApplication.translate("MainWindow", "&Quit", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Quit.setStatusTip(QtGui.QApplication.translate("MainWindow", "Quit", None, QtGui.QApplication.UnicodeUTF8)) self.action_Add.setText(QtGui.QApplication.translate("MainWindow", "&Add...", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Add.setStatusTip(QtGui.QApplication.translate("MainWindow", "Add a new category to the website structure", None, QtGui.QApplication.UnicodeUTF8)) self.action_Edit.setText(QtGui.QApplication.translate("MainWindow", "&Edit...", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Edit.setStatusTip(QtGui.QApplication.translate("MainWindow", "Edit the selected category", None, QtGui.QApplication.UnicodeUTF8)) self.action_Delete.setText(QtGui.QApplication.translate("MainWindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Delete.setStatusTip(QtGui.QApplication.translate("MainWindow", "Delete the selected category", None, QtGui.QApplication.UnicodeUTF8)) self.action_New.setText(QtGui.QApplication.translate("MainWindow", "&Add...", None, QtGui.QApplication.UnicodeUTF8)) + self.action_New.setStatusTip(QtGui.QApplication.translate("MainWindow", "Add an article to selected category", None, QtGui.QApplication.UnicodeUTF8)) self.action_Edit_2.setText(QtGui.QApplication.translate("MainWindow", "&Edit...", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Edit_2.setStatusTip(QtGui.QApplication.translate("MainWindow", "Edit the selected article", None, QtGui.QApplication.UnicodeUTF8)) self.action_Delete_2.setText(QtGui.QApplication.translate("MainWindow", "&Delete", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Delete_2.setStatusTip(QtGui.QApplication.translate("MainWindow", "Delete the selected article", None, QtGui.QApplication.UnicodeUTF8)) self.action_Generate_Site.setText(QtGui.QApplication.translate("MainWindow", "Generate &Site...", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Generate_Site.setStatusTip(QtGui.QApplication.translate("MainWindow", "Export the site into a directory structure with static HTML files", None, QtGui.QApplication.UnicodeUTF8)) self.actionGenerate_Search_Index.setText(QtGui.QApplication.translate("MainWindow", "Generate Search &Index...", None, QtGui.QApplication.UnicodeUTF8)) + self.actionGenerate_Search_Index.setStatusTip(QtGui.QApplication.translate("MainWindow", "Generate full or keyword text database and put it into the generated site structure", None, QtGui.QApplication.UnicodeUTF8)) self.action_About.setText(QtGui.QApplication.translate("MainWindow", "&About", None, QtGui.QApplication.UnicodeUTF8)) + self.action_About.setStatusTip(QtGui.QApplication.translate("MainWindow", "View application information", None, QtGui.QApplication.UnicodeUTF8)) self.actionNew_site.setText(QtGui.QApplication.translate("MainWindow", "&New site...", None, QtGui.QApplication.UnicodeUTF8)) + self.actionNew_site.setStatusTip(QtGui.QApplication.translate("MainWindow", "Create a new website database", None, QtGui.QApplication.UnicodeUTF8)) self.action_Open_site.setText(QtGui.QApplication.translate("MainWindow", "&Open site...", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Open_site.setStatusTip(QtGui.QApplication.translate("MainWindow", "Open an already existing site\'s database", None, QtGui.QApplication.UnicodeUTF8)) self.action_Configuration.setText(QtGui.QApplication.translate("MainWindow", "&Configuration...", None, QtGui.QApplication.UnicodeUTF8)) + self.action_Configuration.setStatusTip(QtGui.QApplication.translate("MainWindow", "Modify the site configuration", None, QtGui.QApplication.UnicodeUTF8)) self.actionTemplates.setText(QtGui.QApplication.translate("MainWindow", "Templates...", None, QtGui.QApplication.UnicodeUTF8)) + self.actionTemplates.setStatusTip(QtGui.QApplication.translate("MainWindow", "Modify or revert site templates", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/ui_site_configuration_dialog.py b/ui_site_configuration_dialog.py index 80d8c45..a26be9e 100644 --- a/ui_site_configuration_dialog.py +++ b/ui_site_configuration_dialog.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'site_configuration_dialog.ui' # -# Created: Thu Nov 25 13:17:07 2010 +# Created: Thu Nov 25 18:49:44 2010 # by: PyQt4 UI code generator 4.7.4 # # WARNING! All changes made in this file will be lost! @@ -12,7 +12,9 @@ from PyQt4 import QtCore, QtGui class Ui_SiteConfigDialog(object): def setupUi(self, SiteConfigDialog): SiteConfigDialog.setObjectName("SiteConfigDialog") + SiteConfigDialog.setWindowModality(QtCore.Qt.ApplicationModal) SiteConfigDialog.resize(562, 367) + SiteConfigDialog.setModal(True) self.gridLayout = QtGui.QGridLayout(SiteConfigDialog) self.gridLayout.setObjectName("gridLayout") self.label = QtGui.QLabel(SiteConfigDialog) @@ -24,10 +26,6 @@ class Ui_SiteConfigDialog(object): self.label_2 = QtGui.QLabel(SiteConfigDialog) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) - self.site_url = QtGui.QLineEdit(SiteConfigDialog) - self.site_url.setText("") - self.site_url.setObjectName("site_url") - self.gridLayout.addWidget(self.site_url, 1, 2, 1, 6) self.label_3 = QtGui.QLabel(SiteConfigDialog) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 2, 0, 1, 1) @@ -73,10 +71,14 @@ class Ui_SiteConfigDialog(object): self.label_7 = QtGui.QLabel(SiteConfigDialog) self.label_7.setObjectName("label_7") self.gridLayout.addWidget(self.label_7, 4, 3, 1, 1) + self.site_url = QtGui.QLineEdit(SiteConfigDialog) + self.site_url.setObjectName("site_url") + self.gridLayout.addWidget(self.site_url, 1, 2, 1, 6) self.retranslateUi(SiteConfigDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), SiteConfigDialog.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), SiteConfigDialog.reject) + QtCore.QObject.connect(self.destination_browse_button, QtCore.SIGNAL("clicked()"), SiteConfigDialog.on_browse) QtCore.QMetaObject.connectSlotsByName(SiteConfigDialog) SiteConfigDialog.setTabOrder(self.site_title, self.site_url) SiteConfigDialog.setTabOrder(self.site_url, self.keywords) @@ -90,12 +92,17 @@ class Ui_SiteConfigDialog(object): def retranslateUi(self, SiteConfigDialog): SiteConfigDialog.setWindowTitle(QtGui.QApplication.translate("SiteConfigDialog", "Site Configuration", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText(QtGui.QApplication.translate("SiteConfigDialog", "Name of the site", None, QtGui.QApplication.UnicodeUTF8)) + self.site_title.setText(QtGui.QApplication.translate("SiteConfigDialog", "My Site", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(QtGui.QApplication.translate("SiteConfigDialog", "Site URL", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(QtGui.QApplication.translate("SiteConfigDialog", "Keywords", None, QtGui.QApplication.UnicodeUTF8)) + self.keywords.setText(QtGui.QApplication.translate("SiteConfigDialog", "some keywords here", None, QtGui.QApplication.UnicodeUTF8)) self.label_4.setText(QtGui.QApplication.translate("SiteConfigDialog", "Description", None, QtGui.QApplication.UnicodeUTF8)) + self.description.setPlainText(QtGui.QApplication.translate("SiteConfigDialog", "Your site\'s description here. This appears in the site header.", None, QtGui.QApplication.UnicodeUTF8)) self.label_6.setText(QtGui.QApplication.translate("SiteConfigDialog", "# of RSS feed items", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setText(QtGui.QApplication.translate("SiteConfigDialog", "Export destination", None, QtGui.QApplication.UnicodeUTF8)) self.destination_browse_button.setText(QtGui.QApplication.translate("SiteConfigDialog", "browse...", None, QtGui.QApplication.UnicodeUTF8)) self.label_8.setText(QtGui.QApplication.translate("SiteConfigDialog", "http://", None, QtGui.QApplication.UnicodeUTF8)) + self.copyright.setText(QtGui.QApplication.translate("SiteConfigDialog", "Copyright (C) year, your name here", None, QtGui.QApplication.UnicodeUTF8)) self.label_7.setText(QtGui.QApplication.translate("SiteConfigDialog", "Copyright text", None, QtGui.QApplication.UnicodeUTF8)) + self.site_url.setText(QtGui.QApplication.translate("SiteConfigDialog", "example.com", None, QtGui.QApplication.UnicodeUTF8))