@@ -2191,14 +2191,14 @@ def __init__(
21912191
21922192 def _create_content (self ):
21932193 """Build panel content."""
2194- # Title
2194+ # Title (compact)
21952195 title_label = ctk .CTkLabel (
21962196 self ,
21972197 text = self .title ,
2198- font = (FONT_FAMILY , FONT_SIZE_NORMAL , "bold" ),
2198+ font = (FONT_FAMILY , FONT_SIZE_SMALL , "bold" ),
21992199 text_color = TEXT_PRIMARY ,
22002200 )
2201- title_label .pack (anchor = "w" , padx = 12 , pady = (12 , 8 ))
2201+ title_label .pack (anchor = "w" , padx = 10 , pady = (6 , 3 ))
22022202
22032203 # Virtual rule list (replaces CTkScrollableFrame + RuleChips)
22042204 self .rule_list = VirtualRuleList (
@@ -2207,36 +2207,40 @@ def _create_content(self):
22072207 on_rule_click = self .on_rule_clicked ,
22082208 on_rule_delete = self ._on_rule_delete ,
22092209 )
2210- self .rule_list .pack (fill = "both" , expand = True , padx = 8 , pady = (0 , 8 ))
2210+ self .rule_list .pack (fill = "both" , expand = True , padx = 6 , pady = (0 , 3 ))
2211+
2212+ # Set minimum height for rule list to ensure it's visible
2213+ self .rule_list .frame .configure (height = 70 )
22112214
2212- # Input frame
2213- input_frame = ctk .CTkFrame (self , fg_color = "transparent" )
2214- input_frame .pack (fill = "x" , padx = 8 , pady = (0 , 8 ))
2215+ # Input frame with fixed height (won't squish on resize)
2216+ input_frame = ctk .CTkFrame (self , fg_color = "transparent" , height = 32 )
2217+ input_frame .pack (fill = "x" , padx = 6 , pady = (0 , 5 ))
2218+ input_frame .pack_propagate (False ) # Prevent children from changing frame height
22152219
22162220 # Pattern input
22172221 self .input_entry = ctk .CTkEntry (
22182222 input_frame ,
22192223 placeholder_text = "pattern1, pattern2*, ..." ,
2220- font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
2224+ font = (FONT_FAMILY , FONT_SIZE_SMALL ),
22212225 fg_color = BG_TERTIARY ,
22222226 border_color = BORDER_COLOR ,
22232227 text_color = TEXT_PRIMARY ,
22242228 placeholder_text_color = TEXT_MUTED ,
2225- height = 36 ,
2229+ height = 28 ,
22262230 )
2227- self .input_entry .pack (side = "left" , fill = "x" , expand = True , padx = (0 , 8 ))
2231+ self .input_entry .pack (side = "left" , fill = "x" , expand = True , padx = (0 , 6 ))
22282232 self .input_entry .bind ("<Return>" , self ._on_add_clicked )
22292233 self .input_entry .bind ("<KeyRelease>" , self ._on_input_key )
22302234
22312235 # Add button
22322236 add_btn = ctk .CTkButton (
22332237 input_frame ,
22342238 text = "+ Add" ,
2235- font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
2239+ font = (FONT_FAMILY , FONT_SIZE_SMALL ),
22362240 fg_color = ACCENT_BLUE ,
22372241 hover_color = "#3a8aee" ,
2238- width = 70 ,
2239- height = 36 ,
2242+ width = 55 ,
2243+ height = 28 ,
22402244 command = self ._on_add_clicked ,
22412245 )
22422246 add_btn .pack (side = "right" )
@@ -2342,13 +2346,8 @@ def __init__(self):
23422346 self ._fetch_in_progress : bool = False
23432347 self ._preview_after_id : Optional [str ] = None
23442348
2345- # Build UI
2346- self ._create_header ()
2347- self ._create_search_bar ()
2348- self ._create_model_lists ()
2349- self ._create_rule_panels ()
2350- self ._create_status_bar ()
2351- self ._create_action_buttons ()
2349+ # Build UI with grid layout for responsive sizing
2350+ self ._create_main_layout ()
23522351
23532352 # Context menu
23542353 self ._create_context_menu ()
@@ -2365,6 +2364,30 @@ def __init__(self):
23652364 # Focus and raise window after it's fully loaded
23662365 self .after (100 , self ._activate_window )
23672366
2367+ def _create_main_layout (self ):
2368+ """Create the main layout with grid for responsive sizing."""
2369+ # Main content frame using grid layout
2370+ # This allows proportional sizing between model lists and rule panels
2371+ self .content_frame = ctk .CTkFrame (self , fg_color = "transparent" )
2372+ self .content_frame .pack (fill = "both" , expand = True , padx = 20 , pady = (8 , 10 ))
2373+
2374+ # Configure grid weights for responsive layout
2375+ # Using 3:1 ratio so models get significantly more space than rules
2376+ self .content_frame .grid_columnconfigure (0 , weight = 1 )
2377+ self .content_frame .grid_rowconfigure (0 , weight = 0 ) # Header - fixed
2378+ self .content_frame .grid_rowconfigure (1 , weight = 0 ) # Search - fixed
2379+ self .content_frame .grid_rowconfigure (2 , weight = 3 ) # Model lists - expands most
2380+ self .content_frame .grid_rowconfigure (3 , weight = 1 ) # Rule panels - expands less
2381+ self .content_frame .grid_rowconfigure (4 , weight = 0 ) # Status bar - fixed
2382+
2383+ # Create all sections
2384+ self ._create_header ()
2385+ self ._create_search_bar ()
2386+ self ._create_model_lists ()
2387+ self ._create_rule_panels ()
2388+ self ._create_status_bar ()
2389+ self ._create_action_buttons ()
2390+
23682391 def _activate_window (self ):
23692392 """Activate and focus the window."""
23702393 self .lift ()
@@ -2373,95 +2396,95 @@ def _activate_window(self):
23732396 self .after (200 , lambda : self .attributes ("-topmost" , False ))
23742397
23752398 def _create_header (self ):
2376- """Create the header with provider selector and buttons."""
2377- header = ctk .CTkFrame (self , fg_color = "transparent" )
2378- header .pack ( fill = "x" , padx = 20 , pady = (15 , 10 ))
2399+ """Create the header with provider selector and buttons (compact) ."""
2400+ header = ctk .CTkFrame (self . content_frame , fg_color = "transparent" )
2401+ header .grid ( row = 0 , column = 0 , sticky = "ew" , pady = (0 , 4 ))
23792402
2380- # Title
2403+ # Title (smaller font)
23812404 title = ctk .CTkLabel (
23822405 header ,
23832406 text = "🎯 Model Filter Configuration" ,
2384- font = (FONT_FAMILY , FONT_SIZE_HEADER , "bold" ),
2407+ font = (FONT_FAMILY , FONT_SIZE_LARGE , "bold" ),
23852408 text_color = TEXT_PRIMARY ,
23862409 )
23872410 title .pack (side = "left" )
23882411
2389- # Help button
2412+ # Help button (smaller)
23902413 help_btn = ctk .CTkButton (
23912414 header ,
23922415 text = "?" ,
2393- font = (FONT_FAMILY , FONT_SIZE_LARGE , "bold" ),
2416+ font = (FONT_FAMILY , FONT_SIZE_NORMAL , "bold" ),
23942417 fg_color = BG_SECONDARY ,
23952418 hover_color = BG_HOVER ,
23962419 border_width = 1 ,
23972420 border_color = BORDER_COLOR ,
2398- width = 36 ,
2399- height = 36 ,
2400- corner_radius = 18 ,
2421+ width = 26 ,
2422+ height = 26 ,
2423+ corner_radius = 13 ,
24012424 command = self ._show_help ,
24022425 )
2403- help_btn .pack (side = "right" , padx = (10 , 0 ))
2426+ help_btn .pack (side = "right" , padx = (8 , 0 ))
24042427 ToolTip (help_btn , "Help (F1)" )
24052428
2406- # Refresh button
2429+ # Refresh button (smaller)
24072430 refresh_btn = ctk .CTkButton (
24082431 header ,
24092432 text = "🔄 Refresh" ,
2410- font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
2433+ font = (FONT_FAMILY , FONT_SIZE_SMALL ),
24112434 fg_color = BG_SECONDARY ,
24122435 hover_color = BG_HOVER ,
24132436 border_width = 1 ,
24142437 border_color = BORDER_COLOR ,
2415- width = 100 ,
2416- height = 36 ,
2438+ width = 80 ,
2439+ height = 26 ,
24172440 command = self ._refresh_models ,
24182441 )
2419- refresh_btn .pack (side = "right" , padx = (10 , 0 ))
2442+ refresh_btn .pack (side = "right" , padx = (8 , 0 ))
24202443 ToolTip (refresh_btn , "Refresh models (Ctrl+R)" )
24212444
2422- # Provider selector
2445+ # Provider selector (compact)
24232446 provider_frame = ctk .CTkFrame (header , fg_color = "transparent" )
24242447 provider_frame .pack (side = "right" )
24252448
24262449 provider_label = ctk .CTkLabel (
24272450 provider_frame ,
24282451 text = "Provider:" ,
2429- font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
2452+ font = (FONT_FAMILY , FONT_SIZE_SMALL ),
24302453 text_color = TEXT_SECONDARY ,
24312454 )
2432- provider_label .pack (side = "left" , padx = (0 , 8 ))
2455+ provider_label .pack (side = "left" , padx = (0 , 6 ))
24332456
24342457 self .provider_dropdown = ctk .CTkComboBox (
24352458 provider_frame ,
24362459 values = ["Loading..." ],
2437- font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
2438- dropdown_font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
2460+ font = (FONT_FAMILY , FONT_SIZE_SMALL ),
2461+ dropdown_font = (FONT_FAMILY , FONT_SIZE_SMALL ),
24392462 fg_color = BG_SECONDARY ,
24402463 border_color = BORDER_COLOR ,
24412464 button_color = BORDER_COLOR ,
24422465 button_hover_color = BG_HOVER ,
24432466 dropdown_fg_color = BG_SECONDARY ,
24442467 dropdown_hover_color = BG_HOVER ,
24452468 text_color = TEXT_PRIMARY ,
2446- width = 180 ,
2447- height = 36 ,
2469+ width = 160 ,
2470+ height = 26 ,
24482471 state = "readonly" ,
24492472 command = self ._on_provider_changed ,
24502473 )
24512474 self .provider_dropdown .pack (side = "left" )
24522475
24532476 def _create_search_bar (self ):
2454- """Create the search bar."""
2455- search_frame = ctk .CTkFrame (self , fg_color = "transparent" )
2456- search_frame .pack ( fill = "x" , padx = 20 , pady = (0 , 10 ))
2477+ """Create the search bar (compact version) ."""
2478+ search_frame = ctk .CTkFrame (self . content_frame , fg_color = "transparent" )
2479+ search_frame .grid ( row = 1 , column = 0 , sticky = "ew" , pady = (0 , 5 ))
24572480
24582481 search_icon = ctk .CTkLabel (
24592482 search_frame ,
24602483 text = "🔍" ,
2461- font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
2484+ font = (FONT_FAMILY , FONT_SIZE_SMALL ),
24622485 text_color = TEXT_MUTED ,
24632486 )
2464- search_icon .pack (side = "left" , padx = (0 , 8 ))
2487+ search_icon .pack (side = "left" , padx = (0 , 6 ))
24652488
24662489 self .search_entry = ctk .CTkEntry (
24672490 search_frame ,
@@ -2471,7 +2494,7 @@ def _create_search_bar(self):
24712494 border_color = BORDER_COLOR ,
24722495 text_color = TEXT_PRIMARY ,
24732496 placeholder_text_color = TEXT_MUTED ,
2474- height = 36 ,
2497+ height = 28 ,
24752498 )
24762499 self .search_entry .pack (side = "left" , fill = "x" , expand = True )
24772500 self .search_entry .bind ("<KeyRelease>" , self ._on_search_changed )
@@ -2480,12 +2503,12 @@ def _create_search_bar(self):
24802503 clear_btn = ctk .CTkButton (
24812504 search_frame ,
24822505 text = "Ă—" ,
2483- font = (FONT_FAMILY , FONT_SIZE_LARGE ),
2506+ font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
24842507 fg_color = "transparent" ,
24852508 hover_color = BG_HOVER ,
24862509 text_color = TEXT_MUTED ,
2487- width = 36 ,
2488- height = 36 ,
2510+ width = 28 ,
2511+ height = 28 ,
24892512 command = self ._clear_search ,
24902513 )
24912514 clear_btn .pack (side = "left" )
@@ -2494,22 +2517,23 @@ def _create_model_lists(self):
24942517 """Create the synchronized model list panel."""
24952518 # Use the virtual list implementation for performance
24962519 self .model_list_panel = VirtualSyncModelLists (
2497- self ,
2520+ self . content_frame ,
24982521 on_model_click = self ._on_model_clicked ,
24992522 on_model_right_click = self ._on_model_right_clicked ,
25002523 )
2501- self .model_list_panel .pack ( fill = "both" , expand = True , padx = 20 , pady = (0 , 10 ))
2524+ self .model_list_panel .grid ( row = 2 , column = 0 , sticky = "nsew" , pady = (0 , 5 ))
25022525
25032526 def _create_rule_panels (self ):
25042527 """Create the ignore and whitelist rule panels."""
2505- rules_frame = ctk .CTkFrame (self , fg_color = "transparent" )
2506- rules_frame .pack (fill = "x" , padx = 20 , pady = (0 , 10 ))
2507- rules_frame .grid_columnconfigure (0 , weight = 1 )
2508- rules_frame .grid_columnconfigure (1 , weight = 1 )
2528+ self .rules_frame = ctk .CTkFrame (self .content_frame , fg_color = "transparent" )
2529+ self .rules_frame .grid (row = 3 , column = 0 , sticky = "nsew" , pady = (0 , 5 ))
2530+ self .rules_frame .grid_columnconfigure (0 , weight = 1 )
2531+ self .rules_frame .grid_columnconfigure (1 , weight = 1 )
2532+ self .rules_frame .grid_rowconfigure (0 , weight = 1 )
25092533
25102534 # Ignore panel
25112535 self .ignore_panel = RulePanel (
2512- rules_frame ,
2536+ self . rules_frame ,
25132537 title = "đźš« Ignore Rules" ,
25142538 rule_type = "ignore" ,
25152539 on_rules_changed = self ._on_rules_changed ,
@@ -2522,7 +2546,7 @@ def _create_rule_panels(self):
25222546
25232547 # Whitelist panel
25242548 self .whitelist_panel = RulePanel (
2525- rules_frame ,
2549+ self . rules_frame ,
25262550 title = "âś“ Whitelist Rules" ,
25272551 rule_type = "whitelist" ,
25282552 on_rules_changed = self ._on_rules_changed ,
@@ -2534,16 +2558,16 @@ def _create_rule_panels(self):
25342558 self .whitelist_panel .set_delete_callback (self ._remove_whitelist_pattern )
25352559
25362560 def _create_status_bar (self ):
2537- """Create the status bar showing available count and action buttons."""
2561+ """Create the status bar showing available count and action buttons (compact) ."""
25382562 # Combined status bar and action buttons in one row
2539- self .status_frame = ctk .CTkFrame (self , fg_color = "transparent" )
2540- self .status_frame .pack ( fill = "x" , padx = 20 , pady = (5 , 15 ))
2563+ self .status_frame = ctk .CTkFrame (self . content_frame , fg_color = "transparent" )
2564+ self .status_frame .grid ( row = 4 , column = 0 , sticky = "ew" , pady = (3 , 3 ))
25412565
2542- # Status label (left side)
2566+ # Status label (left side, smaller font )
25432567 self .status_label = ctk .CTkLabel (
25442568 self .status_frame ,
25452569 text = "Select a provider to begin" ,
2546- font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
2570+ font = (FONT_FAMILY , FONT_SIZE_SMALL ),
25472571 text_color = TEXT_SECONDARY ,
25482572 )
25492573 self .status_label .pack (side = "left" )
@@ -2555,33 +2579,33 @@ def _create_status_bar(self):
25552579 font = (FONT_FAMILY , FONT_SIZE_SMALL ),
25562580 text_color = ACCENT_YELLOW ,
25572581 )
2558- self .unsaved_label .pack (side = "left" , padx = (15 , 0 ))
2582+ self .unsaved_label .pack (side = "left" , padx = (10 , 0 ))
25592583
2560- # Buttons (right side)
2584+ # Buttons (right side, smaller )
25612585 # Discard button
25622586 discard_btn = ctk .CTkButton (
25632587 self .status_frame ,
25642588 text = "↩️ Discard" ,
2565- font = (FONT_FAMILY , FONT_SIZE_NORMAL ),
2589+ font = (FONT_FAMILY , FONT_SIZE_SMALL ),
25662590 fg_color = BG_SECONDARY ,
25672591 hover_color = BG_HOVER ,
25682592 border_width = 1 ,
25692593 border_color = BORDER_COLOR ,
2570- width = 110 ,
2571- height = 36 ,
2594+ width = 85 ,
2595+ height = 26 ,
25722596 command = self ._discard_changes ,
25732597 )
2574- discard_btn .pack (side = "right" , padx = (10 , 0 ))
2598+ discard_btn .pack (side = "right" , padx = (8 , 0 ))
25752599
25762600 # Save button
25772601 save_btn = ctk .CTkButton (
25782602 self .status_frame ,
25792603 text = "đź’ľ Save" ,
2580- font = (FONT_FAMILY , FONT_SIZE_NORMAL , "bold" ),
2604+ font = (FONT_FAMILY , FONT_SIZE_SMALL , "bold" ),
25812605 fg_color = ACCENT_GREEN ,
25822606 hover_color = "#27ae60" ,
2583- width = 110 ,
2584- height = 36 ,
2607+ width = 75 ,
2608+ height = 26 ,
25852609 command = self ._save_changes ,
25862610 )
25872611 save_btn .pack (side = "right" )
0 commit comments