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


Python Misc.convertMacFilename方法代码示例

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


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

示例1: OnSSLButton

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import convertMacFilename [as 别名]
 def OnSSLButton(self, event):
     """ Handle the Browse buttons for the SSL Client Certificate and the SSL CLient Key file fields """
     # Define the File Type as *.pem files
     fileType = '*.pem'
     fileTypesString = _("SSL Certificate Files (*.pem)|*.pem|All files (*.*)|*.*")
     if event.GetId() == self.sslClientCertBrowse.GetId():
         prompt = _("Select the SSL Client Certificate file")
         fileName = self.sslClientCert.GetValue()
     elif event.GetId() == self.sslClientKeyBrowse.GetId():
         prompt = _("Select the SSL Client Key file")
         fileName = self.sslClientKey.GetValue()
     elif event.GetId() == self.sslMsgSrvCertBrowse.GetId():
         prompt = _("Select the SSL Message Server Certificate file")
         fileName = self.sslMsgSrvCert.GetValue()
     (path, flnm) = os.path.split(fileName)
     if path != '':
         self.sslDir = path
     # Invoke the File Selector with the proper default directory, filename, file type, and style
     fs = wx.FileSelector(prompt, self.sslDir, fileName, fileType, fileTypesString, wx.OPEN | wx.FILE_MUST_EXIST)
     # If user didn't cancel ..
     if fs != "":
         # Mac Filenames use a different encoding system.  We need to adjust the string returned by the FileSelector.
         # Surely there's an easier way, but I can't figure it out.
         if 'wxMac' in wx.PlatformInfo:
             import Misc
             fs = Misc.convertMacFilename(fs)
         if event.GetId() == self.sslClientCertBrowse.GetId():
             self.sslClientCert.SetValue(fs)
         elif event.GetId() == self.sslClientKeyBrowse.GetId():
             self.sslClientKey.SetValue(fs)
         elif event.GetId() == self.sslMsgSrvCertBrowse.GetId():
             self.sslMsgSrvCert.SetValue(fs)
         (path, flnm) = os.path.split(fs)
         if path != '':
             self.sslDir = path
开发者ID:jdittrich,项目名称:Transana,代码行数:37,代码来源:UsernameandPasswordClass.py

示例2: OnBrowse

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import convertMacFilename [as 别名]
 def OnBrowse(self, evt):
     """Invoked when the user activates the Browse button."""
     # As long as we have fewer files than the max allowed ...
     if (self.fname_lb.GetCount() < MEDIAFILEMAX) or (self.fname_lb.GetString(0) == ''):
         # ... reset the object's MAIN filename to the top item in the list (if there is one)
         if self.fname_lb.GetCount() > 0:
             self.obj.media_filename = self.fname_lb.GetString(0)
         # Get the directory for that MAIN file name
         dirName = os.path.dirname(self.obj.media_filename)
         # If no path can be extracted from the file name, start with the Video Root Folder
         if dirName == '':
             dirName = TransanaGlobal.configData.videoPath
         # Get the File Name portion
         fileName = os.path.basename(self.obj.media_filename)
         # Determine the File's extension
         (fn, ext) = os.path.splitext(self.obj.media_filename)
         # If we have a known File Type or if blank, use "All Media Files".
         # If it's an unrecognized type, go to "All Files"
         if (TransanaGlobal.configData.LayoutDirection == wx.Layout_LeftToRight) and \
            (ext.lower() in ['.mpg', '.avi', '.mov', '.mp4', '.m4v', '.wmv', '.mp3', '.wav', '.wma', '.aac', '']):
             fileType =  '*.mpg;*.avi;*.mov;*.mp4;*.m4v;*.wmv;*.mp3;*.wav;*.wma;*.aac'
         elif (TransanaGlobal.configData.LayoutDirection == wx.Layout_RightToLeft) and \
            (ext.lower() in ['.mpg', '.avi', '.wmv', '.mp3', '.wav', '.wma', '.aac', '']):
             fileType =  '*.mpg;*.avi;*.wmv;*.mp3;*.wav;*.wma;*.aac'
         else:
             fileType = ''
         # Invoke the File Selector with the proper default directory, filename, file type, and style
         fs = wx.FileSelector(_("Select a media file"),
                         dirName,
                         fileName,
                         fileType, 
                         _(TransanaConstants.fileTypesString), 
                         wx.OPEN | wx.FILE_MUST_EXIST)
         # If user didn't cancel ..
         if fs != "":
             # Mac Filenames use a different encoding system.  We need to adjust the string returned by the FileSelector.
             # Surely there's an easier way, but I can't figure it out.
             if 'wxMac' in wx.PlatformInfo:
                 fs = Misc.convertMacFilename(fs)
             # If we have a non-blank line first line in the filenames list in the form ...
             if (self.fname_lb.GetCount() > 0) and (self.fname_lb.GetString(0).strip() != ''):
                 # ... add the file name to the end of the control
                 self.fname_lb.Append(fs)
                 # ... and add the file name to the Episode object as an ADDITIONAL media file
                 self.obj.additional_media_files = {'filename' : fs,
                                                    'length'   : 0,
                                                    'offset'   : 0,
                                                    'audio'    : 1 }
             # If we don't have a first media file defined ...
             else:
                 # ... set the filename as the MAIN media file for the Episode object
                 self.obj.media_filename = fs
                 # ... Clear the filename listbox
                 self.fname_lb.Clear()
                 # ... add the filename as the first line
                 self.fname_lb.Append(fs)
                 # If the form's ID field is empty ...
                 if self.id_edit.GetValue() == '':
                     # ... get the base filename
                     tempFilename = os.path.basename(fs)
                     # ... separate the filename root and extension
                     (self.obj.id, tempExt) = os.path.splitext(tempFilename)
                     # ... and set the ID to match the base file name
                     self.id_edit.SetValue(self.obj.id)
             self.OnMediaFilenameEdit(evt)
     # If we have the maximum number of media files already selected ...
     else:
         if MEDIAFILEMAX == 1:
             # ... Display an error message to the user.
             msg = _('Only one media file is allowed at a time in this version of Transana.')
         else:
             # ... Display an error message to the user.
             msg = _('A maximum of %d media files is allowed.') % MEDIAFILEMAX
         if 'unicode' in wx.PlatformInfo:
             # Encode with UTF-8 rather than TransanaGlobal.encoding because this is a prompt, not DB Data.
              msg = unicode(msg, 'utf8')
         dlg = Dialogs.ErrorDialog(self, msg)
         dlg.ShowModal()
         dlg.Destroy()
开发者ID:EmmaZh,项目名称:Transana,代码行数:81,代码来源:EpisodePropertiesForm.py


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