Beispiel #1
0
    def main(self):
        # the arguments are    width - height - layoutOrientationOrizontal
        self.main_container = gui.Container(margin='0px auto')
        self.main_container.set_size(1020, 600)
        self.main_container.set_layout_orientation(gui.Container.LAYOUT_VERTICAL)

        self.title = gui.Label('Mine Field GAME')
        self.title.set_size(1000, 30)
        self.title.style['margin'] = '10px'
        self.title.style['font-size'] = '25px'
        self.title.style['font-weight'] = 'bold'

        self.info = gui.Label('Collaborative minefiled game. Enjoy.')
        self.info.set_size(400, 30)
        self.info.style['margin'] = '10px'
        self.info.style['font-size'] = '20px'

        self.lblMineCount = gui.Label('Mines')
        self.lblMineCount.set_size(100, 30)
        self.lblFlagCount = gui.Label('Flags')
        self.lblFlagCount.set_size(100, 30)

        self.time_count = 0
        self.lblTime = gui.Label('Time')
        self.lblTime.set_size(100, 30)

        self.btReset = gui.Button('Restart')
        self.btReset.set_size(100, 30)
        self.btReset.onclick.do(self.new_game)

        self.horizontal_container = gui.Container()
        self.horizontal_container.style['display'] = 'block'
        self.horizontal_container.style['overflow'] = 'auto'
        self.horizontal_container.set_layout_orientation(gui.Container.LAYOUT_HORIZONTAL)
        self.horizontal_container.style['margin'] = '10px'
        self.horizontal_container.append(self.info)
        imgMine = gui.Image('/my_resources:mine.png')
        imgMine.set_size(30, 30)
        self.horizontal_container.append([imgMine, self.lblMineCount])
        imgFlag = gui.Image('/my_resources:flag.png')
        imgFlag.set_size(30, 30)
        self.horizontal_container.append([imgFlag, self.lblFlagCount, self.lblTime, self.btReset])

        self.minecount = 0  # mine number in the map
        self.flagcount = 0  # flag placed by the players

        self.link = gui.Link("https://github.com/dddomodossola/remi",
                             "This is an example of REMI gui library.")
        self.link.set_size(1000, 20)
        self.link.style['margin'] = '10px'

        self.main_container.append([self.title, self.horizontal_container, self.link])

        self.new_game(self)

        self.stop_flag = False
        self.display_time()
        # returning the root widget
        return self.main_container
    def initCamera(self, robot):
        cameraBox = self.sectionBox()

        videoFeedBox = gui.HBox()
        limelightFeed = gui.Image('http://10.26.5.11:5800/')
        videoFeedBox.append(limelightFeed)

        videoFeed = gui.Image('http://10.26.5.6:5800/')
        videoFeedBox.append(videoFeed)

        cameraBox.append(videoFeedBox)
        return cameraBox
Beispiel #3
0
    def __init__(self, appInstance, widgetClass, **kwargs_to_widget):
        self.kwargs_to_widget = kwargs_to_widget
        self.appInstance = appInstance
        self.widgetClass = widgetClass
        super(WidgetHelper, self).__init__()
        self.style['display'] = 'block'
        self.style['background-color'] = 'white'
        self.icon = gui.Image('/res/widget_%s.png' % self.widgetClass.__name__,
                              width='auto',
                              margin='2px')
        self.icon.style['max-width'] = '100%'
        self.icon.style['image-rendering'] = 'auto'
        self.icon.attributes['draggable'] = 'false'
        self.icon.attributes['ondragstart'] = "event.preventDefault();"
        self.append(self.icon)

        self.attributes.update({
            'draggable': 'true',
            'ondragstart':
            "this.style.cursor='move'; event.dataTransfer.dropEffect = 'move';   event.dataTransfer.setData('application/json', JSON.stringify(['add',event.target.id,(event.clientX),(event.clientY)]));",
            'ondragover': "event.preventDefault();",
            'ondrop': "event.preventDefault();return false;"
        })

        self.optional_style_dict = {
        }  #this dictionary will contain optional style attributes that have to be added to the widget once created

        self.set_on_click_listener(self.prompt_new_widget)
Beispiel #4
0
    def __init__(self, param, appInstance=None):
        super(EditorAttributeInput, self).__init__()

        self._param = param
        attributeName = self._param._k
        attributeDesc = self._param._description

        self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
        self.style['display'] = 'block'
        self.style['overflow'] = 'auto'
        self.style['margin'] = '2px'
        self.attributeName = attributeName
        self.EVENT_ATTRIB_ONCHANGE = 'on_attribute_changed'

        self.EVENT_ATTRIB_ONREMOVE = 'onremove_attribute'
        self.removeAttribute = gui.Image('/res/delete.png', width='5%')
        self.removeAttribute.attributes[
            'title'] = 'Remove attribute from this widget.'
        self.removeAttribute.set_on_click_listener(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.append(self.label)
        self.label.attributes['title'] = attributeDesc

        self.__createEditor()

        self.style['display'] = 'block'
        self.set_valid(True)
Beispiel #5
0
 def add_command(self, imagePath, listener, listenerFunction, title):
     icon = gui.Image(imagePath, height='90%')
     icon.style['margin'] = '0px 1px'
     icon.style['outline'] = '1px solid lightgray'
     icon.set_on_click_listener(listener, listenerFunction)
     icon.attributes['title'] = title
     self.append(icon)
    def main(self):

        vertContainer = gui.Widget(
            width='80%',
            layout_orientation=gui.Widget.LAYOUT_VERTICAL,
            margin='0px auto',
            style={
                'display': 'block',
                'overflow': 'auto',
                'background-color': '#BEBEBE'
            })
        vertContainer.style['text-align'] = 'center'
        vertContainer.style['align-items'] = 'center'
        vertContainer.style['justify-content'] = 'center'

        wid = gui.VBox(width=300, height=200, margin='0px auto')
        self.lbl1 = gui.Label('bottom text')
        self.lbl1.style['margin'] = 'auto'
        wid.append(self.lbl1)

        self.img = gui.Image('/res/wildcat.png', height=150, margin='0px auto')

        b1 = gui.Button('Add new tab', width=200, height=30)
        b2 = gui.Button('Show third tab', width=200, height=30)
        b3 = gui.Button('Show first tab', width=200, height=30)

        tb = gui.TabBox(width='100%')
        tb.add_tab([b1, b2], 'First', None)

        b1.set_on_click_listener(self.on_bt1_pressed, tb, 0)
        b2.set_on_click_listener(self.on_bt2_pressed, tb, 0)

        vertContainer.append(tb)

        return vertContainer
Beispiel #7
0
    def main(self):
        #creating a container VBox type, vertical
        wid = gui.VBox(width=1000, height=600, style={'margin':'5px auto', 'padding': '10px'})

        #creating a text label, "white-space":"pre" preserves newline
        self.lbl1 = gui.Label('人脸匹配检测', width='80%', height='50%', style={"white-space": "pre"})
        self.lbl2 = gui.Label('选择匹配图片', width='80%', height='50%', style={"white-space": "pre"})
        self.lbl3 = gui.Label('选择匹配类型', width='80%', height='50%')
        self.img = gui.Image('/res:logo.png', height=100, margin='10px')
        self.img.onclick.do(self.on_img_clicked)
        #a button for simple interaction
        bt = gui.Button('开始匹配', width=200, height=30)

        #setting up the listener for the click event
        bt.onclick.do(self.on_button_pressed)
        comboAlignItems = gui.DropDown.new_from_list(('证件照', '生活照', '摄像头识别'),
                                                     style='left:160px; position:absolute; top:100px; width:152px; height: 30px')

        #adding the widgets to the main container
        wid.append(self.lbl1)
        wid.append(self.lbl3)
        wid.append(comboAlignItems)
        wid.append(self.lbl2)
        wid.append(bt)

        # returning the root widget
        return wid
Beispiel #8
0
    def main(self):
        # the arguments are	width - height - layoutOrientationOrizontal
        self.main_container = gui.Widget(1020, 600, False, 10)

        self.title = gui.Label(1000, 30, 'Mine Field GAME')
        self.title.style['font-size'] = '25px'
        self.title.style['font-weight'] = 'bold'

        self.info = gui.Label(400, 30, 'Collaborative minefiled game. Enjoy.')
        self.info.style['font-size'] = '20px'

        self.lblMineCount = gui.Label(100, 30, 'Mines')
        self.lblFlagCount = gui.Label(100, 30, 'Flags')

        self.time_count = 0
        self.lblTime = gui.Label(100, 30, 'Time')

        self.btReset = gui.Button(100, 30, 'Restart')
        self.btReset.set_on_click_listener(self, "new_game")

        self.horizontal_container = gui.Widget(1000, 30, True, 0)
        self.horizontal_container.append('info', self.info)
        self.horizontal_container.append('icon_mine',
                                         gui.Image(30, 30, '/res/mine.png'))
        self.horizontal_container.append('info_mine', self.lblMineCount)
        self.horizontal_container.append('icon_flag',
                                         gui.Image(30, 30, '/res/flag.png'))
        self.horizontal_container.append('info_flag', self.lblFlagCount)
        self.horizontal_container.append('info_time', self.lblTime)
        self.horizontal_container.append('reset', self.btReset)

        self.minecount = 0  #mine number in the map
        self.flagcount = 0  #flag placed by the players

        self.link = gui.Link(1000, 20, "https://github.com/dddomodossola/remi",
                             "This is an example of REMI gui library.")

        self.main_container.append('title', self.title)
        self.main_container.append('horizontal_container',
                                   self.horizontal_container)
        self.main_container.append('link', self.link)

        self.new_game()

        self.display_time()
        # returning the root widget
        return self.main_container
    def make_gui_elements(self):  # content and behaviour
        #logo:
        self.logo_image = gui.Image('/res/logo.png')
        self.logo_image.attributes[
            "onclick"] = "document.location='https://www.youtube.com/watch?v=t-fcrn1Edik'"

        #playback controls
        self.playback = Namespace()

        self.playback.playing = gui.Label(
            "Now playing: None")  # (TODO): update this

        self.playback.party = gui.Button(icons.PARTY)
        self.playback.party.attributes[
            "onclick"] = "document.body.classList.toggle('dancing');"
        self.playback.party.attributes[
            "title"] = "ENABLE PARTY MODE"  # hover text
        self.playback.previous = gui.Button(icons.PREV)
        self.playback.previous.set_on_click_listener(self.playback_previous)
        self.playback.play = gui.Button(icons.PLAY)
        self.playback.play.set_on_click_listener(self.playback_play)
        self.playback.next = gui.Button(icons.NEXT)
        self.playback.next.set_on_click_listener(self.playback_next)

        self.playback.volume_label = gui.Label("Volume:")
        self.playback.volume_slider = gui.Slider(100, 0, 100, 1)
        self.playback.volume_slider.set_oninput_listener(self.change_volume)

        self.playback.seek_slider = gui.Slider(0, 0, 100, 1)
        self.playback.seek_slider.set_oninput_listener(self.change_seek)

        self.playback.timestamp = gui.Label("--:-- - --:--")

        #playlist
        self.playlist = Namespace()

        self.playlist.table = gui.Table()
        self.playlist.table.append_from_list(
            [['#', 'Name', "length", "", "", "", ""]], fill_title=True)

        self.playlist.looping = gui.CheckBoxLabel(
            "<i><small>loop playlist</small></i>")
        self.playlist.looping.set_on_click_listener(
            self.on_playlist_set_looping)

        self.playlist.shuffle = gui.Button("SHUFFLE")
        self.playlist.shuffle.set_on_click_listener(
            self.on_playlist_clear_shuffle)

        self.playlist.clear = gui.Button("CLEAR")
        self.playlist.clear.set_on_click_listener(self.on_playlist_clear_click)

        #input
        self.input = Namespace()
        self.input.add_song = gui.Label("Add song:")
        self.input.field = gui.TextInput(single_line=True)
        self.input.field.set_on_enter_listener(self.input_submit)
        self.input.submit = gui.Button("Submit!")
        self.input.submit.set_on_click_listener(self.input_submit)
    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 #11
0
    def __init__(self, filename=None, x=0, y=0, width=32, height=32):
        self.widget = gui.Image('', width=width, height=height)

        self.widget.attributes['ondragstart'] = "event.preventDefault();"

        super(Image, self).__init__(x, y, width, height)

        self.cached_filename = None

        if filename is not None and len(filename) > 0:
            self._setData(filename)
Beispiel #12
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)
Beispiel #13
0
    def main(self):

        self.init()

        horizontalContainer = gui.Container(
            width='100%',
            layout_orientation=gui.Container.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })

        subContainerLeft = gui.Container(width=self.width / 2,
                                         height=self.height / 2,
                                         style={
                                             'display': 'block',
                                             'overflow': 'auto',
                                             'text-align': 'center'
                                         })
        subContainerRight = gui.Container(width=self.width / 2,
                                          height=self.height / 2,
                                          style={
                                              'display': 'block',
                                              'overflow': 'auto',
                                              'text-align': 'center'
                                          })

        self.img = gui.Image('/res:logo.png', height=100, margin='10px')

        # self.add("logger",MyTextBox(width='80%', height='100%',single_line=False))
        self.add("menu", Menu(root=self, width=self.width, height=30))
        self.main.append(horizontalContainer)

        # self.table = Table2(attributes = {'id':'table'})

        #http://127.0.0.1:8082/table/api_set_text?value1=text1&value2=text2

        # appending a widget to another, the first argument is a string key
        # wid.append(self.table)

        self.thread_alive_flag = True

        #Here I start a parallel thread that executes my algorithm for a long time
        t = threading.Thread(target=self.my_intensive_long_time_algorithm)
        t.start()

        # returning the root widget
        return self.main
Beispiel #14
0
    def initCamera(self):
        cameraBox = self.sectionBox()

        videoChoiceBox = gui.HBox(gui.Label('Video Feeds'))
        cameraBox.append(videoChoiceBox)

        for camera in ['Limelight', 'Camera 2', 'Camera 3']:
            button = gui.Button(camera)
            button.onclick.connect(self.c_switchVideoFeed)
            videoChoiceBox.append(button)

        staticBox = gui.Widget()
        staticBox.set_size(640, 240)
        cameraBox.append(staticBox)
        relativeBox = gui.Widget()
        relativeBox.style["position"] = "relative"
        relativeBox.style["top"] = "0px"
        relativeBox.style["left"] = "0px"
        staticBox.append(relativeBox)

        self.videoFeed = gui.Image('http://10.26.5.6:5800/')
        self.videoFeed.style["top"] = "0px"
        self.videoFeed.style["left"] = "0px"
        self.videoFeed.style["position"] = "absolute"
        self.videoFeed.style["z-index"] = "1"
        relativeBox.append(self.videoFeed)
        self.setVideoFeed(0)

        horizLine = gui.Widget()
        horizLine.set_size(CROSSHAIR_SIZE, CROSSHAIR_WIDTH)
        horizLine.style["background"] = "#66FF00"
        horizLine.style["left"] = str(CROSSHAIR_X - CROSSHAIR_SIZE / 2) + "px"
        horizLine.style["top"] = str(CROSSHAIR_Y - CROSSHAIR_WIDTH / 2) + "px"
        horizLine.style["position"] = "absolute"
        horizLine.style["z-index"] = "2"
        relativeBox.append(horizLine)

        vertLine = gui.Widget()
        vertLine.set_size(CROSSHAIR_WIDTH, CROSSHAIR_SIZE)
        vertLine.style["background"] = "#66FF00"
        vertLine.style["left"] = str(CROSSHAIR_X - CROSSHAIR_WIDTH / 2) + "px"
        vertLine.style["top"] = str(CROSSHAIR_Y - CROSSHAIR_SIZE / 2) + "px"
        vertLine.style["position"] = "absolute"
        vertLine.style["z-index"] = "2"
        relativeBox.append(vertLine)

        return cameraBox
Beispiel #15
0
    def on_analyze_pressed(self, widget):
        subject_class = SubjectAnalyzer(self.map_file, self.mean_file,
                                        self.sd_file, self.mask_file)
        table_content = subject_class.table

        self.table = gui.Table.new_from_list(table_content,
                                             width=250,
                                             height=500,
                                             margin='10px')
        print([['Region', 'value', 'Z-score'], table_content])
        self.sub_container_left.append(self.table, key='table')
        self.figure_analyzed = gui.Image(r'/res/Z_map.png',
                                         width=350,
                                         height=150,
                                         margin='10px')

        self.sub_container_right.append(self.figure_analyzed, key='image')
Beispiel #16
0
 def diag_conf(self, widget):
     fig, ax = plt.subplots()
     lbls, sizes = [], []
     for i in data:
         if filt[i[0]] and filt[i[2]]:
             lbls.append(i[0] + ':' + i[2])
             sizes.append(i[1])
     ax.pie(sizes, labels=lbls)
     ax.axis('equal')
     self.fig = fig
     self.ax = ax
     self.plt = plt
     self.canv = FigureCanvasAgg(self.fig)
     plt.savefig('temp.png')
     self.img = gui.Image(gui.load_resource('temp.png'))
     self.hboxIMG.empty()
     self.hboxIMG.append(self.img)
Beispiel #17
0
    def main(self):
        # the margin 0px auto centers the main container
        verticalContainer = gui.Widget(width=540,
                                       margin='0px auto',
                                       style={
                                           'display': 'block',
                                           'overflow': 'hidden'
                                       })

        horizontalContainer = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })

        subContainerLeft = gui.Widget(width=320,
                                      style={
                                          'display': 'block',
                                          'overflow': 'auto',
                                          'text-align': 'center'
                                      })

        self.img = gui.Image('/res:logo.png', height=100, margin='10px')
        self.img.onclick.connect(self.on_img_clicked)

        self.uptext = gui.Label('识别应用场景')
        self.bt_tableocr = gui.Button('表格识别',
                                      width=200,
                                      height=30,
                                      margin='10px')
        self.bt_tableocr.onclick.connect(self.goto_tableocr_web)
        self.bt_tableocr = gui.Button('文档识别',
                                      width=200,
                                      height=30,
                                      margin='10px')
        self.bt_tableocr.onclick.connect(self.goto_dococr_web)

        # this flag will be used to stop the display_counter Timer
        self.stop_flag = False

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

        my_file = Path("/res/wildcat.png")
        if my_file.is_file():
            texttoprint = "True"
        else:
            texttoprint = "False"

        self.img = gui.Image('/res/wildcat.png', height=100, margin='0px auto')
        self.lbl = gui.Label(texttoprint)

        main_container.append(self.img)
        main_container.append(self.lbl)

        # returning the root widget
        return main_container
Beispiel #19
0
    def main(self):
        self.fig = ''
        self.ax = ''
        self.plt = ''
        self.datarom = ''
        menuBar = gui.MenuBar(width='100%', height='50px')
        menu = gui.Menu(width='100%', height='50px')
        diag = gui.MenuItem('Filters', width=100, height=50)
        diag.onclick.do(self.filtersMenu)
        menu.append(diag)
        menuBar.style['align-items'] = 'flex-start'
        menuBar.style['align-items'] = 'flex-start'
        menu.style['justify-content'] = 'flex-start'
        menu.style['justify-content'] = 'flex-start'

        #menuBar.style['align-items'] = 'center'
        #menu.style['align-items'] = 'center'
        menuBar.append(menu)
        self.menu = menu
        self.hbox = gui.VBox(width=600)
        self.hbox.style['margin'] = 'auto'
        #self.hbox.style['align-items'] = 'center'
        self.hbox.append(menuBar)
        fig, ax = plt.subplots()
        lbls, sizes = [], []
        for i in data:
            if filt[i[0]] and filt[i[2]]:
                lbls.append(i[0] + ':' + i[2])
                sizes.append(i[1])
        ax.pie(sizes, labels=lbls)
        ax.axis('equal')
        self.fig = fig
        self.ax = ax
        self.plt = plt
        self.canv = FigureCanvasAgg(self.fig)
        plt.savefig('temp.png')
        self.img = gui.Image(self.draw())
        self.hboxIMG = gui.VBox(width=600)
        self.hboxIMG.append(self.img)
        self.hbox.append(self.hboxIMG)
        return self.hbox
Beispiel #20
0
 def __init__(self, widgetClass, **kwargs_to_widget):
     self.kwargs_to_widget = kwargs_to_widget
     self.widgetClass = widgetClass
     super(WidgetHelper, self).__init__('')
     self.style['display'] = 'block'
     self.style['margin'] = '5px auto'
     self.container = gui.HBox(width='100%', height=40)
     self.container.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL)
     self.container.style['background-color'] = 'transparent'
     self.container.style['justify-content'] = 'flex-start'
     self.container.style['-webkit-justify-content'] = 'flex-start'
     self.icon = gui.Image('/res/widget_%s.png' % self.widgetClass.__name__,
                           width=120,
                           height=40)
     self.icon.style['margin'] = '2px'
     self.label = gui.Label(self.widgetClass.__name__)
     self.label.style['margin'] = ''
     self.label.style['align-self'] = 'center'
     self.container.append(self.icon)
     self.container.append(self.label)
     self.append(self.container)
Beispiel #21
0
    def main(self):
        container = gui.VBox(width=500, height=500)
        self.status_lbl = gui.Label('First Upload EGV')

        upload_box = gui.VBox()
        upload_lbl = gui.Label('Upload EGV')
        self.upload_bt = gui.FileUploader('./',
                                          width=200,
                                          height=30,
                                          margin='10px')
        upload_box.append(upload_lbl)
        upload_box.append(self.upload_bt)
        self.upload_bt.onsuccess.connect(self.fileupload_on_success)
        self.upload_bt.onfailed.connect(self.fileupload_on_failed)

        self.preview = gui.Image('/my_resources:empty-image.png',
                                 width=200,
                                 height=200)

        self.print_bt = gui.Button('Print Uploaded Design')
        self.print_bt.onclick.connect(self.print_button_pressed)
        self.print_bt.set_enabled(False)

        self.stop_bt = gui.Button('Stop Printing')
        self.stop_bt.onclick.connect(self.stop_button_pressed)
        self.stop_bt.set_enabled(False)

        # appending a widget to another
        container.append(self.status_lbl)
        container.append(upload_box)
        container.append(self.preview)
        container.append(self.print_bt)
        container.append(self.stop_bt)

        # returning the root widget
        return container
Beispiel #22
0
    def main(self):
        container = gui.VBox(width=400,
                             height=340,
                             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.img_1 = gui.Image(data, width=150, height=150)

        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)
        container.append(self.img_1)

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

        # returning the root widget
        return container
Beispiel #23
0
    def main(self):
        """ GUI contains two vertical containers: Menu at top and all other widgets underneath
            It also contains three horizontal containers:
            Left one contains subject name widget, date, remarks & instructions.
            Middle containers is devoted for table with results.
            Right containers contains the analyze button and data visualization"""

        vertical_container = gui.Widget(width=1050,
                                        margin='0px auto',
                                        style={
                                            'display': 'block',
                                            'overflow': 'hidden'
                                        })
        horizontal_container = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })

        sub_container_left = gui.Widget(width=300,
                                        style={
                                            'display': 'block',
                                            'overflow': 'auto',
                                            'text-align': 'center'
                                        })
        sub_container_right = gui.Widget(width=400,
                                         style={
                                             'display': 'block',
                                             'overflow': 'auto',
                                             'text-align': 'center'
                                         })
        sub_container_instructions = gui.Widget(width=250,
                                                height=450,
                                                margin='10px',
                                                style={
                                                    'display': 'block',
                                                    'overflow': 'auto',
                                                    'text-align': 'left'
                                                })
        """ Subject's number:"""
        self.txt_subject = gui.TextInput(width=230, height=35, margin='1px')
        self.txt_subject.set_text("Subject number")
        self.txt_subject.style['font-size'] = '18px'
        self.txt_subject.style['background'] = 'lightgreen'
        self.txt_subject.style['text-align'] = 'center'
        """ Date: """
        self.date_headline = gui.Label('Acquisition date:',
                                       width=230,
                                       height=20,
                                       margin='1px')
        self.date_headline.style['text-align'] = 'left'
        self.date = gui.Date('2018-01-01', width=230, height=30, margin='1px')
        self.date.style['font-size'] = '16px'
        """ Remarks box: """
        self.txt = gui.TextInput(width=230, height=70, margin='1px')
        self.txt.set_text('Add remarks here')
        """ Instructions: """
        inst1 = gui.Label('Instructions:', width=230, height=25, margin='0px')
        inst1.style['font-size'] = '16px'
        inst1.style['background'] = 'lightgray'
        inst2 = gui.Label("1. Set subject's number and acquisition date",
                          width=230,
                          height=45,
                          margin='0px')
        inst2.style['background'] = 'lightgray'
        inst3 = gui.Label(
            "2. Load files: subject's map file, wanted mask and general population data (mean, sd & template)",
            width=230,
            height=80,
            margin='0px')
        inst3.style['background'] = 'lightgray'
        inst4 = gui.Label("3. Press 'Analyze' button",
                          width=230,
                          height=25,
                          margin='0px')
        inst4.style['background'] = 'lightgray'
        inst5 = gui.Label("4. Export your report",
                          width=230,
                          height=25,
                          margin='0px')
        inst5.style['background'] = 'lightgray'

        sub_container_instructions.append([
            self.txt_subject, self.date_headline, self.date, self.txt, inst1,
            inst2, inst3, inst4, inst5
        ])
        """ Create Table: """
        self.table = gui.Table.new_from_list(
            [['Region', 'value', 'Z-score'],
             ['Prefrontal Lateral R', '80', '1.2'],
             ['Prefrontal Lateral L', '25', '1.99'],
             ['Sensorimotor R', '76', '0.23'],
             ['Sensorimotor L', '88', '2.55']],
            width=250,
            height=500,
            margin='10px')

        sub_container_left.append(self.table, key='table')
        """ Logo: """
        sagol_logo = gui.Image(r'/res/Sagollogo.png',
                               width=300,
                               height=60,
                               margin='25px')
        sagol_logo.style['background'] = 'white'
        """ Analyze button: """
        self.bt_analyze = gui.Button("Analyze",
                                     width=350,
                                     height=30,
                                     margin='16px')
        self.bt_analyze.onclick.connect(self.on_analyze_pressed)
        """ Figure which be replace to visualized results: """
        self.figure_analyzed = gui.Image(r'/res/es.jpg',
                                         width=350,
                                         height=300,
                                         margin='10px')

        sub_container_right.append([sagol_logo, self.bt_analyze])
        sub_container_right.append(self.figure_analyzed, key='image')

        self.sub_container_left = sub_container_left
        self.sub_container_right = sub_container_right
        self.instructions = sub_container_instructions

        horizontal_container.append([
            self.instructions, self.sub_container_left,
            self.sub_container_right
        ])
        """ Menu: """
        menu = gui.Menu(width='100%', height='30px')
        m1 = gui.MenuItem('Select Subject', width=100, height=30)
        m1.onclick.connect(self.menu_subject_clicked)
        m2 = gui.MenuItem('Properties', width=100, height=30)
        m3 = gui.MenuItem("Export as", width=100, height=30)
        m21 = gui.MenuItem('Select Mask', width=200, height=30)
        m21.onclick.connect(self.menu_mask_clicked)
        m22 = gui.MenuItem('General population data', width=200, height=30)
        m31 = gui.MenuItem('PDF', width=100, height=30)
        m31.onclick.connect(self.menu_pdf_clicked)
        m221 = gui.MenuItem('Select mean data', width=100, height=30)
        m221.onclick.connect(self.menu_mean_clicked)
        m222 = gui.MenuItem('Select SD data', width=100, height=30)
        m222.onclick.connect(self.menu_sd_clicked)
        m223 = gui.MenuItem('Select template', width=100, height=30)
        m223.onclick.connect(self.menu_template_clicked)
        menu.append([m1, m2, m3])
        m2.append([m21, m22])
        m3.append([m31])
        m22.append([m221, m222, m223])

        menubar = gui.MenuBar(width='100%', height='30px')
        menubar.append(menu)

        vertical_container.append([menubar, horizontal_container])

        return vertical_container
Beispiel #24
0
    def main(self):
        # the margin 0px auto centers the main container
        verticalContainer = gui.Container(width=540, margin='0px auto', style={'display': 'block', 'overflow': 'hidden'})

        horizontalContainer = gui.Container(width='100%', layout_orientation=gui.Container.LAYOUT_HORIZONTAL, margin='0px', style={'display': 'block', 'overflow': 'auto'})

        subContainerLeft = gui.Container(width=320, style={'display': 'block', 'overflow': 'auto', 'text-align': 'center'})
        self.img = gui.Image('/res:logo.png', height=100, margin='10px')
        self.img.onclick.do(self.on_img_clicked)

        self.table = gui.Table.new_from_list([('ID', 'First Name', 'Last Name'),
                                              ('101', 'Danny', 'Young'),
                                              ('102', 'Christine', 'Holand'),
                                              ('103', 'Lars', 'Gordon'),
                                              ('104', 'Roberto', 'Robitaille'),
                                              ('105', 'Maria', 'Papadopoulos')], width=300, height=200, margin='10px')
        self.table.on_table_row_click.do(self.on_table_row_click)

        # the arguments are	width - height - layoutOrientationOrizontal
        subContainerRight = gui.Container(style={'width': '220px', 'display': 'block', 'overflow': 'auto', 'text-align': 'center'})
        self.count = 0
        self.counter = gui.Label('', width=200, height=30, margin='10px')

        self.lbl = gui.Label('This is a LABEL!', width=200, height=30, margin='10px')

        self.bt = gui.Button('Press me!', width=200, height=30, margin='10px')
        # setting the listener for the onclick event of the button
        self.bt.onclick.do(self.on_button_pressed)

        self.txt = gui.TextInput(width=200, height=30, margin='10px')
        self.txt.set_text('This is a TEXTAREA')
        self.txt.onchange.do(self.on_text_area_change)

        self.spin = gui.SpinBox(1, 0, 100, width=200, height=30, margin='10px')
        self.spin.onchange.do(self.on_spin_change)

        self.progress = gui.Progress(1, 100, width=200, height=5)

        self.check = gui.CheckBoxLabel('Label checkbox', True, width=200, height=30, margin='10px')
        self.check.onchange.do(self.on_check_change)

        self.btInputDiag = gui.Button('Open InputDialog', width=200, height=30, margin='10px')
        self.btInputDiag.onclick.do(self.open_input_dialog)

        self.btFileDiag = gui.Button('File Selection Dialog', width=200, height=30, margin='10px')
        self.btFileDiag.onclick.do(self.open_fileselection_dialog)

        self.btUploadFile = gui.FileUploader('./', width=200, height=30, margin='10px')
        self.btUploadFile.onsuccess.do(self.fileupload_on_success)
        self.btUploadFile.onfailed.do(self.fileupload_on_failed)

        items = ('Danny Young','Christine Holand','Lars Gordon','Roberto Robitaille')
        self.listView = gui.ListView.new_from_list(items, width=300, height=120, margin='10px')
        self.listView.onselection.do(self.list_view_on_selected)

        self.link = gui.Link("http://localhost:8081", "A link to here", width=200, height=30, margin='10px')

        self.dropDown = gui.DropDown.new_from_list(('DropDownItem 0', 'DropDownItem 1'),
                                                   width=200, height=20, margin='10px')
        self.dropDown.onchange.do(self.drop_down_changed)
        self.dropDown.select_by_value('DropDownItem 0')

        self.slider = gui.Slider(10, 0, 100, 5, width=200, height=20, margin='10px')
        self.slider.onchange.do(self.slider_changed)

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

        self.date = gui.Date('2015-04-13', width=200, height=20, margin='10px')
        self.date.onchange.do(self.date_changed)

        self.video = gui.Widget( _type='iframe', width=290, height=200, margin='10px')
        self.video.attributes['src'] = "https://drive.google.com/file/d/0B0J9Lq_MRyn4UFRsblR3UTBZRHc/preview"
        self.video.attributes['width'] = '100%'
        self.video.attributes['height'] = '100%'
        self.video.attributes['controls'] = 'true'
        self.video.style['border'] = 'none'

        self.tree = gui.TreeView(width='100%', height=300)
        ti1 = gui.TreeItem("Item1")
        ti2 = gui.TreeItem("Item2")
        ti3 = gui.TreeItem("Item3")
        subti1 = gui.TreeItem("Sub Item1")
        subti2 = gui.TreeItem("Sub Item2")
        subti3 = gui.TreeItem("Sub Item3")
        subti4 = gui.TreeItem("Sub Item4")
        subsubti1 = gui.TreeItem("Sub Sub Item1")
        subsubti2 = gui.TreeItem("Sub Sub Item2")
        subsubti3 = gui.TreeItem("Sub Sub Item3")
        self.tree.append([ti1, ti2, ti3])
        ti2.append([subti1, subti2, subti3, subti4])
        subti4.append([subsubti1, subsubti2, subsubti3])

        # appending a widget to another, the first argument is a string key
        subContainerRight.append([self.counter, self.lbl, self.bt, self.txt, self.spin, self.progress, self.check, self.btInputDiag, self.btFileDiag])
        # use a defined key as we replace this widget later
        fdownloader = gui.FileDownloader('download test', '../remi/res/logo.png', width=200, height=30, margin='10px')
        subContainerRight.append(fdownloader, key='file_downloader')
        subContainerRight.append([self.btUploadFile, self.dropDown, self.slider, self.colorPicker, self.date, self.tree])
        self.subContainerRight = subContainerRight

        subContainerLeft.append([self.img, self.table, self.listView, self.link, self.video])

        horizontalContainer.append([subContainerLeft, subContainerRight])

        menu = gui.Menu(width='100%', height='30px')
        m1 = gui.MenuItem('File', width=100, height=30)
        m2 = gui.MenuItem('View', width=100, height=30)
        m2.onclick.do(self.menu_view_clicked)
        m11 = gui.MenuItem('Save', width=100, height=30)
        m12 = gui.MenuItem('Open', width=100, height=30)
        m12.onclick.do(self.menu_open_clicked)
        m111 = gui.MenuItem('Save', width=100, height=30)
        m111.onclick.do(self.menu_save_clicked)
        m112 = gui.MenuItem('Save as', width=100, height=30)
        m112.onclick.do(self.menu_saveas_clicked)
        m3 = gui.MenuItem('Dialog', width=100, height=30)
        m3.onclick.do(self.menu_dialog_clicked)

        menu.append([m1, m2, m3])
        m1.append([m11, m12])
        m11.append([m111, m112])

        menubar = gui.MenuBar(width='100%', height='30px')
        menubar.append(menu)

        verticalContainer.append([menubar, horizontalContainer])

        #this flag will be used to stop the display_counter Timer
        self.stop_flag = False

        # kick of regular display of counter
        self.display_counter()

        # returning the root widget
        return verticalContainer
Beispiel #25
0
 def add_command(self, imagePath, callback, title):
     icon = gui.Image(imagePath, height='90%', margin='0px 1px')
     icon.style['outline'] = '1px solid lightgray'
     icon.set_on_click_listener(callback)
     icon.attributes['title'] = title
     self.append(icon)
Beispiel #26
0
 def test_init(self):
     widget = gui.Image('http://placekitten.com/200/200')
     assertValidHTML(widget.repr())
Beispiel #27
0
    def _about_page(self):
        """
        This function defines the structure of the about page of the web application.
        :return: The root remi.gui.Widget object for the about page.
        """

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

        # Define authors section.
        authors_title = wc.h2('Authors')
        authors_title.style['text-align'] = 'center'

        # Center University of Bath logo.
        uob_container = gui.HBox(width='50%',
                                 margin='auto',
                                 style={
                                     'display': 'block',
                                     'overflow': 'auto',
                                     'align-content': 'center'
                                 })
        uob_container.append(
            gui.Image(
                'http://127.0.0.1:8000/web/assets/uob-logo-grey-transparent.png',
                height='75px'))

        # Define abstract section.
        abstract_title = wc.h2('Abstract')
        abstract_title.style['text-align'] = 'center'
        abstract = wc.h6(
            'This repository contains the inplementation of our non-parametric Bayesian latent variable '
            'model (DP-GP-LVM) capable of learning dependency structures across dimensions in a '
            'multivariate setting. '
            'Our approach is based on flexible Gaussian process priors for the generative mappings and '
            'interchangeable Dirichlet process priors to learn the structure. The introduction of the '
            'Dirichlet process as a specific structural prior allows our model to circumvent issues '
            'associated with previous Gaussian process latent variable models. Inference is performed by '
            'deriving an efficient variational bound on the marginal log-likelihood of the model. '
            'We demonstrate the efficacy of our approach via analysis of discovered structure and '
            'superior quantitative performance on missing data imputation. These experiments can also be '
            'found in this repository.')
        abstract.style['text-align'] = 'justify-all'

        # TODO: Add graphical model.

        # TODO: Add references for our paper(s) and maybe other papers for other models and data sets.

        # Define acknowledgements section.
        acknowledgements_title = wc.h2('Acknowledgements')
        acknowledgements_title.style['text-align'] = 'center'
        acknowledgements = wc.h6('TODO')
        acknowledgements.style['text-align'] = 'justify-all'

        # Center EU, CAMERA, and CDE logos.
        ack_logos_container = gui.HBox(width='50%',
                                       margin='auto',
                                       style={
                                           'display': 'block',
                                           'overflow': 'auto',
                                           'align-content': 'center'
                                       })
        ack_logos_container.append([
            gui.Image('http://127.0.0.1:8000/web/assets/logo_ce-en-rvb-hr.jpg',
                      height='50px',
                      margin='20px'),
            gui.Image('http://127.0.0.1:8000/web/assets/CAMERA_logo.png',
                      height='50px',
                      margin='20px'),
            gui.Image('http://127.0.0.1:8000/web/assets/cde_logo.png',
                      height='50px',
                      margin='20px')
        ])

        # Build up the webpage.
        main_container.append([
            self.nav_bar, authors_title, uob_container, abstract_title,
            abstract, acknowledgements_title, acknowledgements,
            ack_logos_container, self.footer
        ])

        # Return the root widget.
        return main_container
Beispiel #28
0
    def main(self, args):
        self.debug = args["debug"]
        utils.debug_msg(self, "start main")

        self.api_url = "http://127.0.0.1:5000/v1/"
        self.api_data = {}
        self.api_last_updated = 1
        self.api_update_interval = 5
        self.api_read()

        self.settings_up = False
        self.edit_keg_up = False
        self.delete_keg_up = False
        self.co2_list = []

        # root object
        self.container = gui.VBox(width=480)
        self.container.style['margin'] = 'auto'
        self.container.style['text-align'] = 'center'

        # header
        self.header = gui.Table(width=480)
        self.header.style['margin'] = 'auto'
        self.header.style['text-align'] = 'center'
        self.header.style['padding'] = '2em'

        # keg table
        self.keg_table = gui.Table(width=480)
        self.keg_table.style['margin'] = 'auto'
        self.keg_table.style['text-align'] = 'center'
        self.keg_table.style['padding'] = '2em'

        # first row
        first_row = gui.TableRow(height=60)

        # temperature
        t = utils.as_degF(self.api_data.get('temp', 0))
        self.temp = gui.Label("%s<br />CO2:%s%%" % (t, '???'))
        self.temp.style['padding-bottom'] = '1em'
        self.temp.style['white-space'] = 'pre'
        table_item = gui.TableItem(width=100, height=30)
        table_item.append(self.temp)
        first_row.append(table_item)

        # title
        self.title = gui.Label("HOPLITE")
        self.title.style['font-size'] = '2em'
        self.title.style['padding-bottom'] = '0.5em'
        table_item = gui.TableItem(width=240, height=30)
        table_item.append(self.title)
        first_row.append(table_item)

        # settings button
        self.settings_button = gui.Image('/static:settings_16.png', width=16)
        self.settings_button.set_on_click_listener(self.show_settings)
        self.settings_button.style['padding-bottom'] = '1.6em'
        table_item = gui.TableItem(width=100, height=30)
        table_item.append(self.settings_button)
        first_row.append(table_item)

        self.header.append(first_row)
        self.container.append(self.header)

        self.keg_table = self.build_keg_table()

        self.container.append(self.keg_table, 'keg_table')

        try:
            co2 = self.co2_list[0]  #TODO: Handle multiple CO2 sources
        except IndexError:
            co2 = "???"
        self.temp.set_text("%s\nCO2:%s%%" % (t, co2))

        utils.debug_msg(self, "end main")

        # return of the root widget
        return self.container
Beispiel #29
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
    def main(self):

        container = gui.VBox(width=480,
                             height=320,
                             layout_orientation=gui.Widget.LAYOUT_VERTICAL,
                             style={
                                 'display': 'block',
                                 'overflow': 'hidden'
                             })

        # ---------- LIGNE 12 ----------------
        container_ligne1 = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'flex',
                'overflow': 'visible'
            },
        )
        info_ligne1 = gui.Widget(width='80%',
                                 layout_orientation=gui.Widget.LAYOUT_VERTICAL,
                                 margin='12px',
                                 style={
                                     'display': 'block',
                                     'overflow': 'visible'
                                 })
        self.logo = gui.Image(
            'https://www.ratp.fr/sites/default/files/network/metro/ligne12.svg',
            width="100px",
            height="50px",
            margin="10px")

        next_bus, last_bus, updated = RATP_Watch.get_12_convention()

        self.nextbus12 = gui.Label(next_bus)
        self.lastbus12 = gui.Label(last_bus)

        container.append(container_ligne1)

        container_ligne1.append(self.logo)

        container_ligne1.append(info_ligne1)
        info_ligne1.append(self.nextbus12)
        info_ligne1.append(self.lastbus12)

        # ------------------- BUS 95 ---------------

        container_ligne3 = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'flex',
                'overflow': 'visible'
            },
        )
        info_ligne3 = gui.Widget(width='80%',
                                 layout_orientation=gui.Widget.LAYOUT_VERTICAL,
                                 margin='12px',
                                 style={
                                     'display': 'block',
                                     'overflow': 'visible'
                                 })
        self.logo = gui.Image(
            'https://www.ratp.fr/sites/default/files/network/bus/ligne95.svg',
            width="100px",
            height="60px",
            margin="10px")

        next_bus, last_bus, updated = RATP_Watch.get_95_morillons()

        self.nextbus95 = gui.Label(next_bus)
        self.lastbus95 = gui.Label(last_bus)

        container.append(container_ligne3)

        container_ligne3.append(self.logo)

        container_ligne3.append(info_ligne3)
        info_ligne3.append(self.nextbus95)
        info_ligne3.append(self.lastbus95)

        # ------------------------- BUS 89 --------------
        "https://www.ratp.fr/sites/default/files/network/bus/ligne89.svg"

        container_ligne4 = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'flex',
                'overflow': 'visible'
            },
        )
        info_ligne4 = gui.Widget(width='80%',
                                 layout_orientation=gui.Widget.LAYOUT_VERTICAL,
                                 margin='12px',
                                 style={
                                     'display': 'block',
                                     'overflow': 'visible'
                                 })
        self.logo = gui.Image(
            'https://www.ratp.fr/sites/default/files/network/bus/ligne89.svg',
            width="100px",
            height="60px",
            margin="10px")

        next_bus, last_bus, updated = RATP_Watch.get_89_brancion_vouille()

        self.nextbus89 = gui.Label(next_bus)
        self.lastbus89 = gui.Label(last_bus)

        container.append(container_ligne4)

        container_ligne4.append(self.logo)

        container_ligne4.append(info_ligne4)
        info_ligne4.append(self.nextbus89)
        info_ligne4.append(self.lastbus89)

        # ---------- BUS 62 -------------
        "https://www.ratp.fr/sites/default/files/network/bus/ligne62.svg"

        container_ligne2 = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'flex',
                'overflow': 'visible'
            },
        )
        info_ligne2 = gui.Widget(width='80%',
                                 layout_orientation=gui.Widget.LAYOUT_VERTICAL,
                                 margin='12px',
                                 style={
                                     'display': 'block',
                                     'overflow': 'visible'
                                 })
        self.logo = gui.Image(
            'https://www.ratp.fr/sites/default/files/network/bus/ligne62.svg',
            width="100px",
            height="60px",
            margin="10px")

        next_bus, last_bus, updated = RATP_Watch.get_62_brancion_vouille()

        self.nextbus62 = gui.Label(next_bus)
        self.lastbus62 = gui.Label(last_bus)

        container.append(container_ligne2)

        container_ligne2.append(self.logo)

        container_ligne2.append(info_ligne2)
        info_ligne2.append(self.nextbus62)
        info_ligne2.append(self.lastbus62)

        # -------- VELIB --------------

        container_ligne5 = gui.Widget(
            width='100%',
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'flex',
                'overflow': 'visible'
            },
        )
        info_ligne5 = gui.Widget(width='80%',
                                 layout_orientation=gui.Widget.LAYOUT_VERTICAL,
                                 margin='12px',
                                 style={
                                     'display': 'block',
                                     'overflow': 'visible'
                                 })
        self.logo = gui.Image(
            'http://www.orchestredeparis.com/assets/img/content/practical/howto/velib.svg',
            width="100px",
            height="60px",
            margin="10px")

        bike, ebike = RATP_Watch.get_velib()

        velo = str(bike) + ' ' + "vélo disponible"
        electrique = str(ebike) + " " + "ebike disponible"

        self.nextbus_velib = gui.Label(velo, margin="0px")
        self.lastbus_velib = gui.Label(electrique, margin="00px")

        container.append(container_ligne5)

        container_ligne5.append(self.logo)

        container_ligne5.append(info_ligne5)
        info_ligne5.append(self.nextbus_velib)
        info_ligne5.append(self.lastbus_velib)

        self.update12()
        self.update62()
        self.update89()
        self.update95()
        self.update_velib()

        return container