예제 #1
0
 def preview(self):
     try:
         appdef = self.createAppDefinition(True)
     except WrongValueException:
         return
     problems = checkAppCanBeCreated(appdef)
     if problems:
         dlg = AppDefProblemsDialog(problems)
         dlg.exec_()
         if not dlg.ok:
             return
     try:
         folder = utils.tempFolderInTempFolder()
         self._run(
             lambda: createApp(appdef, True, folder, True, self.progress))
         path = "file:///" + folder.replace(
             "\\", "/") + "/webapp/index_debug.html"
         webbrowser.open_new(path)
     except WrongValueException:
         pass
     except:
         QgsMessageLog.logMessage(traceback.format_exc(),
                                  level=QgsMessageLog.CRITICAL)
         QMessageBox.critical(
             iface.mainWindow(), "Error creating web app",
             "Could not create web app.\nSee QGIS log for more details.")
예제 #2
0
 def createApp(self):
     try:
         appdef = self.createAppDefinition()
         problems = checkAppCanBeCreated(appdef)
         if problems:
             dlg = AppDefProblemsDialog(problems)
             dlg.exec_()
             if not dlg.ok:
                 return
         folder = askForFolder(self, "Select folder to store app")
         if folder:
             if os.path.exists(os.path.join(folder, "webapp")):
                 ret = QMessageBox.warning(self, "Output folder", " The selected folder already contains a 'webapp' subfolder.\n"
                                     "Do you confirm that you want to overwrite it?",
                                     QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
                 if ret == QMessageBox.No:
                     return
             self._run(lambda: createApp(appdef, not self.checkBoxDeployData.isChecked(), folder, False, self.progress))
             box = QMessageBox()
             box.setWindowTitle("Web App Builder");
             box.setTextFormat(Qt.RichText)
             box.setText("Application files have been correctly generated.<br>"
                         "Use the  <a href='http://boundlessgeo.com/products/opengeo-suite/'> Boundless WebSDK </a> for building the final webapp from them.")
             box.exec_()
     except WrongValueException:
         pass
     except:
         QgsMessageLog.logMessage(traceback.format_exc(), level=QgsMessageLog.CRITICAL)
         QMessageBox.critical(iface.mainWindow(), "Error creating web app",
                              "Could not create web app.\nCheck the QGIS log for more details.")
    def createOrStopApp(self):
        # check if app is compiling
        if self.onCreatingApp:
            stopAppCreation()
            return

        # start compilation
        try:
            appdef = self.createAppDefinition()
            problems = checkAppCanBeCreated(appdef)
            if pluginSetting("compileinserver"):
                try:
                    from boundlessconnect import connect
                except ImportError:
                    QMessageBox.warning(
                        self, "Cannot compile in server",
                        "To compile the WebApp in the server, the Connect plugin is needed.\n"
                        "Connect plugin could not be found. Install it or disable the 'Use SDK Service to compile app' option in the plugin settings",
                        QMessageBox.Close)
                    return

                QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
                try:
                    checkSDKServerVersion()
                except VersionMismatchError, e:
                    problems.append(str(e))
                except Exception, e:
                    QApplication.restoreOverrideCursor()
                    QMessageBox.warning(self, "Problem checking SDK version",
                                        str(e), QMessageBox.Close)
                    return
    def createOrStopApp(self):
        # check if app is compiling
        if self.onCreatingApp:
            stopAppCreation()
            return

        # start compilation
        try:
            appdef = self.createAppDefinition()
            problems = checkAppCanBeCreated(appdef)
            if pluginSetting("compileinserver"):
                QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
                try:
                    checkSDKServerVersion()
                except VersionMismatchError, e:
                    problems.append(str(e))
                except Exception, e:
                    QApplication.restoreOverrideCursor()
                    QMessageBox.warning(self, "Problem checking SDK version",
                                        str(e), QMessageBox.Close)
                    return
 def preview(self):
     try:
         appdef = self.createAppDefinition(True)
     except WrongValueException:
         return
     problems = checkAppCanBeCreated(appdef)
     if problems:
         dlg = AppDefProblemsDialog(problems)
         dlg.exec_()
         if not dlg.ok:
             return
     try:
         folder = utils.tempFolderInTempFolder()
         self._run(lambda: createApp(appdef, True, folder, True, self.progress))
         path = "file:///" + folder.replace("\\","/") + "/webapp/index_debug.html"
         webbrowser.open_new(path)
     except WrongValueException:
         pass
     except:
         QgsMessageLog.logMessage(traceback.format_exc(), level=QgsMessageLog.CRITICAL)
         QMessageBox.critical(iface.mainWindow(), "Error creating web app",
                              "Could not create web app.\nSee QGIS log for more details.")
 def preview(self):
     try:
         appdef = self.createAppDefinition()
     except WrongValueException:
         return
     problems = checkAppCanBeCreated(appdef, True)
     if problems:
         dlg = AppDefProblemsDialog(problems)
         dlg.exec_()
         if not dlg.ok:
             return
     try:
         self.currentFolder = tempFolderInTempFolder("webappbuilder")
         pub.subscribe(self.endCreatePreviewListener,
                       utils.topics.endFunction)
         try:
             self._run(lambda: createApp(appdef, self.currentFolder, True,
                                         self.progress))
         except:
             QgsMessageLog.logMessage(traceback.format_exc(),
                                      level=QgsMessageLog.CRITICAL)
             self.endCreatePreviewListener(False, traceback.format_exc())
     except WrongValueException:
         pass