Exemple #1
0
 def __on_export_geo(self, _event):
     dlgGeo = DialogExportGeo(self, self.spectrum, self.locations, self.settings)
     if dlgGeo.ShowModal() == wx.ID_OK:
         self.status.set_general("Exporting...")
         extent = dlgGeo.get_extent()
         dlgFile = wx.FileDialog(
             self,
             "Export map to file",
             self.settings.dirExport,
             self.filename,
             File.get_type_filters(File.Types.GEO),
             wx.SAVE | wx.OVERWRITE_PROMPT,
         )
         dlgFile.SetFilterIndex(File.GeoType.KMZ)
         if dlgFile.ShowModal() == wx.ID_OK:
             fileName = dlgFile.GetFilename()
             dirName = dlgFile.GetDirectory()
             self.settings.dirExport = dirName
             fileName = extension_add(fileName, dlgFile.GetFilterIndex(), File.Types.GEO)
             fullName = os.path.join(dirName, fileName)
             exportType = dlgFile.GetFilterIndex()
             image = None
             xyz = None
             if exportType == File.GeoType.CSV:
                 xyz = dlgGeo.get_xyz()
             else:
                 image = dlgGeo.get_image()
             export_map(fullName, exportType, extent, image, xyz)
         self.status.set_general("Finished")
         dlgFile.Destroy()
     dlgGeo.Destroy()
 def __on_export_geo(self, _event):
     dlgGeo = DialogExportGeo(self, self.spectrum, self.locations,
                              self.settings)
     if dlgGeo.ShowModal() == wx.ID_OK:
         self.status.set_general("Exporting...")
         extent = dlgGeo.get_extent()
         dlgFile = wx.FileDialog(self, "Export map to file",
                                 self.settings.dirExport, self.filename,
                                 File.get_type_filters(File.Types.GEO),
                                 wx.SAVE | wx.OVERWRITE_PROMPT)
         dlgFile.SetFilterIndex(File.GeoType.KMZ)
         if dlgFile.ShowModal() == wx.ID_OK:
             fileName = dlgFile.GetFilename()
             dirName = dlgFile.GetDirectory()
             self.settings.dirExport = dirName
             fileName = extension_add(fileName, dlgFile.GetFilterIndex(),
                                      File.Types.GEO)
             fullName = os.path.join(dirName, fileName)
             exportType = dlgFile.GetFilterIndex()
             image = None
             xyz = None
             if exportType == File.GeoType.CSV:
                 xyz = dlgGeo.get_xyz()
             else:
                 image = dlgGeo.get_image()
             export_map(fullName, exportType, extent, image, xyz)
         self.status.set_general("Finished")
         dlgFile.Destroy()
     dlgGeo.Destroy()
Exemple #3
0
    def __on_export_image(self, _event):
        dlgFile = wx.FileDialog(
            self,
            "Export image to file",
            self.settings.dirExport,
            self.filename,
            File.get_type_filters(File.Types.IMAGE),
            wx.SAVE | wx.OVERWRITE_PROMPT,
        )
        dlgFile.SetFilterIndex(File.ImageType.PNG)
        if dlgFile.ShowModal() == wx.ID_OK:
            dlgImg = DialogImageSize(self, self.settings)
            if dlgImg.ShowModal() != wx.ID_OK:
                dlgFile.Destroy()
                return

            self.status.set_general("Exporting...")
            fileName = dlgFile.GetFilename()
            dirName = dlgFile.GetDirectory()
            self.settings.dirExport = dirName
            fileName = extension_add(fileName, dlgFile.GetFilterIndex(), File.Types.IMAGE)
            fullName = os.path.join(dirName, fileName)
            exportType = dlgFile.GetFilterIndex()
            export_image(fullName, exportType, self.graph.get_figure(), self.settings)
            self.status.set_general("Finished")
        dlgFile.Destroy()
 def __on_export_scan(self, _event):
     dlg = wx.FileDialog(self, "Export a scan", self.settings.dirExport,
                         self.filename, File.get_type_filters(),
                         wx.SAVE | wx.OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK:
         self.status.set_general("Exporting...")
         fileName = dlg.GetFilename()
         dirName = dlg.GetDirectory()
         self.settings.dirExport = dirName
         fileName = extension_add(fileName, dlg.GetFilterIndex(),
                                  File.Types.PLOT)
         fullName = os.path.join(dirName, fileName)
         export_plot(fullName, dlg.GetFilterIndex(), self.spectrum)
         self.status.set_general("Finished")
     dlg.Destroy()
 def __on_export_scan(self, _event):
     dlg = wx.FileDialog(self, "Export a scan", self.settings.dirExport,
                         self.filename, File.get_type_filters(),
                         wx.SAVE | wx.OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK:
         self.status.set_general("Exporting...")
         fileName = dlg.GetFilename()
         dirName = dlg.GetDirectory()
         self.settings.dirExport = dirName
         fileName = extension_add(fileName, dlg.GetFilterIndex(),
                                  File.Types.PLOT)
         fullName = os.path.join(dirName, fileName)
         export_plot(fullName, dlg.GetFilterIndex(), self.spectrum)
         self.status.set_general("Finished")
     dlg.Destroy()
 def __on_export_track(self, _event):
     dlg = wx.FileDialog(self, "Export GPS to file",
                         self.settings.dirExport, self.filename,
                         File.get_type_filters(File.Types.TRACK),
                         wx.SAVE | wx.OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK:
         self.status.set_general("Exporting...")
         fileName = dlg.GetFilename()
         dirName = dlg.GetDirectory()
         self.settings.dirExport = dirName
         fileName = extension_add(fileName, dlg.GetFilterIndex(),
                                  File.Types.TRACK)
         fullName = os.path.join(dirName, fileName)
         export_gpx(fullName, self.locations, self.GetName())
         self.status.set_general("Finished")
     dlg.Destroy()
 def __on_export_track(self, _event):
     dlg = wx.FileDialog(self, "Export GPS to file",
                         self.settings.dirExport,
                         self.filename,
                         File.get_type_filters(File.Types.TRACK),
                         wx.SAVE | wx.OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK:
         self.status.set_general("Exporting...")
         fileName = dlg.GetFilename()
         dirName = dlg.GetDirectory()
         self.settings.dirExport = dirName
         fileName = extension_add(fileName, dlg.GetFilterIndex(),
                                  File.Types.TRACK)
         fullName = os.path.join(dirName, fileName)
         export_gpx(fullName, self.locations, self.GetName())
         self.status.set_general("Finished")
     dlg.Destroy()
 def __on_save(self, _event):
     dlg = wx.FileDialog(self, "Save a scan", self.settings.dirScans,
                         self.filename,
                         File.get_type_filters(File.Types.SAVE),
                         wx.SAVE | wx.OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK:
         self.status.set_general("Saving...")
         fileName = dlg.GetFilename()
         dirName = dlg.GetDirectory()
         self.filename = os.path.splitext(fileName)[0]
         self.settings.dirScans = dirName
         fileName = extension_add(fileName, dlg.GetFilterIndex(),
                                  File.Types.SAVE)
         fullName = os.path.join(dirName, fileName)
         save_plot(fullName, self.scanInfo, self.spectrum, self.locations)
         self.__saved(True)
         self.status.set_general("Finished")
         self.settings.fileHistory.AddFileToHistory(fullName)
     dlg.Destroy()
 def __on_save(self, _event):
     dlg = wx.FileDialog(self, "Save a scan", self.settings.dirScans,
                         self.filename,
                         File.get_type_filters(File.Types.SAVE),
                         wx.SAVE | wx.OVERWRITE_PROMPT)
     if dlg.ShowModal() == wx.ID_OK:
         self.status.set_general("Saving...")
         fileName = dlg.GetFilename()
         dirName = dlg.GetDirectory()
         self.filename = os.path.splitext(fileName)[0]
         self.settings.dirScans = dirName
         fileName = extension_add(fileName, dlg.GetFilterIndex(),
                                  File.Types.SAVE)
         fullName = os.path.join(dirName, fileName)
         save_plot(fullName, self.scanInfo, self.spectrum, self.locations)
         self.__saved(True)
         self.status.set_general("Finished")
         self.settings.fileHistory.AddFileToHistory(fullName)
     dlg.Destroy()
    def __on_export_image(self, _event):
        dlgFile = wx.FileDialog(self, "Export image to file",
                                self.settings.dirExport, self.filename,
                                File.get_type_filters(File.Types.IMAGE),
                                wx.SAVE | wx.OVERWRITE_PROMPT)
        dlgFile.SetFilterIndex(File.ImageType.PNG)
        if dlgFile.ShowModal() == wx.ID_OK:
            dlgImg = DialogImageSize(self, self.settings)
            if dlgImg.ShowModal() != wx.ID_OK:
                dlgFile.Destroy()
                return

            self.status.set_general("Exporting...")
            fileName = dlgFile.GetFilename()
            dirName = dlgFile.GetDirectory()
            self.settings.dirExport = dirName
            fileName = extension_add(fileName, dlgFile.GetFilterIndex(),
                                     File.Types.IMAGE)
            fullName = os.path.join(dirName, fileName)
            exportType = dlgFile.GetFilterIndex()
            export_image(fullName, exportType, self.graph.get_figure(),
                         self.settings)
            self.status.set_general("Finished")
        dlgFile.Destroy()