@@ -396,6 +396,7 @@ def sync(self, *_):
396396 self .set_table_height (self .runs_table )
397397 self .set_table_height (self .reduction_table )
398398 self .set_table_height (self .custom_reduction_table )
399+
399400 self .set_table_colors (self .reduction_table )
400401 self .set_table_colors (self .custom_reduction_table )
401402 self .set_table_colors (self .reference_table )
@@ -406,56 +407,7 @@ def path(self):
406407 raise ValueError ("Path is not set" )
407408 return self ._path
408409
409- def __init__ (self ):
410- self .text_log = widgets .VBox ([])
411- self .progress_log = widgets .VBox ([])
412- self .plot_log = widgets .VBox ([])
413- self ._path = None
414- self .log ("init" )
415-
416- self .results = {}
417-
418- self .runs_table = DataGrid (
419- pd .DataFrame ([]),
420- editable = True ,
421- auto_fit_columns = True ,
422- column_visibility = {"key" : False },
423- selection_mode = "cell" ,
424- renderers = self .get_renderers_for_runs_table (),
425- )
426- self .reduction_table = DataGrid (
427- pd .DataFrame ([]),
428- editable = True ,
429- auto_fit_columns = True ,
430- column_visibility = {"key" : False },
431- selection_mode = "cell" ,
432- renderers = self .get_renderers_for_reduction_table (),
433- )
434- self .reference_table = DataGrid (
435- pd .DataFrame ([]),
436- editable = True ,
437- auto_fit_columns = True ,
438- column_visibility = {"key" : False },
439- selection_mode = "cell" ,
440- renderers = self .get_renderers_for_reference_table (),
441- )
442- self .custom_reduction_table = DataGrid (
443- pd .DataFrame ([]),
444- editable = True ,
445- auto_fit_columns = True ,
446- column_visibility = {"key" : False },
447- selection_mode = "cell" ,
448- renderers = self .get_renderers_for_custom_reduction_table (),
449- )
450-
451- self .runs_table .on_cell_change (self .sync )
452- self .reduction_table .on_cell_change (self .sync )
453- self .reference_table .on_cell_change (self .sync )
454-
455- self .custom_reduction_table .on_cell_change (
456- lambda _ : self .sync_custom_reduction_table ()
457- )
458-
410+ def _init_proposal_number_box (self ):
459411 self .proposal_number_box = widgets .Text (
460412 value = "" ,
461413 placeholder = "Proposal number or file path" ,
@@ -487,6 +439,28 @@ def on_proposal_number_change(_):
487439 set_proposal_number_state ("bad" )
488440 self .proposal_number_box .observe (on_proposal_number_change , names = 'value' )
489441
442+ def _init_runs_table_component (self ):
443+ self .run_number_min = widgets .IntText (
444+ value = 0 , description = '' , layout = widgets .Layout (width = '5em' )
445+ )
446+ self .run_number_max = widgets .IntText (
447+ value = 9999 , description = '' , layout = widgets .Layout (width = '5em' )
448+ )
449+ self .run_number_min .observe (self .sync , names = 'value' )
450+ self .run_number_max .observe (self .sync , names = 'value' )
451+ run_number_filter = widgets .HBox (
452+ [self .run_number_min , widgets .Label ("<=Run<=" ), self .run_number_max ]
453+ )
454+ self .runs_table_component = widgets .VBox (
455+ [
456+ widgets .Label ("Runs Table" ),
457+ run_number_filter ,
458+ self .runs_table ,
459+ ],
460+ layout = {"width" : "35%" },
461+ )
462+
463+ def _init_reduction_table_component (self ):
490464 reduce_button = widgets .Button (description = "Reduce" )
491465 plot_button = widgets .Button (description = "Plot" )
492466
@@ -542,71 +516,111 @@ def delete_row(_):
542516 delete_row_button .on_click (delete_row )
543517 data_buttons = widgets .HBox ([reduce_button , plot_button ])
544518
545- self .run_number_min = widgets .IntText (
546- value = 0 , description = '' , layout = widgets .Layout (width = '5em' )
519+ self .reduction_table_component = widgets .VBox (
520+ [
521+ data_buttons ,
522+ widgets .VBox (
523+ [
524+ widgets .Label ("Auto Reduction Table" ),
525+ self .reduction_table ,
526+ ],
527+ layout = {'margin' : '10px 0' },
528+ ),
529+ widgets .VBox (
530+ [
531+ widgets .Label ("Manual Reduction Table" ),
532+ widgets .HBox (
533+ [add_row_button , delete_row_button ],
534+ layout = {'margin' : '5px 0' },
535+ ),
536+ self .custom_reduction_table ,
537+ ],
538+ layout = {'margin' : '10px 0' },
539+ ),
540+ ],
541+ layout = {"width" : "60%" },
547542 )
548- self .run_number_max = widgets .IntText (
549- value = 9999 , description = '' , layout = widgets .Layout (width = '5em' )
543+
544+ def _init_display_component (self ):
545+ self .progress_log = widgets .VBox ([])
546+ self .plot_log = widgets .VBox ([])
547+ self .display_component = widgets .VBox (
548+ [
549+ widgets .VBox (
550+ [widgets .Label ("Progress" ), self .progress_log ],
551+ layout = {'width' : '100%' , 'margin' : '10px 0' },
552+ ),
553+ widgets .VBox (
554+ [widgets .Label ("Plots" ), self .plot_log ],
555+ layout = {'width' : '100%' , 'margin' : '10px 0' },
556+ ),
557+ ]
550558 )
551- self .run_number_min .observe (self .sync , names = 'value' )
552- self .run_number_max .observe (self .sync , names = 'value' )
553- run_number_filter = widgets .HBox (
554- [self .run_number_min , widgets .Label ("<=Run<=" ), self .run_number_max ]
559+
560+ def __init__ (self ):
561+ self .text_log = widgets .VBox ([])
562+ self ._path = None
563+ self .log ("init" )
564+
565+ self .results = {}
566+
567+ self .runs_table = DataGrid (
568+ pd .DataFrame ([]),
569+ editable = True ,
570+ auto_fit_columns = True ,
571+ column_visibility = {"key" : False },
572+ selection_mode = "cell" ,
573+ renderers = self .get_renderers_for_runs_table (),
574+ )
575+ self .reduction_table = DataGrid (
576+ pd .DataFrame ([]),
577+ editable = True ,
578+ auto_fit_columns = True ,
579+ column_visibility = {"key" : False },
580+ selection_mode = "cell" ,
581+ renderers = self .get_renderers_for_reduction_table (),
582+ )
583+ self .reference_table = DataGrid (
584+ pd .DataFrame ([]),
585+ editable = True ,
586+ auto_fit_columns = True ,
587+ column_visibility = {"key" : False },
588+ selection_mode = "cell" ,
589+ renderers = self .get_renderers_for_reference_table (),
590+ )
591+ self .custom_reduction_table = DataGrid (
592+ pd .DataFrame ([]),
593+ editable = True ,
594+ auto_fit_columns = True ,
595+ column_visibility = {"key" : False },
596+ selection_mode = "cell" ,
597+ renderers = self .get_renderers_for_custom_reduction_table (),
598+ )
599+
600+ self .runs_table .on_cell_change (self .sync )
601+ self .reduction_table .on_cell_change (self .sync )
602+ self .reference_table .on_cell_change (self .sync )
603+
604+ self .custom_reduction_table .on_cell_change (
605+ lambda _ : self .sync_custom_reduction_table ()
555606 )
556607
608+ self ._init_proposal_number_box ()
609+ self ._init_runs_table_component ()
610+ self ._init_reduction_table_component ()
611+ self ._init_display_component ()
612+
557613 tab_data = widgets .VBox (
558614 [
559615 widgets .HBox (
560616 [
561- widgets .VBox (
562- [
563- widgets .Label ("Runs Table" ),
564- run_number_filter ,
565- self .runs_table ,
566- ],
567- layout = {"width" : "35%" },
568- ),
569- widgets .VBox (
570- [
571- data_buttons ,
572- widgets .VBox (
573- [
574- widgets .Label ("Auto Reduction Table" ),
575- self .reduction_table ,
576- ],
577- layout = {'margin' : '10px 0' },
578- ),
579- widgets .VBox (
580- [
581- widgets .Label ("Manual Reduction Table" ),
582- widgets .HBox (
583- [add_row_button , delete_row_button ],
584- layout = {'margin' : '5px 0' },
585- ),
586- self .custom_reduction_table ,
587- ],
588- layout = {'margin' : '10px 0' },
589- ),
590- ],
591- layout = {"width" : "60%" },
592- ),
593- ]
594- ),
595- widgets .VBox (
596- [
597- widgets .VBox (
598- [widgets .Label ("Progress" ), self .progress_log ],
599- layout = {'width' : '100%' , 'margin' : '10px 0' },
600- ),
601- widgets .VBox (
602- [widgets .Label ("Plots" ), self .plot_log ],
603- layout = {'width' : '100%' , 'margin' : '10px 0' },
604- ),
617+ self .runs_table_component ,
618+ self .reduction_table_component ,
605619 ]
606620 ),
621+ self .display_component ,
607622 ]
608623 )
609-
610624 tab_settings = widgets .VBox (
611625 [
612626 widgets .Label ("This is the settings tab" ),
@@ -615,12 +629,10 @@ def delete_row(_):
615629 ],
616630 layout = {"width" : "100%" },
617631 )
618-
619632 tab_log = widgets .VBox (
620633 [widgets .Label ("Messages" ), self .text_log ],
621634 layout = {"width" : "100%" },
622635 )
623-
624636 self .tabs = widgets .Tab ()
625637 self .tabs .children = [
626638 tab_data ,
0 commit comments