python类FD_SAVE的实例源码

mentaltasks.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)

        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
motorpong.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)

        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
pieern.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)

        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
config.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def saveMessages(self, event=None):
        """Save the message log to file.
        """
        saveDialog = wx.FileDialog(self.scrolledPanel, message='Save Message Log',
            wildcard='Text Files (*.txt)|*.txt|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            with open(saveDialog.GetPath(), 'w') as fileHandle:
                fileHandle.write(self.messageArea.GetValue())
        except Exception as e:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
standard.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def stopRecording(self):
        if self.recordingTime is not None:
            secsToSave = time.time() - self.recordingTime

            wx.LogMessage('Page %s saving %f secs of EEG' % (self.name, secsToSave))

            cap = self.src.getEEGSecs(secsToSave, filter=False)

            saveDialog = wx.FileDialog(self, message='Save EEG data.',
                wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
                style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

            try:
                if saveDialog.ShowModal() != wx.ID_CANCEL:
                    cap.saveFile(saveDialog.GetPath())
            except Exception as e:
                wx.LogError('Save failed!')
                raise
            finally:
                saveDialog.Destroy()

        self.recordButton.SetLabel('Start Recording')
        self.recordingTime = None
IPy.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def getpath(title, filt, k, para=None):
    """Get the defaultpath of the ImagePy"""
    dpath = manager.ConfigManager.get('defaultpath')
    if dpath ==None:
        dpath = root_dir # './'
    dic = {'open':wx.FD_OPEN, 'save':wx.FD_SAVE}
    dialog = wx.FileDialog(curapp, title, dpath, '', filt, dic[k])
    rst = dialog.ShowModal()
    path = None
    if rst == wx.ID_OK:
        path = dialog.GetPath()
        dpath = os.path.split(path)[0]
        manager.ConfigManager.set('defaultpath', dpath)
        if para!=None:para['path'] = path
    dialog.Destroy()

    return rst if para!=None else path
gripy_app.py 文件源码 项目:GRIPy 作者: giruenf 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def on_save_as(self):
        if self.get_project_filename():
            dir_name, file_name = os.path.split(self.get_project_filename())
        style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
        wildcard = "Arquivo de projeto do GRIPy (*.pgg)|*.pgg"
        fdlg = wx.FileDialog(self.GetTopWindow(), 
                             'Escolha o arquivo PGG', 
                            #dir_name, file_name, 
                            wildcard=wildcard, style=style
        )
        if fdlg.ShowModal() == wx.ID_OK:
            file_name = fdlg.GetFilename()
            dir_name = fdlg.GetDirectory()
            if not file_name.endswith('.pgg'):
                file_name += '.pgg'
            disableAll = wx.WindowDisabler()
            wait = wx.BusyInfo("Saving GriPy project. Wait...")    
            self.save_project_data(os.path.join(dir_name, file_name))
            del wait
            del disableAll
        fdlg.Destroy()
EyePicker.py 文件源码 项目:nimo 作者: wolfram2012 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def onSaveAs(self,event):
        fd = wx.FileDialog(self,message="Save the coordinates as...",style=wx.FD_SAVE,
                           wildcard="Comma separated value (*.csv)|*.csv")
        fd.ShowModal()
        self.filename = fd.GetPath()

        self.save(self.filename)
mainframe.py 文件源码 项目:fritzchecksum 作者: mementum 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def OnButtonSaveAs(self, msg):
        if not self.model.status:
            wx.MessageBox('No export file has been successfully loaded yet!')
            return

        dialog = wx.FileDialog(
            self, 'Save As ...', style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        result = dialog.ShowModal()
        if result != wx.ID_OK:
            return

        # Show filedialog and get value
        self.model.save(dialog.GetPath())
mentaltasks.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def saveResultText(self, resultText):
        saveDialog = wx.FileDialog(self, message='Save Result Text.',
            wildcard='Text (*.txt)|*.txt|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            with open(saveDialog.GetPath(), 'w') as fd:
                fd.write(resultText)
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
bciplayer.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)
        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()

    ##def decimate(self, cap):
    ##    #cap = cap.demean().bandpass(0.5, 10.0, order=3)
    ##    cap = cap.copy().demean().bandpass(0.5, 12.0, order=3)

    ##    # kind of a hack XXX - idfah
    ##    if cap.getSampRate() > 32.0:
    ##        decimationFactor = int(np.round(cap.getSampRate()/32.0))
    ##        cap = cap.downsample(decimationFactor)

    ##    return cap
p300grid.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)
        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
p300grid.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def saveResultText(self, resultText):
        saveDialog = wx.FileDialog(self, message='Save Result Text.',
            wildcard='Text (*.txt)|*.txt|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            with open(saveDialog.GetPath(), 'w') as fd:
                fd.write(resultText)
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()

    #def decimate(self, cap):
    #    #cap = cap.demean().bandpass(0.5, 20.0, order=3)

    #    # original
    #    #cap = cap.copy().demean().bandpass(0.5, 12.0, order=3)
    #    # biosemi hack XXX - idfah
    #    cap = cap.copy().demean().reference((36,37)).deleteChans(range(32,40))
    #    cap.keepChans(('Fz', 'Cz', 'P3', 'Pz', 'P4', 'P7', 'Oz', 'P8'))

    #    # kind of a hack XXX - idfah
    #    if cap.getSampRate() > 32.0:
    #        decimationFactor = int(np.round(cap.getSampRate()/32.0))
    #        cap = cap.downsample(decimationFactor)

    #    return cap
p300bot.py 文件源码 项目:cebl 作者: idfah 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def saveCap(self):
        cap = self.src.getEEGSecs(self.getSessionTime(), filter=False)
        saveDialog = wx.FileDialog(self, message='Save EEG data.',
            wildcard='Pickle (*.pkl)|*.pkl|All Files|*',
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)

        try:
            if saveDialog.ShowModal() == wx.ID_CANCEL:
                return
            cap.saveFile(saveDialog.GetPath())
        except Exception:
            wx.LogError('Save failed!')
            raise
        finally:
            saveDialog.Destroy()
bonsu.py 文件源码 项目:bonsu 作者: bonsudev 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def OnSave(self,e):
        panelphase = self.GetChildren()[1].GetPage(0)
        if panelphase.pipeline_started == False:
            cwd = self.CurrentWD()
            if IsNotWX4():
                dlg = wx.FileDialog(self, "Choose a file", cwd, "", "fin files (*.fin)|*.fin|All files (*.*)|*.*", wx.SAVE | wx.OVERWRITE_PROMPT)
            else:
                dlg = wx.FileDialog(self, "Choose a file", cwd, "", "fin files (*.fin)|*.fin|All files (*.*)|*.*", wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
            if dlg.ShowModal() == wx.ID_OK:
                self.filename=dlg.GetFilename()
                self.dirname=dlg.GetDirectory()
                SaveInstance(self)
            dlg.Destroy()
LapGUI.py 文件源码 项目:laplacian-meshes 作者: bmershon 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def OnSaveMesh(self, evt):
        dlg = wx.FileDialog(self, "Choose a file", ".", "", "*", wx.FD_SAVE)
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetFilename()
            dirname = dlg.GetDirectory()
            filepath = os.path.join(dirname, filename)
            self.glcanvas.mesh.saveFile(filepath, True)
            self.glcanvas.Refresh()
        dlg.Destroy()
        return
LapGUI.py 文件源码 项目:laplacian-meshes 作者: bmershon 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def OnSaveScreenshot(self, evt):
        dlg = wx.FileDialog(self, "Choose a file", ".", "", "*", wx.FD_SAVE)
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetFilename()
            dirname = dlg.GetDirectory()
            filepath = os.path.join(dirname, filename)
            saveImageGL(self.glcanvas, filepath)
        dlg.Destroy()
        return
visuals.py 文件源码 项目:pyDataView 作者: edwardsmith999 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def save_dialogue(self, event, defaultFile):
        dlg = wx.FileDialog(self, defaultDir='./', defaultFile=defaultFile,
                            style=wx.FD_SAVE) 
        if (dlg.ShowModal() == wx.ID_OK):
            fpath = dlg.GetPath()
        dlg.Destroy()

        #Check if defined, if cancel pressed then return
        try:
            fpath
        except NameError:
            return

        if defaultFile == 'fig.png':
            try:
                print('Saving figure as ' + fpath)
                self.pyplotp.savefigure(fpath)
                print('Saved.')
            except ValueError:
                raise
        elif defaultFile == 'data.csv':
            print('Writing data as ' + fpath)
            self.pyplotp.writedatacsv(fpath)
            print('Finished.')
        elif defaultFile == 'script.py':
            self.pyplotp.writescript(fpath)

        #Output error as dialogue
        #import sys
        #exc_info = sys.exc_info()
        #print(exc_info, dir(exc_info), type(exc_info))
        #showMessageDlg(exc_info[1])
canvas3d.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def on_save(self, evt):
        dic = {'open':wx.FD_OPEN, 'save':wx.FD_SAVE}
        filt = 'PNG files (*.png)|*.png'
        dialog = wx.FileDialog(self, 'Save Picture', '', '', filt, wx.FD_SAVE)
        rst = dialog.ShowModal()
        if rst == wx.ID_OK:
            path = dialog.GetPath()
            self.canvas.save_bitmap(path)
        dialog.Destroy()
tablewindow.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def _OnSave(self,typename="Csv",sep=","):
        dialog=wx.FileDialog(self,typename,style=wx.FD_SAVE)
        if dialog.ShowModal()==wx.ID_OK:
            self.file=dialog.GetPath()
            self.save_tab(self.file, sep)
        dialog.Destroy()
logwindow.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def OnSave(self,event):
        if self.file=='':
            dialog=wx.FileDialog(None,'wxpython Notebook(s)',style=wx.FD_SAVE)
            if dialog.ShowModal()==wx.ID_OK:
                self.file=dialog.GetPath()
                self.text.SaveFile(self.file)
            dialog.Destroy()
        else:
            self.text.SaveFile(self.file)
logwindow.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def OnSaveAs(self,event):
        dialog=wx.FileDialog(None,'wxpython notebook',style=wx.FD_SAVE)
        if dialog.ShowModal()==wx.ID_OK:
            self.file=dialog.GetPath()
            self.text.SaveFile(self.file)
        dialog.Destroy()
gui.py 文件源码 项目:bp5000 作者: isaiahr 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def save(self, e):
        if not hasattr(self, "brackets"):
            errortext = "Make bracket before doing that"
            w = wx.MessageDialog(self.parent, errortext,
                                 "Error", wx.ICON_ERROR)
            w.ShowModal()
            w.Destroy()
            return
        dia = wx.FileDialog(self, "Save Bracket",
                            "", self.sname, "bp5000 bracket|*.bp5",
                            wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if dia.ShowModal() == wx.ID_CANCEL:
            return

        bracketio.write_bracket(dia.GetPath(), self.brackets)
MD5_Hash.py 文件源码 项目:py3_project 作者: tjy-cool 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def save_file(self, event):
        '''??????????? '''
        wildcard = "Text Files (*.txt)|*.txt|" "All files (*.*)|*.*"
        dlg = wx.FileDialog(None, u"???????",
                            os.getcwd(),
                            defaultFile="",
                            style=wx.FD_SAVE,  # |wx.FD_OVERWRITE_PROMPT
                            wildcard=wildcard
                            )
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetPath()
            with open(filename, 'w', encoding='utf-8') as f:
                f.write(self.t1.GetValue())     # ??????????????
bomsaway.py 文件源码 项目:Boms-Away 作者: Jeff-Ciesielski 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def on_export(self, event):
        """
        Gets a file path via popup, then exports content
        """

        exporters = plugin_loader.load_export_plugins()

        wildcards = '|'.join([x.wildcard for x in exporters])

        export_dialog = wx.FileDialog(self, "Export BOM", "", "",
                                      wildcards,
                                      wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)

        if export_dialog.ShowModal() == wx.ID_CANCEL:
            return

        base, ext = os.path.splitext(export_dialog.GetPath())
        filt_idx = export_dialog.GetFilterIndex()

        exporters[filt_idx]().export(base, self.component_type_map)
mzGUI_standalone.py 文件源码 项目:multiplierz 作者: BlaisProteomics 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def file_chooser(title='Choose a file:', default_path = '', default_file = '',
                 mode='r', wildcard='*', parent_obj = None):
    """Provides a file chooser dialog and returns the file path(s) when the file(s) is selected.
    mode option provides file dialog type: read single, read multiple, or save single.
    mode = 'r' creates an 'Open' file dialog for single file read.
    mode = 'm' creates an 'Open' file dialog for multiple files read.
    mode = 'w' creates a 'Save' file dialog.

    wildcard option can be specified as "*.xls"

    Example:
    >> file_chooser(title='Choose a file:', mode='r')

    """

    wildcard = "%s|%s" % (wildcard, wildcard)

    style = { 'r': wx.FD_OPEN,
              'm': wx.FD_MULTIPLE,
              'w': wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT }[mode]

    try:
        file_chooser = wx.FileDialog(parent_obj, title, wildcard=wildcard, style=style,
                                     defaultDir = default_path, defaultFile = default_file)
    except wx._core.PyNoAppError:
        app = mzApp()
        app.launch()
        file_chooser = wx.FileDialog(parent_obj, title, wildcard=wildcard, style=style,
                                     defaultDir = default_path, defaultFile = default_file)


    file_name = None
    if file_chooser.ShowModal() == wx.ID_OK:
        if mode == 'm':
            file_name = file_chooser.GetPaths()
        else:
            file_name = file_chooser.GetPath()
    file_chooser.Destroy()

    return file_name
dialogs.py 文件源码 项目:hachoir3 作者: vstinner 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def file_save_dialog(title):
    dialog_style = wx.FD_SAVE

    dialog = wx.FileDialog(
        None, message=title,
        defaultDir=os.getcwd(),
        defaultFile='', style=dialog_style)

    return dialog
Migrate2WinSSHTerm.py 文件源码 项目:Migrate2WinSSHTerm 作者: P-St 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def get_con_xml_path(self):
        style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
        dialog = wx.FileDialog(self, message='Save connections.xml',defaultFile='connections.xml', wildcard='connections.xml|connections.xml', style=style)
        if dialog.ShowModal() == wx.ID_OK:
            path = dialog.GetPath()
        else:
            path = None
        dialog.Destroy()
        return path
gripy_debug_console.py 文件源码 项目:GRIPy 作者: giruenf 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def onSaveFileAs(self, evt):       
        style = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT
        wildcard = "Arquivo de console GRIPy (*.gripy_console)|*.gripy_console"
        fdlg = wx.FileDialog(self, 'Escolha o arquivo gripy_console', 
                             defaultDir=self.dir_name, 
                             wildcard=wildcard, 
                             style=style
        )
        if fdlg.ShowModal() == wx.ID_OK:
            self.file_name = fdlg.GetFilename()
            self.dir_name = fdlg.GetDirectory()
            self._do_save()
        fdlg.Destroy()
main.py 文件源码 项目:i3ColourChanger 作者: PMunch 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def OnCreateSnippet(self,event):
        openFileDialog = wx.FileDialog(self, "Save i3 Colour snippet file", os.path.expanduser("~/.i3/"), "","i3 Colour snippet file |*", wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if openFileDialog.ShowModal() == wx.ID_CANCEL:
            return
        open(openFileDialog.GetPath(), 'w').close()
        self.config.updateConfig(openFileDialog.GetPath())
        os.system("rm '"+openFileDialog.GetPath()+"'")
        os.system("mv '/tmp/i3tmpconf' '"+openFileDialog.GetPath()+"'")


问题


面经


文章

微信
公众号

扫码关注公众号