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


Python wx.OPEN属性代码示例

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


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

示例1: OnBrowse

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def OnBrowse(self, event):
        if self.pf.filename:
            dDir = os.path.dirname(self.pf.filename)
            dFile = os.path.basename(self.pf.filename)
        else:
            dDir = self.lastDir
            dFile = u""

        dlg = wx.FileDialog(cfgFrame, "Choose font file",
            defaultDir = dDir, defaultFile = dFile,
            wildcard = "TrueType fonts (*.ttf;*.TTF)|*.ttf;*.TTF|All files|*",
            style = wx.OPEN)

        if dlg.ShowModal() == wx.ID_OK:
            self.fileEntry.SetValue(dlg.GetPath())
            self.fileEntry.SetInsertionPointEnd()

            fname = dlg.GetPath()

            self.nameEntry.SetValue(self.getFontPostscriptName(fname))
            self.lastDir = os.path.dirname(fname)

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

示例2: OnImportScript

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def OnImportScript(self, event = None):
        dlg = wx.FileDialog(self, "File to import",
            misc.scriptDir,
            wildcard = "Importable files (*.txt;*.fdx;*.celtx;*.astx;*.fountain;*.fadein)|" +
                       "*.fdx;*.txt;*.celtx;*.astx;*.fountain;*.fadein|" +
                       "Formatted text files (*.txt)|*.txt|" +
                       "Final Draft XML(*.fdx)|*.fdx|" +
                       "Celtx files (*.celtx)|*.celtx|" +
                       "Adobe Story XML files (*.astx)|*.astx|" +
                       "Fountain files (*.fountain)|*.fountain|" +
                       "Fadein files (*.fadein)|*.fadein|" +
                       "All files|*",
            style = wx.OPEN)

        if dlg.ShowModal() == wx.ID_OK:
            misc.scriptDir = dlg.GetDirectory()

            if not self.tabCtrl.getPage(self.findPage(self.panel))\
                   .ctrl.isUntouched():
                self.panel = self.createNewPanel()

            self.panel.ctrl.importFile(dlg.GetPath())
            self.panel.ctrl.updateScreen()

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

示例3: OnLoadSettings

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

        if dlg.ShowModal() == wx.ID_OK:
            s = util.loadFile(dlg.GetPath(), self)

            if s:
                c = config.ConfigGlobal()
                c.load(s)
                gd.confFilename = dlg.GetPath()

                self.panel.ctrl.applyGlobalCfg(c, False)

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

示例4: OnLoadMesh

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def OnLoadMesh(self, evt):
        dlg = wx.FileDialog(self, "Choose a file", ".", "", "OFF files (*.off)|*.off|TOFF files (*.toff)|*.toff|OBJ files (*.obj)|*.obj", wx.OPEN)
        if dlg.ShowModal() == wx.ID_OK:
            filename = dlg.GetFilename()
            dirname = dlg.GetDirectory()
            filepath = os.path.join(dirname, filename)
            print dirname
            self.glcanvas.mesh = PolyMesh()
            print "Loading mesh %s..."%filename
            self.glcanvas.mesh.loadFile(filepath)
            self.glcanvas.meshCentroid = self.glcanvas.mesh.getCentroid()
            self.glcanvas.meshPrincipalAxes = self.glcanvas.mesh.getPrincipalAxes()
            print "Finished loading mesh"
            print self.glcanvas.mesh
            self.glcanvas.initMeshBBox()
            self.glcanvas.Refresh()
        dlg.Destroy()
        return 
开发者ID:bmershon,项目名称:laplacian-meshes,代码行数:20,代码来源:meshView.py

示例5: new_external_profile

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def new_external_profile(self, event):
        """Prompt for an external miner path, then create a miner.

        On Windows we validate against legal miners; on Linux they can pick
        whatever they want.
        """
        wildcard = _('External miner (*.exe)|*.exe|(*.py)|*.py') if sys.platform == 'win32' else '*.*'
        dialog = wx.FileDialog(self,
                               _("Select external miner:"),
                               defaultDir=os.path.join(get_module_path(), 'miners'),
                               defaultFile="",
                               wildcard=wildcard,
                               style=wx.OPEN)
        if dialog.ShowModal() != wx.ID_OK:
            return

        if sys.platform == 'win32' and dialog.GetFilename() not in SUPPORTED_BACKENDS:
            self.message(
                _("Unsupported external miner %(filename)s. Supported are: %(supported)s") % \
                  dict(filename=dialog.GetFilename(), supported='\n'.join(SUPPORTED_BACKENDS)),
                _("Miner not supported"), wx.OK | wx.ICON_ERROR)
            return
        path = os.path.join(dialog.GetDirectory(), dialog.GetFilename())
        dialog.Destroy()
        self.name_new_profile(extra_profile_data=dict(external_path="CGMINER")) 
开发者ID:theRealTacoTime,项目名称:poclbm,代码行数:27,代码来源:guiminer.py

示例6: OnProfileChoice

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def OnProfileChoice(self, event):
        if self.Profile.GetStringSelection() == _("Other"):
            dialog = wx.FileDialog(self, _("Choose a file"), self.Directory, "",  _("OD Profile files (*.prf)|*.prf|All files|*.*"), wx.OPEN|wx.CHANGE_DIR)
            dialog.ShowModal()
            filepath = dialog.GetPath()
            dialog.Destroy()
            if os.path.isfile(filepath):
                name = os.path.splitext(os.path.basename(filepath))[0]
                self.ListProfile[name] = filepath
                length = self.Profile.GetCount()
                self.Profile.Insert(name, length - 2)
                self.Profile.SetStringSelection(name)
            else:
                self.Profile.SetStringSelection(_("None"))
        event.Skip()


#-------------------------------------------------------------------------------
#                            ADD Slave to NodeList Dialog
#------------------------------------------------------------------------------- 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:22,代码来源:commondialogs.py

示例7: OnImportEDSButton

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def OnImportEDSButton(self, event):
        dialog = wx.FileDialog(self,
                               _("Choose an EDS file"),
                               os.path.expanduser("~"),
                               "",
                               _("EDS files (*.eds)|*.eds|All files|*.*"),
                               wx.OPEN)
        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
        else:
            filepath = ""
        dialog.Destroy()
        if os.path.isfile(filepath):
            result, question = self.NodeList.ImportEDSFile(filepath)
            if result is not None and question:
                dialog = wx.MessageDialog(self, _("%s\nWould you like to replace it ?")%result, _("Question"), wx.YES_NO|wx.ICON_QUESTION)
                if dialog.ShowModal() == wx.ID_YES:
                    result, question = self.NodeList.ImportEDSFile(filepath, True)
                dialog.Destroy()
            if result is not None and not question:
                dialog = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR)
                dialog.ShowModal()
                dialog.Destroy()
        self.RefreshEDSFile()
        event.Skip() 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:27,代码来源:commondialogs.py

示例8: OnOpen

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def OnOpen(self, evt):
        if not self.AskSave(): return
        dlg = wx.FileDialog(self, 'Open', os.path.dirname(self.dataFile),
                           '', '*.xrc', wx.OPEN | wx.CHANGE_DIR)
        if dlg.ShowModal() == wx.ID_OK:
            path = dlg.GetPath()
            self.SetStatusText('Loading...')
            wx.BeginBusyCursor()
            try:
                if self.Open(path):
                    self.SetStatusText('Data loaded')
                else:
                    self.SetStatusText('Failed')
                self.SaveRecent(path)
            finally:
                wx.EndBusyCursor()
        dlg.Destroy() 
开发者ID:andreas-p,项目名称:admin4,代码行数:19,代码来源:xrced.py

示例9: Open

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def Open(self, filePath=None):
        self.ShowFrame()
        if filePath is not None:
            res = wx.MessageBox(
                "Do you really want to load the tree file:\n%s" % filePath,
                eg.APP_NAME,
                wx.YES_NO | wx.CENTRE | wx.ICON_QUESTION,
                parent = self.frame,
            )
            if res == wx.ID_NO:
                return wx.ID_CANCEL
        if self.CheckFileNeedsSave() == wx.ID_CANCEL:
            return wx.ID_CANCEL
        if filePath is None:
            filePath = self.AskFile(wx.OPEN)
        if filePath is None:
            return wx.ID_CANCEL
        self.StartSession(filePath) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:20,代码来源:Document.py

示例10: OnButtonReadFromBinFile

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def OnButtonReadFromBinFile(self, event):
        """
        Load binary file through FileDialog
        Binded to 'Read from File' button.
        @param event : wx.EVT_BUTTON object
        """
        dialog = wx.FileDialog(self, _("Choose a binary file"), os.getcwd(), "",
                               _("bin files (*.bin)|*.bin"), wx.OPEN)

        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()

            try:
                binfile = open(filepath, "rb")
                self.SiiBinary = binfile.read()
                self.HexCode, self.HexRow, self.HexCol = self.Controler.CommonMethod.HexRead(self.SiiBinary)
                self.UpdateSiiGridTable(self.HexRow, self.HexCol)
                self.SiiGrid.SetValue(self.HexCode)
                self.SiiGrid.Update()
            except Exception:
                self.Controler.CommonMethod.CreateErrorDialog(_('The file does not exist!'))

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

示例11: OnImportButton

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def OnImportButton(self, event):
        dialog = wx.FileDialog(self.ParentWindow,
                               _("Choose an XML file"),
                               os.getcwd(), "",
                               _("XML files (*.xml)|*.xml|All files|*.*"),
                               wx.OPEN)

        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
            if self.ModuleLibrary.ImportModuleLibrary(filepath):
                wx.CallAfter(self.RefreshView)
            else:
                message = wx.MessageDialog(self,
                                           _("No such XML file: %s\n") % filepath,
                                           _("Error"),
                                           wx.OK | wx.ICON_ERROR)
                message.ShowModal()
                message.Destroy()
        dialog.Destroy()

        event.Skip() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:23,代码来源:ConfigEditor.py

示例12: method_load_file

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def method_load_file(self):
		import os
		wildcard = 'music sounds (MO3, IT, XM, S3M, MTM, MOD, UMX)|*.mo3;*.it;*.xm;*.s3m;*.mtm;*.mod;*.umx'
		wildcard += '|stream sounds (MP3, MP2, MP1, OGG, WAV, AIFF)|*.mp3;*.mp2;*.mp1;*.ogg;*.wav;*.aiff'
		for plugin in self.plugins.itervalues():
			if plugin[0] > 0:
				wildcard += plugin[1]
		wildcard += '|All files (*.*)|*.*'
		dlg = wx.FileDialog(self, message = _('Choose a file'), defaultDir = os.getcwd(),  defaultFile = '', wildcard = wildcard, style = wx.OPEN|wx.CHANGE_DIR)
		if dlg.ShowModal() == wx.ID_OK:
			self.name_stream = file_name = dlg.GetPath()
			if os.path.isfile(file_name):
				flags = 0
				if isinstance(file_name, unicode):
					flags |= pybass.BASS_UNICODE
					try:
						pybass.BASS_CHANNELINFO._fields_.remove(('filename', pybass.ctypes.c_char_p))
					except:
						pass
					else:
						pybass.BASS_CHANNELINFO._fields_.append(('filename', pybass.ctypes.c_wchar_p))
				error_msg = 'BASS_StreamCreateFile error'
				new_bass_handle = 0
				if dlg.GetFilterIndex() == 0:#BASS_CTYPE_MUSIC_MOD
					flags |= pybass.BASS_MUSIC_PRESCAN
					new_bass_handle = pybass.BASS_MusicLoad(False, file_name, 0, 0, flags, 0)
					error_msg = 'BASS_MusicLoad error'
				else:#other sound types
					new_bass_handle = pybass.BASS_StreamCreateFile(False, file_name, 0, 0, flags)
				if new_bass_handle == 0:
					print error_msg, pybass.get_error_description(pybass.BASS_ErrorGetCode())
				else:
					self.method_stop_audio()
					self.bass_handle = new_bass_handle
					self.stream = None
					self.method_slider_set_range()
					self.method_check_controls() 
开发者ID:Wyliodrin,项目名称:pybass,代码行数:39,代码来源:wx_bass_control.py

示例13: method_load_wav_file

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def method_load_wav_file(self):
		import os
		wildcard = 'wav (*.wav)|*.wav|All files (*.*)|*.*'
		dlg = wx.FileDialog(self, message = _('Choose a file'), defaultDir = os.getcwd(),  defaultFile = '', wildcard = wildcard, style = wx.OPEN|wx.CHANGE_DIR)
		if dlg.ShowModal() == wx.ID_OK:
			self.name_stream = file_name = dlg.GetPath()
			if os.path.isfile(file_name):
				flags = 0
				if isinstance(file_name, unicode):
					flags |= pybass.BASS_UNICODE
					try:
						pybass.BASS_CHANNELINFO._fields_.remove(('filename', pybass.ctypes.c_char_p))
					except:
						pass
					else:
						pybass.BASS_CHANNELINFO._fields_.append(('filename', pybass.ctypes.c_wchar_p))
				def stream_callback(handle, buffer, length, user):
					b = pybass.ctypes.cast(buffer, pybass.ctypes.c_char_p)
					pybass.ctypes.memset(b, 0, length)
					data = pybass.ctypes.c_char_p(self.stream.read(length))
					pybass.ctypes.memmove(b, data, length)
					if self.stream.is_eof():
						length |= pybass.BASS_STREAMPROC_END
						self.stream.current_position = 0
					return length
				self.stream_callback = stream_callback
				self.user_func = pybass.STREAMPROC(self.stream_callback)
				self.stream = memory_stream(open(file_name, 'rb').read(), file_name)
				new_bass_handle = pybass.BASS_StreamCreate(44100, 2, flags, self.user_func, 0)
				if new_bass_handle == 0:
					print 'BASS_StreamCreate error', pybass.get_error_description(pybass.BASS_ErrorGetCode())
				else:
					self.method_stop_audio()
					self.bass_handle = new_bass_handle
					self.stream = None
					self.method_slider_set_range()
					self.method_check_controls() 
开发者ID:Wyliodrin,项目名称:pybass,代码行数:39,代码来源:wx_bass_control.py

示例14: method_load_wav_file

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def method_load_wav_file(self):
		import os
		wildcard = 'wav (*.wav)|*.wav|All files (*.*)|*.*'
		dlg = wx.FileDialog(self, message = _('Choose a file'), defaultDir = os.getcwd(),  defaultFile = '', wildcard = wildcard, style = wx.OPEN|wx.CHANGE_DIR)
		if dlg.ShowModal() == wx.ID_OK:
			self.name_stream = file_name = dlg.GetPath()
			if os.path.isfile(file_name):
				flags = 0
				if isinstance(file_name, unicode):
					flags |= pybass.BASS_UNICODE
					try:
						pybass.BASS_CHANNELINFO._fields_.remove(('filename', pybass.ctypes.c_char_p))
					except:
						pass
					else:
						pybass.BASS_CHANNELINFO._fields_.append(('filename', pybass.ctypes.c_wchar_p))
				def stream_callback(handle, buffer, length, user):
					b = pybass.ctypes.cast(buffer, pybass.ctypes.c_char_p)
					pybass.ctypes.memset(b, 0, length)
					data = pybass.ctypes.c_char_p(self.stream.read(length))
					pybass.ctypes.memmove(b, data, length)
					if self.stream.is_eof():
						length |= pybass.BASS_STREAMPROC_END
						self.stream.current_position = 0
					return length
				self.stream_callback = stream_callback
				self.user_func = pybass.STREAMPROC(self.stream_callback)
				self.stream = memory_stream(open(file_name, 'rb').read(), file_name)
				new_bass_handle = pybass.BASS_StreamCreate(44100, 2, flags, self.user_func, 0)
				if new_bass_handle == 0:
					print('BASS_StreamCreate error %s' % pybass.get_error_description(pybass.BASS_ErrorGetCode()))
				else:
					self.method_stop_audio()
					self.bass_handle = new_bass_handle
					self.stream = None
					self.method_slider_set_range()
					self.method_check_controls() 
开发者ID:Wyliodrin,项目名称:pybass,代码行数:39,代码来源:wx_ctrl_phoenix.py

示例15: OnBrowsePDF

# 需要导入模块: import wx [as 别名]
# 或者: from wx import OPEN [as 别名]
def OnBrowsePDF(self, event):
        dlg = wx.FileDialog(
            cfgFrame, "Choose program",
            os.path.dirname(self.cfg.pdfViewerPath),
            self.cfg.pdfViewerPath, style = wx.OPEN)

        if dlg.ShowModal() == wx.ID_OK:
            self.progEntry.SetValue(dlg.GetPath())

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


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