@@ -794,7 +794,7 @@ def delete_element():
794
794
hierarchy_index = reference_key [1 ]
795
795
section_id = reference_key [2 ]
796
796
797
- augment_element_onto_list (None , 'DELETE' , reference_element , hierarchy_index , section_id , None )
797
+ augment_element_onto_list (None , 'DELETE' , reference_element , hierarchy_index , section_id , metadata = ' ' . join ( reference_key ) )
798
798
799
799
800
800
def augment_element_onto_list (element , augment_type , reference_element , hierarchy_index , section_id , element_index = None , metadata = None ):
@@ -808,7 +808,7 @@ def augment_element_onto_list(element, augment_type, reference_element, hierarch
808
808
element_index: the index the element is supposed to be at. Used for undo and redo
809
809
metadata: custom extra data that is needed for certin operations
810
810
'''
811
- print (element , augment_type , reference_element , hierarchy_index , section_id , element_index )
811
+ print (element , augment_type , reference_element , hierarchy_index , section_id , element_index , metadata )
812
812
local_section_id = 0
813
813
814
814
for todolist in data :
@@ -822,6 +822,7 @@ def augment_element_onto_list(element, augment_type, reference_element, hierarch
822
822
for task in [task for task in todolist if type (task ) is dict ]:
823
823
if reference_element in task and hierarchy_index == '00' :
824
824
if augment_type == 'DELETE' :
825
+ add_to_last (('delete_element' , metadata , task , todolist .index (task )))
825
826
todolist .remove (task )
826
827
elif augment_type == 'INSERT' :
827
828
todolist .insert (todolist .index (task ), element )
@@ -844,6 +845,7 @@ def augment_element_onto_list(element, augment_type, reference_element, hierarch
844
845
for section in [section for section in todolist if type (section ) is list ]:
845
846
if reference_element in section [0 ] and hierarchy_index == '00' :
846
847
if augment_type == 'DELETE' :
848
+ add_to_last (('delete_element' , metadata , section , todolist .index (section )))
847
849
todolist .remove (section )
848
850
elif augment_type == 'INSERT' :
849
851
todolist .insert (todolist .index (section ), element )
@@ -872,6 +874,7 @@ def augment_element_onto_list(element, augment_type, reference_element, hierarch
872
874
for task in [task for task in section if type (task ) is dict ]:
873
875
if reference_element in task and int (section_id ) == local_section_id :
874
876
if augment_type == 'DELETE' :
877
+ add_to_last (('delete_element' , metadata , task , section .index (task )))
875
878
section .remove (task )
876
879
elif augment_type == 'INSERT' :
877
880
section .insert (section .index (task ), element )
@@ -898,6 +901,7 @@ def augment_element_onto_list(element, augment_type, reference_element, hierarch
898
901
return create_new_window ()
899
902
if reference_element in subsection [0 ] and int (section_id ) == local_section_id :
900
903
if augment_type == 'DELETE' :
904
+ add_to_last (('delete_element' , metadata , subsection , section .index (subsection )))
901
905
section .remove (subsection )
902
906
elif augment_type == 'INSERT' :
903
907
section .insert (section .index (subsection ), element )
@@ -932,6 +936,7 @@ def augment_element_onto_list(element, augment_type, reference_element, hierarch
932
936
subsection .insert (subsection .index (task ), taskToInsert )
933
937
else :
934
938
if augment_type == 'DELETE' :
939
+ add_to_last (('delete_element' , metadata , task , subsection .index (task )))
935
940
subsection .remove (task )
936
941
elif augment_type == 'INSERT' :
937
942
subsection .insert (subsection .index (task ), element )
0 commit comments