@@ -151,6 +151,9 @@ def __init__(self, window, screen_group, sorting_group, aux_sorting_group, scrol
151151 self .sorting_group = sorting_group
152152 self .aux_sorting_group = aux_sorting_group
153153 sorting_group .empty ()
154+
155+ self .array_config = [self .array_length , 1 , self .array_length ]
156+ self .list = [i for i in range (1 , self .array_length + 1 )]
154157 #print("{},{} {},{}".format(self.SORTING_WIDTH, self.SORTING_HEIGHT, self.SORTING_X - self.SORTING_WIDTH/2, self.SORTING_Y - self.SORTING_HEIGHT/2))
155158 self .array = Array (sorting_group , (self .SORTING_WIDTH , self .SORTING_HEIGHT ), (self .SORTING_X - self .SORTING_WIDTH / 2 , self .SORTING_Y - self .SORTING_HEIGHT / 2 ), 1 , self .array_length , midi )
156159 self .aux_array = None
@@ -162,6 +165,7 @@ def update(self):
162165 # self.scroll_bar[0] = reset scroll
163166 # self.scroll_bar[1] = sort scroll
164167 # Glitch where it will click the button behind it
168+ #print(len(self.list))
165169 if (self .window .options_screen and self .handled != 1 ):
166170 #print("options extended")
167171 self .scroll_bar [0 ].set_unpressable ()
@@ -237,9 +241,9 @@ def func():
237241 for sort_input in Sorting .sorting_algos :
238242 buttons .append (Wrapper .ScrollButton (Wrapper .DefaultText .text (sort_input .name , Wrapper .FontSizes .BUTTON_SIZE ), bind_function (sort_input ), self .window ))
239243
240- resets .append (Wrapper .ScrollButton (Wrapper .DefaultText .text ("Sorted" , Wrapper .FontSizes .BUTTON_SIZE ), self .array .reset , self .window ))
241- resets .append (Wrapper .ScrollButton (Wrapper .DefaultText .text ("Reverse" , Wrapper .FontSizes .BUTTON_SIZE ), self .array .reset , self .window ))
242- resets .append (Wrapper .ScrollButton (Wrapper .DefaultText .text ("Previous File" , Wrapper .FontSizes .BUTTON_SIZE ), self .array .reset , self .window ))
244+ resets .append (Wrapper .ScrollButton (Wrapper .DefaultText .text ("Sorted" , Wrapper .FontSizes .BUTTON_SIZE ), Wrapper . sequential_functions ( self .on_reset , self . array .reset ) , self .window ))
245+ resets .append (Wrapper .ScrollButton (Wrapper .DefaultText .text ("Reverse" , Wrapper .FontSizes .BUTTON_SIZE ), Wrapper . sequential_functions ( self .on_reset , self . array .reverse ) , self .window ))
246+ resets .append (Wrapper .ScrollButton (Wrapper .DefaultText .text ("Previous File" , Wrapper .FontSizes .BUTTON_SIZE ), Wrapper . sequential_functions ( self .on_reset , self . array .load_config ) , self .window ))
243247
244248 # Button Constants
245249 button_col_top = 130 # Where the buttons start
@@ -318,7 +322,9 @@ def custom_array(self):
318322 tkinter .Tk ().withdraw () # prevents an empty tkinter window from appearing
319323 self .file = filedialog .askopenfilename ()
320324 f = open (self .file , 'r' )
321- array_config = list (map (int , f .readline ().split ()))
322- array = list (map (int , f .readline ().split ()))
323- self .array .change_array (array_config [1 ], array_config [2 ], array_config [0 ], array )
325+ self .array_config .clear ()
326+ self .list .clear ()
327+ self .array_config = list (map (int , f .readline ().split ()))
328+ self .list = list (map (int , f .readline ().split ()))
329+ self .array .change_array (self .array_config [1 ], self .array_config [2 ], self .array_config [0 ], self .list )
324330
0 commit comments