def saveAppdef(self):
     appdefFile = askForFiles(self,
                              "Select app definition file",
                              True,
                              exts="appdef")
     if appdefFile:
         saveAppdef(self.createAppDefinition(), appdefFile)
 def openAppdef(self):
     appdefFile = askForFiles(self, "Select app definition file", False,
                              False, "appdef")
     if appdefFile:
         appdef = loadAppdef(appdefFile)
         if appdef:
             self.loadAppdef(appdef)
             self.tabPanel.setCurrentIndex(0)
Пример #3
0
 def savePlotData(self):
     filename = askForFiles(self,
                            msg="Save plot data",
                            isSave=True,
                            allowMultiple=False,
                            exts="csv")
     if filename:
         with open(filename, 'wb') as csvfile:
             writer = csv.writer(csvfile, quoting=csv.QUOTE_MINIMAL)
             for time, values in self.data.iteritems():
                 for v in values:
                     x, y = v[1]
                     writer.writerow([time, x, y, v[0]])
    def installPlugin(self):
        fileName = askForFiles(self.iface.mainWindow(),
                               'Open file',
                               exts='zip')

        if fileName is None:
            return

        result = utils.installFromZipFile(fileName)
        if result is None:
            self._showMessage('Plugin installed successfully',
                              QgsMessageBar.SUCCESS)
        else:
            self._showMessage(result, QgsMessageBar.WARNING)

        settings.setValue('lastPluginDirectory',
            QFileInfo(fileName).absoluteDir().absolutePath())