X-Git-Url: https://harishankar.org/repos/?p=biaweb_qt.git;a=blobdiff_plain;f=article_dialog.py;h=3923a26bb18a966b1a7da76b711d924dab1f309b;hp=ddd9d18051eaa1b920fc85640695149901cde9a0;hb=592798cba4152c0726edeb629da48cc8ac23a3a3;hpb=a17e899ab18f129ecc6e894e8b2ddc3322aef6f8 diff --git a/article_dialog.py b/article_dialog.py index ddd9d18..3923a26 100644 --- a/article_dialog.py +++ b/article_dialog.py @@ -20,6 +20,25 @@ class ArticleDialog (PyQt4.QtGui.QDialog, ui_article_dialog.Ui_ArticleDialog): if ans == PyQt4.QtGui.QMessageBox.Yes: PyQt4.QtGui.QDialog.reject (self) + # when accepted check the data + def accept (self): + title = str (self.article_title.text ()).strip () + content = str (self.content.toPlainText ()).strip () + stub = str (self.stub.text ()).strip () + + if title <> "" and content <> "" and stub <> "": + PyQt4.QtGui.QDialog.accept (self) + else: + PyQt4.QtGui.QMessageBox.critical (self, "Missing fields", "Some required fields are missing") + + # populate categories in combo box + def populate_categories (self, category_list, selected_cat = None): + for catid, catname, catdesc, stub in category_list: + self.category.addItem (catname, int (catid)) + + # set the index to the selected category item + if selected_cat is not None: + self.category.setCurrentIndex (self.category.findData (selected_cat)) # when bold is clicked def onBold (self):