def settings_panel(self): # getMolMap calulation settings. NOTE: should only be called once. margin = 2 num_angles_slider_text = "Number of Inverse Cone Angles to calculate:" num_angles_slider_widget = IntSlider(value=1, min=1, max=5) num_angles_slider = VBox( children=[HTML(value=num_angles_slider_text), num_angles_slider_widget], margin=margin, width="100%" ) link((self.model, "num_angles"), (num_angles_slider_widget, "value")) sub_slider_text = "Subdivision value of the icosphere for numerical calculation:" sub_slider_widget = IntSlider(value=5, min=1, max=9) link((self.model, "sub"), (sub_slider_widget, "value")) sub_slider = VBox(children=[HTML(value=sub_slider_text), sub_slider_widget], margin=margin, width="100%") # link((sub_slider, 'value'), (i, 'value')) # print(self.width) # sub_slider.align = 'center' # sub_slider.width = '100%' # sub_slider.border_color = 'black' # sub_slider.border_width = 2 radius_slider_text = "Cut radius measured from the central atom:" radius_slider_widget = FloatSlider(value=0, min=0, max=10) link((self.model, "radius"), (radius_slider_widget, "value")) radius_slider = VBox(children=[HTML(value=radius_slider_text), radius_slider_widget], margin=margin) atomradscale_slider_text = "Atomic radius scaling factor:" atomradscale_slider_widget = FloatSlider(value=1, min=0, max=4) link((self.model, "rad_scale"), (atomradscale_slider_widget, "value")) atomradscale_slider = VBox( children=[HTML(value=atomradscale_slider_text), atomradscale_slider_widget], margin=margin ) excludeH_button = Checkbox(description="Exclude H from every geometry:") link((self.model, "excludeH"), (excludeH_button, "value")) excludeH_button.on_trait_change(self.excludeH_changed, "value") dont = "Don't exclude any elements" self.dont = dont # TODO: Syncronize exclude_list_widget with excludeH button and define an event on the # model to filter out the `dont` text. # Alternatevily, separate this option into a checkbox and hide the exclude options # while the button is selected. exclude_list_text = "Exclude elements from every geometry:" exclude_list_widget = SelectMultiple( options=[dont] + [e.symbol for e in ELEMENTS], selected_labels=[dont], color="Black", font_size=14, height=120, ) link((exclude_list_widget, "value"), (self.model, "excludes")) # The dirty old SelectMultiple widget does not have an .on_trait_change method. # So we create a new traitlet (excludes_notifier), which has an .on_trait_change method # because it inherits HasTraits. We link the 'value' trait to excludes_notifier.excludes; # and we bind the event handler to excludes_notifier.on_trait_change self.excludes_notifier = ExcludesNotifier() link((exclude_list_widget, "value"), (self.excludes_notifier, "excludes")) self.excludes_notifier.on_trait_change(self.excludes_changed) exclude_list = VBox(children=[HTML(value=exclude_list_text), exclude_list_widget], margin=margin) atomrad_button = ToggleButtons( description="Atomic radius type:", options=["vdwrad", "covrad", "atmrad"], background_color="AliceBlue", margin=margin, ) link((self.model, "rad_type"), (atomrad_button, "value")) runbutton = Button( description="Run calculation!", tooltip="Click here to calculate Buried Volumes and Inverse Cone Angles!", margin=margin * 3, border_color="#9acfea", # border_radius=5, border_width=3, font_size=20, ) runbutton.on_click(self.run_button_clicked) basic_tab = VBox(children=[atomrad_button, excludeH_button]) sliders = VBox(children=[num_angles_slider, atomradscale_slider, radius_slider, sub_slider]) sliders.width = "100%" sliders.pack = "center" advanced_tab = VBox(children=[atomrad_button, sliders, exclude_list]) main_window = Tab(children=[basic_tab, advanced_tab]) main_window.set_title(0, "Basic") main_window.set_title(1, "Advanced") return ControlPanel( title="getMolMap Settings:", children=[main_window, runbutton], border_width=2, border_radius=4, margin=10, padding=0, )