+ # category add action
+ def onCategoryAdd (self):
+ # if there is no database
+ if self.current_db == None:
+ PyQt4.QtGui.QMessageBox.critical (self, "Error",
+ "Cannot add category. You need to create or open a website first.")
+ else:
+ # show the category add dialog
+ dlg = catd.CategoryDialog (self)
+ # if OK button is pressed
+ if dlg.exec_ () == PyQt4.QtGui.QDialog.Accepted:
+ cat_name = str (dlg.category_name.text ()).strip ()
+ cat_desc = str (dlg.category_desc.text ()).strip ()
+ cat_stub = str (dlg.category_stub.text ()).strip ()
+ ret = biaweb_db.create_category (self.current_db, cat_name, cat_desc, cat_stub)
+ if ret == True:
+ PyQt4.QtGui.QMessageBox.information (self, "Success", "Category successfully created")
+ else:
+ PyQt4.QtGui.QMessageBox.critical (self, "Error", "SQLite 3 error in creating category")
+
+ # file new menu is clicked