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


Python Misc.unistrip方法代码示例

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


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

示例1: _set_keyword

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import unistrip [as 别名]
 def _set_keyword(self, keyword):
     # Make sure parenthesis characters are not allowed in Keywords
     if (string.find(keyword, '(') > -1) or (string.find(keyword, ')') > -1):
         keyword = string.replace(keyword, '(', '')
         keyword = string.replace(keyword, ')', '')
         if 'unicode' in wx.PlatformInfo:
             # Encode with UTF-8 rather than TransanaGlobal.encoding because this is a prompt, not DB Data.
             prompt = unicode(_('Keywords cannot contain parenthesis characters.\nYour Keyword has been renamed to "%s".'), 'utf8') % keyword
         else:
             prompt = _('Keywords cannot contain parenthesis characters.\nYour Keyword has been renamed to "%s".') % keyword
         dlg = Dialogs.ErrorDialog(None, prompt)
         dlg.ShowModal()
         dlg.Destroy()
     self._keyword = Misc.unistrip(keyword)
开发者ID:satarsa,项目名称:Transana,代码行数:16,代码来源:KeywordObject.py

示例2: _set_keywordGroup

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import unistrip [as 别名]
 def _set_keywordGroup(self, keywordGroup):
     
     # ALSO SEE Dialogs.add_kw_group_ui().  The same errors are caught there.
 
     # Make sure parenthesis characters are not allowed in Keyword Group.  Remove them if necessary.
     if (string.find(keywordGroup, '(') > -1) or (string.find(keywordGroup, ')') > -1):
         keywordGroup = string.replace(keywordGroup, '(', '')
         keywordGroup = string.replace(keywordGroup, ')', '')
         if 'unicode' in wx.PlatformInfo:
             # Encode with UTF-8 rather than TransanaGlobal.encoding because this is a prompt, not DB Data.
             prompt = unicode(_('Keyword Groups cannot contain parenthesis characters.\nYour Keyword Group has been renamed to "%s".'), 'utf8') % keywordGroup
         else:
             prompt = _('Keyword Groups cannot contain parenthesis characters.\nYour Keyword Group has been renamed to "%s".') % keywordGroup
         dlg = Dialogs.ErrorDialog(None, prompt)
         dlg.ShowModal()
         dlg.Destroy()
     # Colons are not allowed in Keyword Groups.  Remove them if necessary.
     if keywordGroup.find(":") > -1:
         keywordGroup = keywordGroup.replace(':', '')
         if 'unicode' in wx.PlatformInfo:
             msg = unicode(_('You may not use a colon (":") in the Keyword Group name.  Your Keyword Group has been changed to\n"%s"'), 'utf8')
         else:
             msg = _('You may not use a colon (":") in the Keyword Group name.  Your Keyword Group has been changed to\n"%s"')
         dlg = Dialogs.ErrorDialog(None, msg % keywordGroup)
         dlg.ShowModal()
         dlg.Destroy()
     # Let's make sure we don't exceed the maximum allowed length for a Keyword Group.
     # First, let's see what the max length is.
     maxLen = TransanaGlobal.maxKWGLength
     # Check to see if we've exceeded the max length
     if len(keywordGroup) > maxLen:
         # If so, truncate the Keyword Group
         keywordGroup = keywordGroup[:maxLen]
         # Display a message to the user describing the trunctions
         if 'unicode' in wx.PlatformInfo:
             # Encode with UTF-8 rather than TransanaGlobal.encoding because this is a prompt, not DB Data.
             msg = unicode(_('Keyword Group is limited to %d characters.  Your Keyword Group has been changed to\n"%s"'), 'utf8')
         else:
             msg = _('Keyword Group is limited to %d characters.  Your Keyword Group has been changed to\n"%s"')
         dlg = Dialogs.ErrorDialog(None, msg % (maxLen, keywordGroup))
         dlg.ShowModal()
         dlg.Destroy()
     # Remove white space from the Keyword Group.
     self._keywordGroup = Misc.unistrip(keywordGroup)
开发者ID:satarsa,项目名称:Transana,代码行数:46,代码来源:KeywordObject.py

示例3: _set_id

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import unistrip [as 别名]
 def _set_id(self, id):
     self._id = Misc.unistrip(id)
开发者ID:satarsa,项目名称:Transana,代码行数:4,代码来源:DataObject.py


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