Exemplo n.º 1
0
    def main(self):

        b1 = gui.Button('Show second tab', width=200, height=30)

        tb = gui.TabBox(width='80%')
        tb.add_tab(b1, 'First', None)

        b2 = gui.Button('Second Button', width=200, height=30)
        tb.add_tab(b2, 'Second', None)

        b3 = gui.Button('Third Button', width=200, height=30)
        tb.add_tab(b3, 'Third', None)

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

        return tb
Exemplo n.º 2
0
    def rsc_row_add(self, rsc_nodes, row):
        index = 0
        for node in rsc_nodes:
            # key = node['node_uuid']
            lbl_msg = node['node_name']
            lbl = gui.Label(lbl_msg,
                    style={'border':'1px dashed green', 'padding':'5px', 'margin':'5px'})
            self.disp_rsc_row[row].append(lbl, str(index))
            index += 1
            print(str(index) + ' ' + lbl_msg)

        def rsc_close_btn(self, rsc_disp, rsc_count):
            target_rsc_name = rsc_disp.get_child('rsc_name').get_text().split(':')[1][1:]
            print('Removing ' + str(rsc_count) + ' resources.')
            print('on resource named: ' + str(target_rsc_name))

            # Remove backend resources
            cluster.destroy_rsc(rsc_name_target=target_rsc_name)

            # rsc_disp.empty()
            for key in range(rsc_count):
                print('removing ' + str(key))
                rsc_disp.remove_child(rsc_disp.get_child(str(key)))
            #rsc_disp.remove_child(rsc_disp.get_child('rsc_name'))
            rsc_disp.remove_child(rsc_disp.get_child('destroy'))

        # Add row clear button
        close_btn = gui.Button('Destroy', style={'padding':'5px'})
        close_btn.onclick.connect(rsc_close_btn, self.disp_rsc_row[row], index)
        self.disp_rsc_row[row].append(close_btn, 'destroy')
Exemplo n.º 3
0
    def main(self):
        wid = gui.VBox(width=300, height=300)

        self._items = ("/test/1", "/test/7")

        self.dd = gui.DropDown.new_from_list(self._items,
                                             width='80%',
                                             height=40)
        self.list = gui.ListView.new_from_list(self._items,
                                               width='80%',
                                               height='50%')
        self.ent = gui.TextInput(width=200, height=30, hint='enter words')
        self.bt = gui.Button('Update Models', width=200, height=30)
        self.bt.style['margin'] = 'auto 50px'

        self.bt.set_on_click_listener(self.on_button_pressed)

        # appending a widget to another, the first argument is a string key
        wid.append(self.dd)
        wid.append(self.list)
        wid.append(self.ent)
        wid.append(self.bt)

        # returning the root widget
        return wid
Exemplo n.º 4
0
 def _tab_button(self, w, h, label, base_name, key):
     # create a button that returns the key to on_click_listener
     but = gui.Button(label, width=w, height=h, key=key)
     but.style['font-weight'] = '400'
     but.style['font-size'] = '12px'
     but.set_on_click_listener(self.on_tab_button_pressed, key)
     return but
Exemplo n.º 5
0
    def main(self):
        #creating a container GridBox type
        main_container = gui.GridBox(width='100%',
                                     height='100%',
                                     style={'margin': '0px auto'})

        label = gui.Label('This is a label')
        label.style['background-color'] = 'lightgreen'

        button = gui.Button('Change layout', height='100%')
        button.set_on_click_listener(self.redefine_grid, main_container)

        text = gui.TextInput()

        #defining layout matrix, have to be iterable of iterable
        main_container.define_grid(['ab', 'ac'])
        main_container.append({'a': label, 'b': button, 'c': text})
        #setting sizes for rows and columns
        main_container.style.update({
            'grid-template-columns': '10% 90%',
            'grid-template-rows': '10% 90%'
        })

        # returning the root widget
        return main_container
Exemplo n.º 6
0
    def main(self):
        # create "master" container which will hold top container and bottom container
        # We will add widgets to it vertically
        self.masterContainer = gui.Widget(1200, 50, gui.Widget.LAYOUT_VERTICAL, 10)

        # Create top container and then widgets will be added to it horizontally
        topContainer = gui.Widget(1200, 50, gui.Widget.LAYOUT_HORIZONTAL, 10)

        # Create bottom container
        self.bottomContainer = gui.Widget(1200, 0, gui.Widget.LAYOUT_HORIZONTAL, 0)

        # Create widgets that will be placed in the top container
        self.lbl = gui.Label(200, 30, 'Team name:')
        self.txt = gui.TextInput(200, 30)
        self.btn = gui.Button(200, 30, 'Submit')
        self.btn.set_on_click_listener(self, 'on_button_pressed')

        # Add those widgets to the top container
        topContainer.append('1', self.lbl)
        topContainer.append('2', self.txt)
        topContainer.append('3', self.btn)
        
        # At startup, we want to just add the top container to the master container
        self.masterContainer.append('1', topContainer)
        
        # At startup, make it so the textinput widget is ready to accept input
        self.txt.attributes['tabindex'] = "1"
        self.txt.attributes['autofocus'] = "autofocus"

        # return / render the master container
        return self.masterContainer
Exemplo n.º 7
0
    def main(self):
        container = gui.VBox(width=120, height=120)
        self.lbl = gui.Label('Hello world!')
        self.bt = gui.Button('Press me!')
        self.btb = gui.Button('Back one...')

        # setting the listener for the onclick event of the button
        self.bt.set_on_click_listener(self.on_button_pressed)

        # appending a widget to another, the first argument is a string key
        container.append(self.lbl)
        container.append(self.bt)
        container.append(self.btb)

        # returning the root widget
        return container
Exemplo n.º 8
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
Exemplo n.º 9
0
    def construct_tabview(self):
        # make tab bar as wide as the frame
        if self.bar_width < self.frame_width:
            blank_width = self.frame_width - self.bar_width
            but = gui.Button('', width=blank_width, height=self.bar_height)
            self.tab_bar.append(but, key='xxblank')
            self.bar_width = self.frame_width

        self.tab_bar.style['width'] = gui.to_pix(self.bar_width)
        self.tab_title = gui.Label('fred',
                                   width=self.frame_width - 30,
                                   height=20)
        self.tab_title.style['margin'] = '2px'

        # frame for the tab panel, different tabs are switched into this frame.
        self.tab_frame = gui.Widget(width=self.frame_width,
                                    height=self.frame_height)  #0
        self.tab_frame.set_layout_orientation(gui.Widget.LAYOUT_VERTICAL)

        # add the bar, panels and title to the subclassed Widget
        self.append(self.tab_bar, key='tab_bar')
        self.append(self.tab_title, key='tab_title')
        self.append(self.tab_frame, key='tab_frame')
        self.set_size(self.bar_width, self.frame_height + 100)
        return self
Exemplo n.º 10
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 main(self):

        # trivial main page
        # ********************
        root = gui.VBox(width=600, height=200)  #1

        # button
        button_tabbed_dialog = gui.Button('Open Tabbed Editor',
                                          width=250,
                                          height=30)
        button_tabbed_dialog.set_on_click_listener(
            self.on_tabbed_dialog_button_clicked)
        root.append(button_tabbed_dialog)

        # and fields in main page
        self.t1f1_field = gui.Label('Tab1 Field 1: ', width=400, height=30)
        root.append(self.t1f1_field)

        self.t2f1_field = gui.Label('Tab2 Field 1: ', width=400, height=30)
        root.append(self.t2f1_field)

        # dialog to contain the TabView
        # ***********************************
        self.tabbed_dialog = AdaptableDialog(width=450,
                                             height=300,
                                             title='<b>Tabbed Editor</b>',
                                             message='',
                                             autohide_ok=False)
        self.tabbed_dialog.set_on_confirm_dialog_listener(
            self.tabbed_dialog_confirm)

        # construct a Tabview - frame_width,frame_height,bar height
        frame_width = 400
        self.tabview = TabView(frame_width, 100, 30)

        # add tabs - tab width,key,title
        self.panel1 = self.tabview.add_tab(100, 'tab1', 'Tab 1')
        self.panel2 = self.tabview.add_tab(100, 'tab2', 'Tab 2')

        # and finish building the tabview
        self.tabview.construct_tabview()

        # add some fields to the tab panels
        self.t1field1 = gui.TextInput(width=300, height=35)
        self.t1field1.set_text('Content of Tab 1 field 1')
        append_with_label(self.panel1,
                          'Field 1',
                          self.t1field1,
                          None,
                          width=frame_width)

        self.t2field1 = gui.TextInput(width=250, height=30)
        self.t2field1.set_text('Content of Tab 2 field 1')
        self.panel2.append(self.t2field1)

        # add the tabview to the dialog
        self.tabbed_dialog.append_field(self.tabview, 'tab_view')

        return root
Exemplo n.º 12
0
    def main(self):
        b1 = gui.Button('Timer Config', width=210, height=25)

        tb = gui.TabBox(width='100%', height='100%')
        tb.add_tab(b1, 'Timer Config', None)

        b2 = gui.Button('Timer Status', width=210, height=25)
        tb.add_tab(b2, 'Timer Status', None)

        b3 = gui.Button('Show first tab', width=210, height=25)
        tb.add_tab(b3, 'Third', None)

        b1.set_on_click_listener(self.on_bt1_pressed, tb, b2)
        b2.set_on_click_listener(self.on_bt2_pressed, tb, 'Third')
        b3.set_on_click_listener(self.on_bt3_pressed, tb, 0)

        return tb
Exemplo n.º 13
0
    def _createControlsBox(self, width: int, height: int) -> gui.Widget:
        box = gui.VBox(width=width, height=height, margin='0px auto')
        self._homeButton = gui.Button("HOME")
        self._homeButton.set_on_click_listener(self._homeButtonOnClick)
        box.append(self._homeButton)
        self._prevButton = gui.Button("PREV")
        self._prevButton.set_on_click_listener(self._prevButtonOnClick)
        box.append(self._prevButton)
        box.append(createBtn("CLOSE", True, self._closeButtonOnClick))
        self._nextButton = gui.Button("NEXT")
        self._nextButton.set_on_click_listener(self._nextButtonOnClick)
        box.append(self._nextButton)
        self._endButton = gui.Button("END")
        self._endButton.set_on_click_listener(self._endButtonOnClick)

        box.append(self._endButton)
        return box
Exemplo n.º 14
0
	def main(self):
		self.w = gui.VBox()

		self.hbox_save_load = gui.HBox(margin="10px")
		self.dtext_conf_file = gui.TextInput(width=200, height=30)
		self.dtext_conf_file.set_value(str(vals.config))
		self.dtext_conf_file.set_on_change_listener(self.dtext_conf_file_changed)
		self.bt_load = gui.Button("Load", width=200, height=30, margin="10px")
		self.bt_load.set_on_click_listener(self.bt_load_changed)
		self.bt_save = gui.Button("Save", width=200, height=30, margin="10px")
		self.bt_save.set_on_click_listener(self.bt_save_changed)
		self.hbox_save_load.append(self.dtext_conf_file)
		self.hbox_save_load.append(self.bt_load)
		self.hbox_save_load.append(self.bt_save)
		self.w.append(self.hbox_save_load)

		return self.w
    def main(self):
        #Build UI
        main_container = gui.VBox(style={'margin': '0px auto'})
        self.lbl_result = gui.Label("")
        self.button_0 = gui.Button("Positive",
                                   width=200,
                                   height=30,
                                   margin='10px')
        self.button_0.set_on_click_listener(self.on_button_0)
        self.button_1 = gui.Button("Negative",
                                   width=200,
                                   height=30,
                                   margin='10px')
        self.button_1.set_on_click_listener(self.on_button_1)
        self.button_2 = gui.Button("No Feedback",
                                   width=200,
                                   height=30,
                                   margin='10px')
        self.button_2.set_on_click_listener(self.on_button_2)
        self.button_3 = gui.Button("Done", width=200, height=30, margin='10px')
        self.button_3.set_on_click_listener(self.on_button_3)
        self.lbl = gui.Label("Compelete!")
        main_container.append([
            self.lbl_result, self.button_0, self.button_1, self.button_2,
            self.button_3, self.lbl
        ])

        self.P_a = [
            0.5, 0.8
        ]  #the probability of getting reward for a_0 and a_1 respectively
        self.h_n = np.zeros([N_S, N_ACT, 3])
        self.p = np.ones([
            N_S, N_ACT
        ]) * 1 / N_ACT  # initial probability that choosing different as
        #        self.record_n = np.zeros(2)
        self.a = int(random.randint(0, N_ACT - 1))  #choose an arm randomly
        self.take_action(self.a)
        self.state = 0
        self.record_n[self.state, self.a] = 1
        self.lamda = np.random.randint(N_ACT, size=N_S)
        #        print(self.record_n)
        self.lbl_result.set_text("The light is %s, the state is %s" %
                                 (str(self.a), str(current_s(self.state))))
        self.iterations = 0
        self.record_a[self.state, self.iterations] = self.a
        return main_container
Exemplo n.º 16
0
    def main(self, name='world'):
        self.login_manager = LoginManager(CookieInterface(self), 5)
        self.login_manager.on_session_expired.do(self.on_logout)

        wid = gui.VBox(width=200, height=300, margin='0px auto')
        btlogin = gui.Button('LOGIN')
        btlogin.onclick.do(self.on_login)
        btrenew = gui.Button('RENEW BEFORE EXPIRATION')
        btrenew.onclick.do(self.on_renew)

        self.lblsession_status = gui.Label('NOT LOGGED IN')

        wid.append(btlogin)
        wid.append(btrenew)
        wid.append(self.lblsession_status)

        return wid
Exemplo n.º 17
0
    def main(self):
        container = gui.VBox(width=200, height=100)
        self.lbl = gui.Label('Hello world!')
        self.bt = gui.Button('Press me!')
        self.bt2 = gui.Button('Hello name surname!')

        # setting the listener for the onclick event of the button
        self.bt.onclick.connect(self.on_button_pressed)
        self.bt2.onclick.connect(self.on_button_pressed, "Name", "Surname")

        # appending a widget to another, the first argument is a string key
        container.append(self.lbl)
        container.append(self.bt)
        container.append(self.bt2)

        # returning the root widget
        return container
Exemplo n.º 18
0
    def main(self):
        # creating a container GridBox type
        self.main_container = gui.GridBox(width='100%',
                                          height='100%',
                                          style={
                                              'margin': '0px auto',
                                              'font-family': 'Verdana'
                                          })

        title = gui.Label('Hallo, herzlich willkommen zu Werwolf!',
                          width='100%',
                          style={
                              'font-size': '2em',
                              'display': 'block',
                              'margin': 'auto'
                          })

        login = gui.Button('Anmelden',
                           height='20%',
                           style={
                               'display': 'block',
                               'margin': 'auto'
                           })

        login.onclick.do(self.on_button_pressed)
        config = gui.Button('Spiel konfigurieren',
                            height='20%',
                            style={
                                'display': 'block',
                                'margin': 'auto'
                            })

        config.onclick.do(self.on_button_pressed)
        # defining layout matrix, have to be iterable of iterable
        self.main_container.define_grid(['t', 'a', 'c'])
        self.main_container.append({'t': title, 'a': login, 'c': config})
        # setting sizes for rows and columns
        self.main_container.style.update({
            'grid-template-columns': '100%',
            'grid-template-rows': '10% 45% 45%'
        })

        # returning the root widget

        return self.main_container
Exemplo n.º 19
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
Exemplo n.º 20
0
    def init__gui__(self):
        self.x = gui.TextInput()
        self.y = gui.TextInput()

        self.hbox = hbox = gui.HBox(width="100%")
        hbox.append([gui.Label("X = "), self.x, gui.Label("Y = "), self.y])
        self.label = gui.Label(text=f" Result: ")
        self.button = gui.Button("update")
        self.button.onclick.do(self.onclickbutton)
Exemplo n.º 21
0
    def show_settings(self, widget):
        utils.debug_msg(self, "start")
        if self.settings_up == True:
            utils.debug_msg(self, "show_settings already up")
            return
        else:
            self.settings_up = True

        self.api_read(force=True)

        self.settings_dialog = gui.GenericDialog(title='Settings',
                                                 width='500px')
        utils.debug_msg(self, "settings_dialog")

        # weight display options
        weight_options_list = ['as_kg_gross', 'as_kg_net', 'as_pint', 'as_pct']
        weight_options = gui.DropDown.new_from_list(weight_options_list)
        try:
            weight_options.select_by_value(self.api_data['weight_mode'])
        except (KeyError, IndexError):
            pass
        self.settings_dialog.add_field_with_label('weight_options',
                                                  'Display Keg Weight',
                                                  weight_options)
        utils.debug_msg(self, "weight_options")

        for index, hx_conf in enumerate(self.api_data['hx_list']):
            for channel in ('A', 'B'):
                try:
                    chan_conf = hx_conf['channels'][channel]
                    keg_box = self.build_keg_settings(index,
                                                      channel,
                                                      chan_conf,
                                                      readonly=True,
                                                      edit=True)
                    self.settings_dialog.add_field(
                        str(index) + channel + '_box', keg_box)
                    utils.debug_msg(self,
                                    "index %s channel %s" % (index, channel))
                except (KeyError, IndexError):
                    pass

        add_keg_button = gui.Button('Add/Edit Keg',
                                    width=100,
                                    height=30,
                                    style={'margin': '3px'})
        add_keg_button.set_on_click_listener(self.show_edit_keg)
        self.settings_dialog.children['buttons_container'].add_child(
            'add_keg', add_keg_button)
        utils.debug_msg(self, "add_keg_button")

        self.settings_dialog.set_on_cancel_dialog_listener(
            self.cancel_settings)
        self.settings_dialog.set_on_confirm_dialog_listener(
            self.apply_settings)
        self.settings_dialog.show(self)
        utils.debug_msg(self, "end")
Exemplo n.º 22
0
 def browse_button(self,w,h,label,base_name,field_index,title):
     # create a button that returns the key to on_click_listener
     bname=base_name+str(field_index)
     but=gui.Button(label,width=w,height=h)
     # f = lambda  _bname=field_index: self.open_fileselection_dialog( _bname)
     # fname='self.'+base_name+'_' + str(field_index)
     # setattr(self, fname, f)
     but.set_on_click_listener(self.open_fileselection_dialog,field_index,title)
     return but
Exemplo n.º 23
0
 async def show_pending_request(self, chat_id, info):
     approve_button = G.Button("approve")
     hbox = G.HBox(width="100%")
     hbox.append([
         G.Label(f"{info}", width=150),
         approve_button
     ])
     self.vbox_list_requests.append(hbox)
     self.make_approve_handler(hbox, approve_button, chat_id)
Exemplo n.º 24
0
    def main(self):

        b1 = gui.Button('Show second tab', width=200, height=30)

        tb = gui.TabBox(width='80%')
        tb.append(b1, 'First')

        b2 = gui.Button('Show third tab', width=200, height=30)
        tb.add_tab(b2, 'Second', None)

        b3 = gui.Button('Show first tab', width=200, height=30)
        tb.add_tab(b3, 'Third', None)

        b1.onclick.do(self.on_bt1_pressed, tb, b2)
        b2.onclick.do(self.on_bt2_pressed, tb, 'Third')
        b3.onclick.do(self.on_bt3_pressed, tb, 0)

        return tb
    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)
Exemplo n.º 26
0
    def main(self):
        wid = gui.HBox()
        wid.style['position'] = 'absolute'
        ctrl = gui.VBox(width=400)
        ctrl.style['justify-content'] = 'space-around'

        plotContainer = gui.Widget()

        self._plotsWidget = plotly_app_plot.PlotsWidget(self,
                                                        width='100%',
                                                        height='100%')

        centralContainer = gui.VBox()
        plotContainer.append(centralContainer)
        centralContainer.append(self._plotsWidget)

        self.plt1 = self._plotsWidget.createPlot('1')
        #        centralContainer.append(self.plt1)

        #        self.plt2 = PlotlyWidget()
        self.plt2 = self._plotsWidget.createPlot('2')
        #        centralContainer.append(self.plt2)

        bt1 = gui.Button('Start', width=200, height=30)
        bt1.style['margin'] = 'auto 50px'
        bt1.style['background-color'] = 'green'

        # setting the listener for the onclick event of the button
        bt1.set_on_click_listener(self.on_button_pressed1)
        ctrl.append(bt1)

        bt2 = gui.Button('Start', width=200, height=30)
        bt2.style['margin'] = 'auto 50px'
        bt2.style['background-color'] = 'green'

        # setting the listener for the onclick event of the button
        bt2.set_on_click_listener(self.on_button_pressed2)
        ctrl.append(bt2)

        # returning the root widget
        wid.append(ctrl)
        wid.append(plotContainer)

        return wid
Exemplo n.º 27
0
    def on_dropdown_change(self, value):
        print "Chosen dropdown value: " + str(value)
        # Create the widget chosen
        if "button" in value:
            dynamic_widget = gui.Button(100, 100, "Button")
        elif "label" in value:
            dynamic_widget = gui.Label(100, 100, "Label")

        # Add it, as we use the same ID '3' it will overwrite it if we add it again
        self.wid.append('3', dynamic_widget)
Exemplo n.º 28
0
 def main(self, name='world'):
     #margin 0px auto allows to center the app to the screen
     container = gui.Widget(width=600, height=600)
     self.canvas = Canvas(self, resolution=(600, 400), margin='0px auto')
     button = gui.Button('Go!')
     button.set_on_click_listener(self.draw)
     container.append(self.canvas)
     container.append(button)
     # returning the root widget
     return container
Exemplo n.º 29
0
    def get_chat_widget(self):
        verticalContainer = gui.Widget(width=400,
                                       margin='0px auto',
                                       style={
                                           'display': 'block',
                                           'overflow': 'hidden'
                                       })
        chatButtonContainer = gui.Widget(
            width=400,
            layout_orientation=gui.Widget.LAYOUT_HORIZONTAL,
            margin='0px',
            style={
                'display': 'block',
                'overflow': 'auto'
            })

        RemiClient.history_widget = gui.ListView.new_from_list((),
                                                               width=500,
                                                               height=300,
                                                               margin='10px')

        self.txt_input = gui.TextInput(width=400, height=30, margin='10px')
        self.txt_input.set_text('chat: ')
        self.txt_input.set_on_change_listener(self.on_chat_type)
        self.txt_input.set_on_enter_listener(self.on_chat_enter)

        send_button = gui.Button('Send', width=150, height=30, margin='10px')
        send_button.set_on_click_listener(self.on_chat_click)

        sug_button = gui.Button('Suggestion',
                                width=150,
                                height=30,
                                margin='10px')
        sug_button.set_on_click_listener(self.on_suggestion_click)

        chatButtonContainer.append(send_button)
        chatButtonContainer.append(sug_button)

        verticalContainer.append(self.txt_input)
        verticalContainer.append(chatButtonContainer)
        verticalContainer.append(RemiClient.history_widget)
        return verticalContainer
Exemplo n.º 30
0
    def __init__(self, app: 'LessonReplaceBotApp', table: str, field: str,
                 onchange: Callable):
        self.app = app
        self.table = table
        self.field = field
        self.onchange = onchange

        super().__init__(width=ALL, height='92%')
        hbox = gui.HBox(width=ALL, height=ALL)

        left_panel = gui.VBox(width="30%", height=ALL, margin=MARGIN)
        left_panel.css_justify_content = "flex-start"
        right_panel = gui.VBox(width="70%", height=ALL, margin=MARGIN)

        self.text = gui.TextInput('', width=ALL, height=HEIGHT, margin=MARGIN)
        self.add_btn = gui.Button('Добавить',
                                  width=ALL,
                                  height=HEIGHT,
                                  margin=MARGIN)
        self.add_btn.onclick.do(self.on_btn_add_click)
        self.del_btn = gui.Button('Удалить',
                                  width=ALL,
                                  height=HEIGHT,
                                  margin=MARGIN)
        self.del_btn.set_enabled(False)

        left_panel.append(self.text)
        left_panel.append(self.add_btn)
        left_panel.append(self.del_btn)

        self.list_view = gui.ListView(width=ALL, height=ALL, margin=MARGIN)
        self.refresh_list()
        self.list_view.onselection.do(self.list_view_on_selected)
        view_port = gui.Container(width=ALL,
                                  height=ALL,
                                  style={"overflow-y": "scroll"})
        view_port.append(self.list_view)
        right_panel.append(view_port)

        hbox.append(left_panel)
        hbox.append(right_panel)
        self.append(hbox)