Example #1
0
    def _init_elements(self):
        self._date_end = date.today()
        self._date_start = self._date_end - timedelta(days=3)

        self._scanning_file_message = gui.HBox(
            style="align-self: flex-start; margin-bottom: 10px")
        self._scanning_file_message.append(
            gui.Image("/res:spinner.gif", style="margin-right: 4px"))
        self._scanning_file_message.append(gui.Label("Scanning files"))
        self.append(self._scanning_file_message)
        hide(self._scanning_file_message)

        file_form = gui.HBox(style="margin-bottom: 20px; flex-wrap: wrap")

        self._brewer_dd = gui.DropDown()
        self._update_brewer_ids()
        self._brewer_dd.onchange.do(self._on_bid_change)
        self._brewer_input = LabeledInput("Brewer id",
                                          self._brewer_dd,
                                          style="margin-right: 20px")

        self._uvr_dd = gui.DropDown()
        self._update_uvr_files()
        self._uvr_dd.onchange.do(self._on_uvr_change)
        self._uvr_input = LabeledInput("UVR file",
                                       self._uvr_dd,
                                       style="margin-right: 20px")

        self._date_start_selector = gui.Date(default_value="2019-06-24")
        self._date_start_selector.onchange.do(self._on_date_start_change)
        self._date_start_input = LabeledInput("Start date",
                                              self._date_start_selector,
                                              style="margin-right: 20px")

        self._date_end_selector = gui.Date(default_value="2019-06-27")
        self._date_end_selector.onchange.do(self._on_date_end_change)
        self._date_end_input = LabeledInput("End date",
                                            self._date_end_selector,
                                            style="margin-right: 20px")

        file_form.append(self._brewer_input)
        file_form.append(self._uvr_input)
        file_form.append(self._date_start_input)
        file_form.append(self._date_end_input)

        self.append(file_form)

        self._refresh_button = gui.Button("Refresh files",
                                          style="margin-bottom: 10px")
        self._refresh_button.onclick.do(self.refresh)

        self.append(self._refresh_button)
Example #2
0
    def __init__(self, widget, listenersList, eventConnectionFuncName,
                 eventConnectionFunc, **kwargs):
        super(SignalConnection, self).__init__(**kwargs)

        self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        self.style.update({
            'overflow': 'visible',
            'height': '24px',
            'display': 'block',
            'outline': '1px solid lightgray'
        })
        self.label = gui.Label(eventConnectionFuncName, width='32%')
        self.label.style.update({
            'float': 'left',
            'font-size': '10px',
            'overflow': 'hidden',
            'outline': '1px solid lightgray'
        })

        self.dropdownListeners = gui.DropDown(width='32%', height='100%')
        self.dropdownListeners.onchange.do(self.on_listener_selection)

        self.dropdownMethods = gui.DropDown(width='32%', height='100%')
        self.dropdownMethods.onchange.do(self.on_connection)

        self.append([self.label, self.dropdownListeners, self.dropdownMethods])
        self.dropdownMethods.style['float'] = 'right'
        self.dropdownListeners.style['float'] = 'left'

        self.eventConnectionFunc = eventConnectionFunc
        self.eventConnectionFuncName = eventConnectionFuncName
        self.refWidget = widget
        self.listenersList = listenersList
        self.dropdownListeners.append(gui.DropDownItem("None"))
        for w in listenersList:
            ddi = gui.DropDownItem(w.attributes['editor_varname'])
            ddi.listenerInstance = w
            self.dropdownListeners.append(ddi)
        if hasattr(self.eventConnectionFunc, 'callback_copy'
                   ):  #if the callback is not None, and so there is a listener
            connectedListenerName = eventConnectionFunc.callback_copy.__self__.attributes[
                'editor_varname']
            self.dropdownListeners.set_value(connectedListenerName)
            #this to automatically populate the listener methods dropdown
            self.on_listener_selection(self.dropdownListeners,
                                       connectedListenerName)
            self.dropdownMethods.set_value(
                eventConnectionFunc.callback_copy.__name__)
    def init__gui__(self):
        self.vbox_list_requests = G.VBox(width="100%")
        self.vbox_list_requests.append(G.Label("[Pending user requests]"))

        self.button_update = G.Button(u"🗘")
        self.button_update.onclick.do(self.a(self.on_update_all))

        self.vbox_publics = G.VBox(width="100%")
        self.vbox_publics.append(G.Label("[Publics]"))

        self.hbox_create_new = G.HBox(width="100%")
        self.edit_name = G.TextInput()
        self.button_add_new = G.Button("+")
        self.hbox_create_new.append([self.edit_name, self.button_add_new])
        self.button_add_new.onclick.do(self.a(self.on_add_new))

        self.vbox_publish_form = G.VBox(width="100%")
        self.select_channels = G.DropDown()
        self.edit_publish =G.TextInput()
        self.button_publish = G.Button("publish")
        self.button_publish.onclick.do(self.a(self.on_publish))
        self.vbox_publish_form.append([
            G.Label("[new publishment]"),
            self.select_channels,
            self.edit_publish,
            self.button_publish
        ])

        self.publics_controls = dict()
Example #4
0
    def main(self, name='world'):
        # Add the widget, it's the white background
        # self is for making the widget part of the class to be able to modify it
        self.wid = gui.Widget(400, 300, False, 10)

        # To make it prettier put a tittle of what is this demo
        self.tittle_label = gui.Label(350, 20, "Dynamical layout change demo")
        self.description_label = gui.Label(350, 80, 
            """Choose from the dropdown a widget and it will be added to the interface. 
            If you change the dropdown selection it will substitute it.""")


        # Create dropdown and it's contents
        self.dropdown = gui.DropDown(200, 20)

        choose_ddi = gui.DropDownItem(200, 20, "Choose...")
        button_ddi = gui.DropDownItem(200, 20, "Add button")
        label_ddi  = gui.DropDownItem(200, 20, "Add label")

        self.dropdown.append('0', choose_ddi)
        self.dropdown.append('1', button_ddi)
        self.dropdown.append('2', label_ddi)

        # Add a listener
        self.dropdown.set_on_change_listener(self, 'on_dropdown_change')

        # Add the dropdown to the widget
        self.wid.append('0', self.tittle_label)
        self.wid.append('1', self.description_label)
        self.wid.append('2', self.dropdown)

        # returning the root widget
        return self.wid
Example #5
0
    def _model_page(self):

        # Define root widget.
        main_container = gui.Widget(width='100%',
                                    style={
                                        'vertical-align': 'top',
                                        'align-content': 'center'
                                    })

        # Define title and instructions text.
        models_title = wc.h2('Bayesian Non-Parametric Models')
        models_title.style['text-align'] = 'center'
        models_instructions = wc.h4(
            'Choose a model from the pulldown menu. Afterwards, the user can choose to load a '
            'existing model trained for a specific data set to visualise results and generate '
            'data from the model. Or the user can train a new model by (1) setting model '
            'hyperparameters, (2) choosing a data set, and (3) setting experiment parameters.'
        )
        models_instructions.style['text-align'] = 'justify-all'

        # Define row container for model selection.
        selection_container = gui.HBox(width='50%',
                                       margin='auto',
                                       style={
                                           'display': 'block',
                                           'overflow': 'auto',
                                           'align-content': 'center',
                                           'margin-top': '50px'
                                       })

        model_label = wc.h5('Model: ')
        model_label.style['margin-top'] = '8px'

        # Define drop down with different models.
        self.model_dropdown = gui.DropDown(width='250px',
                                           style={'margin-right': '15px'})
        self.model_dropdown.add_class("form-control dropdown")
        self.model_dropdown.append(
            dict(
                zip(self.models,
                    [gui.DropDownItem(model_str)
                     for model_str in self.models])))

        self.model_select_button = gui.Button('Select',
                                              width='100px',
                                              style={'box-shadow': 'none'})
        self.model_select_button.add_class('btn btn-primary')
        self.model_select_button.onclick.connect(
            self.select_button_clicked)  # Listener function for mouse click.

        # Build up the webpage.
        selection_container.append(
            [model_label, self.model_dropdown, self.model_select_button])
        main_container.append([
            self.nav_bar, models_title, models_instructions,
            selection_container, self.footer
        ])

        # Return the root widget.
        return main_container
Example #6
0
    def main(self):
        container = gui.VBox(width=400,
                             height=240,
                             style={'margin': '0px auto'})
        self.lbl_01 = gui.Label('开源智慧农场监控页面', style={'font-size': '25px'})
        self.dd = gui.DropDown(['设备编号:' + x for x in project_list],
                               width=150,
                               style={'font-size': '12px'})
        self.lbl_1 = gui.Label('环境光照值:等待数据中')
        self.lbl_2 = gui.Label('土壤湿度值:等待数据中')
        self.lbl_9 = gui.Label(' ')

        self.bt = gui.Button('[ 浇水 ]')

        # 选择时执行
        self.dd.onchange.do(self.on_dropdown_onchange)

        # 按钮按下时执行
        self.bt.onclick.do(self.on_button_pressed)

        # 添加到网页上
        container.append(self.lbl_01)
        container.append(self.dd)
        container.append(self.lbl_1)
        container.append(self.lbl_2)
        container.append(self.bt)
        container.append(self.lbl_9)

        # 开启新的进程处理MQTT消息
        t = threading.Thread(target=self.showmqtt)
        t.start()

        # returning the root widget
        return container
Example #7
0
    def __init__(self, widget, listenersList, eventConnectionFuncName,
                 eventConnectionFunc, **kwargs):
        super(SignalConnection, self).__init__(**kwargs)
        self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        self.style['overflow'] = 'hidden'
        self.label = gui.Label(eventConnectionFuncName, width='49%')
        self.label.style['float'] = 'left'
        self.label.style['font-size'] = '10px'
        self.label.style['overflow'] = 'hidden'

        self.dropdown = gui.DropDown(width='49%', height='100%')
        self.dropdown.set_on_change_listener(self, "on_connection")
        self.append(self.label)
        self.append(self.dropdown)
        self.dropdown.style['float'] = 'right'

        self.eventConnectionFunc = eventConnectionFunc
        self.eventConnectionFuncName = eventConnectionFuncName
        self.refWidget = widget
        self.listenersList = listenersList
        self.dropdown.append(gui.DropDownItem("None"))
        for w in listenersList:
            ddi = gui.DropDownItem(w.attributes['editor_varname'])
            ddi.listenerInstance = w
            self.dropdown.append(ddi)
        #selecting in the dropdown the already connected varname
        if self.eventConnectionFunc._event_listener[
                'eventName'] in self.refWidget.eventManager.listeners.keys():
            if self.refWidget.eventManager.listeners[
                    self.eventConnectionFunc._event_listener['eventName']][
                        'instance'] in self.listenersList:
                connectedListenerName = self.refWidget.eventManager.listeners[
                    self.eventConnectionFunc._event_listener['eventName']][
                        'instance'].attributes['editor_varname']
                self.dropdown.set_value(connectedListenerName)
Example #8
0
    def main(self):
        wid = gui.VBox(width='100%', margin='0px auto')

        width = '300'  #'2048'
        height = '300'  #'1152'
        self.video = gui.Widget(width=300, height=300, _type='video')
        self.video.attributes['autoplay'] = 'true'
        self.video.style['overflow'] = 'hidden'
        self.video.attributes['width'] = width
        self.video.attributes['height'] = height

        self.canvas = gui.Widget(_type='canvas')
        self.canvas.style['display'] = 'none'
        self.canvas.attributes['width'] = width
        self.canvas.attributes['height'] = height

        self.imgGrabber = ImageGrabber(self, width, height)

        self.imgGrabber.new_image.do(self.on_new_image)
        self.imgGrabber.onnewvideodevice.do(self.new_video_device)
        getVideoInputsButton = gui.Button("Get cameras", margin='10px')
        getVideoInputsButton.onclick.do(self.on_get_video_inputs)
        captureButton = gui.Button("Start", margin='10px')
        captureButton.onclick.do(self.on_start_grab, None)
        snapshotButton = gui.Button("Grab Image", margin='10px')
        snapshotButton.onclick.do(self.snapshot)
        self.check_flash = gui.CheckBoxLabel('Flashlight',
                                             False,
                                             width=200,
                                             height=30,
                                             margin='10px')
        self.check_flash.set_on_change_listener(self.on_start_grab)

        self.label = gui.Label('Image capture')
        self.label.style['font-size'] = '18px'

        self.device_list = gui.DropDown(width=100)

        wid.append(self.label)
        wid.append(self.video)
        wid.append(self.canvas)
        wid.append(getVideoInputsButton)
        wid.append(self.device_list)
        wid.append(captureButton)
        wid.append(snapshotButton)
        wid.append(self.check_flash)

        self.opencvVideoWidget = OpencvVideoWidget(self, width=400, height=300)
        wid.append(
            gui.VBox(
                children=[gui.Label("opencv image"), self.opencvVideoWidget],
                style={'bolder': '1px dotted black'}))

        wid.add_child("javascript_image_grabber", self.imgGrabber)

        self.dialog = None

        # returning the root widget
        return wid
Example #9
0
    def main(self):
        #creating a container VBox type, vertical (you can use also HBox or Widget)
        main_container = gui.VBox(width='500px',
                                  height='500px',
                                  style={
                                      'margin': '0px auto',
                                      'padding': '10px'
                                  })

        #Label
        self.lbl = gui.Label("  Label with Lock Icon")
        self.lbl.add_class("glyphicon glyphicon-lock label label-primary")

        #Text Input
        self.tf = gui.TextInput(hint='Your Input')
        self.tf.add_class("form-control input-lg")

        #Drop Down
        self.dd = gui.DropDown(width='200px')
        self.dd.style.update({'font-size': 'large'})
        self.dd.add_class("form-control dropdown")
        self.item1 = gui.DropDownItem("First Choice")
        self.item2 = gui.DropDownItem("Second Item")
        self.dd.append(self.item1, 'item1')
        self.dd.append(self.item2, 'item2')

        #Table
        myList = [('ID', 'Lastname', 'Firstname', 'ZIP', 'City'),
                  ('1', 'Pan', 'Peter', '99999', 'Neverland'),
                  ('2', 'Sepp', 'Schmuck', '12345', 'Examplecity')]

        self.tbl = gui.Table.new_from_list(content=myList,
                                           width='400px',
                                           height='100px',
                                           margin='10px')
        self.tbl.add_class("table table-striped")

        #Buttons

        #btn adds basic design to a button like rounded corners and stuff
        #btn-success, btn-danger and similar adds theming based on the function
        #if you use btn-success without btn, the button will be standard, but with green background

        self.bt1 = gui.Button("OK", width="100px")
        self.bt1.add_class("btn-success")  #Bootstrap Class:  btn-success

        self.bt2 = gui.Button("Abbruch", width="100px")
        self.bt2.add_class("btn btn-danger")  #Bootstrap Class:  btn btn-danger

        #Build up the gui
        main_container.append(self.lbl, 'lbl')
        main_container.append(self.tf, 'tf')
        main_container.append(self.dd, 'dd')
        main_container.append(self.tbl, 'tbl')
        main_container.append(self.bt1, 'btn1')
        main_container.append(self.bt2, 'btn2')

        # returning the root widget
        return main_container
Example #10
0
    def __init__(self, widget, listenersList, eventConnectionFuncName, eventConnectionFunc, **kwargs):
        super(SignalConnection, self).__init__(**kwargs)

        self.style.update({'overflow':'visible', 'height':'24px', 'outline':'1px solid lightgray'})
        self.label = gui.Label(eventConnectionFuncName, width='32%')
        self.label.style.update({'float':'left', 'font-size':'10px', 'overflow':'hidden', 'outline':'1px solid lightgray'})

        self.dropdownListeners = gui.DropDown(width='32%', height='100%')
        self.dropdownListeners.onchange.do(self.on_listener_selection)
        self.dropdownListeners.attributes['title'] = "The listener who will receive the event"

        self.dropdownMethods = gui.DropDown(width='32%', height='100%')
        self.dropdownMethods.onchange.do(self.on_connection)
        self.dropdownMethods.attributes['title'] = """The listener's method who will receive the event. \
        A custom method is selected by default. You can select another method, but you should check the method parameters."""

        self.append([self.label, self.dropdownListeners, self.dropdownMethods])

        self.eventConnectionFunc = eventConnectionFunc
        self.eventConnectionFuncName = eventConnectionFuncName
        self.refWidget = widget
        self.listenersList = listenersList
        self.dropdownListeners.append(gui.DropDownItem("None"))
        for w in listenersList:
            ddi = gui.DropDownItem(w.attributes['editor_varname'])
            ddi.listenerInstance = w
            self.dropdownListeners.append(ddi)
        if hasattr(self.eventConnectionFunc, 'callback_copy'): #if the callback is not None, and so there is a listener
            connectedListenerName = ""
            if type(eventConnectionFunc.callback_copy) == gui.ClassEventConnector:
                connectedListenerName = eventConnectionFunc.callback_copy.event_method_bound.__self__.attributes['editor_varname']
            else: #type = types.MethodType #instancemethod
                connectedListenerName = eventConnectionFunc.callback_copy.__self__.attributes['editor_varname']
            connectedListenerFunction = None
            if type(eventConnectionFunc.callback_copy) == gui.ClassEventConnector:
                connectedListenerFunction = eventConnectionFunc.callback_copy.event_method_bound
            else: #type = types.MethodType #instancemethod
                connectedListenerFunction = eventConnectionFunc.callback_copy
            self.dropdownListeners.select_by_value( connectedListenerName )
            #this to automatically populate the listener methods dropdown
            self.on_listener_selection(self.dropdownListeners, connectedListenerName)
            print("connected function name:"+connectedListenerFunction.__name__)
            self.dropdownMethods.select_by_value(connectedListenerFunction.__name__ )
            #force the connection
            self.on_connection(None, None)
    def initPathRecording(self, robot):
        # the text input box is for saving and the dropdown is for loading

        recordingBox = self.sectionBox()
        recordingBox.append(gui.Label("Path Recording"))

        fileIn = gui.Input(default_value="file name")
        recordingBox.append(fileIn)

        recordingButtons = gui.HBox()
        recordingBox.append(recordingButtons)

        fileDropdown = gui.DropDown()
        recordingBox.append(fileDropdown)

        startBtn = gui.Button("Start")
        stopBtn = gui.Button("Stop")
        saveBtn = gui.Button("Save")
        loadBtn = gui.Button("Load")

        for btn in [startBtn, stopBtn, saveBtn, loadBtn]:
            recordingButtons.append(btn)

        def updateDropDown():
            fileDropdown.empty()
            for file in glob.glob(os.path.join(self.presetPath(), "*.ankl")):
                fileName = os.path.basename(file)
                fileDropdown.append(fileName, file)

        def startRecording(button, robot):
            autoActions.startRecording(robot)

        def stopRecording(button, robot):
            autoActions.stopRecording(robot)

        def saveRecording(button, robot, textIn):
            autoActions.saveRecording(robot, fileIn.get_value())
            updateDropDown()

        def loadRecording(dropDownItem, file):
            if file.get_key() is None:
                print("No file selected")
                return
            action = autoActions.createDriveRecordedPathAction(
                robot.pathFollower,
                file.get_key()[:-5])
            self.robot.autoScheduler.actionList.append(action)
            self.updateSchedulerFlag = True

        updateDropDown()

        startBtn.set_on_click_listener(startRecording, robot)
        stopBtn.set_on_click_listener(stopRecording, robot)
        saveBtn.set_on_click_listener(saveRecording, robot, fileIn)
        loadBtn.set_on_click_listener(loadRecording, fileDropdown)

        return recordingBox
Example #12
0
    def __createEditor(self):
        attributeType = self._param._type
        additionalInfo = self._param._additionalInfo
        attributeValue = self._param._v
        attributeName = self._param._k
        attributeDesc = self._param._description
        if additionalInfo == None:
            additionalInfo = {}

        dprint('name', attributeName, 'type', attributeType, 'value',
               attributeValue, 'info', additionalInfo)

        self.inputWidget = None

        #'background-repeat':{'type':str, 'description':'The repeat behaviour of an optional background image', ,'additional_data':{'affected_widget_attribute':'style', 'possible_values':'repeat | repeat-x | repeat-y | no-repeat | inherit'}},
        if attributeType == bool or attributeType == 'bool':
            if attributeValue == 'true':
                attributeValue = True
            if attributeValue == 'false':
                attributeValue = False
            self.inputWidget = gui.CheckBox('checked')
        elif attributeType == int or attributeType == float or attributeType == 'int' or attributeType == 'float':
            min_val = -1000000
            if "min" in additionalInfo:
                min_val = additionalInfo['min']
            max_val = 1000000
            if "max" in additionalInfo:
                max_val = additionalInfo['max']
            step_val = 1
            if "step" in additionalInfo:
                step_val = additionalInfo['step']
            self.inputWidget = gui.SpinBox(attributeValue, min_val, max_val,
                                           step_val)
        elif attributeType == gui.ColorPicker:
            self.inputWidget = gui.ColorPicker()
        elif attributeType == 'dropdown':
            self.inputWidget = gui.DropDown()
            for value in additionalInfo['possible_values']:
                self.inputWidget.append(gui.DropDownItem(value), value)
#        elif attributeType == 'url_editor':
#            self.inputWidget = UrlPathInput(self._appInstance)
#        elif attributeType == 'css_size':
#            self.inputWidget = CssSizeInput(self._appInstance)
        else:  # default editor is string
            self.inputWidget = StringEditor()

        self.inputWidget.set_on_change_listener(self.on_attribute_changed)
        self.inputWidget.set_size('50%', '22px')
        self.inputWidget.attributes['title'] = attributeDesc
        self.inputWidget.style['float'] = 'right'
        self.inputWidget.set_value(attributeValue)
        dprint('setValue', attributeValue)
        dprint('getValue', self.inputWidget.get_value())

        self.append(self.inputWidget)
Example #13
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)
Example #14
0
    def create_enum_row(self, param_name, description, current_value,
                        callback_cb, enums):
        row = gui.TableRow()
        param_name = gui.Label(param_name,
                               width=NAME_L_SIZE,
                               height=FIELD_HEIGHT)
        param_name.attributes['title'] = description
        dropdown = gui.DropDown(width=SLIDER_SIZE, height=FIELD_HEIGHT)

        # Fill dropdown
        for idx, enum in enumerate(enums):
            description_enum = enum['description']
            value = enum['value']
            name = enum['name']
            type_enum = enum['type']
            ddi_text = name + " (" + str(value) + ")"
            ddi = gui.DropDownItem(ddi_text,
                                   width=EDIT1_SIZE,
                                   height=FIELD_HEIGHT)
            ddi.attributes['title'] = description_enum
            dropdown.add_child(value, ddi)
            if value == current_value:
                dropdown.select_by_key(value)

        item = gui.TableItem()
        item.add_child(0, param_name)
        row.add_child(0, item)

        # Dummy item
        item = gui.TableItem()
        item.add_child(1, "")
        row.add_child(1, item)

        item = gui.TableItem()
        item.add_child(2, dropdown)
        row.add_child(2, item)
        dropdown.style['display'] = 'block'
        dropdown.style['margin'] = '0px auto'
        dropdown.style['float'] = 'none'

        # Dummy item
        item = gui.TableItem()
        item.add_child(3, "")
        row.add_child(3, item)

        # Dummy item
        item = gui.TableItem()
        item.add_child(4, "")
        row.add_child(4, item)

        dropdown.set_on_change_listener(callback_cb)

        # return the row itself and the setter func list
        return row, [dropdown.select_by_key]
    def __init__(self, attributeName, attributeDict, appInstance=None):
        super(EditorAttributeInput, self).__init__()
        gui.EventSource.__init__(self)
        self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        self.style.update({'display':'block',
            'overflow':'auto',
            'margin':'2px',
            'outline':'1px solid lightgray'})
        self.attributeName = attributeName
        self.attributeDict = attributeDict
        self.EVENT_ATTRIB_ONCHANGE = 'on_attribute_changed'

        self.EVENT_ATTRIB_ONREMOVE = 'onremove_attribute'
        self.removeAttribute = gui.Image('/editor_resources:delete.png', width='5%')
        self.removeAttribute.attributes['title'] = 'Remove attribute from this widget.'
        self.removeAttribute.onclick.do(self.on_attribute_remove)
        self.append(self.removeAttribute)

        self.label = gui.Label(attributeName, width='45%', height=22, margin='0px')
        self.label.style['overflow'] = 'hidden'
        self.label.style['font-size'] = '13px'
        self.label.style['outline'] = '1px solid lightgray'
        self.append(self.label)
        self.inputWidget = None

        #'background-repeat':{'type':str, 'description':'The repeat behaviour of an optional background image', ,'additional_data':{'affected_widget_attribute':'style', 'possible_values':'repeat | repeat-x | repeat-y | no-repeat | inherit'}},
        if attributeDict['type'] in (bool,int,float,gui.ColorPicker,gui.DropDown,'url_editor','css_size'):
            if attributeDict['type'] == bool:
                self.inputWidget = gui.CheckBox('checked')
            if attributeDict['type'] == int or attributeDict['type'] == float:
                self.inputWidget = gui.SpinBox(attributeDict['additional_data']['default'], attributeDict['additional_data']['min'], attributeDict['additional_data']['max'], attributeDict['additional_data']['step'])
            if attributeDict['type'] == gui.ColorPicker:
                self.inputWidget = gui.ColorPicker()
            if attributeDict['type'] == gui.DropDown:
                self.inputWidget = gui.DropDown()
                for value in attributeDict['additional_data']['possible_values']:
                    self.inputWidget.append(gui.DropDownItem(value),value)
            if attributeDict['type'] == 'url_editor':
                self.inputWidget = UrlPathInput(appInstance)
            if attributeDict['type'] == 'css_size':
                self.inputWidget = CssSizeInput(appInstance)

        else: #default editor is string
            self.inputWidget = gui.TextInput()

        self.inputWidget.onchange.do(self.on_attribute_changed)
        self.inputWidget.set_size('50%','22px')
        self.inputWidget.attributes['title'] = attributeDict['description']
        self.label.attributes['title'] = attributeDict['description']
        self.append(self.inputWidget)
        self.inputWidget.style['float'] = 'right'

        self.style['display'] = 'block'
        self.set_valid(False)
Example #16
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)
Example #17
0
    def __init__(self, attributeName, attributeDict, appInstance=None):
        super(EditorAttributeInput, self).__init__()
        self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        self.style['display'] = 'block'
        self.style['overflow'] = 'auto'
        self.style['margin'] = '2px'
        self.attributeName = attributeName
        self.attributeDict = attributeDict
        self.EVENT_ATTRIB_ONCHANGE = 'on_attribute_changed'

        label = gui.Label(attributeName, width='50%', height=22)
        label.style['margin'] = '0px'
        label.style['overflow'] = 'hidden'
        label.style['font-size'] = '13px'
        self.append(label)
        self.inputWidget = None

        #'background-repeat':{'type':str, 'description':'The repeat behaviour of an optional background image', ,'additional_data':{'affected_widget_attribute':'style', 'possible_values':'repeat | repeat-x | repeat-y | no-repeat | inherit'}},
        if attributeDict['type'] in (bool, int, float, gui.ColorPicker,
                                     gui.DropDown, gui.FileSelectionDialog):
            if attributeDict['type'] == bool:
                self.inputWidget = gui.CheckBox('checked')
            if attributeDict['type'] == int or attributeDict['type'] == float:
                self.inputWidget = gui.SpinBox(
                    attributeDict['additional_data']['default'],
                    attributeDict['additional_data']['min'],
                    attributeDict['additional_data']['max'],
                    attributeDict['additional_data']['step'])
            if attributeDict['type'] == gui.ColorPicker:
                self.inputWidget = gui.ColorPicker()
            if attributeDict['type'] == gui.DropDown:
                self.inputWidget = gui.DropDown()
                for value in attributeDict['additional_data'][
                        'possible_values']:
                    self.inputWidget.append(gui.DropDownItem(value), value)
            if attributeDict['type'] == gui.FileSelectionDialog:
                self.inputWidget = UrlPathInput(appInstance)

        else:  #default editor is string
            self.inputWidget = gui.TextInput()

        self.inputWidget.set_size('50%', '22px')
        self.inputWidget.attributes['title'] = attributeDict['description']
        label.attributes['title'] = attributeDict['description']
        self.inputWidget.set_on_change_listener(self, "on_attribute_changed")
        self.append(self.inputWidget)
        self.inputWidget.style['float'] = 'right'

        self.style['display'] = 'block'
Example #18
0
    def addClicked(self, widget):
        #        selected_item_key = self._moduleList.get_key ()
        #        module_item = self._moduleList.children[selected_item_key]

        addModuleDialog = gui.GenericDialog('Add new module', 'Choose module',
                                            width=500, height=160)
        
        # TODO new from list is not suitable
        drop = gui.DropDown()
        for i in range(len(g_moduleList)):
            drop.append(g_moduleNames[i], g_moduleList[i])
        addModuleDialog.add_field(
            "ModuleName", drop)
        addModuleDialog.set_on_confirm_dialog_listener(
            self.addClickedConfirmed)
        
        addModuleDialog.show(self._appInstance)
Example #19
0
 def __init__(self, appInstance, **kwargs):
     super(CssSizeInput, self).__init__(**kwargs)
     self.appInstance = appInstance
     self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
     self.style['display'] = 'block'
     self.style['overflow'] = 'hidden'
     
     self.numInput = gui.SpinBox('0',-999999999, 999999999, 0.1, width='60%', height='100%')
     self.numInput.set_on_change_listener(self, "on_value_changed")
     self.numInput.style['text-align'] = 'right'
     self.append(self.numInput)
     
     self.dropMeasureUnit = gui.DropDown(width='40%', height='100%')
     self.dropMeasureUnit.append( gui.DropDownItem('px'), 'px' )
     self.dropMeasureUnit.append( gui.DropDownItem('%'), '%' )
     self.dropMeasureUnit.select_by_key('px')
     self.dropMeasureUnit.set_on_change_listener(self, "on_value_changed")
     self.append(self.dropMeasureUnit)
Example #20
0
    def __init__(self, widget, listenersList, eventConnectionFuncName,
                 eventConnectionFunc, **kwargs):
        super(SignalConnection, self).__init__(**kwargs)

        backup_editor_onclick = widget.onclick.callback
        widget.onclick.callback = widget.backup_onclick_listener

        self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        self.style.update({
            'overflow': 'visible',
            'height': '24px',
            'display': 'block',
            'outline': '1px solid lightgray'
        })
        self.label = gui.Label(eventConnectionFuncName, width='49%')
        self.label.style.update({
            'float': 'left',
            'font-size': '10px',
            'overflow': 'hidden',
            'outline': '1px solid lightgray'
        })

        self.dropdown = gui.DropDown(width='49%', height='100%')
        self.dropdown.onchange.connect(self.on_connection)
        self.append([self.label, self.dropdown])
        self.dropdown.style['float'] = 'right'

        self.eventConnectionFunc = eventConnectionFunc
        self.eventConnectionFuncName = eventConnectionFuncName
        self.refWidget = widget
        self.listenersList = listenersList
        self.dropdown.append(gui.DropDownItem("None"))
        for w in listenersList:
            ddi = gui.DropDownItem(w.attributes['editor_varname'])
            ddi.listenerInstance = w
            self.dropdown.append(ddi)
        if self.eventConnectionFunc.callback:  #if the callback is not None, and so there is a listener
            if getattr(self.refWidget, eventConnectionFuncName):
                connectedListenerName = getattr(
                    self.refWidget, eventConnectionFuncName
                ).callback.__self__.attributes['editor_varname']
                self.dropdown.set_value(connectedListenerName)

        widget.onclick.callback = backup_editor_onclick
Example #21
0
    def refresh_servers(self):
        self.dynamic_reconfigure_servers = find_reconfigure_services()
        rospy.loginfo("Found dynamic reconfigure servers:\n" +
                      str(self.dynamic_reconfigure_servers))
        self.dropdown = gui.DropDown()
        choose_ddi = gui.DropDownItem("Choose server...")
        self.dropdown.add_child(0, choose_ddi)
        for idx, server_name in enumerate(self.dynamic_reconfigure_servers):
            ddi = gui.DropDownItem(server_name)
            self.dropdown.add_child(idx + 1, ddi)

        self.dropdown.set_on_change_listener(self.on_dropdown_change)
        # using ID 2 to update the dropdown
        self.hor_servers.add_child(2, self.dropdown)
        # This makes the dropdown not be left
        self.dropdown.style['display'] = 'block'
        self.dropdown.style['margin'] = '10px auto'
        self.dropdown.style['float'] = 'none'
        self.wid.add_child(1, self.hor_servers)
Example #22
0
    def __init__(self, *args):
        super(OSCUnitType, self).__init__(width=500,height=300,title='<b>Select Unit Type</b>')

        e_current_type_field = gui.Label('',width=200,height=30)
        self.add_field_with_label('e_type','Current Type:',e_current_type_field)
        e_req_type_field = gui.DropDown(width=200, height=30)
        c0 = gui.DropDownItem('Select',width=200, height=20)
        c1 = gui.DropDownItem('master',width=200, height=20)
        c2 = gui.DropDownItem('slave',width=200, height=20)
        c3 = gui.DropDownItem('master + slave',width=200, height=20)
        e_req_type_field.append(c0)
        e_req_type_field.append(c1)
        e_req_type_field.append(c2)
        e_req_type_field.append(c3)
        self.add_field_with_label('e_req_type','Change Type:',e_req_type_field)
        error_field= gui.Label('',width=400, height=30)
        self.add_field('error',error_field)
        e_req_type_field.set_value(OSCConfig.current_unit_type)
        self.set_on_confirm_dialog_listener(self,'confirm')
Example #23
0
    def refresh_topics(self):
        self.published_topics_and_types = rospy.get_published_topics()
        if not self.check_raw_topics:
            self.published_topics = [
                topic_name
                for topic_name, topic_type in self.published_topics_and_types
                if topic_type == 'sensor_msgs/CompressedImage'
            ]
        else:
            self.published_topics = [
                topic_name
                for topic_name, topic_type in self.published_topics_and_types
                if (topic_type == 'sensor_msgs/CompressedImage'
                    or topic_type == 'sensor_msgs/Image')
            ]
        self.published_topics.sort()
        rospy.loginfo("Found topics:\n" + str(self.published_topics))
        self.dropdown = gui.DropDown(-1, -1)
        choose_ddi = gui.DropDownItem(-1, -1, "Choose topic...")
        self.dropdown.append(0, choose_ddi)
        for idx, topic_name in enumerate(self.published_topics):
            ddi = gui.DropDownItem(-1, -1, topic_name)
            self.dropdown.append(idx + 1, ddi)

        self.dropdown.set_on_change_listener(self, 'on_dropdown_change')
        # using ID 2 to update the dropdown
        self.hor_topics.append(3, self.dropdown)
        # This makes the dropdown not be left
        self.dropdown.style['display'] = 'block'
        self.dropdown.style['margin'] = '10px auto'
        self.dropdown.style['float'] = 'none'
        # Force to re-render the pause button after the topics list
        self.hor_topics.append(4, self.bt_pause)
        self.bt_pause.style['display'] = 'block'
        self.bt_pause.style['margin'] = '10px auto'
        self.bt_pause.style['float'] = 'none'

        self.wid.append(1, self.hor_topics)
        # Re-render
        if self.rosvideo_widget:
            self.wid.append(2, self.rosvideo_widget)
    def refresh_topics(self):
        self.published_topics_and_types = rospy.get_published_topics()
        self.published_topics = [topic_name for topic_name, topic_type in self.published_topics_and_types]
        self.published_topics.sort()
        rospy.loginfo("Found topics:\n" +
                      str(self.published_topics))
        self.dropdown = gui.DropDown(-1, -1)
        choose_ddi = gui.DropDownItem(-1, -1, "Choose topic...")
        self.dropdown.append(0, choose_ddi)
        for idx, topic_name in enumerate(self.published_topics):
            ddi = gui.DropDownItem(-1, -1, topic_name)
            self.dropdown.append(idx+1, ddi)

        self.dropdown.set_on_change_listener(self, 'on_dropdown_change')
        # using ID 2 to update the dropdown
        self.hor_topics.append(2, self.dropdown)
        # This makes the dropdown not be left
        self.dropdown.style['display'] = 'block'
        self.dropdown.style['margin'] = '10px auto'
        self.dropdown.style['float'] = 'none'
        self.wid.append(1, self.hor_topics)
Example #25
0
    def on_options_manager_menu_clicked(self):
        self.options_manager_dialog = gui.GenericDialog(
            width=450,
            height=300,
            title='Manager Options',
            message='Edit then click OK or Cancel',
            autohide_ok=False)

        self.media_field = gui.TextInput(width=250, height=30)
        self.media_field.set_text(self.media_offset)
        self.media_field.set_on_enter_listener(self, 'dummy_enter')
        self.options_manager_dialog.add_field_with_label(
            'media_field', 'Media Offset', self.media_field)

        self.sudo_dropdown = gui.DropDown(width=250, height=30)
        c0 = gui.DropDownItem('no', width=200, height=20)
        c1 = gui.DropDownItem('yes', width=200, height=20)
        self.sudo_dropdown.append(c0)
        self.sudo_dropdown.append(c1)
        self.sudo_dropdown.set_value(self.use_sudo)
        self.options_manager_dialog.add_field_with_label(
            'sudo_dropdown', 'Use SUDO', self.sudo_dropdown)

        self.profiles_field = gui.TextInput(width=250, height=30)
        self.profiles_field.set_text(self.pp_profiles_offset)
        self.options_manager_dialog.add_field_with_label(
            'profiles_field', 'Profiles Offset', self.profiles_field)

        self.options_field = gui.TextInput(width=250, height=30)
        self.options_field.set_text(self.options)
        self.options_manager_dialog.add_field_with_label(
            'options_field', 'Pi Presents Options', self.options_field)

        self.options_error = gui.Label('', width=440, height=30)
        self.options_manager_dialog.add_field('options_error',
                                              self.options_error)

        self.options_manager_dialog.set_on_confirm_dialog_listener(
            self, 'on_options_manager_dialog_confirm')
        self.options_manager_dialog.show(self)
Example #26
0
    def __init__(self, widget, listenersList, eventConnectionFuncName,
                 eventConnectionFunc, **kwargs):
        super(SignalConnection, self).__init__(**kwargs)
        self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        self.style.update({
            'overflow': 'visible',
            'height': '24px',
            'display': 'block',
            'outline': '1px solid lightgray'
        })
        self.label = gui.Label(eventConnectionFuncName, width='49%')
        self.label.style.update({
            'float': 'left',
            'font-size': '10px',
            'overflow': 'hidden',
            'outline': '1px solid lightgray'
        })

        self.dropdown = gui.DropDown(width='49%', height='100%')
        self.dropdown.set_on_change_listener(self.on_connection)
        self.append([self.label, self.dropdown])
        self.dropdown.style['float'] = 'right'

        self.eventConnectionFunc = eventConnectionFunc
        self.eventConnectionFuncName = eventConnectionFuncName
        self.refWidget = widget
        self.listenersList = listenersList
        self.dropdown.append(gui.DropDownItem("None"))
        for w in listenersList:
            ddi = gui.DropDownItem(w.attributes['editor_varname'])
            ddi.listenerInstance = w
            self.dropdown.append(ddi)
        if self.eventConnectionFunc._event_listener[
                'eventName'] in self.refWidget.eventManager.listeners.keys():
            connectedListenerName = self.refWidget.eventManager.listeners[
                self.eventConnectionFunc._event_listener['eventName']][
                    'callback'].__self__.attributes['editor_varname']
            self.dropdown.set_value(connectedListenerName)
    def main(self, name='world'):
        # Add the widget, it's the white background
        # self is for making the widget part of the class to be able to modify it
        self.wid = gui.VBox(margin='0px auto')
        self.wid.set_size(400, 300)
        self.wid.style['text-align'] = 'center'

        # To make it prettier put a tittle of what is this demo
        self.title_label = gui.Label("Dynamical layout change demo")
        self.title_label.set_size(350, 20)
        self.description_label = gui.Label(
            """Choose from the dropdown a widget and it will be added to the interface.
                                           If you change the dropdown selection it will substitute it."""
        )
        self.description_label.set_size(350, 80)

        # Create dropdown and it's contents
        self.dropdown = gui.DropDown()
        self.dropdown.set_size(200, 20)

        choose_ddi = gui.DropDownItem("Choose...")
        button_ddi = gui.DropDownItem("Add button")
        label_ddi = gui.DropDownItem("Add label")

        self.dropdown.append(choose_ddi)
        self.dropdown.append(button_ddi)
        self.dropdown.append(label_ddi)

        # Add a listener
        self.dropdown.set_on_change_listener(self.on_dropdown_change)

        # Add the dropdown to the widget
        self.wid.append(self.title_label)
        self.wid.append(self.description_label)
        self.wid.append(self.dropdown)

        # returning the root widget
        return self.wid
Example #28
0
    def main(self):
        # margin 0px auto allows to center the app to the screen
        container = gui.VBox(width=400, margin='0px auto')
        container.style['background'] = '#808080'
        logo = gui.Label('PyTSF', width='80%', height=60, margin='0px auto')
        logo.style['margin'] = 'auto'

        panel = gui.HBox(width=400, height=100, margin='0px auto')
        dropdown = gui.DropDown()
        refresh = gui.Button('R')
        options = gui.Button("O")
        go = gui.Button("Go!")

        panel.append(dropdown)
        panel.append(refresh)
        panel.append(options)
        panel.append(go)

        container.append(logo)
        container.append(panel)

        # returning the root widget
        return container
Example #29
0
    def on_options_autostart_menu_clicked(self):
        self.options_autostart_dialog = gui.GenericDialog(
            width=450,
            height=300,
            title='Auotstart Options',
            message='Edit then click OK or Cancel',
            autohide_ok=False)

        self.autostart_path_field = gui.TextInput(width=250, height=30)
        self.autostart_path_field.set_text(self.autostart_path)
        self.options_autostart_dialog.add_field_with_label(
            'autostart_path_field', 'Autostart Profile Path',
            self.autostart_path_field)

        self.autostart_sudo_dropdown = gui.DropDown(width=250, height=30)
        c0 = gui.DropDownItem('no', width=100, height=20)
        c1 = gui.DropDownItem('yes', width=100, height=20)
        self.autostart_sudo_dropdown.append(c0)
        self.autostart_sudo_dropdown.append(c1)
        self.autostart_sudo_dropdown.set_value(self.autostart_use_sudo)
        self.options_autostart_dialog.add_field_with_label(
            'autostart_sudo_dropdown', 'Autostart Use SUDO',
            self.autostart_sudo_dropdown)

        self.autostart_options_field = gui.TextInput(width=250, height=30)
        self.autostart_options_field.set_text(self.autostart_options)
        self.options_autostart_dialog.add_field_with_label(
            'autostart_options_field', 'Autostart Options',
            self.autostart_options_field)

        self.autostart_error = gui.Label('', width=440, height=30)
        self.options_autostart_dialog.add_field('autostart_error',
                                                self.autostart_error)

        self.options_autostart_dialog.set_on_confirm_dialog_listener(
            self, 'on_options_autostart_dialog_confirm')
        self.options_autostart_dialog.show(self)
Example #30
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