本文整理汇总了Python中editxt.project.Project.create_with_path方法的典型用法代码示例。如果您正苦于以下问题:Python Project.create_with_path方法的具体用法?Python Project.create_with_path怎么用?Python Project.create_with_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.project.Project
的用法示例。
在下文中一共展示了Project.create_with_path方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_create_with_path
# 需要导入模块: from editxt.project import Project [as 别名]
# 或者: from editxt.project.Project import create_with_path [as 别名]
def test_create_with_path():
path = "/temp/non-existent/project.edxt"
assert not os.path.exists(path)
result = Project.create_with_path(path)
try:
eq_(result.path, path)
finally:
result.close()
示例2: iter_dropped_paths
# 需要导入模块: from editxt.project import Project [as 别名]
# 或者: from editxt.project.Project import create_with_path [as 别名]
def iter_dropped_paths(self, pasteboard):
from editxt.document import TextDocument
if not pasteboard.types().containsObject_(ak.NSFilenamesPboardType):
raise StopIteration()
for path in pasteboard.propertyListForType_(ak.NSFilenamesPboardType):
if Project.is_project_path(path):
proj = self.app.find_project_with_path(path)
if proj is None:
proj = Project.create_with_path(path)
yield proj
else:
yield TextDocument.get_with_path(path)
示例3: do_load_project
# 需要导入模块: from editxt.project import Project [as 别名]
# 或者: from editxt.project.Project import create_with_path [as 别名]
def do_load_project(path):
import editxt.project as mod
m = Mocker()
create_document_view_with_state = m.method(Project.create_document_view_with_state)
create_document_view_with_state(ANY)
with m:
proj = Project.create_with_path(path)
try:
assert proj.path == path
assert len(proj.documents()) == 1
finally:
proj.close()