Support random check out different snapshot
This commit is contained in:
50
new_demo.py
50
new_demo.py
@@ -1,5 +1,40 @@
|
||||
from tjnetwork_new import *
|
||||
|
||||
def demo_snapshot():
|
||||
p = "demo_snapshot"
|
||||
|
||||
if is_project_open(p):
|
||||
close_project(p)
|
||||
|
||||
if have_project(p):
|
||||
delete_project(p)
|
||||
|
||||
create_project(p)
|
||||
open_project(p)
|
||||
|
||||
add_junction(p, 'j-1', 10.0, 20.0, 30.0)
|
||||
add_junction(p, 'j-2', 10.0, 20.0, 30.0)
|
||||
add_junction(p, 'j-3', 10.0, 20.0, 30.0)
|
||||
add_junction(p, 'j-4', 10.0, 20.0, 30.0)
|
||||
take_snapshot(p, "1-2-3-4")
|
||||
|
||||
undo(p)
|
||||
undo(p)
|
||||
undo(p)
|
||||
undo(p)
|
||||
|
||||
add_junction(p, 'j-5', 10.0, 20.0, 30.0)
|
||||
add_junction(p, 'j-6', 10.0, 20.0, 30.0)
|
||||
add_junction(p, 'j-7', 10.0, 20.0, 30.0)
|
||||
add_junction(p, 'j-8', 10.0, 20.0, 30.0)
|
||||
take_snapshot(p, "5-6-7-8")
|
||||
|
||||
pick_snapshot(p, "1-2-3-4")
|
||||
|
||||
close_project(p)
|
||||
# delete_project(p)
|
||||
|
||||
|
||||
def demo_1_title():
|
||||
p = "demo_1_title"
|
||||
|
||||
@@ -27,7 +62,8 @@ def demo_1_title():
|
||||
print(get_title(p)) #
|
||||
|
||||
close_project(p)
|
||||
delete_project(p)
|
||||
# delete_project(p)
|
||||
|
||||
|
||||
def demo_2_junctions():
|
||||
p = "demo_2_junctions"
|
||||
@@ -77,9 +113,15 @@ def demo_2_junctions():
|
||||
undo(p)
|
||||
print(get_junction_coord(p, j)) # {'x': 10.0, 'y': 20.0}
|
||||
|
||||
redo(p)
|
||||
print(get_junction_coord(p, j)) # {'x': 100.0, 'y': 200.0}
|
||||
|
||||
close_project(p)
|
||||
delete_project(p)
|
||||
# delete_project(p)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
demo_1_title()
|
||||
demo_2_junctions()
|
||||
demo_snapshot()
|
||||
# demo_1_title()
|
||||
# demo_2_junctions()
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user