def __init__(self): subprocess.call("nrnivmodl") warnings.filterwarnings('ignore') self.RB = widgets.RadioButtons(options=[]) self.RB1 = widgets.RadioButtons(description='Select mod file', options=['default', 'local'], style={'description_width': 'initial'}) self.RB1.disabled = True self.RBHPC = widgets.RadioButtons( description='Run on:', options=['NSG', 'Service Account - NSG']) self.RBHPC.disabled = True self.RBM = widgets.RadioButtons( options=['all_traces', 'singletrace', 'demo'], description='run') self.RBM.disabled = True self.file_widget = widgets.FileUpload() self.KEY = 'Application_Fitting-DA5A3D2F8B9B4A5D964D4D2285A49C57' self.TOOL = 'NEURON77_TG' self.create_folder("GUI") os.chdir("GUI") self.prepare_transfer_folder() self.create_cell_selection() self.create_mod_radio() self.create_submission_panel()
def File_reader(self): upload = widgets.FileUpload() output_class = widgets.Output() display("please select the python model :", upload) self.model = upload self.model.observe(self.upload_class_eventhandler, names='value')
def Upload_CSV(): wl = widgets.FileUpload( accept='', multiple=False, description = 'Fichier CSV' ) return wl
def show_widgets(): uploader = widgets.FileUpload(accept='xml', multiple=False) url_box = widgets.Text(placeholder='Put URL to XML here...', description='URL: ', disabled=False) display(uploader, url_box) return uploader, url_box
def annotations_widget(): annotations_box = widgets.Checkbox(value=False, description='Use additional ' 'annotations file', disabled=False) annotations_uploader = widgets.FileUpload(accept='xml', multiple=False) annotations_url = widgets.Text(placeholder='Put URL to XML here...', description='Annotation XML file: ', disabled=False) display(annotations_box, annotations_uploader, annotations_url) return annotations_box, (annotations_uploader, annotations_url)
def __init__(self, on_interact=None, output=None, overwrite_previous_output=True, feedback=False, run=True, action_kws={}, *args, **kwargs): super().__init__(on_interact=on_interact, output=output, overwrite_previous_output=overwrite_previous_output, feedback=feedback, action_kws=action_kws) self.widget = widgets.FileUpload(*args, **kwargs) if run: self.run()
def __init__(self): self.menu_KD = '/menu/KD-Snippets/' self.uploader = widgets.FileUpload(accept='.py', multiple=True) self.upload_button = widgets.Button( description='upload snippet', disabled=False, button_style='', # 'success', 'info', 'warning', 'danger' or '' tooltip='Click me', icon='check') dir = os.path.dirname(os.path.abspath(__file__)) menu_KD = self.menu_KD uploader = self.uploader upload_button = self.upload_button upload_directory = widgets.Text(placeholder="Optional", disabled=False) c = widgets.HTML(value="Snippet Added <b>Successfully</b>", ) def add(sender): [uploaded_file] = uploader.value name = list() for i in uploaded_file: name.append(i) code_name = ''.join(name) if upload_directory.value != "": try: os.chdir(dir + '/menu/KD-Snippets/') os.mkdir(str.capitalize(upload_directory.value)) with open( str.capitalize(upload_directory.value) + "/" + str.capitalize(code_name), "wb") as fp: fp.write(uploader.value[code_name]['content']) os.chdir('..') os.chdir('..') except FileExistsError: os.chdir(dir + '/menu/KD-Snippets/' + str.capitalize(upload_directory.value) + "/") with open(str.capitalize(code_name), "wb") as fp: fp.write(uploader.value[code_name]['content']) os.chdir('..') os.chdir('..') else: os.chdir(dir + '/menu/KD-Snippets/') with open(str.capitalize(code_name), "wb") as fp: fp.write(uploader.value[code_name]['content']) os.chdir('..') os.chdir('..') upload_button.button_style = 'success' upload_button.description = 'Uploaded' display(c) upload_button.on_click(add) display("Enter a Folder Name:", upload_directory) display(uploader, upload_button)
def get_configuration_widget(config: str, with_existing: bool = True) -> VBox: """ Get Configuration Widget for Configuration File :param config: project configuration filename :param with_existing: :return: """ proj_config = ProjectConfiguration(config) proj_config.save_configuration() out = widgets.Output() uploader = widgets.FileUpload(accept=".yml", multiple=False, layout=Layout(width="50%")) name2id, id2name = list_subscriptions() # name2id = {'sub_id': proj_config.get_value("subscription_id")} # id2name = {proj_config.get_value("subscription_id"): "sub_id"} getpass.getuser() # default_sub = proj_config.get_value("subscription_id") default_sub = list(name2id.keys())[0] if proj_config.get_value("subscription_id") in id2name: default_sub = id2name[proj_config.get_value("subscription_id")] else: proj_config.set_value("subscription_id", list(id2name.keys())[0]) proj_config.save_configuration() setting_boxes = create_settings_boxes(default_sub, name2id, proj_config) proj_config.save_configuration() def convert_to_region(key: str) -> None: """ :param key: """ if key in setting_boxes: setting_boxes[key] = widgets.Dropdown( options=[ "eastus", "eastus2", "canadacentral", "centralus", "northcentralus", "southcentralus", "westcentralus", "westus", "westus2", ], value=proj_config.get_value(key).replace("<>", "eastus"), description=key, disabled=False, style={"description_width": "initial"}, layout=Layout(width="50%"), ) convert_to_region("workspace_region") convert_to_region("aks_location") convert_to_region("deep_aks_location") dropdown_keys = [] my_list = get_widgets_list(dropdown_keys, out, setting_boxes, uploader, with_existing, config) def upload_on_change(change: dict): """ :param change: """ if change["type"] == "change" and change["name"] == "value": for file in uploader.value: with open(config, "wb") as f: f.write(uploader.value[file]["content"]) f.close() new_proj_config = ProjectConfiguration(config) update_setting_boxes(new_proj_config, setting_boxes, id2name) uploader.observe(upload_on_change) def on_change(change: dict): """ :param change: """ if change["type"] == "change" and change["name"] == "value": update_and_save_configuration(proj_config, setting_boxes, name2id) for box in setting_boxes: setting_boxes[box].observe(on_change) return widgets.VBox(my_list)
import numpy as np import pandas as pd from ipywidgets import widgets # from app_logic import set_openml_apikey file_upload_widget = widgets.FileUpload(accept='.csv', multiple=False, description='Select a csv file') publish_button = widgets.Button( description='Publish dataset', button_style='', # 'success', 'info', 'warning', 'danger' or '' tooltip='Publish the dataset to OpenML', icon='check') class DatasetAnnotation: """ A Dataclass for referencing dataset meta-data. """ def __init__(self): self.ignore_columns = [] self.id_column = None self.target_column = None self.name = None self.description = None self.collection_date = None self.creator = None self.contributor = None self.data_url = None self.paper_url = None