def __init__ (self):
PyQt4.QtGui.QMainWindow.__init__ (self)
self.setupUi (self)
+ self.current_db = None
def onFileNew (self):
dlg = scd.SiteConfigDialog (self)
</rect>
</property>
<property name="windowTitle">
- <string>BiaWeb</string>
+ <string>BiaWeb - Static Website Content Manager</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Categories</string>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Articles in category</string>
</widget>
</item>
<item row="1" column="0">
- <widget class="QListWidget" name="categories_list"/>
- </item>
- <item row="1" column="2">
<widget class="QListWidget" name="articles_list"/>
</item>
</layout>
<addaction name="menu_About"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
+ <widget class="QDockWidget" name="dockWidget_2">
+ <property name="floating">
+ <bool>false</bool>
+ </property>
+ <property name="features">
+ <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
+ </property>
+ <property name="windowTitle">
+ <string>Categories</string>
+ </property>
+ <attribute name="dockWidgetArea">
+ <number>1</number>
+ </attribute>
+ <widget class="QWidget" name="dockWidgetContents_2">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QListWidget" name="categories_list"/>
+ </item>
+ </layout>
+ </widget>
+ </widget>
<action name="actionOpen_DB">
<property name="text">
<string>Open existing site...</string>
<property name="text">
<string>&Quit</string>
</property>
+ <property name="statusTip">
+ <string>Quit</string>
+ </property>
</action>
<action name="action_Add">
<property name="text">
<string>&Add...</string>
</property>
+ <property name="statusTip">
+ <string>Add a new category to the website structure</string>
+ </property>
</action>
<action name="action_Edit">
<property name="text">
<string>&Edit...</string>
</property>
+ <property name="statusTip">
+ <string>Edit the selected category</string>
+ </property>
</action>
<action name="action_Delete">
<property name="text">
<string>&Delete</string>
</property>
+ <property name="statusTip">
+ <string>Delete the selected category</string>
+ </property>
</action>
<action name="action_New">
<property name="text">
<string>&Add...</string>
</property>
+ <property name="statusTip">
+ <string>Add an article to selected category</string>
+ </property>
</action>
<action name="action_Edit_2">
<property name="text">
<string>&Edit...</string>
</property>
+ <property name="statusTip">
+ <string>Edit the selected article</string>
+ </property>
</action>
<action name="action_Delete_2">
<property name="text">
<string>&Delete</string>
</property>
+ <property name="statusTip">
+ <string>Delete the selected article</string>
+ </property>
</action>
<action name="action_Generate_Site">
<property name="text">
<string>Generate &Site...</string>
</property>
+ <property name="statusTip">
+ <string>Export the site into a directory structure with static HTML files</string>
+ </property>
</action>
<action name="actionGenerate_Search_Index">
<property name="text">
<string>Generate Search &Index...</string>
</property>
+ <property name="statusTip">
+ <string>Generate full or keyword text database and put it into the generated site structure</string>
+ </property>
</action>
<action name="action_About">
<property name="text">
<string>&About</string>
</property>
+ <property name="statusTip">
+ <string>View application information</string>
+ </property>
</action>
<action name="actionNew_site">
<property name="text">
<string>&New site...</string>
</property>
+ <property name="statusTip">
+ <string>Create a new website database</string>
+ </property>
</action>
<action name="action_Open_site">
<property name="text">
<string>&Open site...</string>
</property>
+ <property name="statusTip">
+ <string>Open an already existing site's database</string>
+ </property>
</action>
<action name="action_Configuration">
<property name="text">
<string>&Configuration...</string>
</property>
+ <property name="statusTip">
+ <string>Modify the site configuration</string>
+ </property>
</action>
<action name="actionTemplates">
<property name="text">
<string>Templates...</string>
</property>
+ <property name="statusTip">
+ <string>Modify or revert site templates</string>
+ </property>
</action>
</widget>
<resources/>
# 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")
<ui version="4.0">
<class>SiteConfigDialog</class>
<widget class="QDialog" name="SiteConfigDialog">
+ <property name="windowModality">
+ <enum>Qt::ApplicationModal</enum>
+ </property>
<property name="geometry">
<rect>
<x>0</x>
<property name="windowTitle">
<string>Site Configuration</string>
</property>
+ <property name="modal">
+ <bool>true</bool>
+ </property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
</widget>
</item>
<item row="0" column="1" colspan="7">
- <widget class="QLineEdit" name="site_title"/>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_2">
+ <widget class="QLineEdit" name="site_title">
<property name="text">
- <string>Site URL</string>
+ <string>My Site</string>
</property>
</widget>
</item>
- <item row="1" column="2" colspan="6">
- <widget class="QLineEdit" name="site_url">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
<property name="text">
- <string/>
+ <string>Site URL</string>
</property>
</widget>
</item>
</widget>
</item>
<item row="2" column="1" colspan="7">
- <widget class="QLineEdit" name="keywords"/>
+ <widget class="QLineEdit" name="keywords">
+ <property name="text">
+ <string>some keywords here</string>
+ </property>
+ </widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="tabChangesFocus">
<bool>true</bool>
</property>
+ <property name="plainText">
+ <string>Your site's description here. This appears in the site header.</string>
+ </property>
</widget>
</item>
<item row="4" column="0" colspan="2">
</widget>
</item>
<item row="4" column="4" colspan="4">
- <widget class="QLineEdit" name="copyright"/>
+ <widget class="QLineEdit" name="copyright">
+ <property name="text">
+ <string>Copyright (C) year, your name here</string>
+ </property>
+ </widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="label_7">
</property>
</widget>
</item>
+ <item row="1" column="2" colspan="6">
+ <widget class="QLineEdit" name="site_url">
+ <property name="text">
+ <string>example.com</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<tabstops>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>248</x>
- <y>254</y>
+ <x>257</x>
+ <y>357</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
- <x>316</x>
- <y>260</y>
+ <x>325</x>
+ <y>357</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
</hint>
</hints>
</connection>
+ <connection>
+ <sender>destination_browse_button</sender>
+ <signal>clicked()</signal>
+ <receiver>SiteConfigDialog</receiver>
+ <slot>on_browse()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>529</x>
+ <y>321</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>558</x>
+ <y>310</y>
+ </hint>
+ </hints>
+ </connection>
</connections>
+ <slots>
+ <slot>on_browse()</slot>
+ </slots>
</ui>
# 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!
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))
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)
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))
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))
# 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!
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)
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)
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)
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))