本文整理汇总了Python中sidebar.SideBarItem.SideBarItem.write方法的典型用法代码示例。如果您正苦于以下问题:Python SideBarItem.write方法的具体用法?Python SideBarItem.write怎么用?Python SideBarItem.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sidebar.SideBarItem.SideBarItem
的用法示例。
在下文中一共展示了SideBarItem.write方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from sidebar.SideBarItem import SideBarItem [as 别名]
# 或者: from sidebar.SideBarItem.SideBarItem import write [as 别名]
def run(self, paths = []):
item = SideBarItem(os.path.join(sublime.packages_path(), 'User', 'SideBarEnhancements', 'Open With', 'Side Bar.sublime-menu'), False)
if not item.exists():
item.create()
item.write("""[
{"id": "side-bar-files-open-with",
"children":
[
//application 1
{
"caption": "Photoshop",
"id": "side-bar-files-open-with-photoshop",
"command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "Adobe Photoshop CS5.app", // OSX
"extensions":"psd|png|jpg|jpeg" //any file with these extensions
}
},
{"caption":"-"}
]
}
]""");
item.edit()
示例2: run
# 需要导入模块: from sidebar.SideBarItem import SideBarItem [as 别名]
# 或者: from sidebar.SideBarItem.SideBarItem import write [as 别名]
def run(self, paths = []):
item = SideBarItem(os.path.join(sublime.packages_path(), 'User', 'SideBarEnhancements', 'Open With', 'Side Bar.sublime-menu'), False)
if not item.exists():
item.create()
item.write("""[
{"id": "side-bar-files-open-with",
"children":
[
//application 1
{
"caption": "Photoshop",
"id": "side-bar-files-open-with-photoshop",
"command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "Adobe Photoshop CS5.app", // OSX
"extensions":"psd|png|jpg|jpeg" //any file with these extensions
}
},
//separator
{"caption":"-"},
//application 2
{
"caption": "SeaMonkey",
"id": "side-bar-files-open-with-seamonkey",
"command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "C:\\\\Archivos de programa\\\\SeaMonkey\\\\seamonkey.exe", // WINNT
"extensions":"" //open all even folders
}
},
//application n
{
"caption": "Chrome",
"id": "side-bar-files-open-with-chrome",
"command": "side_bar_files_open_with",
"args": {
"paths": [],
"application": "C:\\\\Documents and Settings\\\\tito\\\\Configuración local\\\\Datos de programa\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe",
"extensions":".*" //any file with extension
}
},
{"caption":"-"}
]
}
]""");
item.edit()