@@ -78,26 +78,35 @@ def __init__(
7878 self .saved_bindings : dict [str , Callable ] = {}
7979
8080 # Creating the sidebar frame
81- sidebar_frame = tk .Frame (parent , bg = "#333333" , width = 275 , bd = 0 , highlightthickness = 0 )
82- sidebar_frame .grid (row = 2 , column = 0 , sticky = "nsew" , padx = 0 , pady = 0 )
83- sidebar_frame .grid_propagate (False ) # Preventing frame from resizing
81+ self .sidebar_frame = tk .Frame (parent , bg = "#333333" , width = 275 , bd = 0 , highlightthickness = 0 )
82+ self .sidebar_frame .grid (row = 2 , column = 0 , sticky = "nsew" , padx = 0 , pady = 0 )
83+ self .sidebar_frame .grid_propagate (False ) # Preventing frame from resizing
84+
85+ self .is_sidebar_visible = True
8486
8587 # Configuring grid weights for the sidebar
86- sidebar_frame .grid_rowconfigure (0 , weight = 0 ) # Search bar
87- sidebar_frame .grid_rowconfigure (1 , weight = 0 ) # Chips label
88- sidebar_frame .grid_rowconfigure (2 , weight = 8 ) # Chips area (80%)
89- sidebar_frame .grid_rowconfigure (3 , weight = 0 ) # Manage button
90- sidebar_frame .grid_columnconfigure (0 , weight = 1 )
88+ self . sidebar_frame .grid_rowconfigure (0 , weight = 0 ) # Search bar
89+ self . sidebar_frame .grid_rowconfigure (1 , weight = 0 ) # Chips label
90+ self . sidebar_frame .grid_rowconfigure (2 , weight = 8 ) # Chips area (80%)
91+ self . sidebar_frame .grid_rowconfigure (3 , weight = 0 ) # Manage button
92+ self . sidebar_frame .grid_columnconfigure (0 , weight = 1 )
9193
9294 self .sidebar_grid = SidebarGrid (columns = 2 , visible_rows = 12 , grid_capacity = 24 )
9395
9496 # Creating sidebar components
95- self .create_search_bar (sidebar_frame )
96- self .create_chips_area (sidebar_frame )
97- self .create_manage_button (sidebar_frame )
97+ self .create_search_bar (self . sidebar_frame )
98+ self .create_chips_area (self . sidebar_frame )
99+ self .create_manage_button (self . sidebar_frame )
98100
99101 self .chip_files_mtimes = get_chip_modification_times ()
100102
103+ def toggle_sidebar (self ):
104+ if self .is_sidebar_visible :
105+ self .sidebar_frame .grid_remove ()
106+ else :
107+ self .sidebar_frame .grid ()
108+ self .is_sidebar_visible = not self .is_sidebar_visible
109+
101110 def initialize_chip_data (self , current_dict_circuit , chip_images_path ) -> None :
102111 """
103112 Initializes the chip data for the sidebar.
0 commit comments