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


Python wx.CHANGE_DIR属性代码示例

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


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

示例1: SaveAs

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CHANGE_DIR [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

示例2: OnExportEDSMenu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CHANGE_DIR [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

示例3: OnOpen

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CHANGE_DIR [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

示例4: onSelect

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CHANGE_DIR [as 别名]
def onSelect(self, e):
		option = self.actions_options[self.action_select.GetCurrentSelection()][0]
		msg = self.actions_options[self.action_select.GetCurrentSelection()][1]
		field = self.actions_options[self.action_select.GetCurrentSelection()][2]
		if field == 0:
			self.data.Disable()
			self.data.SetValue('')
			self.edit_skkey.Disable()
		if field == 1:
			self.data.Enable()
			self.data.SetFocus()
			self.edit_skkey.Enable()
		if msg:
			if msg == 'OpenFileDialog':
				dlg = wx.FileDialog(self, message=_('Choose a file'), defaultDir=self.currentpath + '/sounds',
									defaultFile='',
									wildcard=_('Audio files').decode('utf8') + ' (*.mp3)|*.mp3|' + _('All files').decode('utf8') + ' (*.*)|*.*',
									style=wx.OPEN | wx.CHANGE_DIR)
				if dlg.ShowModal() == wx.ID_OK:
					file_path = dlg.GetPath()
					self.data.SetValue(file_path)
				print self.currentpath
				os.chdir(self.currentpath)			
				dlg.Destroy()
			else:
				if msg == 0:
					pass
				else:
					if field == 1 and option != _('wait'): 
						msg = msg+ _('\n\nYou can add the current value of any Signal K key typing its name between angle brackets, e.g: <navigation.position.latitude>')
					wx.MessageBox(msg, 'Info', wx.OK | wx.ICON_INFORMATION) 
开发者ID:sailoog,项目名称:openplotter,代码行数:33,代码来源:add_action.py

示例5: OnOpenMenu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CHANGE_DIR [as 别名]
def OnOpenMenu(self, event):
        filepath = self.Manager.GetCurrentFilePath()
        if filepath != "":
            directory = os.path.dirname(filepath)
        else:
            directory = os.getcwd()
        dialog = wx.FileDialog(self, _("Choose a file"), directory, "",  _("OD files (*.od)|*.od|All files|*.*"), wx.OPEN|wx.CHANGE_DIR)
        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
            if os.path.isfile(filepath):
                result = self.Manager.OpenFileInCurrent(filepath)
                if isinstance(result, (IntType, LongType)):
                    new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager)
                    new_editingpanel.SetIndex(result)
                    self.FileOpened.AddPage(new_editingpanel, "")
                    self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
                    if self.Manager.CurrentDS302Defined(): 
                        self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, True)
                    else:
                        self.EditMenu.Enable(ID_OBJDICTEDITEDITMENUDS302PROFILE, False)
                    self.RefreshEditMenu()
                    self.RefreshBufferState()
                    self.RefreshProfileMenu()
                    self.RefreshMainMenu()
                else:
                    message = wx.MessageDialog(self, result, _("Error"), wx.OK|wx.ICON_ERROR)
                    message.ShowModal()
                    message.Destroy()
        dialog.Destroy() 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:31,代码来源:objdictedit.py

示例6: OnImportEDSMenu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CHANGE_DIR [as 别名]
def OnImportEDSMenu(self, event):
        dialog = wx.FileDialog(self, _("Choose a file"), os.getcwd(), "",  _("EDS files (*.eds)|*.eds|All files|*.*"), wx.OPEN|wx.CHANGE_DIR)
        if dialog.ShowModal() == wx.ID_OK:
            filepath = dialog.GetPath()
            if os.path.isfile(filepath):
                result = self.Manager.ImportCurrentFromEDSFile(filepath)
                if isinstance(result, (IntType, LongType)):
                    new_editingpanel = EditingPanel(self.FileOpened, self, self.Manager)
                    new_editingpanel.SetIndex(result)
                    self.FileOpened.AddPage(new_editingpanel, "")
                    self.FileOpened.SetSelection(self.FileOpened.GetPageCount() - 1)
                    self.RefreshBufferState()
                    self.RefreshCurrentIndexList()
                    self.RefreshProfileMenu()
                    self.RefreshMainMenu()
                    message = wx.MessageDialog(self, _("Import 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 file!")%filepath, _("Error"), wx.OK|wx.ICON_ERROR)
                message.ShowModal()
                message.Destroy()
        dialog.Destroy() 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:29,代码来源:objdictedit.py

示例7: OnExportCMenu

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CHANGE_DIR [as 别名]
def OnExportCMenu(self, event):
        dialog = wx.FileDialog(self, _("Choose a file"), os.getcwd(), self.Manager.GetCurrentNodeInfos()[0],  _("CANFestival C files (*.c)|*.c|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 + ".c"
                result = self.Manager.ExportCurrentToCFile(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()


#-------------------------------------------------------------------------------
#                               Exception Handler
#------------------------------------------------------------------------------- 
开发者ID:jgeisler0303,项目名称:CANFestivino,代码行数:29,代码来源:objdictedit.py

示例8: GenerateProgramAs

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CHANGE_DIR [as 别名]
def GenerateProgramAs(self):
        dialog = wx.FileDialog(self, _("Choose a file"), os.getcwd(), os.path.basename(self.Controler.GetProgramFilePath()),  _("ST files (*.st)|*.st|All files|*.*"), wx.SAVE | wx.CHANGE_DIR)
        if dialog.ShowModal() == wx.ID_OK:
            self.GenerateProgram(dialog.GetPath())
        dialog.Destroy() 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:7,代码来源:PLCOpenEditor.py

示例9: OnSaveOrSaveAs

# 需要导入模块: import wx [as 别名]
# 或者: from wx import CHANGE_DIR [as 别名]
def OnSaveOrSaveAs(self, evt):
        if evt.GetId() == wx.ID_SAVEAS or not self.dataFile:
            if self.dataFile: name = ''
            else: name = defaultName
            dirname = os.path.abspath(os.path.dirname(self.dataFile))
            dlg = wx.FileDialog(self, 'Save As', dirname, name, '*.xrc',
                               wx.SAVE | wx.OVERWRITE_PROMPT | wx.CHANGE_DIR)
            if dlg.ShowModal() == wx.ID_OK:
                path = dlg.GetPath()
                if isinstance(path, unicode):
                    path = path.encode(sys.getfilesystemencoding())
                dlg.Destroy()
            else:
                dlg.Destroy()
                return

            if conf.localconf:
                # if we already have a localconf then it needs to be
                # copied to a new config with the new name
                lc = conf.localconf
                nc = self.CreateLocalConf(path)
                flag, key, idx = lc.GetFirstEntry()
                while flag:
                    nc.Write(key, lc.Read(key))
                    flag, key, idx = lc.GetNextEntry(idx)
                conf.localconf = nc
            else:
                # otherwise create a new one
                conf.localconf = self.CreateLocalConf(path)
        else:
            path = self.dataFile
        self.SetStatusText('Saving...')
        wx.BeginBusyCursor()
        try:
            try:
                tmpFile,tmpName = tempfile.mkstemp(prefix='xrced-')
                os.close(tmpFile)
                self.Save(tmpName) # save temporary file first
                shutil.move(tmpName, path)
                self.dataFile = path
                if conf.localconf.ReadBool("autogenerate", False):
                    pypath = conf.localconf.Read("filename")
                    embed = conf.localconf.ReadBool("embedResource", False)
                    genGettext = conf.localconf.ReadBool("genGettext", False)
                    self.GeneratePython(self.dataFile, pypath, embed, genGettext)
                    
                self.SetStatusText('Data saved')
                self.SaveRecent(path)
            except IOError:
                self.SetStatusText('Failed')
        finally:
            wx.EndBusyCursor() 
开发者ID:andreas-p,项目名称:admin4,代码行数:54,代码来源:xrced.py


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