def __init__(self, *args, **kwargs): # Compute selected and unselected values options = kwargs.get('options', {}) if isinstance(options, list): options = named_objs([(opt, opt) for opt in options]) self._reverse_lookup = {v: k for k, v in options.items()} selected = [self._reverse_lookup[v] for v in kwargs.get('value', [])] unselected = [k for k in options if k not in selected] # Define whitelist and blacklist self._lists = { False: SelectMultiple(options=unselected), True: SelectMultiple(options=selected) } self._lists[False].observe(self._update_selection, 'value') self._lists[True].observe(self._update_selection, 'value') # Define buttons button_layout = Layout(width='50px') self._buttons = { False: Button(description='<<', layout=button_layout), True: Button(description='>>', layout=button_layout) } self._buttons[False].on_click(self._apply_selection) self._buttons[True].on_click(self._apply_selection) # Define search self._search = { False: Text(placeholder='Filter available options'), True: Text(placeholder='Filter selected options') } self._search[False].observe(self._filter_options, 'value') self._search[True].observe(self._filter_options, 'value') # Define Layout no_margin = Layout(margin='0') row_layout = Layout(margin='0', display='flex', justify_content='space-between') search_row = HBox([self._search[False], self._search[True]]) search_row.layout = row_layout button_box = VBox([self._buttons[True], self._buttons[False]], layout=Layout(margin='auto 0')) tab_row = HBox([self._lists[False], button_box, self._lists[True]]) tab_row.layout = row_layout self._composite = VBox([search_row, tab_row], layout=no_margin) self.observe(self._update_options, 'options') self.observe(self._update_value, 'value') self._selected = {False: [], True: []} self._query = {False: '', True: ''} super(CrossSelect, self).__init__(*args, **dict(kwargs, options=options))
def show_movies(name=''): modes = ['oblique', 'X', 'Y', 'Z'] # define layout hbox_layout = Layout() hbox_layout.width = '100%' #hbox_layout.justify_content = 'space-around' # Use this margin to eliminate space between the image and the box image_margin = '0 0 0 0' # Set size of captions in figures below caption_size = 'h4' # open GIF files boxes = [] for mode in modes: ib = open_image(filename=f'{name}{mode}.gif') ib.layout.object_fit = 'contain' ib.layout.margin = image_margin boxes.append(make_box_for_grid(ib, title=mode)) # generate widgets vb = HBox() vb.layout.align_items = 'center' hb = HBox() hb.layout = hbox_layout hb.children = boxes vb.children = [hb] return vb
PARADIM_UI['s1']['l1'] = VBox([ PARADIM_UI['s1']['ecutwfc'].w, PARADIM_UI['s1']['kpoints'].w, PARADIM_UI['s1']['button'].w, PARADIM_UI['s1']['job_id'].w, PARADIM_UI['s1']['status'].w, ]) PARADIM_UI['s1']['l2'] = VBox([ PARADIM_UI['s1']['input'].w, PARADIM_UI['s1']['commands'].w, ]) PARADIM_UI['s1']['bs'] = HBox([PARADIM_UI['s1']['l1'], PARADIM_UI['s1']['l2']]) PARADIM_UI['s1']['bs'].w = Box([PARADIM_UI['s1']['bs']]) PARADIM_UI['s1']['l2'].layout = Layout(width='100%', border='1px') PARADIM_UI['s1']['bs'].layout = Layout(width='100%', border='1px') s1_tab0 = ui.Form([PARADIM_UI['s1']['bs']], name='Crystal Inputs') s1_tab1 = ui.Form([PARADIM_UI['s1']['stdin']], name='stdin') s1_tab2 = ui.Form([PARADIM_UI['s1']['stdout']], name='stdout') s1_tab3 = ui.Form([PARADIM_UI['s1']['stderr']], name='stderr') def UpdateStep1(event): global PARADIM_UI, PARADIM change = { 'k_points': PARADIM_UI['s1']['kpoints'].value, 'prefix': 'gaas', 'calculation': 'scf', 'crystal': 'crystal', 'system_params': 'ecutwfc = ' + PARADIM_UI['s1']['ecutwfc'].value + ","
SCGI_UI['s1']['button_status'].layout = Layout(width='99%') SCGI_UI['s1']['l1'] = VBox([ SCGI_UI['s1']['ecutwfc'], SCGI_UI['s1']['kpoints'], SCGI_UI['s1']['button'], SCGI_UI['s1']['job_id'], SCGI_UI['s1']['status'], ]) SCGI_UI['s1']['l2'] = VBox([ SCGI_UI['s1']['input'], SCGI_UI['s1']['commands'], ]) SCGI_UI['s1']['bs'] = HBox([SCGI_UI['s1']['l1'], SCGI_UI['s1']['l2']]) SCGI_UI['s1']['l2'].layout = Layout(width='100%', border='1px') SCGI_UI['s1']['bs'].layout = Layout(width='100%', border='1px') s1_tab0 = ui.Form([SCGI_UI['s1']['bs']], name='Crystal Inputs') s1_tab1 = ui.Form([SCGI_UI['s1']['stdin']], name='stdin') s1_tab2 = ui.Form([SCGI_UI['s1']['stdout']], name='stdout') s1_tab3 = ui.Form([SCGI_UI['s1']['stderr']], name='stderr') def UpdateStep1(event): global SCGI_UI, SCGI change = { 'k_points': SCGI_UI['s1']['kpoints'].value, 'prefix': 'gaas', 'calculation': 'scf', 'crystal': 'crystal', 'system_params': 'ecutwfc = ' + SCGI_UI['s1']['ecutwfc'].value + ","
PARADIM_UI['s2']['La4Ni3O10'], PARADIM_UI['s2']['La2NiO4'], ], name="Total Energies"), ], layout=Layout(width='100%', padding="2px")), VBox([ PARADIM_UI['s2']['DE_LaNiO3'], PARADIM_UI['s2']['DE_La3Ni2O7'], PARADIM_UI['s2']['DE_La4Ni3O10'], PARADIM_UI['s2']['DE_La2NiO4'], PARADIM_UI['s2']['DE_NiO'], PARADIM_UI['s2']['button'].w ], layout=Layout(width='100%', padding="2px")) ], layout=Layout(width='100%', border='1px')) PARADIM_UI['s2']['l1'].layout = Layout(width='100%', border='1px') PARADIM_UI['s2']['display'] = PARADIM_UI['s2']['l1'] ################################################## # Third ################################################## PARADIM_UI['s3'] = {} PARADIM_UI['s3']['button'] = Button(description='Calculate Ellingham Diagram') PARADIM_UI['s3']['button'].layout = Layout(width='99%') PARADIM_UI['s3']['button'].w = Box([PARADIM_UI['s3']['button']]) PARADIM_UI['s3']['action'] = Myaction() PARADIM_UI['s3']['button'].on_click( lambda e: PARADIM_UI['s3']['action'].click(e))
PXTAL_UI["chiriality"], PXTAL_UI["defect"], ]) PXTAL_UI["a2"] = VBox([PXTAL_UI["lmpdata_file"]]) PXTAL_UI["a"] = Accordion(children=[PXTAL_UI["a1"], PXTAL_UI["a2"]]) PXTAL_UI["a"].set_title(0, "Structure") PXTAL_UI["a"].set_title(1, "Output") PXTAL_UI["l1"] = VBox( [PXTAL_UI["a"], PXTAL_UI["button"], PXTAL_UI["sim_progress"]]) PXTAL_UI["l2"] = Tab(children=[]) PXTAL_UI["bs"] = HBox([PXTAL_UI["l1"], PXTAL_UI["l2"]]) PXTAL_UI["l1"].layout = Layout(width="500px", border="1px") PXTAL_UI["l2"].layout = Layout(width="100%", border="1px") PXTAL_UI["bs"].layout = Layout(width="100%", border="1px") PXTAL_UI["display"] = ui.Form([PXTAL_UI["bs"]], name="PolymerXtal - Polymer Helix Chain Builder") def fig_Structure(execution): pdbFile = execution.read("PDBview", raw=True) return imolecule.draw(pdbFile[7:]) # helix_name = execution.db.read('Helix Name') # return imolecule.draw(execution.outdir + "/" + helix_name + ".pdb") #, camera_type="orthographic") def fig_PDB(execution): pdbFile = execution.read("PDB", raw=True) out_data = ""