66controls for slice position, isosurface thresholds, volume opacity,
77colormap, log scale, vmin/vmax, and timestep playback.
88"""
9+ # pylint: disable=use-dict-literal
910
1011from typing import List , Callable
1112
3738_BG = '#181825'
3839_SURF = '#1e1e2e'
3940_OVER = '#313244'
40- _BORD = '#45475a'
41+ _BORDER = '#45475a'
4142_TEXT = '#cdd6f4'
4243_SUB = '#a6adc8'
4344_MUTED = '#6c7086'
@@ -83,7 +84,7 @@ def _lbl(text):
8384 })
8485
8586
86- def _slider (sid , lo , hi , step , val , marks = None ):
87+ def _slider (sid , lo , hi , step , val , marks = None ): # pylint: disable=too-many-arguments,too-many-positional-arguments
8788 return dcc .Slider (
8889 id = sid , min = lo , max = hi , step = step , value = val ,
8990 marks = marks or {}, updatemode = 'mouseup' ,
@@ -95,7 +96,7 @@ def _btn(bid, label, color=_TEXT):
9596 return html .Button (label , id = bid , n_clicks = 0 , style = {
9697 'flex' : '1' , 'padding' : '5px 8px' , 'fontSize' : '12px' ,
9798 'backgroundColor' : _OVER , 'color' : color ,
98- 'border' : f'1px solid { _BORD } ' , 'borderRadius' : '4px' ,
99+ 'border' : f'1px solid { _BORDER } ' , 'borderRadius' : '4px' ,
99100 'cursor' : 'pointer' , 'fontFamily' : 'monospace' ,
100101 })
101102
@@ -105,7 +106,7 @@ def _num(sid, placeholder='auto'):
105106 id = sid , type = 'number' , placeholder = placeholder , debounce = True ,
106107 style = {
107108 'width' : '100%' , 'backgroundColor' : _OVER , 'color' : _TEXT ,
108- 'border' : f'1px solid { _BORD } ' , 'borderRadius' : '4px' ,
109+ 'border' : f'1px solid { _BORDER } ' , 'borderRadius' : '4px' ,
109110 'padding' : '4px 6px' , 'fontSize' : '12px' , 'fontFamily' : 'monospace' ,
110111 'boxSizing' : 'border-box' ,
111112 },
@@ -250,7 +251,7 @@ def run_interactive( # pylint: disable=too-many-locals,too-many-statements
250251 dcc .Dropdown (
251252 id = 'var-sel' , options = var_opts , value = varname , clearable = False ,
252253 style = {'fontSize' : '12px' , 'backgroundColor' : _OVER ,
253- 'border' : f'1px solid { _BORD } ' },
254+ 'border' : f'1px solid { _BORDER } ' },
254255 ),
255256 ),
256257
@@ -259,7 +260,7 @@ def run_interactive( # pylint: disable=too-many-locals,too-many-statements
259260 dcc .Dropdown (
260261 id = 'step-sel' , options = step_opts , value = steps [0 ], clearable = False ,
261262 style = {'fontSize' : '12px' , 'backgroundColor' : _OVER ,
262- 'border' : f'1px solid { _BORD } ' },
263+ 'border' : f'1px solid { _BORDER } ' },
263264 ),
264265 html .Div ([
265266 _btn ('play-btn' , '▶ Play' , _GREEN ),
@@ -346,7 +347,7 @@ def run_interactive( # pylint: disable=too-many-locals,too-many-statements
346347 dcc .Dropdown (
347348 id = 'cmap-sel' , options = cmap_opts , value = 'viridis' , clearable = False ,
348349 style = {'fontSize' : '12px' , 'backgroundColor' : _OVER ,
349- 'border' : f'1px solid { _BORD } ' },
350+ 'border' : f'1px solid { _BORDER } ' },
350351 ),
351352 dcc .Checklist (
352353 id = 'log-chk' ,
@@ -362,7 +363,7 @@ def run_interactive( # pylint: disable=too-many-locals,too-many-statements
362363 html .Button ('↺ Auto range' , id = 'reset-btn' , n_clicks = 0 , style = {
363364 'marginTop' : '8px' , 'padding' : '4px 8px' , 'fontSize' : '11px' ,
364365 'width' : '100%' , 'backgroundColor' : _OVER , 'color' : _TEAL ,
365- 'border' : f'1px solid { _BORD } ' , 'borderRadius' : '4px' ,
366+ 'border' : f'1px solid { _BORDER } ' , 'borderRadius' : '4px' ,
366367 'cursor' : 'pointer' , 'fontFamily' : 'monospace' ,
367368 }),
368369 ),
@@ -469,7 +470,7 @@ def _toggle_controls(mode):
469470 def _reset_range (_reset , _var ):
470471 return None , None
471472
472- @app .callback ( # pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals,too-many-branches,too-many-statements
473+ @app .callback (
473474 Output ('viz-graph' , 'figure' ),
474475 Output ('status-bar' , 'children' ),
475476 Input ('var-sel' , 'value' ),
@@ -490,7 +491,7 @@ def _reset_range(_reset, _var):
490491 Input ('vmin-inp' , 'value' ),
491492 Input ('vmax-inp' , 'value' ),
492493 )
493- def _update (var_sel , step , mode ,
494+ def _update (var_sel , step , mode , # pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-locals,too-many-branches,too-many-statements
494495 slice_axis , slice_pos ,
495496 iso_min_frac , iso_max_frac , iso_n , iso_caps ,
496497 vol_opacity , vol_nsurf , vol_min_frac , vol_max_frac ,
0 commit comments