def filtersMenu(self, widget): self.dialog = gui.GenericDialog( title='Filters Menu', message='Click Ok To Confirm Selection', width='300px') self.main_cont = gui.HBox(width=300) dates_cont = gui.VBox(width='50%') for date in dates: chb = gui.CheckBoxLabel(date, filt[date]) chb.onchange.do(self.checkbox) dates_cont.append(chb) chb.onchange.do(self.checkbox) dates_cont.append(chb) self.main_cont.append(dates_cont) names_cont = gui.VBox(width='50%') for name in names: chb = gui.CheckBoxLabel(name, filt[name]) chb.onchange.do(self.checkbox) names_cont.append(chb) self.main_cont.append(names_cont) names_cont.style['align-items'] = 'flex-start' dates_cont.style['align-items'] = 'flex-start' names_cont.style['justify-content'] = 'flex-start' dates_cont.style['justify-content'] = 'flex-start' self.dialog.add_field('main_cont', self.main_cont) self.dialog.confirm_dialog.do(self.diag_conf) self.dialog.show(self)
def make_gui_elements(self): # content and behaviour #logo: self.logo_image = gui.Image('/res/logo.png') self.logo_image.attributes[ "onclick"] = "document.location='https://www.youtube.com/watch?v=t-fcrn1Edik'" #playback controls self.playback = Namespace() self.playback.playing = gui.Label( "Now playing: None") # (TODO): update this self.playback.party = gui.Button(icons.PARTY) self.playback.party.attributes[ "onclick"] = "document.body.classList.toggle('dancing');" self.playback.party.attributes[ "title"] = "ENABLE PARTY MODE" # hover text self.playback.previous = gui.Button(icons.PREV) self.playback.previous.set_on_click_listener(self.playback_previous) self.playback.play = gui.Button(icons.PLAY) self.playback.play.set_on_click_listener(self.playback_play) self.playback.next = gui.Button(icons.NEXT) self.playback.next.set_on_click_listener(self.playback_next) self.playback.volume_label = gui.Label("Volume:") self.playback.volume_slider = gui.Slider(100, 0, 100, 1) self.playback.volume_slider.set_oninput_listener(self.change_volume) self.playback.seek_slider = gui.Slider(0, 0, 100, 1) self.playback.seek_slider.set_oninput_listener(self.change_seek) self.playback.timestamp = gui.Label("--:-- - --:--") #playlist self.playlist = Namespace() self.playlist.table = gui.Table() self.playlist.table.append_from_list( [['#', 'Name', "length", "", "", "", ""]], fill_title=True) self.playlist.looping = gui.CheckBoxLabel( "<i><small>loop playlist</small></i>") self.playlist.looping.set_on_click_listener( self.on_playlist_set_looping) self.playlist.shuffle = gui.Button("SHUFFLE") self.playlist.shuffle.set_on_click_listener( self.on_playlist_clear_shuffle) self.playlist.clear = gui.Button("CLEAR") self.playlist.clear.set_on_click_listener(self.on_playlist_clear_click) #input self.input = Namespace() self.input.add_song = gui.Label("Add song:") self.input.field = gui.TextInput(single_line=True) self.input.field.set_on_enter_listener(self.input_submit) self.input.submit = gui.Button("Submit!") self.input.submit.set_on_click_listener(self.input_submit)
def main(self): wid = gui.VBox(width='100%', margin='0px auto') width = '300' #'2048' height = '300' #'1152' self.video = gui.Widget(width=300, height=300, _type='video') self.video.attributes['autoplay'] = 'true' self.video.style['overflow'] = 'hidden' self.video.attributes['width'] = width self.video.attributes['height'] = height self.canvas = gui.Widget(_type='canvas') self.canvas.style['display'] = 'none' self.canvas.attributes['width'] = width self.canvas.attributes['height'] = height self.imgGrabber = ImageGrabber(self, width, height) self.imgGrabber.new_image.do(self.on_new_image) self.imgGrabber.onnewvideodevice.do(self.new_video_device) getVideoInputsButton = gui.Button("Get cameras", margin='10px') getVideoInputsButton.onclick.do(self.on_get_video_inputs) captureButton = gui.Button("Start", margin='10px') captureButton.onclick.do(self.on_start_grab, None) snapshotButton = gui.Button("Grab Image", margin='10px') snapshotButton.onclick.do(self.snapshot) self.check_flash = gui.CheckBoxLabel('Flashlight', False, width=200, height=30, margin='10px') self.check_flash.set_on_change_listener(self.on_start_grab) self.label = gui.Label('Image capture') self.label.style['font-size'] = '18px' self.device_list = gui.DropDown(width=100) wid.append(self.label) wid.append(self.video) wid.append(self.canvas) wid.append(getVideoInputsButton) wid.append(self.device_list) wid.append(captureButton) wid.append(snapshotButton) wid.append(self.check_flash) self.opencvVideoWidget = OpencvVideoWidget(self, width=400, height=300) wid.append( gui.VBox( children=[gui.Label("opencv image"), self.opencvVideoWidget], style={'bolder': '1px dotted black'})) wid.add_child("javascript_image_grabber", self.imgGrabber) self.dialog = None # returning the root widget return wid
def main(self, name='world'): # the arguments are width - height - layoutOrientationOrizontal self.wid = gui.Widget(800, 800, False, 10) self.hor_topics = gui.Widget(-1, -1, gui.Widget.LAYOUT_HORIZONTAL, 20) # Refresh topics self.bt = gui.Button(-1, -1, 'Refresh topics list') self.bt.set_on_click_listener(self, 'refresh_topics') # List non-compressed topics checkbox self.check_raw_topics = False self.checkbox = gui.CheckBoxLabel(200, 30, label='Show raw topics', checked=False) self.checkbox.set_on_change_listener(self, 'change_raw_topics') # Stop/Play button self.playing = False self.bt_pause = gui.Button(-1, -1, 'Stop video') self.bt_pause.set_on_click_listener(self, 'pause_play') self.hor_topics.append(1, self.bt) self.hor_topics.append(2, self.checkbox) # This makes the button not be left self.bt.style['display'] = 'block' self.bt.style['margin'] = '10px auto' self.bt.style['float'] = 'none' self.rosvideo_widget = None # Dropdown of topics self.refresh_topics() # Pause button self.hor_topics.append(4, self.bt_pause) self.bt_pause.style['display'] = 'block' self.bt_pause.style['margin'] = '10px auto' self.bt_pause.style['float'] = 'none' # Dropdown of topic FPS #TODO: self.fps = 20 # Put the Widget already or it gives problem to put it dynamically self.rosvideo_widget = CompressedImageVideoWidget(400, 400, fps=self.fps) self.wid.append(2, self.rosvideo_widget) rospy.loginfo("Finished initialization.") # returning the root widget return self.wid
def addItem(self, label, index): checkBox = gui.CheckBoxLabel("remove", checked=True) checkBox.set_on_click_listener(self.xBoxCallback) item = gui.MenuItem(label, checkBox) self.menuItems.insert(index, item) #return self.eventMenu.append(item) self.eventMenu.empty() for menuitem in self.menuItems: self.eventMenu.append(menuitem) print(self.menuItems)
def main(self): self.w = gui.VBox() self.hbox_save_load = gui.HBox(margin="10px") self.dtext_conf_file = gui.TextInput(width=200, height=30) self.dtext_conf_file.set_value(str(vals.config)) self.dtext_conf_file.set_on_change_listener(self.dtext_conf_file_changed) self.bt_load = gui.Button("Load", width=200, height=30, margin="10px") self.bt_load.set_on_click_listener(self.bt_load_changed) self.bt_save = gui.Button("Save", width=200, height=30, margin="10px") self.bt_save.set_on_click_listener(self.bt_save_changed) self.hbox_save_load.append(self.dtext_conf_file) self.hbox_save_load.append(self.bt_load) self.hbox_save_load.append(self.bt_save) self.w.append(self.hbox_save_load) self.hbox_nco1 = gui.HBox(margin="10px") self.lb_nco1 = gui.Label("/dev/nco1", width="20%", margin="10px") self.sd_pinc_nco1 = gui.Slider(vals.pinc_nco1, 0, samp_freq/2, 1, width="25%", margin="10px") self.sd_pinc_nco1.set_oninput_listener(self.sd_pinc_nco1_changed) self.sb_pinc_nco1 = gui.SpinBox(vals.pinc_nco1, 0, samp_freq/2, 0.02, width="10%", margin="10px") self.sb_pinc_nco1.set_on_change_listener(self.sb_pinc_nco1_changed) self.sd_poff_nco1 = gui.Slider(vals.poff_nco1, -8192, 8191, 1, width="25%", margin="10px") self.sd_poff_nco1.set_oninput_listener(self.sd_poff_nco1_changed) self.sb_poff_nco1 = gui.SpinBox(vals.poff_nco1, -8192, 8191, 1, width="10%", margin="10px") self.sb_poff_nco1.set_on_change_listener(self.sb_poff_nco1_changed) self.cb_pinc_nco1 = gui.CheckBoxLabel("pinc", vals.cb_pinc_nco1, width="5%", margin="10px") self.cb_pinc_nco1.set_on_change_listener(self.cb_pinc_nco1_changed) self.cb_poff_nco1 = gui.CheckBoxLabel("poff", vals.cb_poff_nco1, width="5%", margin="10px") self.cb_poff_nco1.set_on_change_listener(self.cb_poff_nco1_changed) self.hbox_nco1.append(self.lb_nco1) self.hbox_nco1.append(self.sd_pinc_nco1) self.hbox_nco1.append(self.sb_pinc_nco1) self.hbox_nco1.append(self.sd_poff_nco1) self.hbox_nco1.append(self.sb_poff_nco1) self.hbox_nco1.append(self.cb_pinc_nco1) self.hbox_nco1.append(self.cb_poff_nco1) self.w.append(self.hbox_nco1) return self.w
def main(self): wid = gui.VBox(width=500, height=500, style={ 'margin': '5px auto', 'padding': '10px' }) lbl_description = gui.Label("""Example about TableWidget usage. Change rows and columns count in order to see the behaviour. After changing the size, 'Fill the table' content by means of the button.""" ) wid.append(lbl_description) table = gui.TableWidget(10, 3, True, True, width=300, height=300) table.style['font-size'] = '8px' container = gui.HBox(width='100%') lbl_row_count = gui.Label('Rows:') spin_row_count = gui.SpinBox(10, 0, 15) spin_row_count.onchange.do(self.on_row_count_change, table) container.append(lbl_row_count) container.append(spin_row_count) wid.append(container) container = gui.HBox(width='100%') lbl_column_count = gui.Label('Columns:') spin_column_count = gui.SpinBox(3, 0, 4) spin_column_count.onchange.do(self.on_column_count_change, table) container.append(lbl_column_count) container.append(spin_column_count) wid.append(container) bt_fill_table = gui.Button('Fill table', width=100) bt_fill_table.onclick.do(self.fill_table, table) wid.append(bt_fill_table) chk_use_title = gui.CheckBoxLabel('Use title', True) chk_use_title.onchange.do(self.on_use_title_change, table) wid.append(chk_use_title) self.fill_table(table, table) table.on_item_changed.do(self.on_table_item_changed) wid.append(table) # returning the root widget return wid
def main(self): self.root = gui.VBox(width=500, height=500) self.menuItems = [] for events in self.lbls: checkBox = gui.CheckBoxLabel("remove", checked=True) checkBox.set_on_click_listener(self.xBoxCallback) self.menuItems.append(gui.MenuItem(events, checkBox)) self.eventMenu = gui.Menu(self.menuItems) self.buttonToAdd = gui.Button('Add Item') self.addedEventIndex = gui.TextInput() self.buttonToAdd.set_on_click_listener(self.buttonToAddCallback) mainHBox = sea.hBoxWith(self.eventMenu, self.buttonToAdd, self.addedEventIndex) self.root.append(mainHBox) return self.root
def main(self): self.w = gui.VBox() self.hbox_save_load = gui.HBox(margin="10px") self.dtext_conf_file = gui.TextInput(width=200, height=30) self.dtext_conf_file.set_value(str(vals.config)) self.dtext_conf_file.set_on_change_listener( self.dtext_conf_file_changed) self.bt_load = gui.Button("Load", width=200, height=30, margin="10px") self.bt_load.set_on_click_listener(self.bt_load_changed) self.bt_save = gui.Button("Save", width=200, height=30, margin="10px") self.bt_save.set_on_click_listener(self.bt_save_changed) self.hbox_save_load.append(self.dtext_conf_file) self.hbox_save_load.append(self.bt_load) self.hbox_save_load.append(self.bt_save) self.w.append(self.hbox_save_load) self.hbox_ch1_perturb_ampl = gui.HBox(margin="10px") self.lb_ch1_perturb_ampl = gui.Label("/dev/perturb_ampl", width="20%", margin="10px") self.sd_ch1_perturb_ampl = gui.Slider(vals.ch1_perturb_ampl, -8192, 8191, 1, width="60%", margin="10px") self.sd_ch1_perturb_ampl.set_oninput_listener( self.sd_ch1_perturb_ampl_changed) self.sb_ch1_perturb_ampl = gui.SpinBox(vals.ch1_perturb_ampl, -8192, 8191, 1, width="20%", margin="10px") self.sb_ch1_perturb_ampl.set_on_change_listener( self.sb_ch1_perturb_ampl_changed) self.sd_ch1_perturb_ampl_changed(self.sd_ch1_perturb_ampl, self.sd_ch1_perturb_ampl.get_value()) self.hbox_ch1_perturb_ampl.append(self.lb_ch1_perturb_ampl) self.hbox_ch1_perturb_ampl.append(self.sd_ch1_perturb_ampl) self.hbox_ch1_perturb_ampl.append(self.sb_ch1_perturb_ampl) self.w.append(self.hbox_ch1_perturb_ampl) self.hbox_perturb_nco = gui.HBox(margin="10px") self.lb_perturb_nco = gui.Label("/dev/perturb_nco", width="20%", margin="10px") self.sd_pinc_perturb_nco = gui.Slider(vals.pinc_perturb_nco, 0, 62500000, 1, width="25%", margin="10px") self.sd_pinc_perturb_nco.set_oninput_listener( self.sd_pinc_perturb_nco_changed) self.sb_pinc_perturb_nco = gui.SpinBox(vals.pinc_perturb_nco, 0, 62500000, 0.02, width="10%", margin="10px") self.sb_pinc_perturb_nco.set_on_change_listener( self.sb_pinc_perturb_nco_changed) self.sd_poff_perturb_nco = gui.Slider(vals.poff_perturb_nco, -8192, 8191, 1, width="25%", margin="10px") self.sd_poff_perturb_nco.set_oninput_listener( self.sd_poff_perturb_nco_changed) self.sb_poff_perturb_nco = gui.SpinBox(vals.poff_perturb_nco, -8192, 8191, 1, width="10%", margin="10px") self.sb_poff_perturb_nco.set_on_change_listener( self.sb_poff_perturb_nco_changed) self.cb_pinc_perturb_nco = gui.CheckBoxLabel("pinc", vals.cb_pinc_perturb_nco, width="5%", margin="10px") self.cb_pinc_perturb_nco.set_on_change_listener( self.cb_pinc_perturb_nco_changed) self.cb_poff_perturb_nco = gui.CheckBoxLabel("poff", vals.cb_poff_perturb_nco, width="5%", margin="10px") self.cb_poff_perturb_nco.set_on_change_listener( self.cb_poff_perturb_nco_changed) self.hbox_perturb_nco.append(self.lb_perturb_nco) self.hbox_perturb_nco.append(self.sd_pinc_perturb_nco) self.hbox_perturb_nco.append(self.sb_pinc_perturb_nco) self.hbox_perturb_nco.append(self.sd_poff_perturb_nco) self.hbox_perturb_nco.append(self.sb_poff_perturb_nco) self.hbox_perturb_nco.append(self.cb_pinc_perturb_nco) self.hbox_perturb_nco.append(self.cb_poff_perturb_nco) self.w.append(self.hbox_perturb_nco) return self.w
def main(self): wid = gui.VBox(width=320, height=700, margin='0px auto') #wid = gui.VBox(width='100%', height='100%', margin='0px auto') wid.style['text-align'] = 'center' horizontalContainer_check = gui.Widget( width='100%', height='5%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='1px', style={ 'display': 'block', 'overflow': 'auto' }) horizontalContainer = gui.Widget( width='100%', height='5%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='1px', style={ 'display': 'block', 'overflow': 'auto' }) self.bt = gui.Button('Update', width='20%', height='100%') #stand alone self.bt.style['margin'] = '0px' self.bt.onclick.do(self.on_button_pressed) self.bt_off = gui.Button('Shutdown', width='30%', height='5%') #in the container self.bt_off.style['margin'] = '0px' self.bt_off.onclick.do(self.on_button_pressed_off) self.chck_all = gui.CheckBoxLabel(label='Show all', checked=True, width='25%', height='5%', margin='0px') self.chck_all.onchange.do(self.on_check_change) self.chck1 = gui.CheckBoxLabel(label='adc1', checked=True, width='25%', height='100%', margin='px') self.chck1.onchange.do(self.on_check_change) self.chck2 = gui.CheckBoxLabel(label='adc2', checked=True, width='25%', height='100%', margin='0px') self.chck2.onchange.do(self.on_check_change) self.chck3 = gui.CheckBoxLabel(label='adc3', checked=True, width='25%', height='100%', margin='0px') self.chck3.onchange.do(self.on_check_change) self.chck_vcc = gui.CheckBoxLabel(label='vcc', checked=True, width='25%', height='100%', margin='0px') self.chck_vcc.onchange.do(self.on_check_change) self.date = gui.Label('', width='45%', height='100%', margin='1px') self.data_x, self.data_adc1, self.data_adc2, self.data_adc3, \ self.data_vcc, self.data_tiny_temp, self.data_raspi_temp = update_all_data() self.mpl = MatplotImage(width='100%', height='40%') self.mpl.style['margin'] = '0px' self.mpl.ax.set_title("Voltage [V]") self.mpl.ax.grid(True) if self.chck1.get_value(): self.mpl.ax.plot(self.data_x, self.data_adc1, label='adc1') if self.chck2.get_value(): self.mpl.ax.plot(self.data_x, self.data_adc2, label='adc2') if self.chck3.get_value(): self.mpl.ax.plot(self.data_x, self.data_adc3, label='adc3') if self.chck_vcc.get_value(): self.mpl.ax.plot(self.data_x, self.data_vcc, label='vcc') #bbox_to_anchor x0, y0, width, height #locs = ['upper right', 'lower left', 'center left', 'lower center', 'center','right'] self.mpl.ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), fontsize='small', loc=0, ncol=4, mode="expand", borderaxespad=0.) self.mpl.ax.xaxis.set_major_formatter( matplotlib.dates.DateFormatter('%H:%M')) for label in self.mpl.ax.xaxis.get_ticklabels(): label.set_rotation(45) self.mpl.redraw() self.mpl_t = MatplotImage(width='100%', height='40%') self.mpl_t.style['margin'] = '0px' self.mpl_t.ax.set_title("Temp [degC]") self.mpl_t.ax.grid(True) self.mpl_t.ax.plot(self.data_x, self.data_tiny_temp, label='attiny85') self.mpl_t.ax.plot(self.data_x, self.data_raspi_temp, label='Raspberry') #bbox_to_anchor x0, y0, width, height #locs = ['upper right', 'lower left', 'center left', 'lower center', 'center','right'] self.mpl_t.ax.legend(bbox_to_anchor=(0., 1.02, 1., .102), fontsize='small', loc=0, ncol=2, mode="expand", borderaxespad=0.) self.mpl_t.ax.xaxis.set_major_formatter( matplotlib.dates.DateFormatter('%H:%M')) for label in self.mpl_t.ax.xaxis.get_ticklabels(): label.set_rotation(45) self.mpl_t.redraw() self.shutdown = 0 wid.append(self.bt_off) wid.append(horizontalContainer_check) horizontalContainer_check.append(self.chck1) horizontalContainer_check.append(self.chck2) horizontalContainer_check.append(self.chck3) horizontalContainer_check.append(self.chck_vcc) wid.append(self.mpl) wid.append(self.mpl_t) wid.append(horizontalContainer) horizontalContainer.append(self.chck_all) horizontalContainer.append(self.bt) horizontalContainer.append(self.date) return wid
def test_init(self): widget = gui.CheckBoxLabel() assertValidHTML(widget.repr())
def main(self): # the margin 0px auto centers the main container verticalContainer = gui.Container(width=540, margin='0px auto', style={'display': 'block', 'overflow': 'hidden'}) horizontalContainer = gui.Container(width='100%', layout_orientation=gui.Container.LAYOUT_HORIZONTAL, margin='0px', style={'display': 'block', 'overflow': 'auto'}) subContainerLeft = gui.Container(width=320, style={'display': 'block', 'overflow': 'auto', 'text-align': 'center'}) self.img = gui.Image('/res:logo.png', height=100, margin='10px') self.img.onclick.do(self.on_img_clicked) self.table = gui.Table.new_from_list([('ID', 'First Name', 'Last Name'), ('101', 'Danny', 'Young'), ('102', 'Christine', 'Holand'), ('103', 'Lars', 'Gordon'), ('104', 'Roberto', 'Robitaille'), ('105', 'Maria', 'Papadopoulos')], width=300, height=200, margin='10px') self.table.on_table_row_click.do(self.on_table_row_click) # the arguments are width - height - layoutOrientationOrizontal subContainerRight = gui.Container(style={'width': '220px', 'display': 'block', 'overflow': 'auto', 'text-align': 'center'}) self.count = 0 self.counter = gui.Label('', width=200, height=30, margin='10px') self.lbl = gui.Label('This is a LABEL!', width=200, height=30, margin='10px') self.bt = gui.Button('Press me!', width=200, height=30, margin='10px') # setting the listener for the onclick event of the button self.bt.onclick.do(self.on_button_pressed) self.txt = gui.TextInput(width=200, height=30, margin='10px') self.txt.set_text('This is a TEXTAREA') self.txt.onchange.do(self.on_text_area_change) self.spin = gui.SpinBox(1, 0, 100, width=200, height=30, margin='10px') self.spin.onchange.do(self.on_spin_change) self.progress = gui.Progress(1, 100, width=200, height=5) self.check = gui.CheckBoxLabel('Label checkbox', True, width=200, height=30, margin='10px') self.check.onchange.do(self.on_check_change) self.btInputDiag = gui.Button('Open InputDialog', width=200, height=30, margin='10px') self.btInputDiag.onclick.do(self.open_input_dialog) self.btFileDiag = gui.Button('File Selection Dialog', width=200, height=30, margin='10px') self.btFileDiag.onclick.do(self.open_fileselection_dialog) self.btUploadFile = gui.FileUploader('./', width=200, height=30, margin='10px') self.btUploadFile.onsuccess.do(self.fileupload_on_success) self.btUploadFile.onfailed.do(self.fileupload_on_failed) items = ('Danny Young','Christine Holand','Lars Gordon','Roberto Robitaille') self.listView = gui.ListView.new_from_list(items, width=300, height=120, margin='10px') self.listView.onselection.do(self.list_view_on_selected) self.link = gui.Link("http://localhost:8081", "A link to here", width=200, height=30, margin='10px') self.dropDown = gui.DropDown.new_from_list(('DropDownItem 0', 'DropDownItem 1'), width=200, height=20, margin='10px') self.dropDown.onchange.do(self.drop_down_changed) self.dropDown.select_by_value('DropDownItem 0') self.slider = gui.Slider(10, 0, 100, 5, width=200, height=20, margin='10px') self.slider.onchange.do(self.slider_changed) self.colorPicker = gui.ColorPicker('#ffbb00', width=200, height=20, margin='10px') self.colorPicker.onchange.do(self.color_picker_changed) self.date = gui.Date('2015-04-13', width=200, height=20, margin='10px') self.date.onchange.do(self.date_changed) self.video = gui.Widget( _type='iframe', width=290, height=200, margin='10px') self.video.attributes['src'] = "https://drive.google.com/file/d/0B0J9Lq_MRyn4UFRsblR3UTBZRHc/preview" self.video.attributes['width'] = '100%' self.video.attributes['height'] = '100%' self.video.attributes['controls'] = 'true' self.video.style['border'] = 'none' self.tree = gui.TreeView(width='100%', height=300) ti1 = gui.TreeItem("Item1") ti2 = gui.TreeItem("Item2") ti3 = gui.TreeItem("Item3") subti1 = gui.TreeItem("Sub Item1") subti2 = gui.TreeItem("Sub Item2") subti3 = gui.TreeItem("Sub Item3") subti4 = gui.TreeItem("Sub Item4") subsubti1 = gui.TreeItem("Sub Sub Item1") subsubti2 = gui.TreeItem("Sub Sub Item2") subsubti3 = gui.TreeItem("Sub Sub Item3") self.tree.append([ti1, ti2, ti3]) ti2.append([subti1, subti2, subti3, subti4]) subti4.append([subsubti1, subsubti2, subsubti3]) # appending a widget to another, the first argument is a string key subContainerRight.append([self.counter, self.lbl, self.bt, self.txt, self.spin, self.progress, self.check, self.btInputDiag, self.btFileDiag]) # use a defined key as we replace this widget later fdownloader = gui.FileDownloader('download test', '../remi/res/logo.png', width=200, height=30, margin='10px') subContainerRight.append(fdownloader, key='file_downloader') subContainerRight.append([self.btUploadFile, self.dropDown, self.slider, self.colorPicker, self.date, self.tree]) self.subContainerRight = subContainerRight subContainerLeft.append([self.img, self.table, self.listView, self.link, self.video]) horizontalContainer.append([subContainerLeft, subContainerRight]) menu = gui.Menu(width='100%', height='30px') m1 = gui.MenuItem('File', width=100, height=30) m2 = gui.MenuItem('View', width=100, height=30) m2.onclick.do(self.menu_view_clicked) m11 = gui.MenuItem('Save', width=100, height=30) m12 = gui.MenuItem('Open', width=100, height=30) m12.onclick.do(self.menu_open_clicked) m111 = gui.MenuItem('Save', width=100, height=30) m111.onclick.do(self.menu_save_clicked) m112 = gui.MenuItem('Save as', width=100, height=30) m112.onclick.do(self.menu_saveas_clicked) m3 = gui.MenuItem('Dialog', width=100, height=30) m3.onclick.do(self.menu_dialog_clicked) menu.append([m1, m2, m3]) m1.append([m11, m12]) m11.append([m111, m112]) menubar = gui.MenuBar(width='100%', height='30px') menubar.append(menu) verticalContainer.append([menubar, horizontalContainer]) #this flag will be used to stop the display_counter Timer self.stop_flag = False # kick of regular display of counter self.display_counter() # returning the root widget return verticalContainer
def construct_ui(self): self.main_container = gui.VBox() self.main_container.style['top'] = "0px" self.main_container.style['display'] = "flex" self.main_container.style['overflow'] = "auto" self.main_container.style['width'] = "100%" self.main_container.style['flex-direction'] = "column" self.main_container.style['position'] = "absolute" self.main_container.style['justify-content'] = "space-around" self.main_container.style['margin'] = "0px" self.main_container.style['align-items'] = "center" self.main_container.style['left'] = "0px" self.main_container.style['height'] = "100%" hbox_snap = gui.HBox() hbox_snap.style['left'] = "0px" hbox_snap.style['order'] = "4348867584" hbox_snap.style['display'] = "flex" hbox_snap.style['overflow'] = "auto" hbox_snap.style['width'] = "70%" hbox_snap.style['flex-direction'] = "row" hbox_snap.style['position'] = "static" hbox_snap.style['justify-content'] = "space-around" hbox_snap.style['-webkit-order'] = "4348867584" hbox_snap.style['margin'] = "0px" hbox_snap.style['align-items'] = "center" hbox_snap.style['top'] = "125px" hbox_snap.style['height'] = "150px" button_snap = gui.Button('snap') button_snap.style['margin'] = "0px" button_snap.style['overflow'] = "auto" button_snap.style['width'] = "200px" button_snap.style['height'] = "30px" hbox_snap.append(button_snap, 'button_snap') button_open = gui.Button('open image from file') button_open.style['margin'] = "0px" button_open.style['overflow'] = "auto" button_open.style['width'] = "200px" button_open.style['height'] = "30px" hbox_snap.append(button_open, 'button_open') vbox_settings = gui.VBox() vbox_settings.style['order'] = "4349486136" vbox_settings.style['display'] = "flex" vbox_settings.style['overflow'] = "auto" vbox_settings.style['width'] = "250px" vbox_settings.style['flex-direction'] = "column" vbox_settings.style['position'] = "static" vbox_settings.style['justify-content'] = "space-around" vbox_settings.style['-webkit-order'] = "4349486136" vbox_settings.style['margin'] = "0px" vbox_settings.style['align-items'] = "center" vbox_settings.style['top'] = "149.734375px" vbox_settings.style['height'] = "80px" checkbox_display_original = gui.CheckBoxLabel(' Display original image', False, '') checkbox_display_original.style['order'] = "4348263224" checkbox_display_original.style['-webkit-order'] = "4348263224" checkbox_display_original.style['display'] = "block" checkbox_display_original.style['margin'] = "0px" checkbox_display_original.style['align-items'] = "center" checkbox_display_original.style['overflow'] = "auto" checkbox_display_original.style['width'] = "200px" checkbox_display_original.style['top'] = "135.734375px" checkbox_display_original.style['position'] = "static" checkbox_display_original.style['height'] = "30px" vbox_settings.append(checkbox_display_original, 'checkbox_display_original') checkbox_display_tagged = gui.CheckBoxLabel(' Display tagged image', False, '') checkbox_display_tagged.style['order'] = "4355939912" checkbox_display_tagged.style['-webkit-order'] = "4355939912" checkbox_display_tagged.style['display'] = "block" checkbox_display_tagged.style['margin'] = "0px" checkbox_display_tagged.style['overflow'] = "auto" checkbox_display_tagged.style['width'] = "200px" checkbox_display_tagged.style['top'] = "135px" checkbox_display_tagged.style['position'] = "static" checkbox_display_tagged.style['height'] = "30px" vbox_settings.append(checkbox_display_tagged, 'checkbox_display_tagged') hbox_snap.append(vbox_settings, 'vbox_settings') button_close = gui.Button('close') button_close.style['background-color'] = 'red' button_close.style['width'] = "200px" button_close.style['height'] = '30px' hbox_snap.append(button_close, 'button_close') self.main_container.append(hbox_snap, 'hbox_snap') width = 200 height = 200 self.image_original = PILImageViewerWidget(width=width, height=height) self.main_container.append(self.image_original, 'image_original') self.image_result = PILImageViewerWidget(width=width, height=height) self.main_container.append(self.image_result, 'image_result') self.image_label = gui.Label('', width=400, height=30, margin='10px') self.image_label.style['align-items'] = "center" self.main_container.append(self.image_label, 'image_label') button_close.set_on_click_listener(self.on_close_pressed) button_snap.set_on_click_listener(self.on_snap_pressed) button_open.set_on_click_listener(self.on_open_pressed) return self.main_container
def main(self): self.w = gui.VBox() self.hbox_adc1_offset = gui.HBox(margin="10px") self.lb_adc1_offset = gui.Label("/dev/adc1_offset", width="20%", margin="10px") self.sd_adc1_offset = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_adc1_offset.set_oninput_listener(self.sd_adc1_offset_changed) self.sb_adc1_offset = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_adc1_offset.set_on_change_listener(self.sb_adc1_offset_changed) self.sd_adc1_offset_changed(self.sd_adc1_offset, self.sd_adc1_offset.get_value()) self.hbox_adc1_offset.append(self.lb_adc1_offset) self.hbox_adc1_offset.append(self.sd_adc1_offset) self.hbox_adc1_offset.append(self.sb_adc1_offset) self.w.append(self.hbox_adc1_offset) self.hbox_adc2_offset = gui.HBox(margin="10px") self.lb_adc2_offset = gui.Label("/dev/adc2_offset", width="20%", margin="10px") self.sd_adc2_offset = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_adc2_offset.set_oninput_listener(self.sd_adc2_offset_changed) self.sb_adc2_offset = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_adc2_offset.set_on_change_listener(self.sb_adc2_offset_changed) self.sd_adc2_offset_changed(self.sd_adc2_offset, self.sd_adc2_offset.get_value()) self.hbox_adc2_offset.append(self.lb_adc2_offset) self.hbox_adc2_offset.append(self.sd_adc2_offset) self.hbox_adc2_offset.append(self.sb_adc2_offset) self.w.append(self.hbox_adc2_offset) self.hbox_dac1_offset = gui.HBox(margin="10px") self.lb_dac1_offset = gui.Label("/dev/dac1_offset", width="20%", margin="10px") self.sd_dac1_offset = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_dac1_offset.set_oninput_listener(self.sd_dac1_offset_changed) self.sb_dac1_offset = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_dac1_offset.set_on_change_listener(self.sb_dac1_offset_changed) self.sd_dac1_offset_changed(self.sd_dac1_offset, self.sd_dac1_offset.get_value()) self.hbox_dac1_offset.append(self.lb_dac1_offset) self.hbox_dac1_offset.append(self.sd_dac1_offset) self.hbox_dac1_offset.append(self.sb_dac1_offset) self.w.append(self.hbox_dac1_offset) self.hbox_dac2_offset = gui.HBox(margin="10px") self.lb_dac2_offset = gui.Label("/dev/dac2_offset", width="20%", margin="10px") self.sd_dac2_offset = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_dac2_offset.set_oninput_listener(self.sd_dac2_offset_changed) self.sb_dac2_offset = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_dac2_offset.set_on_change_listener(self.sb_dac2_offset_changed) self.sd_dac2_offset_changed(self.sd_dac2_offset, self.sd_dac2_offset.get_value()) self.hbox_dac2_offset.append(self.lb_dac2_offset) self.hbox_dac2_offset.append(self.sd_dac2_offset) self.hbox_dac2_offset.append(self.sb_dac2_offset) self.w.append(self.hbox_dac2_offset) self.hbox_demod1_nco = gui.HBox(margin="10px") self.lb_demod1_nco = gui.Label("/dev/demod1_nco", width="20%", margin="10px") self.sd_pinc_demod1_nco = gui.Slider(0, 0, 62500000, 1, width="25%", margin="10px") self.sd_pinc_demod1_nco.set_oninput_listener( self.sd_pinc_demod1_nco_changed) self.sb_pinc_demod1_nco = gui.SpinBox(0, 0, 62500000, 0.02, width="10%", margin="10px") self.sb_pinc_demod1_nco.set_on_change_listener( self.sb_pinc_demod1_nco_changed) self.sd_poff_demod1_nco = gui.Slider(0, -8192, 8191, 1, width="25%", margin="10px") self.sd_poff_demod1_nco.set_oninput_listener( self.sd_poff_demod1_nco_changed) self.sb_poff_demod1_nco = gui.SpinBox(0, -8192, 8191, 1, width="10%", margin="10px") self.sb_poff_demod1_nco.set_on_change_listener( self.sb_poff_demod1_nco_changed) self.cb_pinc_demod1_nco = gui.CheckBoxLabel("pinc", True, width="5%", margin="10px") self.cb_pinc_demod1_nco.set_on_change_listener( self.cb_demod1_nco_changed) self.cb_poff_demod1_nco = gui.CheckBoxLabel("poff", True, width="5%", margin="10px") self.cb_poff_demod1_nco.set_on_change_listener( self.cb_demod1_nco_changed) self.hbox_demod1_nco.append(self.lb_demod1_nco) self.hbox_demod1_nco.append(self.sd_pinc_demod1_nco) self.hbox_demod1_nco.append(self.sb_pinc_demod1_nco) self.hbox_demod1_nco.append(self.sd_poff_demod1_nco) self.hbox_demod1_nco.append(self.sb_poff_demod1_nco) self.hbox_demod1_nco.append(self.cb_pinc_demod1_nco) self.hbox_demod1_nco.append(self.cb_poff_demod1_nco) self.w.append(self.hbox_demod1_nco) self.hbox_demod2_nco = gui.HBox(margin="10px") self.lb_demod2_nco = gui.Label("/dev/demod2_nco", width="20%", margin="10px") self.sd_pinc_demod2_nco = gui.Slider(0, 0, 62500000, 1, width="25%", margin="10px") self.sd_pinc_demod2_nco.set_oninput_listener( self.sd_pinc_demod2_nco_changed) self.sb_pinc_demod2_nco = gui.SpinBox(0, 0, 62500000, 0.02, width="10%", margin="10px") self.sb_pinc_demod2_nco.set_on_change_listener( self.sb_pinc_demod2_nco_changed) self.sd_poff_demod2_nco = gui.Slider(0, -8192, 8191, 1, width="25%", margin="10px") self.sd_poff_demod2_nco.set_oninput_listener( self.sd_poff_demod2_nco_changed) self.sb_poff_demod2_nco = gui.SpinBox(0, -8192, 8191, 1, width="10%", margin="10px") self.sb_poff_demod2_nco.set_on_change_listener( self.sb_poff_demod2_nco_changed) self.cb_pinc_demod2_nco = gui.CheckBoxLabel("pinc", True, width="5%", margin="10px") self.cb_pinc_demod2_nco.set_on_change_listener( self.cb_demod2_nco_changed) self.cb_poff_demod2_nco = gui.CheckBoxLabel("poff", True, width="5%", margin="10px") self.cb_poff_demod2_nco.set_on_change_listener( self.cb_demod2_nco_changed) self.hbox_demod2_nco.append(self.lb_demod2_nco) self.hbox_demod2_nco.append(self.sd_pinc_demod2_nco) self.hbox_demod2_nco.append(self.sb_pinc_demod2_nco) self.hbox_demod2_nco.append(self.sd_poff_demod2_nco) self.hbox_demod2_nco.append(self.sb_poff_demod2_nco) self.hbox_demod2_nco.append(self.cb_pinc_demod2_nco) self.hbox_demod2_nco.append(self.cb_poff_demod2_nco) self.w.append(self.hbox_demod2_nco) self.hbox_kp_pid1 = gui.HBox(margin="10px") self.lb_kp_pid1 = gui.Label("/dev/pid1/kp", width="20%", margin="10px") self.sd_kp_pid1 = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_kp_pid1.set_oninput_listener(self.sd_kp_pid1_changed) self.sb_kp_pid1 = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_kp_pid1.set_on_change_listener(self.sb_kp_pid1_changed) self.sd_kp_pid1_changed(self.sd_kp_pid1, self.sd_kp_pid1.get_value()) self.hbox_kp_pid1.append(self.lb_kp_pid1) self.hbox_kp_pid1.append(self.sd_kp_pid1) self.hbox_kp_pid1.append(self.sb_kp_pid1) self.w.append(self.hbox_kp_pid1) self.hbox_ki_pid1 = gui.HBox(margin="10px") self.lb_ki_pid1 = gui.Label("/dev/pid1/ki", width="20%", margin="10px") self.sd_ki_pid1 = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_ki_pid1.set_oninput_listener(self.sd_ki_pid1_changed) self.sb_ki_pid1 = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_ki_pid1.set_on_change_listener(self.sb_ki_pid1_changed) self.sd_ki_pid1_changed(self.sd_ki_pid1, self.sd_ki_pid1.get_value()) self.cb_rst_int_pid1 = gui.CheckBoxLabel("rst_int", True, width="5%", margin="10px") self.cb_rst_int_pid1.set_on_change_listener( self.cb_rst_int_pid1_changed) self.hbox_ki_pid1.append(self.lb_ki_pid1) self.hbox_ki_pid1.append(self.sd_ki_pid1) self.hbox_ki_pid1.append(self.sb_ki_pid1) self.hbox_ki_pid1.append(self.cb_rst_int_pid1) self.w.append(self.hbox_ki_pid1) self.hbox_sp_pid1 = gui.HBox(margin="10px") self.lb_sp_pid1 = gui.Label("/dev/pid1/setpoint", width="20%", margin="10px") self.sd_sp_pid1 = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_sp_pid1.set_oninput_listener(self.sd_sp_pid1_changed) self.sb_sp_pid1 = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_sp_pid1.set_on_change_listener(self.sb_sp_pid1_changed) self.sd_sp_pid1_changed(self.sd_sp_pid1, self.sd_sp_pid1.get_value()) self.hbox_sp_pid1.append(self.lb_sp_pid1) self.hbox_sp_pid1.append(self.sd_sp_pid1) self.hbox_sp_pid1.append(self.sb_sp_pid1) self.w.append(self.hbox_sp_pid1) self.hbox_sign_pid1 = gui.HBox(margin="10px") self.lb_sign_pid1 = gui.Label("/dev/pid1/sign", width="20%", margin="10px") self.sd_sign_pid1 = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_sign_pid1.set_oninput_listener(self.sd_sign_pid1_changed) self.sb_sign_pid1 = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_sign_pid1.set_on_change_listener(self.sb_sign_pid1_changed) self.sd_sign_pid1_changed(self.sd_sign_pid1, self.sd_sign_pid1.get_value()) self.hbox_sign_pid1.append(self.lb_sign_pid1) self.hbox_sign_pid1.append(self.sd_sign_pid1) self.hbox_sign_pid1.append(self.sb_sign_pid1) self.w.append(self.hbox_sign_pid1) self.hbox_pid2_kp = gui.HBox(margin="10px") self.lb_pid2_kp = gui.Label("pid2_kp", width="20%", margin="10px") self.sd_pid2_kp = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_pid2_kp.set_oninput_listener(self.sd_pid2_kp_changed) self.sb_pid2_kp = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_pid2_kp.set_on_change_listener(self.sb_pid2_kp_changed) self.sd_pid2_kp_changed(self.sd_pid2_kp, self.sd_pid2_kp.get_value()) self.hbox_pid2_kp.append(self.lb_pid2_kp) self.hbox_pid2_kp.append(self.sd_pid2_kp) self.hbox_pid2_kp.append(self.sb_pid2_kp) self.w.append(self.hbox_pid2_kp) self.hbox_ki_pid2 = gui.HBox(margin="10px") self.lb_ki_pid2 = gui.Label("/dev/pid2_ki", width="20%", margin="10px") self.sd_ki_pid2 = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_ki_pid2.set_oninput_listener(self.sd_ki_pid2_changed) self.sb_ki_pid2 = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_ki_pid2.set_on_change_listener(self.sb_ki_pid2_changed) self.sd_ki_pid2_changed(self.sd_ki_pid2, self.sd_ki_pid2.get_value()) self.cb_rst_int_pid2 = gui.CheckBoxLabel("rst_int", True, width="5%", margin="10px") self.cb_rst_int_pid2.set_on_change_listener( self.cb_rst_int_pid2_changed) self.hbox_ki_pid2.append(self.lb_ki_pid2) self.hbox_ki_pid2.append(self.sd_ki_pid2) self.hbox_ki_pid2.append(self.sb_ki_pid2) self.hbox_ki_pid2.append(self.cb_rst_int_pid2) self.w.append(self.hbox_ki_pid2) self.hbox_pid3_kp = gui.HBox(margin="10px") self.lb_pid3_kp = gui.Label("pid3_kp", width="20%", margin="10px") self.sd_pid3_kp = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_pid3_kp.set_oninput_listener(self.sd_pid3_kp_changed) self.sb_pid3_kp = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_pid3_kp.set_on_change_listener(self.sb_pid3_kp_changed) self.sd_pid3_kp_changed(self.sd_pid3_kp, self.sd_pid3_kp.get_value()) self.hbox_pid3_kp.append(self.lb_pid3_kp) self.hbox_pid3_kp.append(self.sd_pid3_kp) self.hbox_pid3_kp.append(self.sb_pid3_kp) self.w.append(self.hbox_pid3_kp) self.hbox_ki_pid3 = gui.HBox(margin="10px") self.lb_ki_pid3 = gui.Label("/dev/pid3_ki", width="20%", margin="10px") self.sd_ki_pid3 = gui.Slider(0, -8192, 8191, 1, width="60%", margin="10px") self.sd_ki_pid3.set_oninput_listener(self.sd_ki_pid3_changed) self.sb_ki_pid3 = gui.SpinBox(0, -8192, 8191, 1, width="20%", margin="10px") self.sb_ki_pid3.set_on_change_listener(self.sb_ki_pid3_changed) self.sd_ki_pid3_changed(self.sd_ki_pid3, self.sd_ki_pid3.get_value()) self.cb_rst_int_pid3 = gui.CheckBoxLabel("rst_int", True, width="5%", margin="10px") self.cb_rst_int_pid3.set_on_change_listener( self.cb_rst_int_pid3_changed) self.hbox_ki_pid3.append(self.lb_ki_pid3) self.hbox_ki_pid3.append(self.sd_ki_pid3) self.hbox_ki_pid3.append(self.sb_ki_pid3) self.hbox_ki_pid3.append(self.cb_rst_int_pid3) self.w.append(self.hbox_ki_pid3) self.hbox_pid3_set_point = gui.HBox(margin="10px") self.lb_pid3_set_point = gui.Label("pid3_set_point", width="20%", margin="10px") self.sd_pid3_set_point = gui.Slider(22, 15, 30, 0.01, width="60%", margin="10px") self.sd_pid3_set_point.set_oninput_listener( self.sd_pid3_set_point_changed) self.sb_pid3_set_point = gui.SpinBox(22, 15, 30, 0.01, width="20%", margin="10px") self.sb_pid3_set_point.set_on_change_listener( self.sb_pid3_set_point_changed) self.sd_pid3_set_point_changed(self.sd_pid3_set_point, self.sd_pid3_set_point.get_value()) self.hbox_pid3_set_point.append(self.lb_pid3_set_point) self.hbox_pid3_set_point.append(self.sd_pid3_set_point) self.hbox_pid3_set_point.append(self.sb_pid3_set_point) self.w.append(self.hbox_pid3_set_point) self.hbox_shift_dyn_I = gui.HBox(margin="10px") self.lb_shift_dyn_I = gui.Label("/dev/shift_dyn_I", width="20%", margin="10px") self.sd_shift_dyn_I = gui.Slider(9, -8192, 8191, 1, width="60%", margin="10px") self.sd_shift_dyn_I.set_oninput_listener(self.sd_shift_dyn_I_changed) self.sb_shift_dyn_I = gui.SpinBox(9, -8192, 8191, 1, width="20%", margin="10px") self.sb_shift_dyn_I.set_on_change_listener(self.sb_shift_dyn_I_changed) self.sd_shift_dyn_I_changed(self.sd_shift_dyn_I, self.sd_shift_dyn_I.get_value()) self.hbox_shift_dyn_I.append(self.lb_shift_dyn_I) self.hbox_shift_dyn_I.append(self.sd_shift_dyn_I) self.hbox_shift_dyn_I.append(self.sb_shift_dyn_I) self.w.append(self.hbox_shift_dyn_I) self.hbox_shift_dyn_Q = gui.HBox(margin="10px") self.lb_shift_dyn_Q = gui.Label("/dev/shift_dyn_Q", width="20%", margin="10px") self.sd_shift_dyn_Q = gui.Slider(9, -8192, 8191, 1, width="60%", margin="10px") self.sd_shift_dyn_Q.set_oninput_listener(self.sd_shift_dyn_Q_changed) self.sb_shift_dyn_Q = gui.SpinBox(9, -8192, 8191, 1, width="20%", margin="10px") self.sb_shift_dyn_Q.set_on_change_listener(self.sb_shift_dyn_Q_changed) self.sd_shift_dyn_Q_changed(self.sd_shift_dyn_Q, self.sd_shift_dyn_Q.get_value()) self.hbox_shift_dyn_Q.append(self.lb_shift_dyn_Q) self.hbox_shift_dyn_Q.append(self.sd_shift_dyn_Q) self.hbox_shift_dyn_Q.append(self.sb_shift_dyn_Q) self.w.append(self.hbox_shift_dyn_Q) self.hbox_shift_dyn_2 = gui.HBox(margin="10px") self.lb_shift_dyn_2 = gui.Label("/dev/shift_dyn_2", width="20%", margin="10px") self.sd_shift_dyn_2 = gui.Slider(9, -8192, 8191, 1, width="60%", margin="10px") self.sd_shift_dyn_2.set_oninput_listener(self.sd_shift_dyn_2_changed) self.sb_shift_dyn_2 = gui.SpinBox(9, -8192, 8191, 1, width="20%", margin="10px") self.sb_shift_dyn_2.set_on_change_listener(self.sb_shift_dyn_2_changed) self.sd_shift_dyn_2_changed(self.sd_shift_dyn_2, self.sd_shift_dyn_2.get_value()) self.hbox_shift_dyn_2.append(self.lb_shift_dyn_2) self.hbox_shift_dyn_2.append(self.sd_shift_dyn_2) self.hbox_shift_dyn_2.append(self.sb_shift_dyn_2) self.w.append(self.hbox_shift_dyn_2) self.hbox_tempo = gui.HBox(margin="10px") self.lb_tempo = gui.Label("tempo", width="20%", margin="10px") self.sd_tempo = gui.Slider(500, 50, 10000, 1, width="60%", margin="10px") self.sd_tempo.set_oninput_listener(self.sd_tempo_changed) self.sb_tempo = gui.SpinBox(500, 50, 10000, 1, width="20%", margin="10px") self.sb_tempo.set_on_change_listener(self.sb_tempo_changed) self.sd_tempo_changed(self.sd_tempo, self.sd_tempo.get_value()) self.hbox_tempo.append(self.lb_tempo) self.hbox_tempo.append(self.sd_tempo) self.hbox_tempo.append(self.sb_tempo) self.w.append(self.hbox_tempo) self.hbox_switchIQ = gui.HBox(margin="10px") self.cb_switchIQ = gui.CheckBoxLabel("switchIQ", True, width="5%", margin="10px") self.cb_switchIQ.set_on_change_listener(self.cb_switchIQ_changed) self.hbox_switchIQ.append(self.cb_switchIQ) self.w.append(self.hbox_switchIQ) return self.w
def light_clicked(self, widget): #read current setpoints from pickle light_setpoints = self.read_from_pickle("light_setpoints") self.light_control = gui.GenericDialog(title='Light Control', width='100%', height='100%') light_container = gui.Widget( width='100%', height='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px', style={ 'display': 'block', 'overflow': 'auto' }) on_container = gui.Widget(width='50%', height='50%', margin='0px auto', style={ 'text-align': 'center', 'display': 'block', 'overflow': 'auto' }) off_container = gui.Widget(width='50%', height='50%', margin='0px auto', style={ 'text-align': 'center', 'display': 'block', 'overflow': 'auto' }) always_on_container = gui.Widget( width='100%', height='80%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px', style={ 'text-align': 'center', 'display': 'block', 'overflow': 'auto' }) spacer = gui.Widget(width='100%', height=50, margin='0px auto', style={ 'display': 'block', 'overflow': 'auto' }) spacer_label = gui.Label('', width='100%', height=20, margin='0px') verticalContainer = gui.Widget(width='100%', height='100%', margin='0px auto', style={ 'display': 'block', 'overflow': 'auto' }) always_on_label = gui.Label('Light toggle', width='50%', height='100%', margin='0px') self.always_on = gui.CheckBoxLabel('', light_setpoints['always_on'], width='50%', height='100%', margin='0x') self.always_on.onchange.do(self.on_check_change) self.light_on_label = gui.Label( 'Lights on at ' + str(light_setpoints['on_time']) + ':00', width='100%', height=30, margin='0px') self.light_off_label = gui.Label( 'Lights off at ' + str(light_setpoints['off_time']) + ':00', width='100%', height=30, margin='0px') self.on_slider = gui.Slider(light_setpoints['on_time'], 0, 24, 1, width='80%', height=60, margin='20px') self.off_slider = gui.Slider(light_setpoints['off_time'], 0, 24, 1, width='80%', height=60, margin='20px') self.on_slider.onchange.do(self.on_slider_changed) self.off_slider.onchange.do(self.off_slider_changed) on_container.append([self.light_on_label, self.on_slider]) off_container.append([self.light_off_label, self.off_slider]) always_on_container.append([always_on_label, self.always_on]) light_container.append([on_container, off_container]) verticalContainer.append( [spacer_label, light_container, always_on_container, spacer]) self.light_control.add_field("light", verticalContainer) self.light_control.confirm_dialog.do(self.light_confirm) self.light_control.show(self)
def main(self): verticalContainer = gui.Widget(640, 900, gui.Widget.LAYOUT_VERTICAL, 10) horizontalContainer = gui.Widget(620, 620, gui.Widget.LAYOUT_HORIZONTAL, 10) subContainerLeft = gui.Widget(340, 530, gui.Widget.LAYOUT_VERTICAL, 10) self.img = gui.Image(100, 100, '/res/logo.png') self.img.set_on_click_listener(self, 'on_img_clicked') self.table = gui.Table(300, 200) self.table.from_2d_matrix([['ID', 'First Name', 'Last Name'], ['101', 'Danny', 'Young'], ['102', 'Christine', 'Holand'], ['103', 'Lars', 'Gordon'], ['104', 'Roberto', 'Robitaille'], ['105', 'Maria', 'Papadopoulos']]) # the arguments are width - height - layoutOrientationOrizontal subContainerRight = gui.Widget(240, 560, gui.Widget.LAYOUT_VERTICAL, 10) self.count = 0 self.counter = gui.Label(200, 30, '') self.lbl = gui.Label(200, 30, 'This is a LABEL!') self.bt = gui.Button(200, 30, 'Press me!') # setting the listener for the onclick event of the button self.bt.set_on_click_listener(self, 'on_button_pressed') self.txt = gui.TextInput(200, 30) self.txt.set_text('This is a TEXTAREA') self.txt.set_on_change_listener(self, 'on_text_area_change') self.spin = gui.SpinBox(200, 30, 100) self.spin.set_on_change_listener(self, 'on_spin_change') self.check = gui.CheckBoxLabel(200, 30, 'Label checkbox', True) self.check.set_on_change_listener(self, 'on_check_change') self.btInputDiag = gui.Button(200, 30, 'Open InputDialog') self.btInputDiag.set_on_click_listener(self, 'open_input_dialog') self.btFileDiag = gui.Button(200, 30, 'File Selection Dialog') self.btFileDiag.set_on_click_listener(self, 'open_fileselection_dialog') self.btUploadFile = gui.FileUploader(200, 30, './') self.btUploadFile.set_on_success_listener(self, 'fileupload_on_success') self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed') self.listView = gui.ListView(300, 120) self.listView.set_on_selection_listener(self, "list_view_on_selected") li0 = gui.ListItem(279, 20, 'Danny Young') li1 = gui.ListItem(279, 20, 'Christine Holand') li2 = gui.ListItem(279, 20, 'Lars Gordon') li3 = gui.ListItem(279, 20, 'Roberto Robitaille') self.listView.append('0', li0) self.listView.append('1', li1) self.listView.append('2', li2) self.listView.append('3', li3) self.link = gui.Link(200, 20, "http://localhost:8081", "A link to here") self.dropDown = gui.DropDown(200, 20) c0 = gui.DropDownItem(200, 20, 'DropDownItem 0') c1 = gui.DropDownItem(200, 20, 'DropDownItem 1') self.dropDown.append('0', c0) self.dropDown.append('1', c1) self.dropDown.set_on_change_listener(self, 'drop_down_changed') self.dropDown.set_value('DropDownItem 0') self.slider = gui.Slider(200, 20, 10, 0, 100, 5) self.slider.set_on_change_listener(self, 'slider_changed') self.colorPicker = gui.ColorPicker(200, 20, '#ffbb00') self.colorPicker.set_on_change_listener(self, 'color_picker_changed') self.date = gui.Date(200, 20, '2015-04-13') self.date.set_on_change_listener(self, 'date_changed') self.video = gui.VideoPlayer( 480, 270, 'http://www.w3schools.com/tags/movie.mp4', 'http://www.oneparallel.com/wp-content/uploads/2011/01/placeholder.jpg' ) # appending a widget to another, the first argument is a string key subContainerRight.append('0', self.counter) subContainerRight.append('1', self.lbl) subContainerRight.append('2', self.bt) subContainerRight.append('3', self.txt) subContainerRight.append('4', self.spin) subContainerRight.append('checkbox', self.check) subContainerRight.append('5', self.btInputDiag) subContainerRight.append('5_', self.btFileDiag) subContainerRight.append( '5__', gui.FileDownloader(200, 30, 'download test', '../remi/res/logo.png')) subContainerRight.append('5___', self.btUploadFile) subContainerRight.append('6', self.dropDown) subContainerRight.append('7', self.slider) subContainerRight.append('8', self.colorPicker) subContainerRight.append('9', self.date) self.subContainerRight = subContainerRight subContainerLeft.append('0', self.img) subContainerLeft.append('1', self.table) subContainerLeft.append('2', self.listView) subContainerLeft.append('3', self.link) subContainerLeft.append('4', self.video) horizontalContainer.append('0', subContainerLeft) horizontalContainer.append('1', subContainerRight) menu = gui.Menu(620, 30) m1 = gui.MenuItem(100, 30, 'File') m2 = gui.MenuItem(100, 30, 'View') m2.set_on_click_listener(self, 'menu_view_clicked') m11 = gui.MenuItem(100, 30, 'Save') m12 = gui.MenuItem(100, 30, 'Open') m12.set_on_click_listener(self, 'menu_open_clicked') m111 = gui.MenuItem(100, 30, 'Save') m111.set_on_click_listener(self, 'menu_save_clicked') m112 = gui.MenuItem(100, 30, 'Save as') m112.set_on_click_listener(self, 'menu_saveas_clicked') m3 = gui.MenuItem(100, 30, 'Dialog') m3.set_on_click_listener(self, 'menu_dialog_clicked') menu.append('1', m1) menu.append('2', m2) menu.append('3', m3) m1.append('11', m11) m1.append('12', m12) m11.append('111', m111) m11.append('112', m112) menubar = gui.MenuBar(620, 30) menubar.append('1', menu) verticalContainer.append('0', menubar) verticalContainer.append('1', horizontalContainer) # kick of regular display of counter self.display_counter() # returning the root widget return verticalContainer
def main(self): wid = gui.VBox(width='100%', margin='0px auto') width = '300' #'2048' height = '300' #'1152' self.video = gui.Widget(width=300, height=300, _type='video') self.video.attributes['autoplay'] = 'true' self.video.style['overflow'] = 'hidden' self.video.attributes['width'] = width self.video.attributes['height'] = height self.canvas = gui.Widget(_type='canvas') self.canvas.style['display'] = 'none' self.canvas.attributes['width'] = width self.canvas.attributes['height'] = height self.imgGrabber = ImageGrabber(self, width, height) self.imgGrabber.set_on_change_listener(self.on_new_image) self.imgGrabber.set_on_newvideodevice_listener(self.new_video_device) getVideoInputsButton = gui.Button("Get cameras", margin='10px') getVideoInputsButton.set_on_click_listener(self.on_get_video_inputs) captureButton = gui.Button("Start", margin='10px') captureButton.set_on_click_listener(self.on_start_grab, None) self.check_flash = gui.CheckBoxLabel('Flashlight', False, width=200, height=30, margin='10px') self.check_flash.set_on_change_listener(self.on_start_grab) self.label = gui.Label('Image capture') self.label.style['font-size'] = '18px' self.device_list = gui.DropDown(width=100) wid.append(self.label) wid.append(self.video) wid.append(self.canvas) wid.append(getVideoInputsButton) wid.append(self.device_list) wid.append(captureButton) wid.append(self.check_flash) #javascript_log_override = gui.Tag(_type='script') #javascript_log_override.add_child("javascript", """ console.log = function(message) { alert(message);}; console.error = console.debug = console.info = console.log;""") #wid.add_child("javascript_log_override",javascript_log_override) self.halcon_msg_handler_server = socketserver.TCPServer( ('localhost', 0), HalconMsgHandler) self.halcon_msg_handler_server.app_instance = self #in order to pass app instance to req handler # Activate the server; this will keep running until you # interrupt the program with Ctrl-C threading.Thread( target=self.halcon_msg_handler_server.serve_forever).start() wid.add_child("javascript_image_grabber", self.imgGrabber) self.dialog = None # returning the root widget return wid
def main(self): self.w = gui.VBox() self.hbox_save_load = gui.HBox(margin="10px") self.dtext_conf_file = gui.TextInput(width=200, height=30) self.dtext_conf_file.set_value(str(vals.config)) self.dtext_conf_file.set_on_change_listener(self.dtext_conf_file_changed) self.bt_load = gui.Button("Load", width=200, height=30, margin="10px") self.bt_load.set_on_click_listener(self.bt_load_changed) self.bt_save = gui.Button("Save", width=200, height=30, margin="10px") self.bt_save.set_on_click_listener(self.bt_save_changed) self.hbox_save_load.append(self.dtext_conf_file) self.hbox_save_load.append(self.bt_load) self.hbox_save_load.append(self.bt_save) self.w.append(self.hbox_save_load) self.hbox_adc1_offset = gui.HBox(margin="10px") self.lb_adc1_offset = gui.Label("/dev/adc1_offset", width="20%", margin="10px") self.sd_adc1_offset = gui.Slider(vals.adc1_offset, -8192, 8191, 1, width="60%", margin="10px") self.sd_adc1_offset.set_oninput_listener(self.sd_adc1_offset_changed) self.sb_adc1_offset = gui.SpinBox(vals.adc1_offset, -8192, 8191, 1, width="20%", margin="10px") self.sb_adc1_offset.set_on_change_listener(self.sb_adc1_offset_changed) self.sd_adc1_offset_changed(self.sd_adc1_offset, self.sd_adc1_offset.get_value()) self.hbox_adc1_offset.append(self.lb_adc1_offset) self.hbox_adc1_offset.append(self.sd_adc1_offset) self.hbox_adc1_offset.append(self.sb_adc1_offset) self.w.append(self.hbox_adc1_offset) self.hbox_dac1_offset = gui.HBox(margin="10px") self.lb_dac1_offset = gui.Label("/dev/dac1_offset", width="20%", margin="10px") self.sd_dac1_offset = gui.Slider(vals.dac1_offset, -8192, 8191, 1, width="60%", margin="10px") self.sd_dac1_offset.set_oninput_listener(self.sd_dac1_offset_changed) self.sb_dac1_offset = gui.SpinBox(vals.dac1_offset, -8192, 8191, 1, width="20%", margin="10px") self.sb_dac1_offset.set_on_change_listener(self.sb_dac1_offset_changed) self.sd_dac1_offset_changed(self.sd_dac1_offset, self.sd_dac1_offset.get_value()) self.hbox_dac1_offset.append(self.lb_dac1_offset) self.hbox_dac1_offset.append(self.sd_dac1_offset) self.hbox_dac1_offset.append(self.sb_dac1_offset) self.w.append(self.hbox_dac1_offset) self.hbox_ch1_mod_input_ampl = gui.HBox(margin="10px") self.lb_ch1_mod_input_ampl = gui.Label("/dev/mod_input_ampl", width="20%", margin="10px") self.sd_ch1_mod_input_ampl = gui.Slider(vals.ch1_mod_input_ampl, -8192, 8191, 1, width="60%", margin="10px") self.sd_ch1_mod_input_ampl.set_oninput_listener(self.sd_ch1_mod_input_ampl_changed) self.sb_ch1_mod_input_ampl = gui.SpinBox(vals.ch1_mod_input_ampl, -8192, 8191, 1, width="20%", margin="10px") self.sb_ch1_mod_input_ampl.set_on_change_listener(self.sb_ch1_mod_input_ampl_changed) self.sd_ch1_mod_input_ampl_changed(self.sd_ch1_mod_input_ampl, self.sd_ch1_mod_input_ampl.get_value()) self.hbox_ch1_mod_input_ampl.append(self.lb_ch1_mod_input_ampl) self.hbox_ch1_mod_input_ampl.append(self.sd_ch1_mod_input_ampl) self.hbox_ch1_mod_input_ampl.append(self.sb_ch1_mod_input_ampl) self.w.append(self.hbox_ch1_mod_input_ampl) self.hbox_mod_input_nco = gui.HBox(margin="10px") self.lb_mod_input_nco = gui.Label("/dev/mod_input_nco", width="20%", margin="10px") self.sd_pinc_mod_input_nco = gui.Slider(vals.pinc_mod_input_nco, 0, 62500000, 1, width="25%", margin="10px") self.sd_pinc_mod_input_nco.set_oninput_listener(self.sd_pinc_mod_input_nco_changed) self.sb_pinc_mod_input_nco = gui.SpinBox(vals.pinc_mod_input_nco, 0, 62500000, 0.02, width="10%", margin="10px") self.sb_pinc_mod_input_nco.set_on_change_listener(self.sb_pinc_mod_input_nco_changed) self.sd_poff_mod_input_nco = gui.Slider(vals.poff_mod_input_nco, -8192, 8191, 1, width="25%", margin="10px") self.sd_poff_mod_input_nco.set_oninput_listener(self.sd_poff_mod_input_nco_changed) self.sb_poff_mod_input_nco = gui.SpinBox(vals.poff_mod_input_nco, -8192, 8191, 1, width="10%", margin="10px") self.sb_poff_mod_input_nco.set_on_change_listener(self.sb_poff_mod_input_nco_changed) self.cb_pinc_mod_input_nco = gui.CheckBoxLabel("pinc", vals.cb_pinc_mod_input_nco, width="5%", margin="10px") self.cb_pinc_mod_input_nco.set_on_change_listener(self.cb_pinc_mod_input_nco_changed) self.cb_poff_mod_input_nco = gui.CheckBoxLabel("poff", vals.cb_poff_mod_input_nco, width="5%", margin="10px") self.cb_poff_mod_input_nco.set_on_change_listener(self.cb_poff_mod_input_nco_changed) self.hbox_mod_input_nco.append(self.lb_mod_input_nco) self.hbox_mod_input_nco.append(self.sd_pinc_mod_input_nco) self.hbox_mod_input_nco.append(self.sb_pinc_mod_input_nco) self.hbox_mod_input_nco.append(self.sd_poff_mod_input_nco) self.hbox_mod_input_nco.append(self.sb_poff_mod_input_nco) self.hbox_mod_input_nco.append(self.cb_pinc_mod_input_nco) self.hbox_mod_input_nco.append(self.cb_poff_mod_input_nco) self.w.append(self.hbox_mod_input_nco) self.hbox_ch1_mod_out_pid2_ampl = gui.HBox(margin="10px") self.lb_ch1_mod_out_pid2_ampl = gui.Label("/dev/mod_out_pid2_ampl", width="20%", margin="10px") self.sd_ch1_mod_out_pid2_ampl = gui.Slider(vals.ch1_mod_out_pid2_ampl, -8192, 8191, 1, width="60%", margin="10px") self.sd_ch1_mod_out_pid2_ampl.set_oninput_listener(self.sd_ch1_mod_out_pid2_ampl_changed) self.sb_ch1_mod_out_pid2_ampl = gui.SpinBox(vals.ch1_mod_out_pid2_ampl, -8192, 8191, 1, width="20%", margin="10px") self.sb_ch1_mod_out_pid2_ampl.set_on_change_listener(self.sb_ch1_mod_out_pid2_ampl_changed) self.sd_ch1_mod_out_pid2_ampl_changed(self.sd_ch1_mod_out_pid2_ampl, self.sd_ch1_mod_out_pid2_ampl.get_value()) self.hbox_ch1_mod_out_pid2_ampl.append(self.lb_ch1_mod_out_pid2_ampl) self.hbox_ch1_mod_out_pid2_ampl.append(self.sd_ch1_mod_out_pid2_ampl) self.hbox_ch1_mod_out_pid2_ampl.append(self.sb_ch1_mod_out_pid2_ampl) self.w.append(self.hbox_ch1_mod_out_pid2_ampl) self.hbox_mod_out_pid2_nco = gui.HBox(margin="10px") self.lb_mod_out_pid2_nco = gui.Label("/dev/mod_out_pid2_nco", width="20%", margin="10px") self.sd_pinc_mod_out_pid2_nco = gui.Slider(vals.pinc_mod_out_pid2_nco, 0, 62500000, 1, width="25%", margin="10px") self.sd_pinc_mod_out_pid2_nco.set_oninput_listener(self.sd_pinc_mod_out_pid2_nco_changed) self.sb_pinc_mod_out_pid2_nco = gui.SpinBox(vals.pinc_mod_out_pid2_nco, 0, 62500000, 0.02, width="10%", margin="10px") self.sb_pinc_mod_out_pid2_nco.set_on_change_listener(self.sb_pinc_mod_out_pid2_nco_changed) self.sd_poff_mod_out_pid2_nco = gui.Slider(vals.poff_mod_out_pid2_nco, -8192, 8191, 1, width="25%", margin="10px") self.sd_poff_mod_out_pid2_nco.set_oninput_listener(self.sd_poff_mod_out_pid2_nco_changed) self.sb_poff_mod_out_pid2_nco = gui.SpinBox(vals.poff_mod_out_pid2_nco, -8192, 8191, 1, width="10%", margin="10px") self.sb_poff_mod_out_pid2_nco.set_on_change_listener(self.sb_poff_mod_out_pid2_nco_changed) self.cb_pinc_mod_out_pid2_nco = gui.CheckBoxLabel("pinc", vals.cb_pinc_mod_out_pid2_nco, width="5%", margin="10px") self.cb_pinc_mod_out_pid2_nco.set_on_change_listener(self.cb_pinc_mod_out_pid2_nco_changed) self.cb_poff_mod_out_pid2_nco = gui.CheckBoxLabel("poff", vals.cb_poff_mod_out_pid2_nco, width="5%", margin="10px") self.cb_poff_mod_out_pid2_nco.set_on_change_listener(self.cb_poff_mod_out_pid2_nco_changed) self.hbox_mod_out_pid2_nco.append(self.lb_mod_out_pid2_nco) self.hbox_mod_out_pid2_nco.append(self.sd_pinc_mod_out_pid2_nco) self.hbox_mod_out_pid2_nco.append(self.sb_pinc_mod_out_pid2_nco) self.hbox_mod_out_pid2_nco.append(self.sd_poff_mod_out_pid2_nco) self.hbox_mod_out_pid2_nco.append(self.sb_poff_mod_out_pid2_nco) self.hbox_mod_out_pid2_nco.append(self.cb_pinc_mod_out_pid2_nco) self.hbox_mod_out_pid2_nco.append(self.cb_poff_mod_out_pid2_nco) self.w.append(self.hbox_mod_out_pid2_nco) self.hbox_kp_pid1 = gui.HBox(margin="10px") self.lb_kp_pid1 = gui.Label("/dev/pid1/kp", width="20%", margin="10px") self.sd_kp_pid1 = gui.Slider(vals.kp_pid1, -8192, 8191, 1, width="60%", margin="10px") self.sd_kp_pid1.set_oninput_listener(self.sd_kp_pid1_changed) self.sb_kp_pid1 = gui.SpinBox(vals.kp_pid1, -8192, 8191, 1, width="20%", margin="10px") self.sb_kp_pid1.set_on_change_listener(self.sb_kp_pid1_changed) self.sd_kp_pid1_changed(self.sd_kp_pid1, self.sd_kp_pid1.get_value()) self.hbox_kp_pid1.append(self.lb_kp_pid1) self.hbox_kp_pid1.append(self.sd_kp_pid1) self.hbox_kp_pid1.append(self.sb_kp_pid1) self.w.append(self.hbox_kp_pid1) self.hbox_ki_pid1 = gui.HBox(margin="10px") self.lb_ki_pid1 = gui.Label("/dev/pid1/ki", width="20%", margin="10px") self.sd_ki_pid1 = gui.Slider(vals.ki_pid1, -8192, 8191, 1, width="60%", margin="10px") self.sd_ki_pid1.set_oninput_listener(self.sd_ki_pid1_changed) self.sb_ki_pid1 = gui.SpinBox(vals.ki_pid1, -8192, 8191, 1, width="20%", margin="10px") self.sb_ki_pid1.set_on_change_listener(self.sb_ki_pid1_changed) self.sd_ki_pid1_changed(self.sd_ki_pid1, self.sd_ki_pid1.get_value()) self.cb_rst_int_pid1 = gui.CheckBoxLabel("rst_int", vals.rst_int_pid1, width="5%", margin="10px") self.cb_rst_int_pid1.set_on_change_listener(self.cb_rst_int_pid1_changed) self.hbox_ki_pid1.append(self.lb_ki_pid1) self.hbox_ki_pid1.append(self.sd_ki_pid1) self.hbox_ki_pid1.append(self.sb_ki_pid1) self.hbox_ki_pid1.append(self.cb_rst_int_pid1) self.w.append(self.hbox_ki_pid1) self.hbox_ki_piid1 = gui.HBox(margin="10px") self.lb_ki_piid1 = gui.Label("/dev/pid1/kii", width="20%", margin="10px") self.sd_ki_piid1 = gui.Slider(vals.ki_piid1, -8192, 8191, 1, width="60%", margin="10px") self.sd_ki_piid1.set_oninput_listener(self.sd_ki_piid1_changed) self.sb_ki_piid1 = gui.SpinBox(vals.ki_piid1, -8192, 8191, 1, width="20%", margin="10px") self.sb_ki_piid1.set_on_change_listener(self.sb_ki_piid1_changed) self.sd_ki_piid1_changed(self.sd_ki_piid1, self.sd_ki_piid1.get_value()) self.hbox_ki_piid1.append(self.lb_ki_piid1) self.hbox_ki_piid1.append(self.sd_ki_piid1) self.hbox_ki_piid1.append(self.sb_ki_piid1) self.w.append(self.hbox_ki_piid1) self.hbox_sp_pid1 = gui.HBox(margin="10px") self.lb_sp_pid1 = gui.Label("/dev/pid1/setpoint", width="20%", margin="10px") self.sd_sp_pid1 = gui.Slider(vals.sp_pid1, -8192, 8191, 1, width="60%", margin="10px") self.sd_sp_pid1.set_oninput_listener(self.sd_sp_pid1_changed) self.sb_sp_pid1 = gui.SpinBox(vals.sp_pid1, -8192, 8191, 1, width="20%", margin="10px") self.sb_sp_pid1.set_on_change_listener(self.sb_sp_pid1_changed) self.sd_sp_pid1_changed(self.sd_sp_pid1, self.sd_sp_pid1.get_value()) self.hbox_sp_pid1.append(self.lb_sp_pid1) self.hbox_sp_pid1.append(self.sd_sp_pid1) self.hbox_sp_pid1.append(self.sb_sp_pid1) self.w.append(self.hbox_sp_pid1) self.hbox_sign_pid1 = gui.HBox(margin="10px") self.lb_sign_pid1 = gui.Label("/dev/pid1/sign", width="20%", margin="10px") self.sd_sign_pid1 = gui.Slider(vals.sign_pid1, -8192, 8191, 1, width="60%", margin="10px") self.sd_sign_pid1.set_oninput_listener(self.sd_sign_pid1_changed) self.sb_sign_pid1 = gui.SpinBox(vals.sign_pid1, -8192, 8191, 1, width="20%", margin="10px") self.sb_sign_pid1.set_on_change_listener(self.sb_sign_pid1_changed) self.sd_sign_pid1_changed(self.sd_sign_pid1, self.sd_sign_pid1.get_value()) self.hbox_sign_pid1.append(self.lb_sign_pid1) self.hbox_sign_pid1.append(self.sd_sign_pid1) self.hbox_sign_pid1.append(self.sb_sign_pid1) self.w.append(self.hbox_sign_pid1) self.hbox_kp_pid2 = gui.HBox(margin="10px") self.lb_kp_pid2 = gui.Label("/dev/pid2/kp", width="20%", margin="10px") self.sd_kp_pid2 = gui.Slider(vals.kp_pid2, -8192, 8191, 1, width="60%", margin="10px") self.sd_kp_pid2.set_oninput_listener(self.sd_kp_pid2_changed) self.sb_kp_pid2 = gui.SpinBox(vals.kp_pid2, -8192, 8191, 1, width="20%", margin="10px") self.sb_kp_pid2.set_on_change_listener(self.sb_kp_pid2_changed) self.sd_kp_pid2_changed(self.sd_kp_pid2, self.sd_kp_pid2.get_value()) self.hbox_kp_pid2.append(self.lb_kp_pid2) self.hbox_kp_pid2.append(self.sd_kp_pid2) self.hbox_kp_pid2.append(self.sb_kp_pid2) self.w.append(self.hbox_kp_pid2) self.hbox_ki_pid2 = gui.HBox(margin="10px") self.lb_ki_pid2 = gui.Label("/dev/pid2/ki", width="20%", margin="10px") self.sd_ki_pid2 = gui.Slider(vals.ki_pid2, -8192, 8191, 1, width="60%", margin="10px") self.sd_ki_pid2.set_oninput_listener(self.sd_ki_pid2_changed) self.sb_ki_pid2 = gui.SpinBox(vals.ki_pid2, -8192, 8191, 1, width="20%", margin="10px") self.sb_ki_pid2.set_on_change_listener(self.sb_ki_pid2_changed) self.sd_ki_pid2_changed(self.sd_ki_pid2, self.sd_ki_pid2.get_value()) self.cb_rst_int_pid2 = gui.CheckBoxLabel("rst_int", vals.rst_int_pid2, width="5%", margin="10px") self.cb_rst_int_pid2.set_on_change_listener(self.cb_rst_int_pid2_changed) self.hbox_ki_pid2.append(self.lb_ki_pid2) self.hbox_ki_pid2.append(self.sd_ki_pid2) self.hbox_ki_pid2.append(self.sb_ki_pid2) self.hbox_ki_pid2.append(self.cb_rst_int_pid2) self.w.append(self.hbox_ki_pid2) self.hbox_sp_pid2 = gui.HBox(margin="10px") self.lb_sp_pid2 = gui.Label("/dev/pid2/setpoint", width="20%", margin="10px") self.sd_sp_pid2 = gui.Slider(vals.sp_pid2, -8192, 8191, 1, width="60%", margin="10px") self.sd_sp_pid2.set_oninput_listener(self.sd_sp_pid2_changed) self.sb_sp_pid2 = gui.SpinBox(vals.sp_pid2, -8192, 8191, 1, width="20%", margin="10px") self.sb_sp_pid2.set_on_change_listener(self.sb_sp_pid2_changed) self.sd_sp_pid2_changed(self.sd_sp_pid2, self.sd_sp_pid2.get_value()) self.hbox_sp_pid2.append(self.lb_sp_pid2) self.hbox_sp_pid2.append(self.sd_sp_pid2) self.hbox_sp_pid2.append(self.sb_sp_pid2) self.w.append(self.hbox_sp_pid2) self.hbox_sign_pid2 = gui.HBox(margin="10px") self.lb_sign_pid2 = gui.Label("/dev/pid2/sign", width="20%", margin="10px") self.sd_sign_pid2 = gui.Slider(vals.sign_pid2, -8192, 8191, 1, width="60%", margin="10px") self.sd_sign_pid2.set_oninput_listener(self.sd_sign_pid2_changed) self.sb_sign_pid2 = gui.SpinBox(vals.sign_pid2, -8192, 8191, 1, width="20%", margin="10px") self.sb_sign_pid2.set_on_change_listener(self.sb_sign_pid2_changed) self.sd_sign_pid2_changed(self.sd_sign_pid2, self.sd_sign_pid2.get_value()) self.hbox_sign_pid2.append(self.lb_sign_pid2) self.hbox_sign_pid2.append(self.sd_sign_pid2) self.hbox_sign_pid2.append(self.sb_sign_pid2) self.w.append(self.hbox_sign_pid2) self.hbox_pid2_offset = gui.HBox(margin="10px") self.lb_pid2_offset = gui.Label("/dev/pid2_offset", width="20%", margin="10px") self.sd_pid2_offset = gui.Slider(vals.pid2_offset, -8192, 8191, 1, width="60%", margin="10px") self.sd_pid2_offset.set_oninput_listener(self.sd_pid2_offset_changed) self.sb_pid2_offset = gui.SpinBox(vals.pid2_offset, -8192, 8191, 1, width="20%", margin="10px") self.sb_pid2_offset.set_on_change_listener(self.sb_pid2_offset_changed) self.sd_pid2_offset_changed(self.sd_pid2_offset, self.sd_pid2_offset.get_value()) self.hbox_pid2_offset.append(self.lb_pid2_offset) self.hbox_pid2_offset.append(self.sd_pid2_offset) self.hbox_pid2_offset.append(self.sb_pid2_offset) self.w.append(self.hbox_pid2_offset) return self.w
def main(self): self.w = gui.VBox() self.hbox_save_load = gui.HBox(margin="10px") self.dtext_conf_file = gui.TextInput(width=200, height=30) self.dtext_conf_file.set_value(str(vals.config)) self.dtext_conf_file.set_on_change_listener( self.dtext_conf_file_changed) self.bt_load = gui.Button("Load", width=200, height=30, margin="10px") self.bt_load.set_on_click_listener(self.bt_load_changed) self.bt_save = gui.Button("Save", width=200, height=30, margin="10px") self.bt_save.set_on_click_listener(self.bt_save_changed) self.hbox_save_load.append(self.dtext_conf_file) self.hbox_save_load.append(self.bt_load) self.hbox_save_load.append(self.bt_save) self.w.append(self.hbox_save_load) self.hbox_adc1_offset = gui.HBox(margin="10px") self.lb_adc1_offset = gui.Label("/dev/adc1_offset", width="20%", margin="10px") self.sd_adc1_offset = gui.Slider(vals.adc1_offset, -8192, 8191, 1, width="60%", margin="10px") self.sd_adc1_offset.set_on_change_listener(self.sd_adc1_offset_changed) self.sb_adc1_offset = gui.SpinBox(vals.adc1_offset, -8192, 8191, 1, width="20%", margin="10px") self.sb_adc1_offset.set_on_change_listener(self.sb_adc1_offset_changed) self.sd_adc1_offset_changed(self.sd_adc1_offset, self.sd_adc1_offset.get_value()) self.hbox_adc1_offset.append(self.lb_adc1_offset) self.hbox_adc1_offset.append(self.sd_adc1_offset) self.hbox_adc1_offset.append(self.sb_adc1_offset) self.w.append(self.hbox_adc1_offset) self.hbox_adc2_offset = gui.HBox(margin="10px") self.lb_adc2_offset = gui.Label("/dev/adc2_offset", width="20%", margin="10px") self.sd_adc2_offset = gui.Slider(vals.adc2_offset, -8192, 8191, 1, width="60%", margin="10px") self.sd_adc2_offset.set_on_change_listener(self.sd_adc2_offset_changed) self.sb_adc2_offset = gui.SpinBox(vals.adc2_offset, -8192, 8191, 1, width="20%", margin="10px") self.sb_adc2_offset.set_on_change_listener(self.sb_adc2_offset_changed) self.sd_adc2_offset_changed(self.sd_adc2_offset, self.sd_adc2_offset.get_value()) self.hbox_adc2_offset.append(self.lb_adc2_offset) self.hbox_adc2_offset.append(self.sd_adc2_offset) self.hbox_adc2_offset.append(self.sb_adc2_offset) self.w.append(self.hbox_adc2_offset) self.hbox_dds1_offset = gui.HBox(margin="10px") self.lb_dds1_offset = gui.Label("/dev/dds1_offset", width="20%", margin="10px") self.sd_dds1_offset = gui.Slider(vals.dds1_offset, -8192, 8191, 1, width="60%", margin="10px") self.sd_dds1_offset.set_on_change_listener(self.sd_dds1_offset_changed) self.sb_dds1_offset = gui.SpinBox(vals.dds1_offset, -8192, 8191, 1, width="20%", margin="10px") self.sb_dds1_offset.set_on_change_listener(self.sb_dds1_offset_changed) self.sd_dds1_offset_changed(self.sd_dds1_offset, self.sd_dds1_offset.get_value()) self.hbox_dds1_offset.append(self.lb_dds1_offset) self.hbox_dds1_offset.append(self.sd_dds1_offset) self.hbox_dds1_offset.append(self.sb_dds1_offset) self.w.append(self.hbox_dds1_offset) self.hbox_dds2_offset = gui.HBox(margin="10px") self.lb_dds2_offset = gui.Label("/dev/dds2_offset", width="20%", margin="10px") self.sd_dds2_offset = gui.Slider(vals.dds2_offset, -8192, 8191, 1, width="60%", margin="10px") self.sd_dds2_offset.set_on_change_listener(self.sd_dds2_offset_changed) self.sb_dds2_offset = gui.SpinBox(vals.dds2_offset, -8192, 8191, 1, width="20%", margin="10px") self.sb_dds2_offset.set_on_change_listener(self.sb_dds2_offset_changed) self.sd_dds2_offset_changed(self.sd_dds2_offset, self.sd_dds2_offset.get_value()) self.hbox_dds2_offset.append(self.lb_dds2_offset) self.hbox_dds2_offset.append(self.sd_dds2_offset) self.hbox_dds2_offset.append(self.sb_dds2_offset) self.w.append(self.hbox_dds2_offset) self.hbox_ch1_dds_ampl = gui.HBox(margin="10px") self.lb_ch1_dds_ampl = gui.Label("/dev/dds_ampl/1", width="20%", margin="10px") self.sd_ch1_dds_ampl = gui.Slider(vals.ch1_dds_ampl, -8192, 8191, 1, width="60%", margin="10px") self.sd_ch1_dds_ampl.set_on_change_listener( self.sd_ch1_dds_ampl_changed) self.sb_ch1_dds_ampl = gui.SpinBox(vals.ch1_dds_ampl, -8192, 8191, 1, width="20%", margin="10px") self.sb_ch1_dds_ampl.set_on_change_listener( self.sb_ch1_dds_ampl_changed) self.sd_ch1_dds_ampl_changed(self.sd_ch1_dds_ampl, self.sd_ch1_dds_ampl.get_value()) self.hbox_ch1_dds_ampl.append(self.lb_ch1_dds_ampl) self.hbox_ch1_dds_ampl.append(self.sd_ch1_dds_ampl) self.hbox_ch1_dds_ampl.append(self.sb_ch1_dds_ampl) self.w.append(self.hbox_ch1_dds_ampl) self.hbox_ch2_dds_ampl = gui.HBox(margin="10px") self.lb_ch2_dds_ampl = gui.Label("/dev/dds_ampl/2", width="20%", margin="10px") self.sd_ch2_dds_ampl = gui.Slider(vals.ch2_dds_ampl, -8192, 8191, 1, width="60%", margin="10px") self.sd_ch2_dds_ampl.set_on_change_listener( self.sd_ch2_dds_ampl_changed) self.sb_ch2_dds_ampl = gui.SpinBox(vals.ch2_dds_ampl, -8192, 8191, 1, width="20%", margin="10px") self.sb_ch2_dds_ampl.set_on_change_listener( self.sb_ch2_dds_ampl_changed) self.sd_ch2_dds_ampl_changed(self.sd_ch2_dds_ampl, self.sd_ch2_dds_ampl.get_value()) self.hbox_ch2_dds_ampl.append(self.lb_ch2_dds_ampl) self.hbox_ch2_dds_ampl.append(self.sd_ch2_dds_ampl) self.hbox_ch2_dds_ampl.append(self.sb_ch2_dds_ampl) self.w.append(self.hbox_ch2_dds_ampl) self.hbox_nco_counter_1 = gui.HBox(margin="10px") self.lb_nco_counter_1 = gui.Label("/dev/nco_counter_1", width="20%", margin="10px") self.sd_pinc_nco_counter_1 = gui.Slider(vals.pinc_nco_counter_1, 0, samp_freq / 2, 1, width="25%", margin="10px") self.sd_pinc_nco_counter_1.set_on_change_listener( self.sd_pinc_nco_counter_1_changed) self.sb_pinc_nco_counter_1 = gui.SpinBox(vals.pinc_nco_counter_1, 0, samp_freq / 2, 0.02, width="10%", margin="10px") self.sb_pinc_nco_counter_1.set_on_change_listener( self.sb_pinc_nco_counter_1_changed) self.sd_poff_nco_counter_1 = gui.Slider(vals.poff_nco_counter_1, -8192, 8191, 1, width="25%", margin="10px") self.sd_poff_nco_counter_1.set_on_change_listener( self.sd_poff_nco_counter_1_changed) self.sb_poff_nco_counter_1 = gui.SpinBox(vals.poff_nco_counter_1, -8192, 8191, 1, width="10%", margin="10px") self.sb_poff_nco_counter_1.set_on_change_listener( self.sb_poff_nco_counter_1_changed) self.cb_pinc_nco_counter_1 = gui.CheckBoxLabel( "pinc", vals.cb_pinc_nco_counter_1, width="5%", margin="10px") self.cb_pinc_nco_counter_1.set_on_change_listener( self.cb_pinc_nco_counter_1_changed) self.cb_poff_nco_counter_1 = gui.CheckBoxLabel( "poff", vals.cb_poff_nco_counter_1, width="5%", margin="10px") self.cb_poff_nco_counter_1.set_on_change_listener( self.cb_poff_nco_counter_1_changed) self.hbox_nco_counter_1.append(self.lb_nco_counter_1) self.hbox_nco_counter_1.append(self.sd_pinc_nco_counter_1) self.hbox_nco_counter_1.append(self.sb_pinc_nco_counter_1) self.hbox_nco_counter_1.append(self.sd_poff_nco_counter_1) self.hbox_nco_counter_1.append(self.sb_poff_nco_counter_1) self.hbox_nco_counter_1.append(self.cb_pinc_nco_counter_1) self.hbox_nco_counter_1.append(self.cb_poff_nco_counter_1) self.w.append(self.hbox_nco_counter_1) self.hbox_nco_counter_2 = gui.HBox(margin="10px") self.lb_nco_counter_2 = gui.Label("/dev/nco_counter_2", width="20%", margin="10px") self.sd_pinc_nco_counter_2 = gui.Slider(vals.pinc_nco_counter_2, 0, samp_freq / 2, 1, width="25%", margin="10px") self.sd_pinc_nco_counter_2.set_on_change_listener( self.sd_pinc_nco_counter_2_changed) self.sb_pinc_nco_counter_2 = gui.SpinBox(vals.pinc_nco_counter_2, 0, samp_freq / 2, 0.02, width="10%", margin="10px") self.sb_pinc_nco_counter_2.set_on_change_listener( self.sb_pinc_nco_counter_2_changed) self.sd_poff_nco_counter_2 = gui.Slider(vals.poff_nco_counter_2, -8192, 8191, 1, width="25%", margin="10px") self.sd_poff_nco_counter_2.set_on_change_listener( self.sd_poff_nco_counter_2_changed) self.sb_poff_nco_counter_2 = gui.SpinBox(vals.poff_nco_counter_2, -8192, 8191, 1, width="10%", margin="10px") self.sb_poff_nco_counter_2.set_on_change_listener( self.sb_poff_nco_counter_2_changed) self.cb_pinc_nco_counter_2 = gui.CheckBoxLabel( "pinc", vals.cb_pinc_nco_counter_2, width="5%", margin="10px") self.cb_pinc_nco_counter_2.set_on_change_listener( self.cb_pinc_nco_counter_2_changed) self.cb_poff_nco_counter_2 = gui.CheckBoxLabel( "poff", vals.cb_poff_nco_counter_2, width="5%", margin="10px") self.cb_poff_nco_counter_2.set_on_change_listener( self.cb_poff_nco_counter_2_changed) self.hbox_nco_counter_2.append(self.lb_nco_counter_2) self.hbox_nco_counter_2.append(self.sd_pinc_nco_counter_2) self.hbox_nco_counter_2.append(self.sb_pinc_nco_counter_2) self.hbox_nco_counter_2.append(self.sd_poff_nco_counter_2) self.hbox_nco_counter_2.append(self.sb_poff_nco_counter_2) self.hbox_nco_counter_2.append(self.cb_pinc_nco_counter_2) self.hbox_nco_counter_2.append(self.cb_poff_nco_counter_2) self.w.append(self.hbox_nco_counter_2) return self.w
def __init__(self, settings: Settings): super().__init__() form_title = Title(Level.H4, "ARF File column") self.append(form_title) self._arf_selection = gui.DropDown() self._arf_selection.append(gui.DropDownItem("1")) self._arf_selection.append(gui.DropDownItem("2")) self._arf_selection.append(gui.DropDownItem("3")) self._arf_selection.append(gui.DropDownItem("4")) self._arf_selection.set_value(str(settings.arf_column)) arf_input = LabeledInput( "Column of the ARF file to use for the cos correction (column 0 is sza)", self._arf_selection, style="margin-bottom: 10px") self.append(arf_input) form_title = Title(Level.H4, "Daily file settings") self.append(form_title) self._weighted_irradiance_type_selection = gui.DropDown() for t in WeightedIrradianceType: self._weighted_irradiance_type_selection.append( gui.DropDownItem(t)) self._weighted_irradiance_type_selection.set_value( settings.weighted_irradiance_type) weighted_irradiance_type_input = LabeledInput( "Type of weight function to use for the weighted irradiance", self._weighted_irradiance_type_selection, style="margin-bottom: 10px", ) self.append(weighted_irradiance_type_input) coscor_title = Title(Level.H4, "Cos correction") coscor_title.set_style("margin-top: 14px") self.append(coscor_title) self._no_coscor_checkbox = gui.CheckBoxLabel("Skip cos correction", style="height: 30px") self._no_coscor_checkbox.set_value(settings.no_coscor) self.append(self._no_coscor_checkbox) coscor_title = Title(Level.H4, "Temperature correction") coscor_title.set_style("margin-top: 14px") self.append(coscor_title) temperature_explanation = IconLabel( "Each value of the spectrum F for a temperature T (°C) will be corrected with a correction " "factor C and a reference temperature Tref (°C) with the formula: F * [1 + C * (T - Tref)]", "info_outline", style="margin-bottom: 10px", ) self.append(temperature_explanation) # Temperature correction dual field temp_correction = gui.HBox( style="justify-content: stretch; width: 260px") self._temp_factor_spin = gui.SpinBox( settings.temperature_correction_factor, -4, 4, 0.01, style="width: 100px; height: 25px") self._temp_ref_spin = gui.SpinBox(settings.temperature_correction_ref, -50, 50, 0.5, style="width: 100px; height: 25px") temp_factor_label = gui.Label("C:", style="flex-grow: 1") temp_correction.append(temp_factor_label) temp_correction.append(self._temp_factor_spin) temp_ref_label = gui.Label("Tref:", style="margin-left: 8px; flex-grow: 1") temp_correction.append(temp_ref_label) temp_correction.append(self._temp_ref_spin) self.append(temp_correction) default_title = Title(Level.H4, "Default values") default_title.set_style("margin-top: 14px") self.append(default_title) default_explanation = IconLabel( "Will be used if no value is found in the files or via api", "info_outline", style="margin-bottom: 10px") self.append(default_explanation) # Albedo field self._albedo_spin = gui.SpinBox(settings.default_albedo, 0, 1, 0.01) albedo_input = LabeledInput("Albedo", self._albedo_spin, style="margin-bottom: 10px") self.append(albedo_input) # Aerosol dual field aerosol = gui.HBox(style="justify-content: stretch; width: 100%") self._alpha_spin = gui.SpinBox(settings.default_aerosol.alpha, 0, 2, 0.01, style="width: 110px; height: 25px") self._beta_spin = gui.SpinBox(settings.default_aerosol.beta, 0, 1.5, 0.01, style="width: 110px; height: 25px") alpha_label = gui.Label("α:", style="flex-grow: 1") aerosol.append(alpha_label) aerosol.append(self._alpha_spin) beta_label = gui.Label("β:", style="margin-left: 8px; flex-grow: 1") aerosol.append(beta_label) aerosol.append(self._beta_spin) aerosol_input = LabeledInput("Aerosol", aerosol, style="margin-bottom: 10px") self.append(aerosol_input) # Ozone field self._ozone_spin = gui.SpinBox(settings.default_ozone, 200, 600, 0.5) ozone_input = LabeledInput("Ozone", self._ozone_spin, style="margin-bottom: 10px") self.append(ozone_input) self._straylight_checkbox = gui.CheckBoxLabel( "Apply straylight correction", style="min-height: 30px") self._straylight_checkbox.set_value( settings.default_straylight_correction == StraylightCorrection.APPLIED) self.append(self._straylight_checkbox) source_title = Title(Level.H4, "Data source") source_title.set_style("margin-top: 14px") self.append(source_title) source_explanation = IconLabel( "Data can either come from files on disk or from the online database eubrewnet.", "info_outline", style="margin-bottom: 10px; line-height: 14pt", ) self.append(source_explanation) self._form_selection_checkbox = gui.CheckBoxLabel( "Specify files manually instead of giving a date and a brewer id", style="min-height: 30px; margin-bottom: 6px") self._form_selection_checkbox.set_value(settings.manual_mode) self._form_selection_checkbox.onchange.do( lambda w, v: self._update_manual_mode(v)) self.append(self._form_selection_checkbox) self._source_container = VBox() self._uv_source_selection = gui.DropDown() for source in DataSource: self._uv_source_selection.append(gui.DropDownItem(source)) self._uv_source_selection.set_value(settings.uv_data_source) uv_source_input = LabeledInput("UV data source", self._uv_source_selection, style="margin-bottom: 10px") self._source_container.append(uv_source_input) self._ozone_source_selection = gui.DropDown() for source in DataSource: self._ozone_source_selection.append(gui.DropDownItem(source)) self._ozone_source_selection.set_value(settings.ozone_data_source) ozone_source_input = LabeledInput("Ozone data source", self._ozone_source_selection, style="margin-bottom: 10px") self._source_container.append(ozone_source_input) self._uvr_source_selection = gui.DropDown() for source in DataSource: self._uvr_source_selection.append(gui.DropDownItem(source)) self._uvr_source_selection.set_value(settings.uvr_data_source) uvr_source_input = LabeledInput("UVR data source", self._uvr_source_selection, style="margin-bottom: 10px") self._source_container.append(uvr_source_input) self._brewer_model_source_selection = gui.DropDown() for source in DataSource: self._brewer_model_source_selection.append( gui.DropDownItem(source)) self._brewer_model_source_selection.set_value( settings.brewer_model_data_source) brewer_model_source_input = LabeledInput( "Brewer model data source", self._brewer_model_source_selection, style="margin-bottom: 10px") self._source_container.append(brewer_model_source_input) self.append(self._source_container) self._update_manual_mode(settings.manual_mode) woudc_title = Title(Level.H4, "WOUDC output") woudc_title.set_style("margin-top: 14px") self.append(woudc_title) gawsis_link = gui.Link("https://woudc.org/", "WOUDC") woudc_explanation = IconLabel( "Create files in the WOUDC format which can be submitted to\xa0", "info_outline", style="margin-bottom: 10px", ) woudc_explanation.append(gawsis_link) self.append(woudc_explanation) self._woudc_checkbox = gui.CheckBoxLabel( "Create WOUDC files", style="min-height: 30px; margin-bottom: 6px") self._woudc_checkbox.set_value(settings.activate_woudc) self._woudc_checkbox.onchange.do(lambda w, v: self._update_woudc(v)) self.append(self._woudc_checkbox) woudc_info = settings.woudc_info self._woudc_info_container = VBox() self._agency_input = gui.Input(default_value=woudc_info.agency) agency_input = LabeledInput("Agency", self._agency_input) self._woudc_info_container.append(agency_input) self._version_input = gui.Input(default_value=woudc_info.version) version_input = LabeledInput("Version", self._version_input) self._woudc_info_container.append(version_input) self._scientific_authority_input = gui.Input( default_value=woudc_info.scientific_authority) scientific_authority_input = LabeledInput( "Scientific Authority", self._scientific_authority_input) self._woudc_info_container.append(scientific_authority_input) self._platform_id_input = gui.Input( default_value=woudc_info.platform_id) platform_id_input = LabeledInput("Platform ID", self._platform_id_input) self._woudc_info_container.append(platform_id_input) self._platform_name_input = gui.Input( default_value=woudc_info.platform_name) platform_name_input = LabeledInput("Platform Name", self._platform_name_input) self._woudc_info_container.append(platform_name_input) self._country_input = gui.Input(default_value=woudc_info.country_iso3) country_input = LabeledInput("Country (ISO 3)", self._country_input) self._woudc_info_container.append(country_input) self._gaw_id_input = gui.Input(default_value=woudc_info.gaw_id) gaw_id_input = LabeledInput("GAW Id", self._gaw_id_input) self._woudc_info_container.append(gaw_id_input) self._altitude_spin = gui.SpinBox(woudc_info.altitude, 0, 6000, 1) altitude_input = LabeledInput("Altitude", self._altitude_spin, style="margin-bottom: 10px") self._woudc_info_container.append(altitude_input) self.append(self._woudc_info_container) self._update_woudc(settings.activate_woudc)
def main(self): verticalContainer = gui.Widget(width=540) verticalContainer.style['display'] = 'block' verticalContainer.style['overflow'] = 'hidden' horizontalContainer = gui.Widget(width='100%', layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, margin='0px') horizontalContainer.style['display'] = 'block' horizontalContainer.style['overflow'] = 'auto' subContainerLeft = gui.Widget(width=320) subContainerLeft.style['display'] = 'block' subContainerLeft.style['overflow'] = 'auto' subContainerLeft.style['text-align'] = 'center' self.img = gui.Image('/res/logo.png', width=100, height=100, margin='10px') self.img.set_on_click_listener(self, 'on_img_clicked') self.table = gui.Table(width=300, height=200, margin='10px') self.table.from_2d_matrix([['ID', 'First Name', 'Last Name'], ['101', 'Danny', 'Young'], ['102', 'Christine', 'Holand'], ['103', 'Lars', 'Gordon'], ['104', 'Roberto', 'Robitaille'], ['105', 'Maria', 'Papadopoulos']]) # the arguments are width - height - layoutOrientationOrizontal subContainerRight = gui.Widget() subContainerRight.style['width'] = '220px' subContainerRight.style['display'] = 'block' subContainerRight.style['overflow'] = 'auto' subContainerRight.style['text-align'] = 'center' self.count = 0 self.counter = gui.Label('', width=200, height=30, margin='10px') self.lbl = gui.Label('This is a LABEL!', width=200, height=30, margin='10px') self.bt = gui.Button('Press me!', width=200, height=30, margin='10px') # setting the listener for the onclick event of the button self.bt.set_on_click_listener(self, 'on_button_pressed') self.txt = gui.TextInput(width=200, height=30, margin='10px') self.txt.set_text('This is a TEXTAREA') self.txt.set_on_change_listener(self, 'on_text_area_change') self.spin = gui.SpinBox(100, width=200, height=30, margin='10px') self.spin.set_on_change_listener(self, 'on_spin_change') self.check = gui.CheckBoxLabel('Label checkbox', True, width=200, height=30, margin='10px') self.check.set_on_change_listener(self, 'on_check_change') self.btInputDiag = gui.Button('Open InputDialog', width=200, height=30, margin='10px') self.btInputDiag.set_on_click_listener(self, 'open_input_dialog') self.btFileDiag = gui.Button('File Selection Dialog', width=200, height=30, margin='10px') self.btFileDiag.set_on_click_listener(self, 'open_fileselection_dialog') self.btUploadFile = gui.FileUploader('./', width=200, height=30, margin='10px') self.btUploadFile.set_on_success_listener(self, 'fileupload_on_success') self.btUploadFile.set_on_failed_listener(self, 'fileupload_on_failed') items = ('Danny Young','Christine Holand','Lars Gordon','Roberto Robitaille') self.listView = gui.ListView.new_from_list(items, width=300, height=120, margin='10px') self.listView.set_on_selection_listener(self, "list_view_on_selected") self.link = gui.Link("http://localhost:8081", "A link to here", width=200, height=30, margin='10px') self.dropDown = gui.DropDown(width=200, height=20, margin='10px') c0 = gui.DropDownItem('DropDownItem 0', width=200, height=20) c1 = gui.DropDownItem('DropDownItem 1', width=200, height=20) self.dropDown.append(c0) self.dropDown.append(c1) self.dropDown.set_on_change_listener(self, 'drop_down_changed') self.dropDown.set_value('DropDownItem 0') self.slider = gui.Slider(10, 0, 100, 5, width=200, height=20, margin='10px') self.slider.set_on_change_listener(self, 'slider_changed') self.colorPicker = gui.ColorPicker('#ffbb00', width=200, height=20, margin='10px') self.colorPicker.set_on_change_listener(self, 'color_picker_changed') self.date = gui.Date('2015-04-13', width=200, height=20, margin='10px') self.date.set_on_change_listener(self, 'date_changed') self.video = gui.VideoPlayer('http://www.w3schools.com/tags/movie.mp4', 'http://www.oneparallel.com/wp-content/uploads/2011/01/placeholder.jpg', width=300, height=270, margin='10px') # appending a widget to another, the first argument is a string key subContainerRight.append(self.counter) subContainerRight.append(self.lbl) subContainerRight.append(self.bt) subContainerRight.append(self.txt) subContainerRight.append(self.spin) subContainerRight.append(self.check) subContainerRight.append(self.btInputDiag) subContainerRight.append(self.btFileDiag) # use a defined key as we replace this widget later fdownloader = gui.FileDownloader('download test', '../remi/res/logo.png', width=200, height=30, margin='10px') subContainerRight.append(fdownloader, key='file_downloader') subContainerRight.append(self.btUploadFile) subContainerRight.append(self.dropDown) subContainerRight.append(self.slider) subContainerRight.append(self.colorPicker) subContainerRight.append(self.date) self.subContainerRight = subContainerRight subContainerLeft.append(self.img) subContainerLeft.append(self.table) subContainerLeft.append(self.listView) subContainerLeft.append(self.link) subContainerLeft.append(self.video) horizontalContainer.append(subContainerLeft) horizontalContainer.append(subContainerRight) menu = gui.Menu(width='100%', height='30px') m1 = gui.MenuItem('File', width=100, height=30) m2 = gui.MenuItem('View', width=100, height=30) m2.set_on_click_listener(self, 'menu_view_clicked') m11 = gui.MenuItem('Save', width=100, height=30) m12 = gui.MenuItem('Open', width=100, height=30) m12.set_on_click_listener(self, 'menu_open_clicked') m111 = gui.MenuItem('Save', width=100, height=30) m111.set_on_click_listener(self, 'menu_save_clicked') m112 = gui.MenuItem('Save as', width=100, height=30) m112.set_on_click_listener(self, 'menu_saveas_clicked') m3 = gui.MenuItem('Dialog', width=100, height=30) m3.set_on_click_listener(self, 'menu_dialog_clicked') menu.append(m1) menu.append(m2) menu.append(m3) m1.append(m11) m1.append(m12) m11.append(m111) m11.append(m112) menubar = gui.MenuBar(width='100%', height='30px') menubar.append(menu) verticalContainer.append(menubar) verticalContainer.append(horizontalContainer) # kick of regular display of counter self.display_counter() # returning the root widget return verticalContainer
def main(self): self.w = gui.VBox() self.hbox_save_load = gui.HBox(margin="10px") self.dtext_conf_file = gui.TextInput(width=200, height=30) self.dtext_conf_file.set_value(str(vals.config)) self.dtext_conf_file.set_on_change_listener( self.dtext_conf_file_changed) self.bt_load = gui.Button("Load", width=200, height=30, margin="10px") self.bt_load.set_on_click_listener(self.bt_load_changed) self.bt_save = gui.Button("Save", width=200, height=30, margin="10px") self.bt_save.set_on_click_listener(self.bt_save_changed) self.hbox_save_load.append(self.dtext_conf_file) self.hbox_save_load.append(self.bt_load) self.hbox_save_load.append(self.bt_save) self.w.append(self.hbox_save_load) self.hbox_dds1_f0 = gui.HBox(margin="10px") self.lb_dds1_f0 = gui.Label("/dev/dds1_f0", width="20%", margin="10px") self.sd_dds1_f0 = gui.Slider(vals.dds1_f0, 0, 62500000, 1, width="60%", margin="10px") self.sd_dds1_f0.set_oninput_listener(self.sd_dds1_f0_changed) self.sb_dds1_f0 = gui.SpinBox(vals.dds1_f0, 0, 62500000, 0.02, width="20%", margin="10px") self.sb_dds1_f0.set_on_change_listener(self.sb_dds1_f0_changed) self.sd_dds1_f0_changed(self.sd_dds1_f0, self.sd_dds1_f0.get_value()) self.hbox_dds1_f0.append(self.lb_dds1_f0) self.hbox_dds1_f0.append(self.sd_dds1_f0) self.hbox_dds1_f0.append(self.sb_dds1_f0) self.w.append(self.hbox_dds1_f0) self.hbox_dds1_nco = gui.HBox(margin="10px") self.lb_dds1_nco = gui.Label("/dev/dds1_nco", width="20%", margin="10px") self.sd_pinc_dds1_nco = gui.Slider(vals.pinc_dds1_nco, 0, 62500000, 1, width="25%", margin="10px") self.sd_pinc_dds1_nco.set_oninput_listener( self.sd_pinc_dds1_nco_changed) self.sb_pinc_dds1_nco = gui.SpinBox(vals.pinc_dds1_nco, 0, 62500000, 0.02, width="10%", margin="10px") self.sb_pinc_dds1_nco.set_on_change_listener( self.sb_pinc_dds1_nco_changed) self.sd_poff_dds1_nco = gui.Slider(vals.poff_dds1_nco, -2048, 2047, 1, width="25%", margin="10px") # IR 12bit range self.sd_poff_dds1_nco.set_oninput_listener( self.sd_poff_dds1_nco_changed) self.sb_poff_dds1_nco = gui.SpinBox(vals.poff_dds1_nco, -2048, 2047, 1, width="10%", margin="10px") # IR 12bit range self.sb_poff_dds1_nco.set_on_change_listener( self.sb_poff_dds1_nco_changed) self.cb_pinc_dds1_nco = gui.CheckBoxLabel("pinc", vals.cb_pinc_dds1_nco, width="5%", margin="10px") self.cb_pinc_dds1_nco.set_on_change_listener( self.cb_pinc_dds1_nco_changed) self.cb_poff_dds1_nco = gui.CheckBoxLabel("poff", vals.cb_poff_dds1_nco, width="5%", margin="10px") self.cb_poff_dds1_nco.set_on_change_listener( self.cb_poff_dds1_nco_changed) self.hbox_dds1_nco.append(self.lb_dds1_nco) self.hbox_dds1_nco.append(self.sd_pinc_dds1_nco) self.hbox_dds1_nco.append(self.sb_pinc_dds1_nco) self.hbox_dds1_nco.append(self.sd_poff_dds1_nco) self.hbox_dds1_nco.append(self.sb_poff_dds1_nco) self.hbox_dds1_nco.append(self.cb_pinc_dds1_nco) self.hbox_dds1_nco.append(self.cb_poff_dds1_nco) self.w.append(self.hbox_dds1_nco) self.hbox_ch1_dds_ampl = gui.HBox(margin="10px") self.lb_ch1_dds_ampl = gui.Label("/dev/dds_ampl/1", width="20%", margin="10px") self.sd_ch1_dds_ampl = gui.Slider(vals.ch1_dds_ampl, -8192, 8191, 1, width="60%", margin="10px") self.sd_ch1_dds_ampl.set_oninput_listener(self.sd_ch1_dds_ampl_changed) self.sb_ch1_dds_ampl = gui.SpinBox(vals.ch1_dds_ampl, -8192, 8191, 1, width="20%", margin="10px") self.sb_ch1_dds_ampl.set_on_change_listener( self.sb_ch1_dds_ampl_changed) self.sd_ch1_dds_ampl_changed(self.sd_ch1_dds_ampl, self.sd_ch1_dds_ampl.get_value()) self.hbox_ch1_dds_ampl.append(self.lb_ch1_dds_ampl) self.hbox_ch1_dds_ampl.append(self.sd_ch1_dds_ampl) self.hbox_ch1_dds_ampl.append(self.sb_ch1_dds_ampl) self.w.append(self.hbox_ch1_dds_ampl) self.hbox_ch1_dds_range = gui.HBox(margin="10px") self.lb_ch1_dds_range = gui.Label("/dev/dds_range/1", width="20%", margin="10px") self.sd_ch1_dds_range = gui.Slider(vals.ch1_dds_range, -128, 127, 1, width="60%", margin="10px") # IR 8bit range self.sd_ch1_dds_range.set_oninput_listener( self.sd_ch1_dds_range_changed) self.sb_ch1_dds_range = gui.SpinBox(vals.ch1_dds_range, -128, 127, 1, width="20%", margin="10px") # IR 8bit range self.sb_ch1_dds_range.set_on_change_listener( self.sb_ch1_dds_range_changed) self.sd_ch1_dds_range_changed(self.sd_ch1_dds_range, self.sd_ch1_dds_range.get_value()) self.hbox_ch1_dds_range.append(self.lb_ch1_dds_range) self.hbox_ch1_dds_range.append(self.sd_ch1_dds_range) self.hbox_ch1_dds_range.append(self.sb_ch1_dds_range) self.w.append(self.hbox_ch1_dds_range) self.hbox_demod1_nco = gui.HBox(margin="10px") self.lb_demod1_nco = gui.Label("/dev/demod1_nco", width="20%", margin="10px") self.sd_pinc_demod1_nco = gui.Slider(vals.pinc_demod1_nco, 0, 62500000, 1, width="25%", margin="10px") self.sd_pinc_demod1_nco.set_oninput_listener( self.sd_pinc_demod1_nco_changed) self.sb_pinc_demod1_nco = gui.SpinBox(vals.pinc_demod1_nco, 0, 62500000, 0.02, width="10%", margin="10px") self.sb_pinc_demod1_nco.set_on_change_listener( self.sb_pinc_demod1_nco_changed) self.sd_poff_demod1_nco = gui.Slider(vals.poff_demod1_nco, -2048, 2047, 1, width="25%", margin="10px") # IR 12bit range self.sd_poff_demod1_nco.set_oninput_listener( self.sd_poff_demod1_nco_changed) self.sb_poff_demod1_nco = gui.SpinBox(vals.poff_demod1_nco, -2048, 2047, 1, width="10%", margin="10px") # IR 12bit range self.sb_poff_demod1_nco.set_on_change_listener( self.sb_poff_demod1_nco_changed) self.cb_pinc_demod1_nco = gui.CheckBoxLabel("pinc", vals.cb_pinc_demod1_nco, width="5%", margin="10px") self.cb_pinc_demod1_nco.set_on_change_listener( self.cb_pinc_demod1_nco_changed) self.cb_poff_demod1_nco = gui.CheckBoxLabel("poff", vals.cb_poff_demod1_nco, width="5%", margin="10px") self.cb_poff_demod1_nco.set_on_change_listener( self.cb_poff_demod1_nco_changed) self.hbox_demod1_nco.append(self.lb_demod1_nco) self.hbox_demod1_nco.append(self.sd_pinc_demod1_nco) self.hbox_demod1_nco.append(self.sb_pinc_demod1_nco) self.hbox_demod1_nco.append(self.sd_poff_demod1_nco) self.hbox_demod1_nco.append(self.sb_poff_demod1_nco) self.hbox_demod1_nco.append(self.cb_pinc_demod1_nco) self.hbox_demod1_nco.append(self.cb_poff_demod1_nco) self.w.append(self.hbox_demod1_nco) self.hbox_mux_filter = gui.HBox(margin="10px") self.lb_mux_filter = gui.Label("/dev/mux_filter", width="20%", margin="10px") self.sd_mux_filter = gui.Slider(vals.mux_filter, 0, 3, 1, width="60%", margin="10px") self.sd_mux_filter.set_oninput_listener(self.sd_mux_filter_changed) self.sb_mux_filter = gui.SpinBox(vals.mux_filter, 0, 3, 1, width="20%", margin="10px") self.sb_mux_filter.set_on_change_listener(self.sb_mux_filter_changed) self.sd_mux_filter_changed(self.sd_mux_filter, self.sd_mux_filter.get_value()) self.hbox_mux_filter.append(self.lb_mux_filter) self.hbox_mux_filter.append(self.sd_mux_filter) self.hbox_mux_filter.append(self.sb_mux_filter) self.w.append(self.hbox_mux_filter) self.hbox_mux_ram = gui.HBox(margin="10px") self.lb_mux_ram = gui.Label("/dev/mux_ram", width="20%", margin="10px") self.sd_mux_ram = gui.Slider(vals.mux_ram, 0, 3, 1, width="60%", margin="10px") self.sd_mux_ram.set_oninput_listener(self.sd_mux_ram_changed) self.sb_mux_ram = gui.SpinBox(vals.mux_ram, 0, 3, 1, width="20%", margin="10px") self.sb_mux_ram.set_on_change_listener(self.sb_mux_ram_changed) self.sd_mux_ram_changed(self.sd_mux_ram, self.sd_mux_ram.get_value()) self.hbox_mux_ram.append(self.lb_mux_ram) self.hbox_mux_ram.append(self.sd_mux_ram) self.hbox_mux_ram.append(self.sb_mux_ram) self.w.append(self.hbox_mux_ram) self.hbox_mux_pid = gui.HBox(margin="10px") self.lb_mux_pid = gui.Label("/dev/mux_pid", width="20%", margin="10px") self.sd_mux_pid = gui.Slider(vals.mux_pid, 0, 1, 1, width="60%", margin="10px") self.sd_mux_pid.set_oninput_listener(self.sd_mux_pid_changed) self.sb_mux_pid = gui.SpinBox(vals.mux_pid, 0, 1, 1, width="20%", margin="10px") self.sb_mux_pid.set_on_change_listener(self.sb_mux_pid_changed) self.sd_mux_pid_changed(self.sd_mux_pid, self.sd_mux_pid.get_value()) self.hbox_mux_pid.append(self.lb_mux_pid) self.hbox_mux_pid.append(self.sd_mux_pid) self.hbox_mux_pid.append(self.sb_mux_pid) self.w.append(self.hbox_mux_pid) self.hbox_mux_out_ch2 = gui.HBox(margin="10px") self.lb_mux_out_ch2 = gui.Label("/dev/mux_out_ch2", width="20%", margin="10px") self.sd_mux_out_ch2 = gui.Slider(vals.mux_out_ch2, 0, 3, 1, width="60%", margin="10px") self.sd_mux_out_ch2.set_oninput_listener(self.sd_mux_out_ch2_changed) self.sb_mux_out_ch2 = gui.SpinBox(vals.mux_out_ch2, 0, 3, 1, width="20%", margin="10px") self.sb_mux_out_ch2.set_on_change_listener(self.sb_mux_out_ch2_changed) self.sd_mux_out_ch2_changed(self.sd_mux_out_ch2, self.sd_mux_out_ch2.get_value()) self.hbox_mux_out_ch2.append(self.lb_mux_out_ch2) self.hbox_mux_out_ch2.append(self.sd_mux_out_ch2) self.hbox_mux_out_ch2.append(self.sb_mux_out_ch2) self.w.append(self.hbox_mux_out_ch2) self.hbox_kp_pid1 = gui.HBox(margin="10px") self.lb_kp_pid1 = gui.Label("/dev/pid1/kp", width="20%", margin="10px") self.sd_kp_pid1 = gui.Slider(vals.kp_pid1, -32768, 32767, 1, width="60%", margin="10px") # IR 16bit range self.sd_kp_pid1.set_oninput_listener(self.sd_kp_pid1_changed) self.sb_kp_pid1 = gui.SpinBox(vals.kp_pid1, -32768, 32767, 1, width="20%", margin="10px") # IR 16bit range self.sb_kp_pid1.set_on_change_listener(self.sb_kp_pid1_changed) self.sd_kp_pid1_changed(self.sd_kp_pid1, self.sd_kp_pid1.get_value()) self.hbox_kp_pid1.append(self.lb_kp_pid1) self.hbox_kp_pid1.append(self.sd_kp_pid1) self.hbox_kp_pid1.append(self.sb_kp_pid1) self.w.append(self.hbox_kp_pid1) self.hbox_ki_pid1 = gui.HBox(margin="10px") self.lb_ki_pid1 = gui.Label("/dev/pid1/ki", width="20%", margin="10px") self.sd_ki_pid1 = gui.Slider(vals.ki_pid1, -32768, 32767, 1, width="60%", margin="10px") # IR 16bit range self.sd_ki_pid1.set_oninput_listener(self.sd_ki_pid1_changed) self.sb_ki_pid1 = gui.SpinBox(vals.ki_pid1, -32768, 32767, 1, width="20%", margin="10px") # IR 16bit range self.sb_ki_pid1.set_on_change_listener(self.sb_ki_pid1_changed) self.sd_ki_pid1_changed(self.sd_ki_pid1, self.sd_ki_pid1.get_value()) self.cb_rst_int_pid1 = gui.CheckBoxLabel("rst_int", vals.rst_int_pid1, width="5%", margin="10px") self.cb_rst_int_pid1.set_on_change_listener( self.cb_rst_int_pid1_changed) self.hbox_ki_pid1.append(self.lb_ki_pid1) self.hbox_ki_pid1.append(self.sd_ki_pid1) self.hbox_ki_pid1.append(self.sb_ki_pid1) self.hbox_ki_pid1.append(self.cb_rst_int_pid1) self.w.append(self.hbox_ki_pid1) self.hbox_sp_pid1 = gui.HBox(margin="10px") self.lb_sp_pid1 = gui.Label("/dev/pid1/setpoint", width="20%", margin="10px") self.sd_sp_pid1 = gui.Slider(vals.sp_pid1, -32768, 32767, 1, width="60%", margin="10px") # IR 16bit range self.sd_sp_pid1.set_oninput_listener(self.sd_sp_pid1_changed) self.sb_sp_pid1 = gui.SpinBox(vals.sp_pid1, -32768, 32767, 1, width="20%", margin="10px") # IR 16bit range self.sb_sp_pid1.set_on_change_listener(self.sb_sp_pid1_changed) self.sd_sp_pid1_changed(self.sd_sp_pid1, self.sd_sp_pid1.get_value()) self.hbox_sp_pid1.append(self.lb_sp_pid1) self.hbox_sp_pid1.append(self.sd_sp_pid1) self.hbox_sp_pid1.append(self.sb_sp_pid1) self.w.append(self.hbox_sp_pid1) self.hbox_sign_pid1 = gui.HBox(margin="10px") self.lb_sign_pid1 = gui.Label( "/dev/pid1/sign 0: err=data-setpoint, 1: err=setpoint-data", width="20%", margin="10px") self.sd_sign_pid1 = gui.Slider(vals.sign_pid1, 0, 1, 1, width="60%", margin="10px") self.sd_sign_pid1.set_oninput_listener(self.sd_sign_pid1_changed) self.sb_sign_pid1 = gui.SpinBox(vals.sign_pid1, 0, 1, 1, width="20%", margin="10px") self.sb_sign_pid1.set_on_change_listener(self.sb_sign_pid1_changed) self.sd_sign_pid1_changed(self.sd_sign_pid1, self.sd_sign_pid1.get_value()) self.hbox_sign_pid1.append(self.lb_sign_pid1) self.hbox_sign_pid1.append(self.sd_sign_pid1) self.hbox_sign_pid1.append(self.sb_sign_pid1) self.w.append(self.hbox_sign_pid1) return self.w