@@ -282,22 +282,28 @@ def create_main_layout(self):
282282 allow_drag = False ,
283283 )
284284
285- all_zones = [f'zone{ a } ' for a in range (1 ,9 )]
285+ gs = self .make_half_layout (gs , ['zone1' , 'zone2' , 'zone5' , 'zone6' ], layout_zone , 0 )
286+ gs = self .make_half_layout (gs , ['zone3' , 'zone4' , 'zone7' , 'zone8' ], layout_zone , 2 )
287+
288+ self .main_layout = gs
289+
290+ def make_half_layout (self , gs , all_zones , layout_zone , shift ):
291+
286292 is_zone = [(layout_zone .get (zone ) is not None ) and (len (layout_zone .get (zone )) > 0 ) for zone in all_zones ]
287- is_zone_array = np .reshape (is_zone , (2 ,4 ))
293+ is_zone_array = np .reshape (is_zone , (2 ,2 ))
288294 original_zone_array = copy (is_zone_array )
289295
290- for zone_index in range ( 8 ):
291- row = zone_index // 4
292- col = zone_index % 4
296+ for zone_index , zone_name in enumerate ( all_zones ):
297+ row = zone_index // 2
298+ col = zone_index % 2
293299 if row == 0 :
294300 num_rows , num_cols = get_size_top_row (row , col , is_zone_array , original_zone_array )
295301 elif row == 1 :
296302 num_rows , num_cols = get_size_bottom_row (row , col , is_zone_array , original_zone_array )
297303 if num_rows > 0 and num_cols > 0 :
298- gs [slice (row , row + num_rows ), slice (col ,col + num_cols )] = layout_zone .get (f'zone { zone_index + 1 } ' )
304+ gs [slice (row , row + num_rows ), slice (col + shift ,col + num_cols + shift )] = layout_zone .get (zone_name )
299305
300- self . main_layout = gs
306+ return gs
301307
302308 def update_visibility (self , event ):
303309 active = event .new
0 commit comments