Esempio n. 1
0
    def main(self):
        # We need to get dynamically the available voices
        self.voices_dict = {}
        # Default English_(Great_Britain) voice
        self.selected_voice_id = 78
        self.voices_dropdown = gui.DropDown.new_from_list(
            ["Loading voices list..."], width=200, height=20, margin='10px')
        self.container = gui.VBox(width=400)
        self.lbl = gui.Label("Text to say:")
        self.text_input = gui.TextInput(width=300)
        self.lbl_rate = gui.Label("Rate (speed) to say:")
        self.rate_slider = gui.Slider(1.0, min=0.1, max=5.0, step=0.1)
        self.lbl_pitch = gui.Label("Pitch of voice:")
        self.pitch_slider = gui.Slider(1.0, min=0.1, max=2.0, step=0.1)
        self.bt_say = gui.Button("Say")
        self.bt_say.onclick.do(self.on_say)

        self.container.append(self.lbl)
        self.container.append(self.text_input)
        self.container.append(self.lbl_rate)
        self.container.append(self.rate_slider)
        self.container.append(self.lbl_pitch)
        self.container.append(self.pitch_slider)
        self.container.append(self.bt_say)
        self.container.append(self.voices_dropdown, key=99999)

        # returning the root widget
        return self.container
    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)
Esempio n. 3
0
    def menu_dialog_clicked(self, widget):
        self.dialog = gui.GenericDialog(title='Dialog Box', message='Click Ok to transfer content to main page', width='500px')
        self.dtextinput = gui.TextInput(width=200, height=30)
        self.dtextinput.set_value('Initial Text')
        self.dialog.add_field_with_label('dtextinput', 'Text Input', self.dtextinput)

        self.dcheck = gui.CheckBox(False, width=200, height=30)
        self.dialog.add_field_with_label('dcheck', 'Label Checkbox', self.dcheck)
        values = ('Danny Young', 'Christine Holand', 'Lars Gordon', 'Roberto Robitaille')
        self.dlistView = gui.ListView.new_from_list(values, width=200, height=120)
        self.dialog.add_field_with_label('dlistView', 'Listview', self.dlistView)

        self.ddropdown = gui.DropDown.new_from_list(('DropDownItem 0', 'DropDownItem 1'),
                                                    width=200, height=20)
        self.dialog.add_field_with_label('ddropdown', 'Dropdown', self.ddropdown)

        self.dspinbox = gui.SpinBox(min=0, max=5000, width=200, height=20)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dspinbox', 'Spinbox', self.dspinbox)

        self.dslider = gui.Slider(10, 0, 100, 5, width=200, height=20)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dslider', 'Slider', self.dslider)

        self.dcolor = gui.ColorPicker(width=200, height=20)
        self.dcolor.set_value('#ffff00')
        self.dialog.add_field_with_label('dcolor', 'Colour Picker', self.dcolor)

        self.ddate = gui.Date(width=200, height=20)
        self.ddate.set_value('2000-01-01')
        self.dialog.add_field_with_label('ddate', 'Date', self.ddate)

        self.dialog.confirm_dialog.do(self.dialog_confirm)
        self.dialog.show(self)
Esempio n. 4
0
    def do_tlx(self, widget, user, type_):
        self.dialog = gui.GenericDialog(
            title="NASA-TLX",
            message=
            f"NASA Task Load Index for the {type_.name} view experiment performed by {user.name}. How much did each component contribute to your task load? (scale from 0 to 20)",
            width="600px")

        for component in self.tlx.components.values():
            self.dialog.add_field(
                component.code,
                gui.Label(f"{component.name}: {component.description}",
                          margin="10px"))
            slider = gui.Slider(component.score, 0, 20, 1, width="80%")
            slider.set_oninput_listener(self.tlx_slider_changed,
                                        component.code)
            slider_value = gui.Label(slider.get_value(), margin="10px")
            self.tlx_sliders[component.code] = (slider, slider_value)
            box = gui.Widget(width="100%",
                             layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
                             height=50)
            box.append(slider_value)
            box.append(slider)
            self.dialog.add_field(component.code + "_score", box)

        self.dialog.set_on_confirm_dialog_listener(self.tlx_done, user, type_)
        self.dialog.show(self)
Esempio n. 5
0
    def create_num_row(self, param_name, description, range_min, range_max,
                       current_value, callback_cb, step):
        row = gui.TableRow()
        param_name = gui.Label(param_name,
                               width=NAME_L_SIZE,
                               height=FIELD_HEIGHT)
        param_name.attributes['title'] = description
        min_val = gui.Label(str(range_min),
                            width=MIN_L_SIZE,
                            height=FIELD_HEIGHT)
        range_slider = gui.Slider(width=SLIDER_SIZE,
                                  height=FIELD_HEIGHT,
                                  defaultValue=current_value,
                                  min=range_min,
                                  max=range_max,
                                  step=step)
        range_slider.set_on_change_listener(callback_cb)
        max_val = gui.Label(str(range_max),
                            width=MAX_L_SIZE,
                            height=FIELD_HEIGHT)
        spin_val = gui.SpinBox(width=EDIT2_SIZE,
                               height=FIELD_HEIGHT,
                               defaultValue=current_value,
                               min=range_min,
                               max=range_max,
                               step=step)
        # https://github.com/dddomodossola/remi/issues/49
        # Added 46 as it's dot so we allow floating point values
        spin_val.attributes[
            spin_val.
            EVENT_ONKEYPRESS] = 'return event.charCode >= 48 && event.charCode <= 57 || event.charCode == 46 || event.charCode == 13'
        spin_val.set_on_change_listener(callback_cb)
        item = gui.TableItem()
        item.add_child(0, param_name)
        row.add_child(0, item)

        item = gui.TableItem()
        item.add_child(1, min_val)
        row.add_child(1, item)
        min_val.style['float'] = 'none'
        min_val.style['text-align'] = 'center'

        item = gui.TableItem()
        item.add_child(2, range_slider)
        row.add_child(2, item)

        item = gui.TableItem()
        item.add_child(3, max_val)
        row.add_child(3, item)
        max_val.style['float'] = 'none'
        max_val.style['text-align'] = 'center'

        item = gui.TableItem()
        item.add_child(4, spin_val)
        row.add_child(4, item)
        spin_val.style['display'] = 'block'
        spin_val.style['margin'] = '10px auto'
        spin_val.style['float'] = 'none'

        return row, [range_slider.set_value, spin_val.set_value]
Esempio n. 6
0
    def main(self):
        container = gui.VBox(width = 600, height = 800)
        self.lbl = gui.Label('Hello world!')
        self.btFindStar = gui.Button('FIND_STAR')
        self.btCalibrate = gui.Button('CALIBRATE')
        self.btStartGuide = gui.Button('START GUIDE')
        self.btStopGuide = gui.Button('STOP GUIDE')
        self.gain = gui.Slider(10, 0, 100, 5, width=200, height=20, margin='10px')
        self.gain.set_on_change_listener(self.slider_changed)
	self.image_widget = PILImageViewverWidget(width=200, height=200)

        # setting the listener for the onclick event of the button
        self.btFindStar.set_on_click_listener(self.on_button_pressed)
        self.btCalibrate.set_on_click_listener(self.on_button_pressed)
        self.btStartGuide.set_on_click_listener(self.on_button_pressed)
        self.btStartGuide.set_on_click_listener(self.StartGuide)
        self.btStopGuide.set_on_click_listener(self.StopGuide)

        # appending a widget to another, the first argument is a string key
        container.append(self.image_widget)
        container.append(self.lbl)
        container.append(self.btFindStar)
        container.append(self.btCalibrate)
        container.append(self.btStartGuide)
        container.append(self.btStopGuide)
        container.append(self.gain)

	self.image()
	self.image_widget.load('/home/pi/linguider.png')
        # returning the root widget
        return container
Esempio n. 7
0
    def menu_dialog_clicked(self):
        self.dialog = gui.GenericDialog(
            title='Dialog Box',
            message='Click Ok to transfer content to main page')

        self.dtextinput = gui.TextInput(200, 30)
        self.dtextinput.set_value('Initial Text')
        self.dialog.add_field_with_label('dtextinput', 'Text Input',
                                         self.dtextinput)

        self.dcheck = gui.CheckBox(200, 30, False)
        self.dialog.add_field_with_label('dcheck', 'Label Checkbox',
                                         self.dcheck)
        values = ('Danny Young', 'Christine Holand', 'Lars Gordon',
                  'Roberto Robitaille')
        self.dlistView = gui.ListView(200, 120)
        key = 0
        for value in values:
            obj = gui.ListItem(170, 20, value)
            self.dlistView.append(str(key), obj)
            key += 1
        self.dialog.add_field_with_label('dlistView', 'Listview',
                                         self.dlistView)

        self.ddropdown = gui.DropDown(200, 20)
        c0 = gui.DropDownItem(200, 20, 'DropDownItem 0')
        c1 = gui.DropDownItem(200, 20, 'DropDownItem 1')
        self.ddropdown.append('0', c0)
        self.ddropdown.append('1', c1)
        self.ddropdown.set_value('Value1')
        self.dialog.add_field_with_label('ddropdown', 'Dropdown',
                                         self.ddropdown)

        self.dspinbox = gui.SpinBox(200, 20, min=0, max=5000)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dspinbox', 'Spinbox', self.dspinbox)

        self.dslider = gui.Slider(200, 20, 10, 0, 100, 5)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dslider', 'Slider', self.dslider)

        self.dcolor = gui.ColorPicker(200, 20)
        self.dcolor.set_value('#ffff00')
        self.dialog.add_field_with_label('dcolor', 'Colour Picker',
                                         self.dcolor)

        self.ddate = gui.Date(
            200,
            20,
        )
        self.ddate.set_value('2000-01-01')
        self.dialog.add_field_with_label('ddate', 'Date', self.ddate)

        self.dialog.set_on_confirm_dialog_listener(self, 'dialog_confirm')
        self.dialog.show(self)
Esempio n. 8
0
    def __init__(self, identity, walker):
        self.id = identity
        self.container = gui.VBox(width=200, height=50)
        self.value = 90
        self.lbl = gui.Label("Servo " + str(self.id+1) + ":  " + str(self.value), width=100, height=20) 
        self.slider = gui.Slider(self.value, 0, 180, 2, width=200, height=20)
        self.slider.onchange.do(self.slider_changed)
        self.walker = walker

        self.container.append(self.lbl)
        self.container.append(self.slider)
Esempio n. 9
0
    def nutrients_clicked(self, widget):
        nutrients_setpoints = self.read_from_pickle("nutrients_setpoints")
        ph_value = self.read_from_pickle("ph_sensor")

        self.nutrients_control = gui.GenericDialog(title='Nutrient Control',
                                                   width='100%',
                                                   height='100%')
        nutrients_container = gui.Widget(width='100%',
                                         height='100%',
                                         margin='0px auto',
                                         style={
                                             'text-align': 'center',
                                             'display': 'block',
                                             'overflow': 'auto'
                                         })
        self.ph_label = gui.Label('pH setpoint: ' +
                                  str(nutrients_setpoints['ph']),
                                  width='100%',
                                  height=30,
                                  margin='0px')
        self.ph_slider = gui.Slider(nutrients_setpoints['ph'],
                                    0,
                                    14,
                                    0.25,
                                    width='80%',
                                    height=30,
                                    margin='20px')
        self.ph_slider.onchange.do(self.ph_slider_changed)
        self.ph_sensor_label = gui.Label('current reservoir pH: ',
                                         width='100%',
                                         height=30,
                                         margin='0px')

        spacer = gui.Widget(width='100%',
                            height=75,
                            margin='0px auto',
                            style={
                                'display': 'block',
                                'overflow': 'auto'
                            })
        spacer_label = gui.Label('', width='100%', height=20, margin='0px')

        nutrients_container.append([
            spacer_label, self.ph_label, self.ph_slider, self.ph_sensor_label,
            spacer
        ])
        self.nutrients_control.add_field("nutrients", nutrients_container)
        self.nutrients_control.confirm_dialog.do(self.nutrients_confirm)

        self.ph_sensor_label.set_text("current reservoir pH: " +
                                      str(ph_value["ph"]))

        self.nutrients_control.show(self)
Esempio n. 10
0
	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
Esempio n. 11
0
    def menu_dialog_clicked(self):
        self.dialog = gui.GenericDialog(
            title='Dialog Box',
            message='Click Ok to transfer content to main page')
        self.dialog.style['width'] = '300px'
        self.dtextinput = gui.TextInput(width=200, height=30)
        self.dtextinput.set_value('Initial Text')
        self.dialog.add_field_with_label('dtextinput', 'Text Input',
                                         self.dtextinput)

        self.dcheck = gui.CheckBox(False, width=200, height=30)
        self.dialog.add_field_with_label('dcheck', 'Label Checkbox',
                                         self.dcheck)
        values = ('Danny Young', 'Christine Holand', 'Lars Gordon',
                  'Roberto Robitaille')
        self.dlistView = gui.ListView(width=200, height=120)
        for key, value in enumerate(values):
            self.dlistView.append(value, key=str(key))
        self.dialog.add_field_with_label('dlistView', 'Listview',
                                         self.dlistView)

        self.ddropdown = gui.DropDown(width=200, height=20)
        c0 = gui.DropDownItem('DropDownItem 0', width=200, height=20)
        c1 = gui.DropDownItem('DropDownItem 1', width=200, height=20)
        self.ddropdown.append(c0)
        self.ddropdown.append(c1)
        self.ddropdown.set_value('Value1')
        self.dialog.add_field_with_label('ddropdown', 'Dropdown',
                                         self.ddropdown)

        self.dspinbox = gui.SpinBox(min=0, max=5000, width=200, height=20)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dspinbox', 'Spinbox', self.dspinbox)

        self.dslider = gui.Slider(10, 0, 100, 5, width=200, height=20)
        self.dspinbox.set_value(50)
        self.dialog.add_field_with_label('dslider', 'Slider', self.dslider)

        self.dcolor = gui.ColorPicker(width=200, height=20)
        self.dcolor.set_value('#ffff00')
        self.dialog.add_field_with_label('dcolor', 'Colour Picker',
                                         self.dcolor)

        self.ddate = gui.Date(width=200, height=20)
        self.ddate.set_value('2000-01-01')
        self.dialog.add_field_with_label('ddate', 'Date', self.ddate)

        self.dialog.set_on_confirm_dialog_listener(self, 'dialog_confirm')
        self.dialog.show(self)
Esempio n. 12
0
    def main(self, name='world'):
        #margin 0px auto allows to center the app to the screen
        wid = gui.VBox(width=300, height=200, margin='0px auto')
        lbl = gui.Label('Hello %s!' % name, width='80%', height='50%')
        lbl.style['margin'] = 'auto'

        #bt = gui.Button('Press me!', width=200, height=30)
        bt = gui.Button('Turn lights ON', width=200, height=30)
        bt.style['margin'] = 'auto 50px'

        # setting the listener for the onclick event of the button
        self.npressed = 0

        # connect to the arduino, read the default startup output
        # and set all the lights to be off
        self.ser = serial.Serial('/dev/ttyACM0', 57600, timeout=1)
        hello = self.ser.readline()
        hello = self.ser.readline()
        self.ser.write(b'm42')

        bt.set_on_click_listener(self.on_button_pressed, lbl)
        bt.set_on_mousedown_listener(self.on_button_mousedown, 'data1', 2,
                                     'three')

        self.colorPicker = gui.ColorPicker('#ffbb00',
                                           width=200,
                                           height=20,
                                           margin='10px')
        self.colorPicker.set_on_change_listener(self.color_picker_changed, lbl)

        #this will never be called, can't register an event more than one time
        bt.set_on_mouseup_listener(self.on_button_mouseup, 'data1')

        self.slider = gui.Slider(128,
                                 0,
                                 255,
                                 1,
                                 width=200,
                                 height=20,
                                 margin='10px')
        self.slider.set_on_change_listener(self.slider_changed)

        # appending a widget to another, the first argument is a string key
        wid.append(lbl)
        wid.append(bt)
        wid.append(self.colorPicker)
        wid.append(self.slider)
        # returning the root widget
        return wid
Esempio n. 13
0
    def fan_clicked(self, widget):
        #read from pickle
        fan_setpoints = self.read_from_pickle("fan_setpoints")

        self.fan_control = gui.GenericDialog(title='Fan Control',
                                             width='100%',
                                             height='100%')
        fan_container = gui.Widget(width='100%',
                                   height='100%',
                                   margin='0px auto',
                                   style={
                                       'text-align': 'center',
                                       'display': 'block',
                                       'overflow': 'auto'
                                   })
        self.fan_label = gui.Label('Fan Speed: ' + str(fan_setpoints['fan']) +
                                   '%',
                                   width='95%',
                                   height=30,
                                   margin='10px')
        self.fan_slider = gui.Slider(fan_setpoints['fan'],
                                     0,
                                     100,
                                     1,
                                     width='80%',
                                     height=30,
                                     margin='20px')
        self.fan_slider.onchange.do(self.fan_slider_changed)

        spacer = gui.Widget(width='100%',
                            height=84,
                            margin='0px auto',
                            style={
                                'display': 'block',
                                'overflow': 'auto'
                            })
        spacer_label = gui.Label('', width='100%', height=20, margin='0px')

        fan_container.append(
            [spacer_label, self.fan_label, self.fan_slider, spacer])
        self.fan_control.add_field("fan", fan_container)
        self.fan_control.confirm_dialog.do(self.fan_confirm)
        self.fan_control.show(self)
    def initTest(self, robot):
        testBox = self.sectionBox()

        motorNumberIn = gui.Input()
        motorSelectionBox = sea.hBoxWith(gui.Label("Motor Number:"),
                                         motorNumberIn)

        motorSpeedSlider = gui.Slider(default_value=0,
                                      min=-1.0,
                                      max=1.0,
                                      step=0.05)
        testButton = gui.Button("Test")
        motorSpeedBox = sea.hBoxWith(testButton, gui.Label("Speed:"),
                                     motorSpeedSlider)

        def testMotor(button):
            robot.superDrive.disable()
            try:
                motorNum = int(motorNumberIn.get_value()) - 1
            except:
                print("Motor number incorrect")
                return

            wheelNum = 0
            if motorNum >= 3:
                wheelNum = 1
                motorNum -= 3

            if motorNum < 0 or motorNum >= 3:
                print("Motor number incorrect")
                return

            robot.testSettings["wheelNum"] = wheelNum
            robot.testSettings["motorNum"] = motorNum
            robot.testSettings["speed"] = float(motorSpeedSlider.get_value())

        testButton.set_on_click_listener(testMotor)

        testBox.append(gui.Label("Test"))
        testBox.append(motorSelectionBox)
        testBox.append(motorSpeedBox)
        return testBox
Esempio n. 15
0
    def do_survey(self, widget, user, type_):
        self.dialog = gui.GenericDialog(title="Survey", message=f"Survey for the {type_.name} view experiment performed by {user.name}. How would you rate each item? (scale from 1 to 7)", width="600px")

        for question in self.survey.questions.values():
            self.dialog.add_field(question.code, gui.Label(f"{question.description}", margin="10px"))
            slider = gui.Slider(question.score, 1, 7, 1, width="80%")
            slider.set_oninput_listener(self.survey_slider_changed, question.code)
            slider_value = gui.Label(slider.get_value(), margin="10px")
            self.survey_sliders[question.code] = (slider, slider_value)
            box = gui.Widget(width="100%", layout_orientation=gui.Widget.LAYOUT_HORIZONTAL, height=50)
            box.append(slider_value)
            box.append(slider)
            self.dialog.add_field(question.code + "_score", box)

        self.longform = gui.TextInput(single_line=False, hint="What other things would you like to say?", height="100px", margin="10px")

        self.dialog.add_field("dlongformlabel", gui.Label("Other feedback:", margin="10px"))
        self.dialog.add_field("dlongform", self.longform)

        self.dialog.set_on_confirm_dialog_listener(self.survey_done, user, type_)
        self.dialog.show(self)
Esempio n. 16
0
    def main(self):

        # App variables
        self.points_x = []  # Corner points x coordinates
        self.points_y = []  # Corner points y coordinates
        self.contour_x = []  # Contour points
        self.contour_y = []

        # Main widget===================================================================================================
        wid = Widget(width=600,
                     height=500,
                     margin='0px auto',
                     style="position: relative")

        # Body==========================================================================================================
        # ==============================================================================================================
        wid_body = HBox(width='100%',
                        height='100%',
                        style='position: absolute; left: 0px; top: 0px')
        wid.append(wid_body)

        # Plot and data variables=======================================================================================
        plotContainer = VBox(width='65%',
                             height='100%',
                             style='position: absolute; left: 0px; top: 0px')
        wid_body.append(plotContainer)

        #  Head and instructions
        wid_head = VBox(
            width='100%',
            height='20%',
            style='position: absolute; align: left; left: 0px; top: 0px')
        plotContainer.append(wid_head)

        appTitleContainer = HBox(
            width='100%',
            height='50%',
            style='position: absolute; align: left; left: 0px; top: 0px')
        wid_head.append(appTitleContainer)
        appTitle = gui.Label("LASERSKI SISTEM ZA ODGANJANJE GOLOBOV",
                             style='left:10%; top:20%')
        appTitleContainer.append(appTitle)

        # Instructions - help
        InstrContainer = HBox(
            width='100%',
            height='50%',
            style='position: absolute; align: left; left: 0px; top: 0px')
        wid_head.append(InstrContainer)

        btInstr = gui.Button('Instructions', width='20%', height='70%')
        #btInstr.style['margin'] = '5%'
        btInstr.set_on_click_listener(self.on_button_pressed_instr)
        InstrContainer.append(btInstr)

        btContour = gui.Button('Contour', width='20%', height='70%')
        #btContour.style['margin'] = '5%'
        btContour.set_on_click_listener(self.on_button_pressed_contour)
        InstrContainer.append(btContour)

        btLoad = gui.Button('Load last path', width='20%', height='70%')
        #btContour.style['margin'] = '5%'
        btLoad.set_on_click_listener(self.on_button_pressed_load)
        InstrContainer.append(btLoad)

        btOn = gui.Button('On', width='10%', height='70%')
        #btOn.style['margin'] = '5%'
        btOn.set_on_click_listener(self.on_button_pressed_on)
        InstrContainer.append(btOn)

        btOff = gui.Button('Off', width='10%', height='70%')
        #btOff.style['margin'] = '5%'
        btOff.set_on_click_listener(self.on_button_pressed_off)
        InstrContainer.append(btOff)

        # Plot
        self.mpl = MatplotImage(width='100%', height='90%')
        self.mpl.style['margin'] = '0px'
        self.mpl.ax.set_title("test")
        self.sc_poly = self.mpl.ax.plot(self.points_x, self.points_y, c='r')
        self.scp = self.mpl.ax.scatter(self.points_x, self.points_y, c='r')
        self.mpl.redraw()
        plotContainer.append(self.mpl)

        # Movement Buttons==============================================================================================

        # CONTINERS:
        # Main buttons container
        btContainer = VBox(width='35%',
                           height='100%',
                           style='position: absolute; left: 0px; top: 0px')
        wid_body.append(btContainer)

        # Arrow buttons container
        btContainerArrows = VBox(
            width='100%',
            height='30%',
            style='position: absolute; left: 0px; top: 0px')
        btContainer.append(btContainerArrows)

        # Up button container
        btContainerArrowsUp = HBox(
            width='100%',
            height='33%',
            style='position: absolute; left: 0px; top: 0px')
        btContainerArrows.append(btContainerArrowsUp)

        # Left and right buttons container
        btContainerArrowsLR = HBox(
            width='100%',
            height='34%',
            style='position: absolute; left: 0px; top: 60px')
        btContainerArrows.append(btContainerArrowsLR)

        # Down button container
        btContainerArrowsDown = HBox(
            width='100%',
            height='33%',
            style='position: absolute; left: 0px; top: 120px')
        btContainerArrows.append(btContainerArrowsDown)

        # BUTTONS:
        # Up
        btUp = gui.Button('Up', width='25%', height='70%')
        btUp.style['margin'] = '10%'
        btUp.set_on_click_listener(self.on_button_pressed_up)

        # Down
        btDown = gui.Button('Down', width='25%', height='70%')
        btUp.style['margin'] = '10%'
        btDown.set_on_click_listener(self.on_button_pressed_down)

        # Right
        btRight = gui.Button('Right', width='25%', height='70%')
        btUp.style['margin'] = '10%'
        btRight.set_on_click_listener(self.on_button_pressed_right)

        # Left
        btLeft = gui.Button('Left', width='25%', height='70%')
        btUp.style['margin'] = '10%'
        btLeft.set_on_click_listener(self.on_button_pressed_left)

        # Append to containers
        btContainerArrowsUp.append(btUp)
        btContainerArrowsDown.append(btDown)
        btContainerArrowsLR.append(btLeft)
        btContainerArrowsLR.append(btRight)

        # Steps and speed===============================================================================================
        # CONTAINERS:
        # Main slider container
        btContainerSliders = VBox(
            width='100%',
            height='40%',
            style='position: absolute; left: 0px; top: 0px')
        btContainer.append(btContainerSliders)

        # Step size slider container
        btContainerStepSize = VBox(
            width='100%',
            height='30%',
            style='position: absolute; left: 0px; top: 0px')
        btContainerSliders.append(btContainerStepSize)

        # Speed slider container
        btContainerSpeedSlider = VBox(
            width='100%',
            height='30%',
            style='position: absolute; left: 0px; top: 0px')
        btContainerSliders.append(btContainerSpeedSlider)

        # Move and pause time
        btContainerTime = HBox(width='100%',
                               height='40%',
                               style='position: absolute; left: 0px; top: 0px')
        btContainerSliders.append(btContainerTime)
        btContainerTimeMove = VBox(
            width='50%',
            height='100%',
            style='position: absolute; left: 0px; top: 0px')
        btContainerTime.append(btContainerTimeMove)
        btContainerTimePause = VBox(
            width='50%',
            height='100%',
            style='position: absolute; left: 0px; top: 0px')
        btContainerTime.append(btContainerTimePause)

        # BUTTONS:
        # Step-size drop-down
        stepsSlider = gui.Slider(3,
                                 1,
                                 7,
                                 1,
                                 style='margin: 5%; width: 90%; height: 50%')
        stepsSlider.set_on_change_listener(self.onchange_stepSize)
        stepSizeTitle = gui.Label("Step size:", style='left:0px; top:10%')

        # Speed slider
        speedSlider = gui.Slider(5,
                                 1,
                                 10,
                                 1,
                                 style='margin: 5%; width: 90%; height: 50%')
        speedSlider.set_on_change_listener(self.onchange_speedSlider)
        speedSliderTitle = gui.Label("Speed:", style='left:0px; top:10%')

        # Move drop down
        moveTime = gui.DropDown.new_from_list(
            ('00:10', '01:00', '05:00', '10:00'),
            value='01:00',
            style='margin: 5%; width: 90%; height: 50%')
        moveTime.set_on_change_listener(self.onchange_moveTime)
        moveTime.set_value('01:00')
        moveTimeTitle = gui.Label("Move interval:", style='left:0px; top:10%')

        # Pause drop down
        pauseTime = gui.DropDown.new_from_list(
            ('00:10', '01:00', '05:00', '10:00'),
            value='01:00',
            style='margin: 5%; width: 90%; height: 50%')
        pauseTime.set_on_change_listener(self.onchange_pauseTime)
        pauseTimeTitle = gui.Label("Pause interval:",
                                   style='left:0px; top:10%')

        # Append to containers
        btContainerStepSize.append(stepSizeTitle)
        btContainerStepSize.append(stepsSlider)
        btContainerSpeedSlider.append(speedSliderTitle)
        btContainerSpeedSlider.append(speedSlider)
        btContainerTimeMove.append(moveTimeTitle)
        btContainerTimeMove.append(moveTime)
        btContainerTimePause.append(pauseTimeTitle)
        btContainerTimePause.append(pauseTime)
        # Command buttons===============================================================================================

        # CONTAINERS:
        # Command buttons container
        btContainerCommands = VBox(
            width='100%',
            height='30%',
            style='position: absolute; left: 0px; top: 260px')
        btContainer.append(btContainerCommands)

        # Add-remove buttons container
        btContainerCommandsPoints = HBox(
            width='100%',
            height='50%',
            style='position: absolute; left: 0px; top: 0px')
        btContainerCommands.append(btContainerCommandsPoints)

        # Path generate, start stop buttons container
        btContainerCommandsPath = HBox(
            width='100%',
            height='50%',
            style='position: absolute; left: 0px; top: 120px')
        btContainerCommands.append(btContainerCommandsPath)

        # BUTTONS:
        # Add point button
        btAddPoint = gui.Button('Add new point', width=100, height=50)
        btAddPoint.style['margin'] = '10px'
        btAddPoint.set_on_click_listener(self.on_button_pressed_addPoint)

        # Remove point buttons
        btRemovePoint = gui.Button('Remove last point', width=100, height=50)
        btRemovePoint.style['margin'] = '10px'
        btRemovePoint.set_on_click_listener(self.on_button_pressed_removePoint)

        # Generate path button
        self.btGeneratePath = gui.Button('Generate path', width=100, height=50)
        self.btGeneratePath.style['margin'] = '10px'
        self.btGeneratePath.set_on_click_listener(
            self.on_button_pressed_generatePath)

        # Start/stop button
        self.btStart = gui.Button('Start', width=100, height=50)
        self.btStart.style['margin'] = '10px'
        self.btStart.set_on_click_listener(self.on_button_pressed_start)

        # Append buttons:
        btContainerCommandsPoints.append(btAddPoint)
        btContainerCommandsPoints.append(btRemovePoint)
        btContainerCommandsPath.append(self.btGeneratePath)
        btContainerCommandsPath.append(self.btStart)

        # Update widget
        self.import_points()

        return wid
Esempio n. 17
0
    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 main(self, robot, appCallback):
        self.robot = robot

        root = gui.VBox(width=600)

        title = gui.Label('Motor Tester')
        title.style['margin'] = '24px'
        title.style['font-size'] = '36px'
        title.style['font-weight'] = 'bold'
        root.append(title)

        self.talonBox = gui.SpinBox(default_value=0, min_value=0, max_value=99, step=1)
        self.talonBox.set_on_change_listener(self.queuedEvent(robot.c_setTalon))
        root.append(sea.hBoxWith(
            gui.Label('Talon:'),
            gui.HBox(width=SPACE),
            self.talonBox
        ))

        self.selectedTalonLbl = gui.Label('')
        root.append(sea.hBoxWith(
            gui.Label('Selected talon:'),
            gui.HBox(width=SPACE),
            self.selectedTalonLbl
        ))

        self.outputVoltageLbl = gui.Label('')
        root.append(sea.hBoxWith(
            gui.Label('Output voltage:'),
            gui.HBox(width=SPACE),
            self.outputVoltageLbl
        ))

        self.outputCurrentLbl = gui.Label('')
        root.append(sea.hBoxWith(
            gui.Label('Output current:'),
            gui.HBox(width=SPACE),
            self.outputCurrentLbl
        ))

        self.encoderPositionLbl = gui.Label('')
        root.append(sea.hBoxWith(
            gui.Label('Encoder position:'),
            gui.HBox(width=SPACE),
            self.encoderPositionLbl
        ))

        self.encoderVelocityLbl = gui.Label('')
        root.append(sea.hBoxWith(
            gui.Label('Encoder velocity:'),
            gui.HBox(width=SPACE),
            self.encoderVelocityLbl
        ))

        controlTabBox = gui.TabBox(width='100%')
        root.append(controlTabBox)

        controlTabBox.add_tab(gui.Widget(), 'Disabled',
            self.queuedEvent(robot.c_updateDisabled))

        self.outputSlider = gui.Slider(default_value="0", min=-100, max=100,
                                       width='100%')
        controlTabBox.add_tab(self.outputSlider, 'Percent Output',
                              self.c_percentOutputTab)
        self.outputSlider.set_on_change_listener(
            self.queuedEvent(robot.c_updatePercentOutput))

        velocityFrame = gui.HBox(width='100%')
        controlTabBox.add_tab(velocityFrame, 'Velocity', self.c_velocityTab)
        self.velocityOutputSlider = gui.Slider(default_value="0",
                                               min=-100, max=100, width='100%')
        velocityFrame.append(self.velocityOutputSlider)
        self.maxVelocityBox = gui.SpinBox(
            default_value='8000', min=0, max=1000000, step=100, width='100')
        velocityFrame.append(self.maxVelocityBox)
        self.velocityOutputSlider.set_on_change_listener(
            self.queuedEvent(robot.c_updateVelocity),
            self.velocityOutputSlider, self.maxVelocityBox)
        self.maxVelocityBox.set_on_change_listener(
            self.queuedEvent(robot.c_updateVelocity),
            self.velocityOutputSlider, self.maxVelocityBox)

        self.offsetBox = gui.SpinBox('0', -1000000, 1000000, 100)
        holdButton = gui.Button('Hold', width='100')
        holdButton.set_on_click_listener(
            self.queuedEvent(robot.c_updatePosition), self.offsetBox)
        controlTabBox.add_tab(sea.hBoxWith(
            gui.Label('Offset:'),
            gui.HBox(width=SPACE),
            self.offsetBox,
            holdButton
        ), 'Hold Position', self.queuedEvent(robot.c_updateDisabled))

        # margin
        root.append(gui.HBox(height=10))

        appCallback(self)
        return root
Esempio n. 19
0
    def mist_clicked(self, widget):
        #read pickle must happen
        mist_setpoints = self.read_from_pickle("mist_setpoints")

        self.mist_control = gui.GenericDialog(title='Light Control',
                                              width='100%',
                                              height='100%')
        mist_container = gui.Widget(
            width='100%',
            height='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })
        freq_container = gui.Widget(width='50%',
                                    height='50%',
                                    margin='0px auto',
                                    style={
                                        'text-align': 'center',
                                        'display': 'block',
                                        'overflow': 'auto'
                                    })
        dur_container = gui.Widget(width='50%',
                                   height='50%',
                                   margin='0px auto',
                                   style={
                                       'text-align': 'center',
                                       'display': 'block',
                                       'overflow': 'auto'
                                   })

        spacer = gui.Widget(width='100%',
                            height=84,
                            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'
                                       })

        self.mist_freq_label = gui.Label(
            'Frequency: ' + str(mist_setpoints['mist_freq']) + ' minutes',
            width=200,
            height=30,
            margin='10px')
        self.mist_dur_label = gui.Label(
            'Duration: ' + str(mist_setpoints['mist_dur']) + ' seconds',
            width=200,
            height=30,
            margin='10px')
        self.mist_freq_slider = gui.Slider(mist_setpoints['mist_freq'],
                                           1,
                                           120,
                                           1,
                                           width='80%',
                                           height=30,
                                           margin='20px')
        self.mist_dur_slider = gui.Slider(mist_setpoints['mist_dur'],
                                          0.5,
                                          10,
                                          0.5,
                                          width='80%',
                                          height=30,
                                          margin='20px')
        self.mist_freq_slider.onchange.do(self.mist_freq_slider_changed)
        self.mist_dur_slider.onchange.do(self.mist_dur_slider_changed)
        freq_container.append([self.mist_freq_label, self.mist_freq_slider])
        dur_container.append([self.mist_dur_label, self.mist_dur_slider])
        mist_container.append([freq_container, dur_container])
        verticalContainer.append([spacer_label, mist_container, spacer])
        self.mist_control.add_field("mist", verticalContainer)
        self.mist_control.confirm_dialog.do(self.mist_confirm)
        self.mist_control.show(self)
Esempio n. 20
0
    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
Esempio n. 21
0
    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
Esempio n. 22
0
	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
Esempio n. 23
0
    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)
Esempio n. 24
0
    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 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
Esempio n. 26
0
 def test_init(self):
     widget = gui.Slider()
     assertValidHTML(widget.repr())
Esempio n. 27
0
    def main(self):
        verticalContainer = gui.Widget(640, 680, 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.table = gui.Table(300, 200)
        row = gui.TableRow()
        item = gui.TableTitle()
        item.append(str(id(item)), 'ID')
        row.append(str(id(item)), item)
        item = gui.TableTitle()
        item.append(str(id(item)), 'First Name')
        row.append(str(id(item)), item)
        item = gui.TableTitle()
        item.append(str(id(item)), 'Last Name')
        row.append(str(id(item)), item)
        self.table.append(str(id(row)), row)
        self.add_table_row(self.table, '101', 'Danny', 'Young')
        self.add_table_row(self.table, '102', 'Christine', 'Holand')
        self.add_table_row(self.table, '103', 'Lars', 'Gordon')
        self.add_table_row(self.table, '104', 'Roberto', 'Robitaille')
        self.add_table_row(self.table, '105', 'Maria', 'Papadopoulos')

        # the arguments are	width - height - layoutOrientationOrizontal
        subContainerRight = gui.Widget(240, 560, gui.Widget.LAYOUT_VERTICAL,
                                       10)

        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.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.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')

        # appending a widget to another, the first argument is a string key
        subContainerRight.append('1', self.lbl)
        subContainerRight.append('2', self.bt)
        subContainerRight.append('3', self.txt)
        subContainerRight.append('4', self.spin)
        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)

        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')

        menu.append('1', m1)
        menu.append('2', m2)
        m1.append('11', m11)
        m1.append('12', m12)
        m11.append('111', m111)
        m11.append('112', m112)

        verticalContainer.append('0', menu)
        verticalContainer.append('1', horizontalContainer)

        # returning the root widget
        return verticalContainer
Esempio n. 28
0
    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
Esempio n. 29
0
    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