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


Python SideBarItem.edit方法代码示例

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


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

示例1: on_done

# 需要导入模块: from sidebar.SideBarItem import SideBarItem [as 别名]
# 或者: from sidebar.SideBarItem.SideBarItem import edit [as 别名]
	def on_done(self, paths, relative_to_project, name):
		if relative_to_project and s.get('new_files_relative_to_project_root'):
			paths = SideBarProject().getDirectories()
			if paths:
				paths = [SideBarItem(paths[0], False)]
			if not paths:
				paths = SideBarSelection(paths).getSelectedDirectoriesOrDirnames()
		else:
			paths = SideBarSelection(paths).getSelectedDirectoriesOrDirnames()
		if not paths:
			paths = SideBarProject().getDirectories()
			if paths:
				paths = [SideBarItem(paths[0], False)]
		if not paths:
			sublime.active_window().new_file()
		else:
			for item in paths:
				item = SideBarItem(item.join(name), False)
				if item.exists():
					sublime.error_message("Unable to create file, file or folder exists.")
					self.run(paths, name)
					return
				else:
					try:
						item.create()
						item.edit()
					except:
						sublime.error_message("Unable to create file:\n\n"+item.path())
						self.run(paths, name)
						return
			SideBarProject().refresh();
开发者ID:Blueprint-Marketing,项目名称:sublime-config,代码行数:33,代码来源:SideBar.py

示例2: run

# 需要导入模块: from sidebar.SideBarItem import SideBarItem [as 别名]
# 或者: from sidebar.SideBarItem.SideBarItem import edit [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()
开发者ID:62Gerente,项目名称:unix,代码行数:29,代码来源:SideBar.py

示例3: run

# 需要导入模块: from sidebar.SideBarItem import SideBarItem [as 别名]
# 或者: from sidebar.SideBarItem.SideBarItem import edit [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()
开发者ID:aokolovskis,项目名称:config,代码行数:57,代码来源:SideBar.py

示例4: on_done

# 需要导入模块: from sidebar.SideBarItem import SideBarItem [as 别名]
# 或者: from sidebar.SideBarItem.SideBarItem import edit [as 别名]
	def on_done(self, old, new):
		item = SideBarItem(old, os.path.isdir(old))
		try:
			if not item.copy(new):
				sublime.error_message("Unable to duplicate, destination exists.")
				self.run([old], new)
				return
		except:
			sublime.error_message("Unable to copy:\n\n"+old+"\n\nto\n\n"+new)
			self.run([old], new)
			return
		item = SideBarItem(new, os.path.isdir(new))
		if item.isFile():
			item.edit();
		SideBarProject().refresh();
开发者ID:Nucc,项目名称:sublime_settings,代码行数:17,代码来源:SideBar.py

示例5: on_done

# 需要导入模块: from sidebar.SideBarItem import SideBarItem [as 别名]
# 或者: from sidebar.SideBarItem.SideBarItem import edit [as 别名]
	def on_done(self, paths, name):
		for item in SideBarSelection(paths).getSelectedDirectoriesOrDirnames():
			item = SideBarItem(item.join(name), False)
			if item.exists():
				sublime.error_message("Unable to create file, file or folder exists.")
				self.run(paths, name)
				return
			else:
				try:
					item.create()
					item.edit()
				except:
					sublime.error_message("Unable to create file:\n\n"+item.path())
					self.run(paths, name)
					return
		SideBarProject().refresh();
开发者ID:aokolovskis,项目名称:config,代码行数:18,代码来源:SideBar.py


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