1414
1515class NavBarIcons :
1616 _ICON_MAP = {
17- "Select Weather File" : "tabler:upload" ,
1817 "Climate Summary" : "tabler:chart-bar" ,
1918 "Temperature and Humidity" : "tabler:temperature" ,
2019 "Sun and Clouds" : "tabler:sun" ,
@@ -26,7 +25,6 @@ class NavBarIcons:
2625 "Changelog" : "tabler:history" ,
2726 }
2827
29- SELECT_WEATHER_FILE = _ICON_MAP ["Select Weather File" ]
3028 CLIMATE_SUMMARY = _ICON_MAP ["Climate Summary" ]
3129 TEMPERATURE_AND_HUMIDITY = _ICON_MAP ["Temperature and Humidity" ]
3230 SUN_AND_CLOUDS = _ICON_MAP ["Sun and Clouds" ]
@@ -49,14 +47,7 @@ def create_tools_filter_components():
4947 return dmc .Stack (
5048 id = ElementIds .TOOLS_MONTH_HOUR_SECTION ,
5149 children = [
52- dmc .Divider (label = "Filter function" , size = "xs" , color = "blue" ),
53- dmc .Button (
54- "Apply month and hour filter" ,
55- id = ElementIds .TOOLS_APPLY_MONTH_HOUR_FILTER ,
56- color = "blue" ,
57- variant = "light" ,
58- size = "xs" ,
59- ),
50+ dmc .Divider (label = "Filters" , size = "xs" , color = "blue" ),
6051 # Month controls
6152 dmc .Text ("Month Range:" , size = "xs" , c = "dimmed" ),
6253 dcc .RangeSlider (
@@ -113,6 +104,13 @@ def create_tools_filter_components():
113104 ],
114105 justify = "flex-end" ,
115106 ),
107+ dmc .Button (
108+ "Apply month and hour filter" ,
109+ id = ElementIds .TOOLS_APPLY_MONTH_HOUR_FILTER ,
110+ color = "blue" ,
111+ variant = "filled" ,
112+ size = "xs" ,
113+ ),
116114 ],
117115 gap = "xs" ,
118116 p = "xs" ,
@@ -137,7 +135,28 @@ def create_navbar():
137135 }
138136 }
139137
140- # Secondary Menu
138+ # Select weather file - top-level menu item
139+ select_weather_file_page = next (
140+ (
141+ page
142+ for page in dash .page_registry .values ()
143+ if page [Variables .NAME .col_name ] == "Select weather file"
144+ ),
145+ None ,
146+ )
147+ select_weather_file_link = (
148+ dmc .NavLink (
149+ label = select_weather_file_page [Variables .NAME .col_name ],
150+ href = select_weather_file_page [Variables .PATH .col_name ],
151+ id = f"nav-{ select_weather_file_page [Variables .PATH .col_name ].replace ('/' , '' )} " ,
152+ active = False ,
153+ styles = nav_link_styles ,
154+ )
155+ if select_weather_file_page
156+ else None
157+ )
158+
159+ # Secondary Menu - exclude "Select weather file" as it will be a top-level menu
141160 sub_links = [
142161 dmc .NavLink (
143162 label = page [Variables .NAME .col_name ],
@@ -150,11 +169,12 @@ def create_navbar():
150169 styles = nav_link_styles ,
151170 )
152171 for page in dash .page_registry .values ()
153- if page [Variables .NAME .col_name ] not in ["404" , "Changelog" ]
172+ if page [Variables .NAME .col_name ]
173+ not in ["404" , "Changelog" , "Select weather file" ]
154174 ]
155175
156176 parent_group = dmc .NavLink (
157- label = "Pages Menu " ,
177+ label = "Visualize weather file " ,
158178 children = sub_links ,
159179 id = ElementIds .NAV_GROUP_MAIN ,
160180 variant = "light" ,
@@ -168,17 +188,11 @@ def create_navbar():
168188
169189 controls_stack = dmc .Stack (
170190 gap = "xs" ,
171- py = "xs" ,
191+ p = "xs" ,
172192 children = [
193+ dmc .Divider (label = "Units and Ranges" , size = "xs" , color = "blue" ),
173194 dmc .Tooltip (
174- label = dmc .Stack (
175- gap = "xs" ,
176- children = [
177- dmc .Text (
178- "You can choose value ranges between Global and Local"
179- ),
180- ],
181- ),
195+ label = dmc .Text ("You can choose value ranges between Global and Local" ),
182196 position = "right" ,
183197 withArrow = True ,
184198 children = dmc .SegmentedControl (
@@ -189,18 +203,13 @@ def create_navbar():
189203 {"label" : "Global" , "value" : "global" },
190204 {"label" : "Local" , "value" : "local" },
191205 ],
192- w = 220 ,
206+ w = 210 ,
193207 size = "sm" ,
194208 styles = segmented_control_styles ,
195209 ),
196210 ),
197211 dmc .Tooltip (
198- label = dmc .Stack (
199- gap = "xs" ,
200- children = [
201- dmc .Text ("You can choose units between SI and IP" ),
202- ],
203- ),
212+ label = dmc .Text ("You can choose units between SI and IP" ),
204213 position = "right" ,
205214 withArrow = True ,
206215 children = dmc .SegmentedControl (
@@ -211,7 +220,7 @@ def create_navbar():
211220 {"label" : "SI" , "value" : UnitSystem .SI },
212221 {"label" : "IP" , "value" : UnitSystem .IP },
213222 ],
214- w = 220 ,
223+ w = 210 ,
215224 size = "sm" ,
216225 styles = segmented_control_styles ,
217226 ),
@@ -223,11 +232,12 @@ def create_navbar():
223232
224233 # Tools
225234 controls_group = dmc .NavLink (
226- label = "Tools Menu " ,
227- children = [controls_stack , filter_components ],
235+ label = "Filters and units " ,
236+ children = [filter_components , controls_stack ],
228237 id = ElementIds .NAV_GROUP_CONTROLS ,
229238 variant = "light" ,
230239 childrenOffset = 0 ,
240+ opened = True ,
231241 )
232242
233243 # Documentation
@@ -240,7 +250,12 @@ def create_navbar():
240250 )
241251
242252 return dmc .ScrollArea (
243- children = [parent_group , controls_group , doc_link ],
253+ children = [
254+ select_weather_file_link ,
255+ parent_group ,
256+ controls_group ,
257+ doc_link ,
258+ ],
244259 )
245260
246261
0 commit comments