1 from pysize
.core
.pysize_fs_tree
import pysize_tree
2 from pysize
.core
.observable
import observable
6 next_insertion_index
= 0
7 history_observable
= observable()
10 global next_insertion_index
12 same
= next_insertion_index
and fp
== history
[next_insertion_index
- 1][0]
14 if next_insertion_index
== len(history
):
15 # History is being written
18 paths
, name
= history
[next_insertion_index
]
20 # History took another path, clear the remaining forward history
21 del history
[next_insertion_index
+ 1:]
22 history
[next_insertion_index
] = fp
, tree
.root
.get_name()
23 next_insertion_index
+= 1
24 history_observable
.fire_observers(next_insertion_index
, history
)
26 def go_to_history(index
):
27 global next_insertion_index
28 entry
= history
[index
][0]
29 next_insertion_index
= index
+ 1
30 history_observable
.fire_observers(next_insertion_index
, history
)
34 if len(history
) > next_insertion_index
:
35 return go_to_history(next_insertion_index
)
38 if next_insertion_index
> 1:
39 return go_to_history(next_insertion_index
- 2)