当前位置: 首页>>代码示例>>Python>>正文


Python wx.FD_OVERWRITE_PROMPT属性代码示例

本文整理汇总了Python中wx.FD_OVERWRITE_PROMPT属性的典型用法代码示例。如果您正苦于以下问题:Python wx.FD_OVERWRITE_PROMPT属性的具体用法?Python wx.FD_OVERWRITE_PROMPT怎么用?Python wx.FD_OVERWRITE_PROMPT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在wx的用法示例。


在下文中一共展示了wx.FD_OVERWRITE_PROMPT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __save

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def __save(self, prompt):
        if prompt or self._filename is None:
            defDir, defFile = '', ''
            if self._filename is not None:
                defDir, defFile = os.path.split(self._filename)
            dlg = wx.FileDialog(self,
                                'Save File',
                                defDir, defFile,
                                'rfmon files (*.rfmon)|*.rfmon',
                                wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
            if dlg.ShowModal() == wx.ID_CANCEL:
                return
            self._filename = dlg.GetPath()

        self.__update_settings()
        save_recordings(self._filename,
                        self._settings.get_freq(),
                        self._settings.get_gain(),
                        self._settings.get_cal(),
                        self._settings.get_dynamic_percentile(),
                        self._monitors)
        self.__set_title()

        self._isSaved = True
        self.__set_title() 
开发者ID:EarToEarOak,项目名称:RF-Monitor,代码行数:27,代码来源:gui.py

示例2: compile

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def compile(event):
        """Return a compiled version of the capture currently loaded.

        For now it only returns a bytecode file.
        #TODO: Return a proper executable for the platform currently
        used **Without breaking the current workflow** which works both
        in development mode and in production
        """
        try:
            bytecode_path = py_compile.compile(TMP_PATH)
        except:
            wx.LogError("No capture loaded")
            return
        default_file = "capture.pyc"
        with wx.FileDialog(parent=event.GetEventObject().Parent, message="Save capture executable",
                           defaultDir=os.path.expanduser("~"), defaultFile=default_file, wildcard="*",
                           style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) as fileDialog:

            if fileDialog.ShowModal() == wx.ID_CANCEL:
                return     # the user changed their mind
            pathname = fileDialog.GetPath()
            try:
                shutil.copy(bytecode_path, pathname)
            except IOError:
                wx.LogError(f"Cannot save current data in file {pathname}.") 
开发者ID:RMPR,项目名称:atbswp,代码行数:27,代码来源:control.py

示例3: save_app_as

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def save_app_as(self):
        "saves a wxGlade project onto an xml file chosen by the user"
        # both flags occurs several times
        fn = wx.FileSelector( _("Save project as..."),
                              wildcard="wxGlade files (*.wxg)|*.wxg|wxGlade Template files (*.wgt) |*.wgt|"
                              "XML files (*.xml)|*.xml|All files|*",
                              flags=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
                              default_filename=common.root.filename or (self.cur_dir+os.sep+"wxglade.wxg"))
        if not fn: return

        # check for file extension and add default extension if missing
        ext = os.path.splitext(fn)[1].lower()
        if not ext:
            fn = "%s.wxg" % fn

        common.root.filename = fn
        #remove the template flag so we can save the file.
        common.root.properties["is_template"].set(False)

        self.save_app()
        self.cur_dir = os.path.dirname(fn)
        self.file_history.AddFileToHistory(fn) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:24,代码来源:main.py

示例4: OnSave

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def OnSave(self, event):
        dialog = wx.FileDialog(
            self,
            defaultDir="",
            message="Save scores",
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
            wildcard="Text files (*.txt)|*.txt",
        )
        if dialog.ShowModal() == wx.ID_OK:
            path = dialog.GetPath()
            if path != "":
                stream = open(path, "w")
                for (key, score) in _scores.items():
                    if score is None:
                        print("%s None" % (key), file=stream)
                    else:
                        print("%s %d" % (key, score), file=stream)
                stream.close()
                print("Dumped scores to", path) 
开发者ID:dials,项目名称:dials,代码行数:21,代码来源:score_frame.py

示例5: save_figure

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def save_figure(self, *args):
        # Fetch the required filename and file type.
        filetypes, exts, filter_index = self.canvas._get_imagesave_wildcards()
        default_file = self.canvas.get_default_filename()
        dlg = wx.FileDialog(self.canvas.GetParent(),
                            "Save to file", "", default_file, filetypes,
                            wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        dlg.SetFilterIndex(filter_index)
        if dlg.ShowModal() == wx.ID_OK:
            dirname = dlg.GetDirectory()
            filename = dlg.GetFilename()
            DEBUG_MSG(
                'Save file dir:%s name:%s' %
                (dirname, filename), 3, self)
            format = exts[dlg.GetFilterIndex()]
            basename, ext = os.path.splitext(filename)
            if ext.startswith('.'):
                ext = ext[1:]
            if ext in ('svg', 'pdf', 'ps', 'eps', 'png') and format != ext:
                # looks like they forgot to set the image type drop
                # down, going with the extension.
                _log.warning('extension %s did not match the selected '
                             'image type %s; going with %s',
                             ext, format, ext)
                format = ext
            try:
                self.canvas.figure.savefig(
                    os.path.join(dirname, filename), format=format)
            except Exception as e:
                error_msg_wx(str(e)) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:32,代码来源:backend_wx.py

示例6: save_figure

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def save_figure(self, *args):
        # Fetch the required filename and file type.
        filetypes, exts, filter_index = self.canvas._get_imagesave_wildcards()
        default_file = self.canvas.get_default_filename()
        dlg = wx.FileDialog(self._parent, "Save to file", "", default_file,
                            filetypes,
                            wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        dlg.SetFilterIndex(filter_index)
        if dlg.ShowModal() == wx.ID_OK:
            dirname = dlg.GetDirectory()
            filename = dlg.GetFilename()
            DEBUG_MSG(
                'Save file dir:%s name:%s' %
                (dirname, filename), 3, self)
            format = exts[dlg.GetFilterIndex()]
            basename, ext = os.path.splitext(filename)
            if ext.startswith('.'):
                ext = ext[1:]
            if ext in ('svg', 'pdf', 'ps', 'eps', 'png') and format != ext:
                # looks like they forgot to set the image type drop
                # down, going with the extension.
                warnings.warn(
                    'extension %s did not match the selected '
                    'image type %s; going with %s' %
                    (ext, format, ext), stacklevel=2)
                format = ext
            try:
                self.canvas.figure.savefig(
                    os.path.join(dirname, filename), format=format)
            except Exception as e:
                error_msg_wx(str(e)) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:33,代码来源:backend_wx.py

示例7: trigger

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def trigger(self, *args):
        # Fetch the required filename and file type.
        filetypes, exts, filter_index = self.canvas._get_imagesave_wildcards()
        default_dir = os.path.expanduser(
            matplotlib.rcParams['savefig.directory'])
        default_file = self.canvas.get_default_filename()
        dlg = wx.FileDialog(self.canvas.GetTopLevelParent(), "Save to file",
                            default_dir, default_file, filetypes,
                            wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        dlg.SetFilterIndex(filter_index)
        if dlg.ShowModal() != wx.ID_OK:
            return

        dirname = dlg.GetDirectory()
        filename = dlg.GetFilename()
        DEBUG_MSG('Save file dir:%s name:%s' % (dirname, filename), 3, self)
        format = exts[dlg.GetFilterIndex()]
        basename, ext = os.path.splitext(filename)
        if ext.startswith('.'):
            ext = ext[1:]
        if ext in ('svg', 'pdf', 'ps', 'eps', 'png') and format != ext:
            # looks like they forgot to set the image type drop
            # down, going with the extension.
            warnings.warn(
                'extension %s did not match the selected '
                'image type %s; going with %s' %
                (ext, format, ext), stacklevel=2)
            format = ext
        if default_dir != "":
            matplotlib.rcParams['savefig.directory'] = dirname
        try:
            self.canvas.figure.savefig(
                os.path.join(dirname, filename), format=format)
        except Exception as e:
            error_msg_wx(str(e)) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:37,代码来源:backend_wx.py

示例8: saveFileBrowser

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def saveFileBrowser(self, message, defaultFile=''):
        dlg = wx.FileDialog(self, message, defaultFile=defaultFile,
                        style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
        else:
            path = ''
        dlg.Destroy()
        return path 
开发者ID:collingreen,项目名称:chronolapse,代码行数:11,代码来源:chronolapse.py

示例9: getDialog

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def getDialog(self):
        options = self.Parent._options
        return wx.FileDialog(
            self,
            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
            defaultFile=options.get('default_file', _("enter_filename")),
            defaultDir=options.get('default_dir', _('')),
            message=options.get('message', _('choose_file')),
            wildcard=options.get('wildcard', wx.FileSelectorDefaultWildcardStr)
        ) 
开发者ID:chriskiehl,项目名称:Gooey,代码行数:12,代码来源:chooser.py

示例10: save_all_file

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def save_all_file(filename, parent, config, filetype):
		initialdir = grp_config.get(config[0],config[1])
		dialog = wx.FileDialog(None,_('Choose a filename'), defaultDir=initialdir,defaultFile=filename, wildcard=filetype[0]+" "+filetype[1], style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
		filename = None
		if dialog.ShowModal() == wx.ID_OK:
			filename = dialog.GetPath()
		dialog.Destroy()
		if filename:
			initialdir=os.path.dirname(filename)
			grp_config.set(config[0],config[1],initialdir)
		return filename 
开发者ID:pnprog,项目名称:goreviewpartner,代码行数:13,代码来源:toolbox.py

示例11: _FileNewMenu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def _FileNewMenu(self, event):
        if self._RefuseUnsavedModifications(True):
            return False
        dialog = self._GetFileDialog("Create new data file",
                                     wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if dialog.ShowModal() == wx.ID_OK:
            path = dialog.GetPath()
            if len(path) < 5 or not path.endswith('.tkj'):
                path = path + '.tkj'
            self._SetDataFile(path, True)
        dialog.Destroy() 
开发者ID:cmpilato,项目名称:thotkeeper,代码行数:13,代码来源:app.py

示例12: _FileSaveAsMenu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def _FileSaveAsMenu(self, event):
        dialog = self._GetFileDialog('Save as a new data file',
                                     wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if dialog.ShowModal() == wx.ID_OK:
            path = dialog.GetPath()
            if len(path) < 5 or not path.endswith('.tkj'):
                path = path + '.tkj'
            self._SaveEntriesToPath(path)
        dialog.Destroy() 
开发者ID:cmpilato,项目名称:thotkeeper,代码行数:11,代码来源:app.py

示例13: _FileArchiveMenu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def _FileArchiveMenu(self, event):
        date = self._QueryChooseDate('Archive files before which date?')
        if date is None:
            return

        path = None
        new_basename = ''
        if self.conf.data_file is not None:
            new_base, new_ext = os.path.splitext(os.path.basename(
                self.conf.data_file))
            if not new_ext:
                new_ext = '.tkj'
            new_basename = new_base + '.archive' + new_ext
        dialog = self._GetFileDialog('Archive to a new data file',
                                     wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
                                     new_basename)
        if dialog.ShowModal() == wx.ID_OK:
            path = dialog.GetPath()
        dialog.Destroy()
        if path is None:
            return

        if len(path) < 5 or not path.endswith('.tkj'):
            path = path + '.tkj'
        wx.Yield()
        wx.BeginBusyCursor()
        try:
            self._ArchiveEntriesBeforeDate(path,
                                           date.GetYear(),
                                           date.GetMonth() + 1,
                                           date.GetDay())
        finally:
            wx.EndBusyCursor() 
开发者ID:cmpilato,项目名称:thotkeeper,代码行数:35,代码来源:app.py

示例14: CreateNewFile

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def CreateNewFile(self):
        get_lib_path('g.gui.tangible')
        dlg = wx.FileDialog(self, message="Create a new file with analyses",
                            wildcard="Python source (*.py)|*.py",
                            style=wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
            orig = os.path.join(get_lib_path('g.gui.tangible'), 'current_analyses.py')
            if not os.path.exists(orig):
                self.giface.WriteError("File with analyses not found: {}".format(orig))
            else:
                copyfile(orig, path)
                self.selectAnalyses.SetValue(path)
                self.settings['analyses']['file'] = path
        dlg.Destroy() 
开发者ID:tangible-landscape,项目名称:grass-tangible-landscape,代码行数:17,代码来源:g.gui.tangible.py

示例15: check_c

# 需要导入模块: import wx [as 别名]
# 或者: from wx import FD_OVERWRITE_PROMPT [as 别名]
def check_c(self, e):
        global StopCapture
        cm = e.EventObject.GetValue()
        # self.sd.monitor(self.monitor)
        if cm:
            openFileDialog = wx.FileDialog(self, "CSV dump to file", "", "", 
                  "CSV files (*.csv)|*.csv", 
                         wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
            openFileDialog.ShowModal()
            self.log_csv = openFileDialog.GetPath()
            openFileDialog.Destroy()
            if self.log_csv == u"":
                e.EventObject.SetValue(False)
                return
            StopCapture = False
            self.sd.dumpcount = 0
            t = threading.Thread(target=capture_thr, args=(self.sd, self.log_csv))
            t.setDaemon(True)
            t.start()
        else:
            StopCapture = True
            wx.MessageBox("Capture finished. %d events written to \"%s\"" % (self.sd.dumpcount, self.log_csv), "Message", wx.OK | wx.ICON_INFORMATION)
            while StopCapture:
                pass
        [d.Enable(not cm) for d in self.dynamic]
        if cm:
            [self.hot(i, False) for i in self.heat]
        self.capture = cm 
开发者ID:jamesbowman,项目名称:i2cdriver,代码行数:30,代码来源:i2cgui.py


注:本文中的wx.FD_OVERWRITE_PROMPT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。