Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
push_socket.connect(socket_address)
push_socket.send_json({'plain_message':{'nickname':my_nickname,'message':sender.value}})
sender.value = ''
console_container = widgets.VBox(visible=False)
console_container.padding = '10px'
output_box = widgets.Textarea()
output_box.height = '400px'
output_box.font_family = 'monospace'
output_box.color = '#AAAAAA'
output_box.background_color = 'black'
output_box.width = '600px'
input_box = widgets.Text()
input_box.font_family = 'monospace'
input_box.color = '#AAAAAA'
input_box.background_color = 'black'
input_box.width = '800px'
console_container.children = [output_box, input_box]
console_container.visible = True
input_box.on_submit(handle_input)
return output_box,console_container
self.w_time_But = widgets.Button(
description='Browse Dec Time Image')
self.w_time = widgets.Text(description='(h):', value='12', width=500)
self.w_T_A1_But = widgets.Button(
description='Browse Air Temperature Image')
self.w_T_A1 = widgets.Text(description='(K):', value='0', width=500)
self.w_T_A0_But = widgets.Button(
description='Browse Sunrise Air Temperature Image')
self.w_T_A0 = widgets.Text(description='(K):', value='0', width=500)
self.w_T_A0_But.visible = False
self.w_T_A0.visible = False
self.w_S_dnBut = widgets.Button(
description='Browse Shortwave Irradiance Image')
self.w_S_dn = widgets.Text(description='(W/m2):', value='0', width=500)
self.w_uBut = widgets.Button(description='Browse Wind Speed Image')
self.w_u = widgets.Text(description='(m/s):', value='0.01', width=500)
self.w_eaBut = widgets.Button(
description='Browse Vapour Pressure Image')
self.w_ea = widgets.Text(description='(mb):', value='0', width=500)
met_text = widgets.HTML(
'OPTIONAL: Leave empy to use estimated values for the following cells')
self.w_L_dnBut = widgets.Button(
description='Browse Longwave Irradiance Image')
self.w_L_dn = widgets.Text(description='(W/m2):', value='', width=500)
self.w_pBut = widgets.Button(description='Browse Pressure Image')
self.w_p = widgets.Text(description='(mb):', value='', width=500)
self.met_page = widgets.VBox([widgets.HTML('Select Day of Year image or type a constant value'),
widgets.HBox([self.w_DOY_But, self.w_DOY]),
widgets.HTML('Select time (decimal) image or type a constant value'),
widgets.HBox([self.w_time_But, self.w_time]),
elif item_dict:
self._item_list = list(item_dict.keys())
self._item_dict = item_dict
self.value = list(self._item_dict.values())[0]
else:
raise ValueError("One of item_list or item_dict must be supplied.")
self._wgt_select = widgets.Select(
options=self._item_list,
description=description,
layout=Layout(width=width, height=height),
style={"description_width": "initial"},
)
self._display_filter = display_filter
if display_filter:
self._w_filter = widgets.Text(
value="", description="Filter:", style={"description_width": "initial"}
)
# set up observer callbacks
self._w_filter.observe(self._update_options, names="value")
self._wgt_select.observe(self._select_item, names="value")
self.item_action = action
# setup to use updatable display objects
rand_id = random.randint(0, 999999) # nosec
self._output_id = f"{self.__class__.__name__}_{rand_id}"
self._disp_elems: List[Any] = []
if auto_display:
self.display()
description='Browse Date of Year Image')
self.w_DOY = widgets.Text(description=' ', value='1', width=500)
self.w_time_But = widgets.Button(
description='Browse Dec Time Image')
self.w_time = widgets.Text(description='(h):', value='12', width=500)
self.w_T_A1_But = widgets.Button(
description='Browse Air Temperature Image')
self.w_T_A1 = widgets.Text(description='(K):', value='0', width=500)
self.w_T_A0_But = widgets.Button(
description='Browse Sunrise Air Temperature Image')
self.w_T_A0 = widgets.Text(description='(K):', value='0', width=500)
self.w_T_A0_But.visible = False
self.w_T_A0.visible = False
self.w_S_dnBut = widgets.Button(
description='Browse Shortwave Irradiance Image')
self.w_S_dn = widgets.Text(description='(W/m2):', value='0', width=500)
self.w_uBut = widgets.Button(description='Browse Wind Speed Image')
self.w_u = widgets.Text(description='(m/s):', value='0.01', width=500)
self.w_eaBut = widgets.Button(
description='Browse Vapour Pressure Image')
self.w_ea = widgets.Text(description='(mb):', value='0', width=500)
met_text = widgets.HTML(
'OPTIONAL: Leave empy to use estimated values for the following cells')
self.w_L_dnBut = widgets.Button(
description='Browse Longwave Irradiance Image')
self.w_L_dn = widgets.Text(description='(W/m2):', value='', width=500)
self.w_pBut = widgets.Button(description='Browse Pressure Image')
self.w_p = widgets.Text(description='(mb):', value='', width=500)
self.met_page = widgets.VBox([widgets.HTML('Select Day of Year image or type a constant value'),
widgets.HBox([self.w_DOY_But, self.w_DOY]),
description=' ', value=str(self.rho_nir_C), width=500)
self.w_tau_nir_C_But = widgets.Button(description='Leaf trans. NIR')
self.w_tau_nir_C = widgets.Text(
description=' ', value=str(self.tau_nir_C), width=500)
self.w_rho_vis_S_But = widgets.Button(description='Soil refl. PAR')
self.w_rho_vis_S = widgets.Text(
description=' ', value=str(self.rho_vis_S), width=500)
self.w_rho_nir_S_But = widgets.Button(description='Soil refl. NIR')
self.w_rho_nir_S = widgets.Text(
description=' ', value=str(self.rho_nir_S), width=500)
self.w_emis_C_But = widgets.Button(description='Leaf emissivity')
self.w_emis_C = widgets.Text(
description=' ', value=str(self.emis_C), width=500)
self.w_emis_S_But = widgets.Button(description='Soil emissivity')
self.w_emis_S = widgets.Text(
description=' ', value=str(self.emis_S), width=500)
self.spec_page = widgets.VBox([widgets.HTML('Select leaf PAR reflectance image or type a constant value'),
widgets.HBox([self.w_rho_vis_C_But, self.w_rho_vis_C]),
widgets.HTML('Select leaf PAR transmitance image or type a constant value'),
widgets.HBox([self.w_tau_vis_C_But, self.w_tau_vis_C]),
widgets.HTML('Select leaf NIR reflectance image or type a constant value'),
widgets.HBox([self.w_rho_nir_C_But, self.w_rho_nir_C]),
widgets.HTML('Select leaf NIR transmitance image or type a constant value'),
widgets.HBox([self.w_tau_nir_C_But, self.w_tau_nir_C]),
widgets.HTML('Select soil PAR reflectance or image type a constant value'),
widgets.HBox([self.w_rho_vis_S_But, self.w_rho_vis_S]),
widgets.HTML('Select soil NIR reflectance or image type a constant value'),
widgets.HBox([self.w_rho_nir_S_But, self.w_rho_nir_S]),
widgets.HTML('Select leaf emissivity image or type a constant value'),
widgets.HBox([self.w_emis_C_But, self.w_emis_C]),
def _init_periodogram_widgets(self):
### Periodogram widget stuff ###
self._perfig_file_location = widgets.Text(
value='Pyriod_Periodogram.png',
placeholder='File name to write figure to',
tooltip='Path of figure file to write to.',
description='Fig location:',
disabled=False
)
self._save_perfig = widgets.Button(
description="Save",
disabled=False,
#button_style='success', # 'success', 'info', 'warning', 'danger' or ''
tooltip='Save currently displayed figure to file.',
icon='save'
)
self._save_perfig.on_click(self._save_perfig_button_click)
unit_registry = arr.units.registry
equiv = unit_registry.list_same_dimensions(arr.units)
dropdown = ipywidgets.Dropdown(options = sorted(equiv), value = str(arr.units))
def arr_updater(arr, texts):
def _value_updater(change):
arr2 = arr.in_units(change['new'])
if arr2.shape == ():
arr2 = [arr2]
for v, t in zip(arr2, texts):
t.value = str(v.value)
return _value_updater
if arr.shape == ():
arr_iter = [arr]
else:
arr_iter = arr
texts = [ipywidgets.Text(value = str(_.value), disabled = True)
for _ in arr_iter]
dropdown.observe(arr_updater(arr, texts), names="value")
return ipywidgets.HBox(texts + [dropdown])
if isinstance(default_selected, dict):
default_selected = list(default_selected.items())
if default_selected:
set_selected = set(default_selected)
selected_items = sorted(set_selected.intersection(source_items))
else:
selected_items = []
self._select_list = widgets.SelectMultiple(
options=selected_items, layout=layout, description="Selected: "
)
self._display_filter = display_filter
if display_filter:
self._w_filter = widgets.Text(
value="", description="Filter:", style={"description_width": "initial"}
)
# set up observer callbacks
self._w_filter.observe(self._update_options, names="value")
self._b_add_all = widgets.Button(description="Add All \u21fe")
self._b_add = widgets.Button(description="Add \u21fe")
self._b_del = widgets.Button(description="\u21fd Remove")
self._b_del_all = widgets.Button(description="\u21fd Remove All")
self._b_add.on_click(self._on_btn_add)
self._b_del.on_click(self._on_btn_del)
self._b_del_all.on_click(self._on_btn_del_all)
self._b_add_all.on_click(self._on_btn_add_all)
def generate_text_widget(self, value, description='', description_tooltip='', continuous_update=False, placeholder='', disabled=False):
return widgets.Text(
value=value,
placeholder=placeholder,
description="<strong>{description}: </strong>".format(description=description),
style=self.styles.get('description_width'),
layout={'width': '400px'},
description_tooltip=description_tooltip,
continuous_update=continuous_update,
disabled=disabled
)
self.w_rho_vis_C_But = widgets.Button(description='Leaf refl. PAR')
self.w_rho_vis_C = widgets.Text(
description=' ', value=str(self.rho_vis_C), width=500)
self.w_tau_vis_C_But = widgets.Button(description='Leaf trans. PAR')
self.w_tau_vis_C = widgets.Text(
description=' ', value=str(self.tau_vis_C), width=500)
self.w_rho_nir_C_But = widgets.Button(description='Leaf refl. NIR')
self.w_rho_nir_C = widgets.Text(
description=' ', value=str(self.rho_nir_C), width=500)
self.w_tau_nir_C_But = widgets.Button(description='Leaf trans. NIR')
self.w_tau_nir_C = widgets.Text(
description=' ', value=str(self.tau_nir_C), width=500)
self.w_rho_vis_S_But = widgets.Button(description='Soil refl. PAR')
self.w_rho_vis_S = widgets.Text(
description=' ', value=str(self.rho_vis_S), width=500)
self.w_rho_nir_S_But = widgets.Button(description='Soil refl. NIR')
self.w_rho_nir_S = widgets.Text(
description=' ', value=str(self.rho_nir_S), width=500)
self.w_emis_C_But = widgets.Button(description='Leaf emissivity')
self.w_emis_C = widgets.Text(
description=' ', value=str(self.emis_C), width=500)
self.w_emis_S_But = widgets.Button(description='Soil emissivity')
self.w_emis_S = widgets.Text(
description=' ', value=str(self.emis_S), width=500)
self.spec_page = widgets.VBox([widgets.HTML('Select leaf PAR reflectance image or type a constant value'),
widgets.HBox([self.w_rho_vis_C_But, self.w_rho_vis_C]),
widgets.HTML('Select leaf PAR transmitance image or type a constant value'),
widgets.HBox([self.w_tau_vis_C_But, self.w_tau_vis_C]),
widgets.HTML('Select leaf NIR reflectance image or type a constant value'),