X-Git-Url: https://harishankar.org/repos/?p=biaweb_qt.git;a=blobdiff_plain;f=main_window.py;fp=main_window.py;h=f917e760ade95d39b6f87245a06025819788d13a;hp=b6cb96d3f5fc902674dd119b2ede8e2fa1d1bfe7;hb=3632ca174c91a33db13178bc19ad2f93473b52c0;hpb=7db1961b4f7513f9ad5b6b357a655e16903e7f83 diff --git a/main_window.py b/main_window.py index b6cb96d..f917e76 100644 --- a/main_window.py +++ b/main_window.py @@ -38,12 +38,44 @@ class MainWindow (PyQt4.QtGui.QMainWindow, ui_main_window.Ui_MainWindow): qrow = PyQt4.QtGui.QTreeWidgetItem ([str(item[0]), str(item[1])]) self.articles.addTopLevelItem (qrow) + # configuration dialog + def onConfiguration (self): + if self.current_db == None: + PyQt4.QtGui.QMessageBox.critical (self, "Error", + "Cannot edit configuration. You need to create or open a website first") + else: + dlg = scd.SiteConfigDialog (self) + configs = biaweb_db.get_configuration (self.current_db) + + dlg.site_url.setText (configs[0]) + dlg.site_title.setText (configs[1]) + dlg.keywords.setText (configs[2]) + dlg.description.setPlainText (configs[3]) + dlg.num_rss_items.setValue (configs[4]) + dlg.destination.setText (configs[5]) + dlg.copyright.setText (configs[6]) + + if (dlg.exec_ () == PyQt4.QtGui.QDialog.Accepted): + site_title = str (dlg.site_title.text ()).strip () + site_url = str (dlg.site_url.text ()).strip () + keywords = str (dlg.keywords.text ()).strip () + destination = str (dlg.destination.text ()).strip () + description = str (dlg.description.toPlainText ()).strip () + num_rss = dlg.num_rss_items.value () + copyright = str (dlg.copyright.text ()).strip () + flag = biaweb_db.set_configuration (self.current_db, site_title, site_url, keywords, description, + copyright, num_rss, destination) + if flag == False: + PyQt4.QtGui.QMessageBox.critical (self, "Error", + "SQLite 3 error in updating configuration") + + # 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.") + "Cannot add category. You need to create or open a website first") else: # show the category add dialog dlg = catd.CategoryDialog (self)