2525import tkinter as tk
2626from logging import basicConfig as logging_basicConfig
2727from logging import getLevelName as logging_getLevelName
28+ from logging import error as logging_error
2829from tkinter import ttk
2930from typing import Union
3031
@@ -49,6 +50,13 @@ def __init__(self, master: tk.Widget, phases: dict[str, dict], total_steps: int,
4950
5051 self .create_phase_frames ()
5152 self .bind ("<Configure>" , self ._on_resize )
53+ show_tooltip (
54+ self ,
55+ _ (
56+ "This bar shows your progress through the configuration phases. Each phase contains configuration steps that must be completed in sequence."
57+ ),
58+ position_below = False ,
59+ )
5260
5361 def create_phase_frames (self ) -> None :
5462 """Create frames for each phase with progress bars and labels."""
@@ -91,17 +99,25 @@ def create_phase_frames(self) -> None:
9199 if "\n " not in label_text and len (label_text ) < 20 :
92100 label_text += "\n "
93101
102+ # Use gray text color if phase is marked as optional
103+ is_optional = phase_data .get ("optional" , False )
104+ label_fg = "gray" if is_optional else "black"
105+
94106 label = ttk .Label (
95107 frame ,
96108 text = label_text ,
97109 wraplength = 0 , # Will be updated in _on_resize
98110 justify = tk .CENTER ,
99111 anchor = "center" ,
112+ foreground = label_fg ,
100113 )
101114 label .grid (row = 1 , column = 0 , sticky = "ew" )
102115
103116 self .phase_frames [phase_name ] = frame
104- show_tooltip (frame , phase_data .get ("description" , "" ))
117+ tooltip_msg = _ (phase_data .get ("description" , "" ))
118+ if is_optional :
119+ tooltip_msg += "\n " + _ ("This phase is optional." )
120+ show_tooltip (frame , tooltip_msg )
105121 self .phase_bars .append ({"bar" : progress , "start" : start , "end" : end })
106122
107123 def _on_resize (self , _event : Union [tk .Event , None ] = None ) -> None :
@@ -133,6 +149,12 @@ def update_progress(self, current_file: int) -> None:
133149 - Show progress between start-end otherwise
134150
135151 """
152+ if not (0 < current_file < self .total_files ):
153+ msg = _ ("Out of expected range [0 .. {self.total_files}] current file number: {current_file}" )
154+ msg = msg .format (self = self , current_file = current_file )
155+ logging_error (msg )
156+ return
157+
136158 for phase in self .phase_bars :
137159 if phase ["start" ] <= current_file <= phase ["end" ]:
138160 # Calculate progress within this phase
0 commit comments