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


Python wx.SAVE属性代码示例

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


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

示例1: OnSaveScriptAs

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def OnSaveScriptAs(self):
        if self.fileName:
            dDir = os.path.dirname(self.fileName)
            dFile = os.path.basename(self.fileName)
        else:
            dDir = misc.scriptDir
            dFile = u""

        dlg = wx.FileDialog(mainFrame, "Filename to save as",
            defaultDir = dDir,
            defaultFile = dFile,
            wildcard = "Trelby files (*.trelby)|*.trelby|All files|*",
            style = wx.SAVE | wx.OVERWRITE_PROMPT)
        if dlg.ShowModal() == wx.ID_OK:
            self.saveFile(dlg.GetPath())

        dlg.Destroy() 
开发者ID:trelby,项目名称:trelby,代码行数:19,代码来源:trelby.py

示例2: gui_webui_save_download

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def gui_webui_save_download(self, d2save, path):
        try:
            if sys.platform == 'win32':
                from win32com.shell import shell
                pidl = shell.SHGetSpecialFolderLocation(0, 5)
                defaultpath = shell.SHGetPathFromIDList(pidl)
            else:
                defaultpath = os.path.expandvars('$HOME')
        except:
            defaultpath = ''

        filename = 'test.mkv'
        if globalConfig.get_mode() == 'client_wx':
            import wx
            dlg = wx.FileDialog(None, message='Save file', defaultDir=defaultpath, defaultFile=filename, wildcard='All files (*.*)|*.*', style=wx.SAVE)
            dlg.Raise()
            result = dlg.ShowModal()
            dlg.Destroy()
            if result == wx.ID_OK:
                path = dlg.GetPath()
                d2save.save_content(path) 
开发者ID:alesnav,项目名称:p2ptv-pi,代码行数:23,代码来源:BackgroundProcess.py

示例3: SaveAs

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def SaveAs(self):
        filepath = self.Manager.GetCurrentFilePath()
        if filepath != "":
            directory, filename = os.path.split(filepath)
        else:
            directory, filename = os.getcwd(), "%s.od"%self.Manager.GetCurrentNodeInfos()[0]
        dialog = wx.FileDialog(self, _("Choose a file"), directory, filename,  _("OD files (*.od)|*.od|All files|*.*"), wx.SAVE|wx.OVERWRITE_PROMPT|wx.CHANGE_DIR)
        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
            if os.path.isdir(os.path.dirname(filepath)):
                result = self.Manager.SaveCurrentInFile(filepath)
                if not isinstance(result, (StringType, UnicodeType)):
                    self.RefreshBufferState()
                else:
                    message = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR)
                    message.ShowModal()
                    message.Destroy()
            else:
                message = wx.MessageDialog(self, _("%s is not a valid folder!")%os.path.dirname(filepath), _("Error"), wx.OK|wx.ICON_ERROR)
                message.ShowModal()
                message.Destroy()
        dialog.Destroy() 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:24,代码来源:objdictedit.py

示例4: OnExportEDSMenu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def OnExportEDSMenu(self, event):
        dialog = wx.FileDialog(self, _("Choose a file"), os.getcwd(), self.Manager.GetCurrentNodeInfos()[0], _("EDS files (*.eds)|*.eds|All files|*.*"), wx.SAVE|wx.OVERWRITE_PROMPT|wx.CHANGE_DIR)
        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
            if os.path.isdir(os.path.dirname(filepath)):
                path, extend = os.path.splitext(filepath)
                if extend in ("", "."):
                    filepath = path + ".eds"
                result = self.Manager.ExportCurrentToEDSFile(filepath)
                if not result:
                    message = wx.MessageDialog(self, _("Export successful"), _("Information"), wx.OK|wx.ICON_INFORMATION)
                    message.ShowModal()
                    message.Destroy()
                else:
                    message = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR)
                    message.ShowModal()
                    message.Destroy()
            else:
                message = wx.MessageDialog(self, _("\"%s\" is not a valid folder!")%os.path.dirname(filepath), _("Error"), wx.OK|wx.ICON_ERROR)
                message.ShowModal()
                message.Destroy()
        dialog.Destroy() 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:24,代码来源:objdictedit.py

示例5: ReadFromEEPROM

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def ReadFromEEPROM(self, event):
        """
        Refresh displayed data based on slave EEPROM and save binary file through dialog
        @param event : wx.EVT_BUTTON object
        """
        # Check whether beremiz connected or not.
        check_connect_flag = self.Controler.CommonMethod.CheckConnect(False)
        if check_connect_flag:
            self.SiiBinary = self.Controler.CommonMethod.LoadData()
            self.SetEEPROMData()
            dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(),
                                   "slave0.bin",  _("bin files (*.bin)|*.bin|All files|*.*"),
                                   wx.SAVE | wx.OVERWRITE_PROMPT)

            if dialog.ShowModal() == wx.ID_OK:
                filepath = dialog.GetPath()
                binfile = open(filepath, "wb")
                binfile.write(self.SiiBinary)
                binfile.close()

            dialog.Destroy() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:23,代码来源:EtherCATManagementEditor.py

示例6: OnButtonWriteToBinFile

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def OnButtonWriteToBinFile(self, event):
        """
        Save current EEPROM data to binary file through FileDialog
        Binded to 'Write to File' button.
        @param event : wx.EVT_BUTTON object
        """
        dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(), "slave0.bin",
                               _("bin files (*.bin)|*.bin|All files|*.*"), wx.SAVE | wx.OVERWRITE_PROMPT)

        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
            binfile = open(filepath, "wb")
            binfile.write(self.SiiBinary)
            binfile.close()

        dialog.Destroy() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:18,代码来源:EtherCATManagementEditor.py

示例7: _generateOpenPLC

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def _generateOpenPLC(self):
        self._Clean()
        if (self._Build() is True):
            f = open(self._getIECgeneratedcodepath(), "r")
            program = f.read()
            f.close()

            dlg = wx.FileDialog(self.AppFrame, "Save to file:", "", "", "OpenPLC Program(*.st)|*.st", wx.SAVE|wx.OVERWRITE_PROMPT)
            if dlg.ShowModal() == wx.ID_OK:
                try:
                    f = open(dlg.GetPath(), "w")
                    f.write(program)
                    f.close()
                    #wx.MessageBox('OpenPLC program generated successfully', 'Info', wx.OK | wx.ICON_INFORMATION)
                    self.logger.write("OpenPLC program generated successfully\n")

                except:
                    self.logger.write_error('It was not possible to save the generated program\n') 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:20,代码来源:ProjectController.py

示例8: SaveProjectAs

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def SaveProjectAs(self):
        filepath = self.Controler.GetFilePath()
        if filepath != "":
            directory, filename = os.path.split(filepath)
        else:
            directory, filename = os.getcwd(), "%(projectName)s.xml" % self.Controler.GetProjectProperties()
        dialog = wx.FileDialog(self, _("Choose a file"), directory, filename,  _("PLCOpen files (*.xml)|*.xml|All files|*.*"), wx.SAVE | wx.OVERWRITE_PROMPT)
        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
            if os.path.isdir(os.path.dirname(filepath)):
                result = self.Controler.SaveXMLFile(filepath)
                if not result:
                    self.ShowErrorMessage(_("Can't save project to file %s!") % filepath)
            else:
                self.ShowErrorMessage(_("\"%s\" is not a valid folder!") % os.path.dirname(filepath))
            self._Refresh(TITLE, FILEMENU, PAGETITLES)
        dialog.Destroy() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:19,代码来源:PLCOpenEditor.py

示例9: OnSave

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def OnSave(self, event):
        dlg = wx.FileDialog(self, "Filename to save as",
            wildcard = "HTML files (*.html)|*.html|All files|*",
            style = wx.SAVE | wx.OVERWRITE_PROMPT)

        if dlg.ShowModal() == wx.ID_OK:
            util.writeToFile(dlg.GetPath(), self.html, self)

        dlg.Destroy() 
开发者ID:trelby,项目名称:trelby,代码行数:11,代码来源:commandsdlg.py

示例10: OnSaveSettingsAs

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def OnSaveSettingsAs(self, event = None):
        dlg = wx.FileDialog(self, "Filename to save as",
            defaultDir = os.path.dirname(gd.confFilename),
            defaultFile = os.path.basename(gd.confFilename),
            wildcard = "Setting files (*.conf)|*.conf|All files|*",
            style = wx.SAVE | wx.OVERWRITE_PROMPT)

        if dlg.ShowModal() == wx.ID_OK:
            if util.writeToFile(dlg.GetPath(), cfgGl.save(), self):
                gd.confFilename = dlg.GetPath()

        dlg.Destroy() 
开发者ID:trelby,项目名称:trelby,代码行数:14,代码来源:trelby.py

示例11: OnSaveScriptSettingsAs

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def OnSaveScriptSettingsAs(self, event = None):
        dlg = wx.FileDialog(self, "Filename to save as",
            defaultDir = gd.scriptSettingsPath,
            wildcard = "Script setting files (*.sconf)|*.sconf|All files|*",
            style = wx.SAVE | wx.OVERWRITE_PROMPT)

        if dlg.ShowModal() == wx.ID_OK:
            if util.writeToFile(dlg.GetPath(), self.panel.ctrl.sp.saveCfg(), self):
                gd.scriptSettingsPath = os.path.dirname(dlg.GetPath())

        dlg.Destroy() 
开发者ID:trelby,项目名称:trelby,代码行数:13,代码来源:trelby.py

示例12: OnSaveMesh

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def OnSaveMesh(self, evt):
        dlg = wx.FileDialog(self, "Choose a file", ".", "", "*", wx.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 
开发者ID:bmershon,项目名称:laplacian-meshes,代码行数:12,代码来源:meshView.py

示例13: OnSaveScreenshot

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def OnSaveScreenshot(self, evt):
        dlg = wx.FileDialog(self, "Choose a file", ".", "", "*", wx.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 
开发者ID:bmershon,项目名称:laplacian-meshes,代码行数:11,代码来源:meshView.py

示例14: save_figure

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [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.SAVE|wx.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=0)
                format = ext
            try:
                self.canvas.print_figure(
                    os.path.join(dirname, filename), format=format)
            except Exception as e:
                error_msg_wx(str(e)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:28,代码来源:backend_wx.py

示例15: OnSaveImage

# 需要导入模块: import wx [as 别名]
# 或者: from wx import SAVE [as 别名]
def OnSaveImage(self, event):
        dlg = wx.FileDialog(self, 'Save a PNG file', ".", '', '*.png', wx.SAVE)
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetPath()
            self.save_image(filename)
        dlg.Destroy() 
开发者ID:NOAA-ORR-ERD,项目名称:gridded,代码行数:8,代码来源:ugrid_wx.py


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