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
    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.onchange.do(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 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.dropdown.set_value( connectedListenerName )
Beispiel #3
0
    def on_listener_selection(self, widget, dropDownValue):
        if self.dropdownListeners.get_value() == 'None':
            self.eventConnectionFunc.do(None)
        else:
            listener = self.dropdownListeners._selected_item.listenerInstance

            self.dropdownMethods.empty()

            func_members = inspect.getmembers(listener, inspect.ismethod)
            for (name, value) in func_members:
                if name not in ['__init__', 'main', 'idle', 'construct_ui']:
                    ddi = gui.DropDownItem(name)
                    ddi.listenerInstance = listener
                    ddi.listenerFunction = value
                    self.dropdownMethods.append(ddi)

            #here I create a custom listener for the specific event and widgets, the user can select this or an existing method
            #listener.__class__.fakeListenerFunc = fakeListenerFunc
            custom_listener_name = self.eventConnectionFuncName + "_" + self.refWidget.attributes[
                'editor_varname']
            setattr(listener.__class__, custom_listener_name, fakeListenerFunc)
            getattr(
                listener,
                custom_listener_name).__func__.__name__ = custom_listener_name
            ddi = gui.DropDownItem(custom_listener_name)
            ddi.listenerInstance = listener
            ddi.listenerFunction = getattr(listener, custom_listener_name)
            ddi.style['color'] = "green"
            ddi.attributes['title'] = "automatically generated method"
            self.dropdownMethods.append(ddi)
Beispiel #4
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)
Beispiel #5
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
Beispiel #6
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)
Beispiel #7
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)
Beispiel #8
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
Beispiel #9
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)
Beispiel #10
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)
Beispiel #11
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')
Beispiel #12
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)
Beispiel #13
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)
Beispiel #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)
Beispiel #16
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)
Beispiel #18
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)
    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
Beispiel #20
0
    def on_listener_selection(self, widget, dropDownValue):
        self.dropdownMethods.empty()
        if self.dropdownListeners.get_value()=='None':
            self.disconnect()
        else:
            listener = self.dropdownListeners._selected_item.listenerInstance

            l = []
            func_members = inspect.getmembers(listener)#, inspect.ismethod)
            for (name, value) in func_members:
                if type(value) == gui.ClassEventConnector:
                    value = value.event_method_bound
                if name not in ['__init__', 'main', 'idle', 'construct_ui'] and type(value) == types.MethodType:
                    ddi = gui.DropDownItem(name)
                    ddi.listenerInstance = listener
                    ddi.listenerFunction = value
                    l.append(ddi)
            
            #creating a none element
            ddi = gui.DropDownItem('None')
            self.dropdownMethods.append(ddi)

            #here I create a custom listener for the specific event and widgets, the user can select this or an existing method
            #listener.__class__.fakeListenerFunc = fakeListenerFunc
            if listener.attributes['editor_newclass'] == "True":
                custom_listener_name = self.eventConnectionFuncName + "_" + self.refWidget.attributes['editor_varname']
                setattr(listener, custom_listener_name, types.MethodType(fakeListenerFunc, listener))
                getattr(listener, custom_listener_name).__func__.__name__ = custom_listener_name
                ddi = gui.DropDownItem(custom_listener_name)
                ddi.listenerInstance = listener
                ddi.listenerFunction = getattr(listener, custom_listener_name)
                ddi.style['color'] = "green"
                ddi.style['font-weight'] = "bolder"
                ddi.attributes['title'] = "automatically generated method"
                self.dropdownMethods.append(ddi)

            self.dropdownMethods.append(l)
Beispiel #21
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)
Beispiel #22
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'
Beispiel #23
0
    def _update_brewer_ids(self):
        if self.settings.uv_data_source == DataSource.FILES or self.settings.uvr_data_source == DataSource.FILES:
            brewer_ids = self._file_utils.get_brewer_ids()
        else:
            brewer_ids = EUBREWNET_AVAILABLE_BREWER_IDS
        self._brewer_dd.empty()
        for bid in brewer_ids:
            item = gui.DropDownItem(bid)
            self._brewer_dd.append(item)

        if self._brewer_id not in brewer_ids and len(brewer_ids) > 0:
            self._brewer_id = brewer_ids[0]
        if self._brewer_id not in brewer_ids:
            self._brewer_id = None
        self._brewer_dd.set_value(self._brewer_id)
Beispiel #24
0
    def _update_uvr_files(self):
        if self.settings.uvr_data_source == DataSource.EUBREWNET:
            return
        uvr_files = self._file_utils.get_uvr_files(self._brewer_id)

        self._uvr_dd.empty()
        for uvr_file in uvr_files:
            item = gui.DropDownItem(uvr_file.file_name)
            self._uvr_dd.append(item)

        if self._uvr_file not in [u.file_name
                                  for u in uvr_files] and len(uvr_files) > 0:
            self._uvr_file = uvr_files[0].file_name
        elif self._uvr_file not in [u.file_name for u in uvr_files]:
            self._uvr_file = None
        self._uvr_dd.set_value(self._uvr_file)
    async def show_public(self, public):
        self.select_channels.append(G.DropDownItem(text=public['name']))

        if public['name'] in self.publics_controls:
            control = self.publics_controls[public['name']]
        else:
            control = dict(
                vbox=G.VBox(width="100%")
            )
            self.vbox_publics.append(control['vbox'])
            self.publics_controls[public['name']] = control

        try:
            subscribers_list_control = control['vbox']
            subscribers_list_control.empty()
            subscribers_list_control.append(G.Label(f"[{public['name']}]: {len(public['subscribers'])}"))
            subscribers = sorted(public['subscribers'])
            for subscriber in subscribers:
                subscribers_list_control.append(G.Label(subscriber))
        except Exception as e:
            pass
Beispiel #26
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
Beispiel #27
0
 def test_init(self):
     widget = gui.DropDownItem('test drop down item')
     self.assertIn('test drop down item', widget.repr())
     assertValidHTML(widget.repr())
Beispiel #28
0
    def _data_set_page(self):

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

        # Define title and instructions text.
        datasets_title = wc.h2('Data Sets')
        datasets_title.style['text-align'] = 'center'
        datasets_instructions = wc.h4(
            'Choose a data set from the pulldown menu before loading/defining the '
            'appropriate model. Afterwards, the user is presented with information about the '
            'data set, e.g., number of dimensions and number of observations. The user can '
            'also visualise the data. Then, with a loaded data set, the user can (1) set '
            'experiment parameters and set model hyperparameters, (2a) load results or load '
            'a trained model, or (2b) choose to train a new model.')
        datasets_instructions.style['text-align'] = 'justify-all'

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

        dataset_label = wc.h5('Data Set: ')
        dataset_label.style['margin-top'] = '8px'

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

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

        # Build up the webpage.
        selection_container.append(
            [dataset_label, self.dataset_dropdown, self.dataset_select_button])
        main_container.append([
            self.nav_bar, datasets_title, datasets_instructions,
            selection_container, self.footer
        ])

        # Return the root widget.
        return main_container
Beispiel #29
0
 def new_video_device(self, emitter, device_id, device_kind, device_label):
     item = gui.DropDownItem(device_label)
     item.device_id = device_id
     self.device_list.append(item, device_id)
     self.device_list.select_by_key(device_id)
Beispiel #30
0
    def main(self):
        #custom additional html head tags
        my_html_head = """<title>Bootstrap Test</title>"""

        #Load Boostrap Ressources from Online Source
        #One could download the files and put them into res folder for access without internet connection

        #Not all the Bootstrap functionality will work!! Just basic styling is possible.

        #For valid Bootstrap Classes check:  https://www.w3schools.com/bootstrap/bootstrap_ref_all_classes.asp

        #custom css
        my_css_head = """
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
            """

        #custom js
        my_js_head = """
            <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
            <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
            """
        #appending elements to page header
        self.page.children['head'].add_child('myhtml', my_html_head)
        self.page.children['head'].add_child('mycss', my_css_head)
        self.page.children['head'].add_child('myjs', my_js_head)

        #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