def run(self): appdef = None projFile = QgsProject.instance().fileName() if projFile: appdefFile = projFile + ".appdef" if os.path.exists(appdefFile): if pluginSetting("askreload") == "Ask": ret = QMessageBox.question( self.iface.mainWindow(), "Web app builder", "This project has been already published as a web app.\n" "Do you want to reload app configuration?", QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) if ret == QMessageBox.Yes: appdef = loadAppdef(appdefFile) elif pluginSetting("askreload") == "Open last configuration": appdef = loadAppdef(appdefFile) initialize() # reset credential token in case related credentials are changed utils.resetCachedToken() try: dlg = MainDialog(appdef) dlg.exec_() except: dlg.progressBar.setMaximum(100) dlg.progressBar.setValue(0) dlg.progressBar.setVisible(False) dlg.progressLabel.setVisible(False) QApplication.restoreOverrideCursor() QgsMessageLog.logMessage(traceback.format_exc(), "WebAppBuilder", level=QgsMessageLog.CRITICAL) QMessageBox.critical( self.iface.mainWindow(), "Unmanaged error. See QGIS log for more details.")
def testAppdef(name, process=True, aboutContent=None): filename = os.path.join(os.path.dirname(__file__), "data", name + ".appdef") appdef = loadAppdef(filename) if aboutContent: content = "<h1>Test instructions</h1><p>%s</p>" % aboutContent appdef["Widgets"]["aboutpanel"] = {"Parameters": {"content": content}} if process: processAppdef(appdef) return appdef
def run(self): appdef = None projFile = QgsProject.instance().fileName() if projFile: appdefFile = projFile + ".appdef" if os.path.exists(appdefFile): ret = QMessageBox.question(self.iface.mainWindow(), "Web app builder", "This project has been already published as a web app.\n" "Do you want to reload app configuration?", QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) if ret == QMessageBox.Yes: appdef = loadAppdef(appdefFile) initialize() dlg = MainDialog(appdef) dlg.exec_()
def testAppdef(name, process = True): filename = os.path.join(os.path.dirname(__file__), "data", name + ".appdef") appdef = loadAppdef(filename) if process: processAppdef(appdef) return appdef