Exemplo n.º 1
0
    def init(self):
        self.main_container = flx.VSplit(
            style='font-family: "Helvetica Neue";')
        with self.main_container:
            with flx.VSplit(flex=2):
                self.image = flx.Widget(flex=4, style='background: black;')
                self.title_w = flx.Widget(flex=1)
                with self.title_w:
                    self.title = ui.Label(wrap=True)
                self.overview_w = flx.Widget(flex=1, style='height: 10vh;')
                with self.overview_w:
                    self.overview = ui.Label(wrap=True)
            with flx.HBox(flex=1):
                # self.h_button = flx.Button(text='Horrible', flex=1)
                self.m_button = flx.Button(text='Meh', flex=1)
                self.n_button = flx.Button(text='Neutral', flex=1)
                self.g_button = flx.Button(text='Yeah!', flex=1)
                # self.a_button = flx.Button(text='Amazing', flex=1)
            with flx.HBox(flex=0):
                self.slider = ui.Slider(text='Exploration/Exploitation',
                                        flex=3,
                                        min=0,
                                        max=1,
                                        step=0.01,
                                        value=sliderValue)
                # self.label = ui.Label(flex=1)
                # self.label = flx.Label(flex=1)

            # class JS:
            #     @react.connect('slider.value')
            #     def _change_label(self, value):
            #         self.label.text('x'.repeat(value))
        self.set_movie()
Exemplo n.º 2
0
    def init(self):

        with ui.HBox():

            with ui.VBox(flex=0):
                self.b1 = ui.RadioButton(text='Linear')
                self.b2 = ui.RadioButton(text='Basis')
                self.b3 = ui.RadioButton(text='Cardinal', checked=True)
                self.b4 = ui.RadioButton(text='Catmull Rom')
                self.b5 = ui.RadioButton(text='Lagrange')
                self.b6 = ui.RadioButton(text='Lanczos')
                ui.Widget(style='min-height:10px')
                self.closed = ui.CheckBox(text='Closed')
                ui.Widget(style='min-height:10px')
                self.tension_label = ui.Label(text='Tension: 0.5')
                self.tension = ui.Slider(min=-0.5, max=1, value=0.5)
                ui.Widget(flex=1)

            with ui.VBox(flex=1):
                ui.Label(text=GENERAL_TEXT,
                         wrap=True,
                         style='font-size: 12px;')
                self.explanation = ui.Label(text=CARDINAL_TEXT,
                                            wrap=True,
                                            style='font-size: 12px;')

                self.spline = SplineWidget(flex=1)
Exemplo n.º 3
0
 def init(self):
     self.box = []
     with flx.VBox(
             flex=1,
             style='border:2px solid gray;border-radius: 5px;text-align:left'
     ):
         with flx.HFix(flex=1, style='text-align:left'):
             flx.Label(text='Testpmd args:')
             self.cb_as = flx.CheckBox(text="auto-start")
             self.cb_crc = flx.CheckBox(text="disable-crc-strip")
             self.cb_fia = flx.CheckBox(text="flow-isolate-all")
         with flx.HBox(flex=1):
             ui.Label(text='--rxq:', flex=0)
             self.rxq = ui.LineEdit(text='1', flex=1)
             ui.Label(flex=1, text='')
             ui.Label(text='--rxd:', flex=0)
             self.rxd = ui.LineEdit(text='64', flex=1)
             ui.Label(flex=1, text='')
             ui.Label(text='--txq:', flex=0)
             self.txq = ui.LineEdit(text='1', flex=1)
             ui.Label(flex=1, text='')
             ui.Label(text='--txd:', flex=0)
             self.txd = ui.LineEdit(text='64', flex=1)
             ui.Label(flex=1, text='')
             ui.Label(text='--hairpin:', flex=0)
             self.hairpin = ui.LineEdit(text='0', flex=1)
         with flx.HFix(flex=1, style=' text-align:left'):
             self.cmdline = ui.Label(text='testpmd cmdline:', flex=10)
             self.start = flx.Button(text='start', flex=1)
Exemplo n.º 4
0
    def init(self):
        with ui.HBox():
            with ui.VBox():
                ui.Label(text='<h3>Server monitor</h3>')
                self.info = ui.Label(text='...')

                if app.current_server().serving[0] == 'localhost':
                    # Don't do this for a public server
                    self.button = ui.Button(text='Do some work')
                    self.button.connect('mouse_down', self._do_work)

                self.cpu_plot = ui.PlotWidget(
                    style='width: 640px; height: 320px;',
                    xdata=[],
                    yrange=(0, 100),
                    ylabel='CPU usage (%)',
                    sync_props=False)
                self.mem_plot = ui.PlotWidget(
                    style='width: 640px; height: 320px;',
                    xdata=[],
                    yrange=(0, 100),
                    ylabel='Mem usage (%)',
                    sync_props=False)
                ui.Widget(flex=1)

        # Relay global info into this app
        relay.connect(self._push_info, 'system_info:' + self.id)
Exemplo n.º 5
0
 def init(self):
     with ui.VBox():
         self.line = ui.LineEdit(flex=(0.5, 0.5),
                                 placeholder_text='type here',
                                 autocomp=['foo', 'bar'])
         ui.Label(flex=0, text='copy:')
         self.label = ui.Label(flex=1)
Exemplo n.º 6
0
 def init(self):
     with ui.HBox(flex=1):
         with ui.Widget(flex=1,style="overflow-y:scroll"):
             with ui.VBoxPanel(flex=0) as self.leftView:
                 with ui.HBox(flex=0,style="background:#ee0;min-height:40px;max-height:40px"):
                     ui.Label(text="<b>主设备</b>")
                     ui.Label(text="<b>从设备</b>")
         with ui.PinboardLayout(flex=0,style="background:#eee;color:#000;min-width:200px"):
             self.btnStartPolling = ui.Button(flex=0,text="发起一次轮询",css_class="button button-primary button-rounded button-small",pos=(10,10),base_size=(160,32))
Exemplo n.º 7
0
 def init(self):
     self.udr = uart.UartDriver()
     self.uartfd = None
     self.mDevList = []
     with ui.VBoxPanel() as self.vboxs:
         with ui.PinboardLayout(flex = 0,base_size=100,style="background:#777;color:#0ff"):
             self.mDevNameLab = ui.Label(flex=0,text="目前没有打开的串口",pos=(10,10),base_size=(600,32))
             self.mDevTypeLab = ui.Label(flex=0,text="设备规格:",pos=(10,40),base_size=(600,32))
         self.mMenuBar = MenuBarView(flex=0,menuBtnFunc=self._menuBtnHandler)
         self.mBottomArea = ui.Widget(flex=1)
Exemplo n.º 8
0
 def init(self):
     
     with ui.HBox():
         
         ui.Label(text='Widget in a hbox in a hbox in a hbox')
         
         with ui.HBox(flex=1):
             
             with ui.HBox(flex=1):
                 ui.Label(text='|||')
                 Red(flex=1)
Exemplo n.º 9
0
 def init(self):
     
     with ui.VBox():
         
         ui.Label(text='Widget in a vbox in a vbox in a vbox')
         
         with ui.VBox(flex=1):
             
             with ui.VBox(flex=1):
                 ui.Label(text='---')
                 Red(flex=1)
Exemplo n.º 10
0
    def init(self):

        with ui.HBox():

            with ui.VBox(flex=1, orientation='vertical'):

                ui.Label(text='<b>BoxLayout</b> (aware of natural size)')
                ui.Label(text='flex: 1, sub-flexes: 0, 0, 0')
                with ui.BoxLayout(flex=1, orientation='horizontal'):
                    Panel(text='A', flex=0)
                    Panel(text='B', flex=0)
                    Panel(text='C is a bit longer', flex=0)
                ui.Label(text='flex: 0, sub-flexes: 1, 1, 1')
                with ui.BoxLayout(flex=0, orientation='horizontal'):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=1)
                    Panel(text='C is a bit longer', flex=1)
                ui.Label(text='flex: 1, sub-flexes: 1, 0, 2')
                with ui.BoxLayout(flex=1, orientation='horizontal'):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=0)
                    Panel(text='C is a bit longer', flex=2)
                ui.Label(text='flex: 2, sub-flexes: 1, 2, 3')
                with ui.BoxLayout(flex=2, orientation='horizontal'):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=2)
                    Panel(text='C is a bit longer', flex=3)

            ui.Widget(flex=0, style='min-width:20px')

            with ui.VBox(flex=1, orientation='vertical'):

                ui.Label(text='<b>BoxPanel</b> (high level layout)')
                ui.Label(text='flex: 1, sub-flexes: 0, 0, 0')
                with ui.BoxPanel(flex=1, orientation='horizontal'):
                    Panel(text='A', flex=0)
                    Panel(text='B', flex=0)
                    Panel(text='C is a bit longer', flex=0)
                ui.Label(text='flex: 0 (collapses), sub-flexes: 1, 1, 1')
                with ui.BoxPanel(flex=0, orientation='horizontal'):
                    Panel(text='A', flex=1, style='min-height:5px;')
                    Panel(text='B', flex=1)
                    Panel(text='C is a bit longer', flex=1)
                ui.Label(text='flex: 1, sub-flexes: 1, 0, 2')
                with ui.BoxPanel(flex=1, orientation='horizontal'):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=0)
                    Panel(text='C is a bit longer', flex=2)
                ui.Label(text='flex: 2, sub-flexes: 1, 2, 3')
                with ui.BoxPanel(flex=2, orientation='horizontal'):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=2)
                    Panel(text='C is a bit longer', flex=3)
Exemplo n.º 11
0
    def init(self):
        with ui.HBox():
            with ui.VBox():
                ui.Label(text='<h3>Server monitor</h3>')
                self.info = ui.Label(text='...')
                self.button = ui.Button(text='Do some work')

                self.plot = ui.PlotWidget(size=(640, 480),
                                          xdata=[],
                                          yrange=(0, 100),
                                          ylabel='CPU usage (%)')
                ui.Widget(flex=1)
Exemplo n.º 12
0
    def init(self):

        with ui.VBoxLayout():
            with ui.FormLayout(spacing=1):
                ui.Label(self, 'Name')
                self._name = ui.TextInput(self)
                ui.Label(self, 'Age')
                self._age = ui.IntInput(self)
            with ui.HBoxLayout():
                ui.Widget(self, flex=1)  # spacer
                ui.Button(self, 'Cancel', on_click=self.close, flex=0)
                ui.Button(self, 'Ok', on_click=self.process, flex=0)
Exemplo n.º 13
0
 def init(self):
     with ui.HBox(flex=1):
         with ui.Widget(flex=1,style="overflow-y:scroll"):
             with ui.VBoxPanel(flex=0) as self.leftView:
                 with ui.HBox(flex=0,style="background:#ee0;min-height:40px;max-height:40px"):
                     ui.Label(text="<b>主设备</b>")
                     ui.Label(text="<b>从设备</b>")
         with ui.VBox(flex=0,padding=6,style="background:#eee;color:#000;min-width:200px"):
             self.listenMode = ui.RadioButton(text="CEV485监听模式",checked=True)
             self.simuAllClient = ui.RadioButton(text="模拟所有客户端响应")
             self.simuOneKeyModClient = ui.RadioButton(text="模拟一键报警")
             self.btnStart = ui.Button(text="模拟启动",css_class="button button-primary button-rounded button-small",pos=(10,10),base_size=(160,32))
             ui.Widget(flex=1)
Exemplo n.º 14
0
 def init(self):
     
     with ui.HSplit():
         
         with ui.VBox(flex=1):
             
             ui.Label(html='<b>Box mode</b> (aware of natural size)')
             ui.Label(text='flex: 1, sub-flexes: 0, 0, 0')
             with ui.HBox(flex=1):
                 Panel(text='A', flex=0)
                 Panel(text='B', flex=0)
                 Panel(text='C is a bit longer', flex=0)
             ui.Label(text='flex: 0, sub-flexes: 1, 1, 1')
             with ui.HBox(flex=0):
                 Panel(text='A', flex=1)
                 Panel(text='B', flex=1)
                 Panel(text='C is a bit longer', flex=1)
             ui.Label(text='flex: 1, sub-flexes: 1, 0, 2')
             with ui.HBox(flex=1):
                 Panel(text='A', flex=1)
                 Panel(text='B', flex=0)
                 Panel(text='C is a bit longer', flex=2)
             ui.Label(text='flex: 2, sub-flexes: 1, 2, 3')
             with ui.HBox(flex=2):
                 Panel(text='A', flex=1)
                 Panel(text='B', flex=2)
                 Panel(text='C is a bit longer', flex=3)
         
         with ui.VBox(flex=1):
             
             ui.Label(html='<b>Fix mode</b> (high level layout)')
             ui.Label(text='flex: 1, sub-flexes: 0, 0, 0')
             with ui.HFix(flex=1):
                 Panel(text='A', flex=0)
                 Panel(text='B', flex=0)
                 Panel(text='C is a bit longer', flex=0)
             ui.Label(text='flex: 0 (collapses), sub-flexes: 1, 1, 1')
             with ui.HFix(flex=0):
                 Panel(text='A', flex=1, style='min-height:5px;')
                 Panel(text='B', flex=1)
                 Panel(text='C is a bit longer', flex=1)
             ui.Label(text='flex: 1, sub-flexes: 1, 0, 2')
             with ui.HFix(flex=1):
                 Panel(text='A', flex=1)
                 Panel(text='B', flex=0)
                 Panel(text='C is a bit longer', flex=2)
             ui.Label(text='flex: 2, sub-flexes: 1, 2, 3')
             with ui.HFix(flex=2):
                 Panel(text='A', flex=1)
                 Panel(text='B', flex=2)
                 Panel(text='C is a bit longer', flex=3)
Exemplo n.º 15
0
 def init(self):
     self.layout = ui.PlotLayout()
     self.slider1 = ui.Slider(min=1, max=2, value=1)
     self.slider2 = ui.Slider(min=3, max=10, value=3)
     self.progress = ui.ProgressBar(max=100, value=0)
     self.layout.add_tools(
         'Edit plot',
         ui.Label(text='exponent'),
         self.slider1,
         ui.Label(text='numel'),
         self.slider2,
     )
     self.layout.add_tools('Plot info', ui.Label(text='Maximum'),
                           self.progress)
Exemplo n.º 16
0
 def init(self):
     with ui.HBox():
         with ui.VBox():
             ui.Label(text='<h3>Server monitor</h3>')
             self.info = ui.Label(text='...')
             if os.getenv('FLEXX_HOSTNAME', 'localhost') == 'localhost':
                 self.button = ui.Button(text='Do some work')
             
             self.cpu_plot = ui.PlotWidget(style='width: 640px; height: 320px;',
                                           xdata=[], yrange=(0, 100), 
                                           ylabel='CPU usage (%)')
             self.mem_plot = ui.PlotWidget(style='width: 640px; height: 320px;',
                                           xdata=[], yrange=(0, 100), 
                                           ylabel='Mem usage (%)')
             ui.Widget(flex=1)
Exemplo n.º 17
0
 def init(self):
     self.label = ui.Label()
     self.style = 'overflow-y: scroll'  # enable scrolling
     
     # Send data to the JS side. In this case we don't need meta data
     meta = {}
     self.send_data(bytes(data), meta)
Exemplo n.º 18
0
    def init(self):

        ui.Label(
            text=
            'Refreshing the page should maintain the value of the line edit.')
        self.edit = ui.LineEdit(placeholder_text='username',
                                text=self.session.get_cookie('username', ''))
Exemplo n.º 19
0
 def update(self, event):
     with self.vbox:
         with ui.GroupWidget():
             btn = ui.Button(title=event['name'], text=event['name'])
             delete = ui.Button(title=event['name'], text='del')
             ui.Label(text=event['description'])
         btn.connect('mouse_click', self.wdg)
         delete.connect('mouse_click', self.delete)
Exemplo n.º 20
0
    def init(self):
        # Put a label and some sliders deep in the hierarchy

        with ui.HBox():
            with ui.VBox(flex=1) as self.box:
                self.label = ui.Label()
                for i in range(5):
                    ui.Slider(value=i / 5)
Exemplo n.º 21
0
    def init(self):
        with ui.BoxLayout(orientation='v'):

            ui.Label(text='Flex 0 0 0')
            with ui.HBox(flex=0):
                self.b1 = ui.Button(text='Hola', flex=0)
                self.b2 = ui.Button(text='Hello world', flex=0)
                self.b3 = ui.Button(text='Foo bar', flex=0)

            ui.Label(text='Flex 1 0 3')
            with ui.HBox(flex=0):
                self.b1 = ui.Button(text='Hola', flex=1)
                self.b2 = ui.Button(text='Hello world', flex=0)
                self.b3 = ui.Button(text='Foo bar', flex=3)

            ui.Widget(flex=1)
            ui.Label(text='Note the spacer Widget above')
Exemplo n.º 22
0
 def init(self):
     self.box = []
     with flx.VBox(flex=1,
                   style='border:2px solid gray;border-radius: 5px'):
         flx.Label(text='Add flow', flex=1, style='text-align:center')
         with flx.HBox(style='border:2px solid gray;border-radius: 5px'):
             ui.Label(text='attr:')
             self.attr = ui.ComboBox(editable=True,
                                     selected_key='ingress',
                                     options=('ingress', 'egress',
                                              'transfer'))
             ui.Label(text='port_id:')
             self.port_id = ui.LineEdit(text='0')
             ui.Label(text='group:')
             self.group_id = ui.LineEdit(text='1')
         self.item = ItemBox()
         self.action = ActionBox()
Exemplo n.º 23
0
 def init(self):
     
     with ui.HFix():
         ui.Widget(flex=1)
         with ui.VBox(flex=0, style='min-width:200px'):
             with ui.GroupWidget(title='Plot options'):
                 ui.Label(text='Month')
                 self.month = ui.ComboBox(options=months, selected_index=12, style='width: 100%')
                 self.smoothing_label = ui.Label(text='Smoothing')
                 self.smoothing = ui.Slider(max=20, step=2, text='{value} samples')
             ui.Widget(flex=3)
         with ui.VBox(flex=4):
             self.plot = ui.PlotWidget(flex=1,
                                       xdata=years, yrange=(-5, 20),
                                       title='Average monthly temperature',
                                       xlabel='year', ylabel=u'temperature (°C)')
         ui.Widget(flex=1)
Exemplo n.º 24
0
    def init(self):
        self.label = ui.Label()
        self.style = 'overflow-y: scroll'  # enable scrolling

        # Send data to the JS side. In this case we don't need meta data
        meta = {}
        bb = data.tobytes() if hasattr(data, 'tobytes') else bytes(data)
        self.send_data(bb, meta)
Exemplo n.º 25
0
    def init(self):

        with ui.VBox():
            ui.Label(html='<h3>Server monitor</h3>')
            if app.current_server().serving[0] == 'localhost':
                # Don't do this for a public server
                self.button = ui.Button(text='Do some work')
            self.view = MonitorView(flex=1)
Exemplo n.º 26
0
    def init(self):

        with ui.VBox():
            ui.Label(text=self.TITLE)
            self.slider1 = ui.Slider()
            self.slider2 = ui.Slider()

            ui.Widget(flex=1)
Exemplo n.º 27
0
 def init(self):
     self.start_time = time()
     
     self.status = ui.Label(text='...')
     self.cpu_plot = ui.PlotWidget(flex=1, style='width: 640px; height: 320px;',
                                   xdata=[], yrange=(0, 100), 
                                   ylabel='CPU usage (%)')
     self.mem_plot = ui.PlotWidget(flex=1, style='width: 640px; height: 320px;',
                                   xdata=[], yrange=(0, 100), 
                                   ylabel='Mem usage (%)')
Exemplo n.º 28
0
 def init(self):
     
     with ui.HBox():
         ui.Widget(flex=1)
         with ui.VBox(flex=0):
             with ui.GroupWidget(title='Plot options'):
                 with ui.VBox():
                     self.month_label = ui.Label(text='Month')
                     self.month = ui.Slider(max=12, step=1)
                     self.smoothing_label = ui.Label(text='Smoothing')
                     self.smoothing = ui.Slider(max=20, step=2)
             ui.Widget(flex=1)
         with ui.VBox(flex=4):
             self.plot = ui.PlotWidget(flex=1,
                                       xdata=years, yrange=(-5, 20),
                                       title='Average monthly temperature',
                                       xlabel='year', ylabel=u'temperature (°C)')
             ui.Widget(flex=0, style='height:30px')
         ui.Widget(flex=1)
Exemplo n.º 29
0
    def init(self):
        super().init()
        self.ctx = self.node.getContext('2d')
        self._last_pos = (0, 0)

        # Set mouse capturing mode
        self.set_capture_mouse(1)

        # Label to show current mouse position
        self.wpos = ui.Label()
Exemplo n.º 30
0
 def init(self):
     with ui.VBox():
         
         with ui.HBox():
             self.first_edit = ui.LineEdit(placeholder_text='first name',
                                           text='Jane')
             self.last_edit = ui.LineEdit(placeholder_text='last name',
                                          text='Doe')
             ui.Widget(flex=1)  # spacer
             
         with ui.HBox():
             ui.Label(text=lambda: self.root.first_name,
                      style='border:1px solid red')
             ui.Label(text=lambda: self.root.last_name,
                      style='border:1px solid red')
             ui.Widget(flex=1)  # spacer
         
         MyPersonLabel(style='border:1px solid blue')
         
         ui.Widget(flex=1)  # spacer