Article dialog implementation under progress
[biaweb_qt.git] / main_window.py
index 0d6c91a..b2547b6 100644 (file)
@@ -5,6 +5,7 @@ import PyQt4
 import ui_main_window
 import site_configuration_dialog as scd
 import category_dialog as catd
+import article_dialog as artd
 import biaweb_db
 import sys
 
@@ -44,6 +45,29 @@ class MainWindow (PyQt4.QtGui.QMainWindow, ui_main_window.Ui_MainWindow):
                        self.repopulate_categories ()
                        self.repopulate_articles ()
 
+       # when add article is triggered
+       def onArticleAdd (self):
+               if self.current_db == None:
+                       PyQt4.QtGui.QMessageBox.critical (self, "Error",
+                                                       "Cannot create article. You need to create or open a website first")
+               else:
+                       catid = self.get_selected_item_id (self.categories)
+                       # if no category is selected
+                       if catid is None:
+                               PyQt4.QtGui.QMessageBox.critical (self, "Error", "No category selected for article")
+                               return
+                       artdlg = artd.ArticleDialog (self)
+                       artdlg.exec_ ()
+
+
+       # when edit article is triggered
+       def onArticleEdit (self):
+               pass
+
+       # when delete article is triggered
+       def onArticleDelete (self):
+               pass
+
        # when item selection is changed in categories tree widget
        def onCategorySelectionChanged (self):
                if self.current_db is not None: