本文整理汇总了Python中Foundation.NSURL.fileURLWithPath_isDirectory_方法的典型用法代码示例。如果您正苦于以下问题:Python NSURL.fileURLWithPath_isDirectory_方法的具体用法?Python NSURL.fileURLWithPath_isDirectory_怎么用?Python NSURL.fileURLWithPath_isDirectory_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundation.NSURL
的用法示例。
在下文中一共展示了NSURL.fileURLWithPath_isDirectory_方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_dialog
# 需要导入模块: from Foundation import NSURL [as 别名]
# 或者: from Foundation.NSURL import fileURLWithPath_isDirectory_ [as 别名]
def save_dialog(directory, filename):
panel = NSSavePanel.savePanel()
panel.setTitle_("Save PDF booklet")
myUrl = NSURL.fileURLWithPath_isDirectory_(directory, True)
panel.setDirectoryURL_(myUrl)
panel.setNameFieldStringValue_(filename)
NSApp.activateIgnoringOtherApps_(True)
ret_value = panel.runModal()
if ret_value:
return panel.filename()
else:
return ''
示例2: set_wallpaper
# 需要导入模块: from Foundation import NSURL [as 别名]
# 或者: from Foundation.NSURL import fileURLWithPath_isDirectory_ [as 别名]
def set_wallpaper(screen_index, path):
'''
Set desktop wallpaper for screen at index
CLI Example:
.. code-block:: bash
salt '*' desktop.set_wallpaper 0 '/Library/Desktop Pictures/Solid Colors/Solid Aqua Graphite.png'
'''
workspace = NSWorkspace.sharedWorkspace()
screens = NSScreen.screens()
screen = screens[screen_index]
file_url = NSURL.fileURLWithPath_isDirectory_(path, False)
options = {}
(status, error) = workspace.setDesktopImageURL_forScreen_options_error_(file_url, screen, options, None)
return status