本文整理汇总了Python中util.homify函数的典型用法代码示例。如果您正苦于以下问题:Python homify函数的具体用法?Python homify怎么用?Python homify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了homify函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: populateRecentFilesMenu
def populateRecentFilesMenu(self):
self.menu_recent_files.clear()
for url in recentfiles.urls():
f = url.toLocalFile()
dirname, basename = os.path.split(f)
text = "{0} ({1})".format(basename, util.homify(dirname))
self.menu_recent_files.addAction(text).url = url
qutil.addAccelerators(self.menu_recent_files.actions())
开发者ID:brumleygap,项目名称:frescobaldi,代码行数:8,代码来源:mainwindow.py
示例2: action
def action(filename):
url = QUrl.fromLocalFile(filename)
a = QAction(menu)
a.setText(_("Open \"{url}\"").format(url=util.homify(filename)))
a.setIcon(icons.get('document-open'))
@a.triggered.connect
def open_doc():
d = mainwindow.openUrl(url)
mainwindow.setCurrentDocument(d)
return a
开发者ID:satoshi-porin,项目名称:frescobaldi,代码行数:10,代码来源:contextmenu.py
示例3: display
def display(self):
text = util.homify(self._info.command)
if self._info.version():
text += " ({0})".format(self._info.versionString())
self.setIcon(icons.get("lilypond-run"))
else:
self.setIcon(icons.get("dialog-error"))
if self._info.command == self.listWidget().parentWidget().parentWidget()._defaultCommand:
text += " [{0}]".format(_("default"))
self.setText(text)
开发者ID:mbsrz1972,项目名称:frescobaldi,代码行数:10,代码来源:lilypond.py
示例4: menu_file_open_recent
def menu_file_open_recent(parent):
m = QMenu(parent)
m.setTitle(_("Open &Recent"))
m.triggered.connect(slot_file_open_recent_action)
import recentfiles
for url in recentfiles.urls():
f = url.toLocalFile()
dirname, basename = os.path.split(f)
text = "{0} ({1})".format(basename, util.homify(dirname))
m.addAction(text).url = url
qutil.addAccelerators(m.actions())
return m
开发者ID:19joho66,项目名称:frescobaldi,代码行数:12,代码来源:globalmenu.py
示例5: path
def path(url):
"""Returns the path, as a string, of the url to group documents.
Returns None if the document is nameless.
"""
if url.isEmpty():
return None
elif url.toLocalFile():
return util.homify(os.path.dirname(url.toLocalFile()))
else:
return url.resolved(QUrl('.')).toString(QUrl.RemoveUserInfo)
开发者ID:WedgeLeft,项目名称:frescobaldi,代码行数:12,代码来源:widget.py
示例6: prettyName
def prettyName(self):
"""Return a pretty-printable name for this LilyPond instance."""
command = self.abscommand() or ""
# strip unneeded cruft from the command name
outstrip='out/bin/lilypond'
if command.endswith(outstrip):
command=command[:-len(outstrip)]
macstrip='/Contents/Resources/bin/lilypond'
if sys.platform.startswith('darwin') and command.endswith('.app' + macstrip):
command=command[:-len(macstrip)]
return "{name} {version} ({command})".format(
name = self.name,
version = self.versionString(),
command = util.homify(command))
开发者ID:jan-warchol,项目名称:frescobaldi,代码行数:14,代码来源:lilypondinfo.py
示例7: complete
def complete():
target = definition.target(node)
if target:
if target.document is node.document:
a.setText(_("&Jump to definition (line {num})").format(
num = node.document.index(node.document.block(target.position)) + 1))
else:
a.setText(_("&Jump to definition (in {filename})").format(
filename=util.homify(target.document.filename)))
@a.triggered.connect
def activate():
definition.goto_target(mainwindow, target)
else:
a.setText(_("&Jump to definition (unknown)"))
a.setEnabled(False)
开发者ID:EdwardBetts,项目名称:frescobaldi,代码行数:15,代码来源:contextmenu.py
示例8: updateWindowTitle
def updateWindowTitle(self):
doc = self.currentDocument()
name = []
if sessions.currentSession():
name.append(sessions.currentSession() + ":")
if doc:
if doc.url().isEmpty():
name.append(doc.documentName())
elif doc.url().toLocalFile():
name.append(util.homify(doc.url().toLocalFile()))
else:
name.append(doc.url().toString())
if doc.isModified():
# L10N: state of document in window titlebar
name.append(_("[modified]"))
self.setWindowTitle(app.caption(" ".join(name)))
开发者ID:jan-warchol,项目名称:frescobaldi,代码行数:16,代码来源:mainwindow.py
示例9: setDocumentStatus
def setDocumentStatus(self, doc):
if doc in self.docs:
index = self.docs.index(doc)
self.setTabText(index, doc.documentName())
if doc.url().toLocalFile():
tooltip = util.homify(doc.url().toLocalFile())
elif not doc.url().isEmpty():
tooltip = doc.url().toString(QUrl.RemoveUserInfo)
else:
tooltip = None
self.setTabToolTip(index, tooltip)
# icon
if jobmanager.isRunning(doc):
icon = 'lilypond-run'
elif doc.isModified():
icon = 'document-save'
else:
icon = 'text-plain'
self.setTabIcon(index, icons.get(icon))
开发者ID:WedgeLeft,项目名称:frescobaldi,代码行数:19,代码来源:tabbar.py
示例10: setDocumentStatus
def setDocumentStatus(self, doc):
if doc in self.docs:
index = self.docs.index(doc)
self.setTabText(index, doc.documentName().replace('&', '&&'))
if doc.url().toLocalFile():
tooltip = util.homify(doc.url().toLocalFile())
elif not doc.url().isEmpty():
tooltip = doc.url().toString(QUrl.RemoveUserInfo)
else:
tooltip = None
self.setTabToolTip(index, tooltip)
# icon
job = jobmanager.job(doc)
if job and job.is_running() and not jobattributes.get(job).hidden:
icon = 'lilypond-run'
elif doc.isModified():
icon = 'document-save'
else:
icon = 'text-plain'
self.setTabIcon(index, icons.get(icon))
开发者ID:benluo,项目名称:frescobaldi,代码行数:20,代码来源:tabbar.py
示例11: setDocuments
def setDocuments(self, documents):
"""Display the specified documents in the list."""
# clear the treewidget
for d in self.tree.invisibleRootItem().takeChildren():
for i in d.takeChildren():
i.doc = None
# group the documents by directory
dirs = {}
for d in documents:
path = d.url().toLocalFile()
if path:
dirname, filename = os.path.split(path)
dirs.setdefault(dirname, []).append((filename, d))
for dirname in sorted(dirs, key=util.naturalsort):
diritem = QTreeWidgetItem()
diritem.setText(0, util.homify(dirname))
self.tree.addTopLevelItem(diritem)
diritem.setExpanded(True)
diritem.setFlags(Qt.ItemIsEnabled)
diritem.setIcon(0, icons.get('folder-open'))
for filename, document in sorted(dirs[dirname],
key=lambda item: util.naturalsort(item[0])):
fileitem = QTreeWidgetItem()
diritem.addChild(fileitem)
if documentwatcher.DocumentWatcher.instance(document).isdeleted():
itemtext = _("[deleted]")
icon = "dialog-error"
else:
itemtext = _("[modified]")
icon = "document-edit"
fileitem.setIcon(0, icons.get(icon))
fileitem.setText(0, filename)
fileitem.setText(1, itemtext)
fileitem.doc = document
# select the item if there is only one
if len(dirs) == 1 and len(dirs.values()[0]) == 1:
fileitem.setSelected(True)
self.tree.resizeColumnToContents(0)
self.tree.resizeColumnToContents(1)
self.updateButtons()
开发者ID:arnaldorusso,项目名称:frescobaldi,代码行数:40,代码来源:widget.py
示例12: updateWindowTitle
def updateWindowTitle(self):
doc = self.currentDocument()
name = []
if sessions.currentSession():
name.append(sessions.currentSession() + ':')
if doc:
if doc.url().isEmpty():
name.append(doc.documentName())
elif doc.url().toLocalFile():
name.append(util.homify(doc.url().toLocalFile()))
else:
name.append(doc.url().toString())
if doc.isModified():
# L10N: state of document in window titlebar
name.append(_("[modified]"))
window_title = app.caption(" ".join(name))
if vcs.app_is_git_controlled():
window_title += " " + vcs.app_active_branch_window_title()
self.setWindowTitle(window_title)
开发者ID:brumleygap,项目名称:frescobaldi,代码行数:22,代码来源:mainwindow.py
示例13: displaycommand
def displaycommand(self):
"""The path to the command in a format pretty to display.
This removes the 'out/bin/lilypond' part of custom build LilyPond
versions, and on Mac OS X it removes the
'/Contents/Resources/bin/lilypond' part.
Finally it replaces the users home directory with '~'.
The empty string is returned if LilyPond is not installed on the users'
system.
"""
command = self.abscommand()
if command:
outstrip='out/bin/lilypond'
if command.endswith(outstrip):
command=command[:-len(outstrip)]
macstrip='/Contents/Resources/bin/lilypond'
if sys.platform.startswith('darwin') and command.endswith('.app' + macstrip):
command=command[:-len(macstrip)]
return util.homify(command)
else:
return self.command
开发者ID:brownian,项目名称:frescobaldi,代码行数:23,代码来源:lilypondinfo.py
注:本文中的util.homify函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论