本文整理汇总了Python中pyaid.string.StringUtils.StringUtils.slugify方法的典型用法代码示例。如果您正苦于以下问题:Python StringUtils.slugify方法的具体用法?Python StringUtils.slugify怎么用?Python StringUtils.slugify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyaid.string.StringUtils.StringUtils
的用法示例。
在下文中一共展示了StringUtils.slugify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _handleAddApp
# 需要导入模块: from pyaid.string.StringUtils import StringUtils [as 别名]
# 或者: from pyaid.string.StringUtils.StringUtils import slugify [as 别名]
def _handleAddApp(self):
defaultPath = self.appConfig.get('LAST_APP_PATH', OsUtils.getDocumentsPath())
path = PyGlassBasicDialogManager.browseForDirectory(
parent=self,
caption=StringUtils.dedent("""
Specify the root path to a PyGlass application, in which a resource folder
resides"""),
defaultPath=defaultPath)
if not path:
return
label = PyGlassBasicDialogManager.openTextQuery(
parent=self,
header='Enter Application Name',
message='Specify the name of this application for display within Alembic Migrator',
defaultText=os.path.basename(path.rstrip(os.sep)) )
apps = self.appConfig.get('APPLICATIONS', dict())
appData = {
'label':label,
'path':path,
'databases':dict(),
'id':TimeUtils.getUidTimecode('App', StringUtils.slugify(label))}
apps[appData['id']] = appData
self.appConfig.set('APPLICATIONS', apps)
self.refresh()
resultItem = self.appsListWidget.findItems(appData['id'], QtCore.Qt.MatchExactly)
if resultItem:
resultItem[0].setSelected(True)
示例2: cleanFilename
# 需要导入模块: from pyaid.string.StringUtils import StringUtils [as 别名]
# 或者: from pyaid.string.StringUtils.StringUtils import slugify [as 别名]
def cleanFilename(cls, filename):
if not filename:
return StringUtils.getRandomString(12)
out = StringUtils.slugify(filename)
if not out:
return StringUtils.getRandomString(12)
return out
示例3: _handleAddDatabase
# 需要导入模块: from pyaid.string.StringUtils import StringUtils [as 别名]
# 或者: from pyaid.string.StringUtils.StringUtils import slugify [as 别名]
def _handleAddDatabase(self):
result = PyGlassBasicDialogManager.openTextQuery(
parent=self,
header='Enter Database Name',
message='Enter the name of the database as it would appear in the Database URL, e.g. '
+'"activity" or "employees/artists"')
if not result:
return
data = {
'id':TimeUtils.getUidTimecode('DATABASE', StringUtils.slugify(result)),
'label':StringUtils.toText(result).title(),
'name':result }
apps = self.appConfig.get('APPLICATIONS')
app = apps[self.currentAppID]
app['databases'][data['id']] = data
self.appConfig.set('APPLICATIONS', apps)
self._refreshAppDisplay()
resultItem = self.databasesListWidget.findItems(result, QtCore.Qt.MatchExactly)
if resultItem:
resultItem[0].setSelected(True)