Ejemplo n.º 1
0
    def init(self):
        self.selectedImages = []

        with flx.TabLayout() as self.tabs:
            with flx.HFix(title="selection", flex=1) as self.selector_view:
                with flx.VFix() as self.images:
                    flx.Label(text="Images", flex=(1, 1))
                    self.imageGrid = ImageGrid(
                        4,
                        4,
                        path_provider,
                        lambda o, idx, idy: self.image_click_handler(
                            o, idx, idy),
                        flex=(1, 9))
                self.images.node.style.backgroundColor = "#88888888"
                with flx.VFix() as self.selected:
                    flx.Label(text="Selected", flex=(1, 1))
                    self.selectedGrid = ImageGrid(
                        4,
                        4,
                        self.selected_provider,
                        lambda o, idx, idy: self.selected_click_handler(
                            o, idx, idy),
                        flex=(1, 9))
            with flx.HFix(title="results", flex=1) as self.result_view:
                self.resultGrid = ImageGrid(8, 4, path_provider, flex=(1, 1))
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
 def init(self, descs, cls_detail=PanelProtocolDetail):
     super().init(descs)
     self.cls_detail = cls_detail
     with flx.HFix():
         self.lbl_title = flx.Label(flex=4)
         self._cont = flx.HFix(flex=42)
         self.btn_detail = flx.Button(text="...", flex=2, disabled = not cls_detail)
         self.btn_remove = flx.Button(text="-", flex=1)
Ejemplo n.º 4
0
    def init(self):

        with flx.VBox():

            flx.Label(
                style='background:#cfc;',
                wrap=1,
                text='Here is some content at the top for which we want to '
                'use minimal size. Thus the use of a VBox. '
                'Below is a splitter, with a box layout on the left '
                'and a fix layout on the right.')

            with flx.HSplit(flex=1):
                with flx.VBox(style='border:1px solid #777;'):

                    flx.Label(text='Flex 0 0 0')
                    with flx.HBox(flex=0):
                        self.b1 = flx.Button(text='Hi')
                        self.b2 = flx.Button(text='Helloooo world!')
                        self.b3 = flx.Button(text='Foo bar')

                    flx.Label(text='Flex 1 1 1')
                    with flx.HBox(flex=0):
                        self.b1 = flx.Button(flex=1, text='Hi')
                        self.b2 = flx.Button(flex=1, text='Helloooo world!')
                        self.b3 = flx.Button(flex=1, text='Foo bar')

                    flx.Label(text='Flex 1 0 3')
                    with flx.HBox(flex=0):
                        self.b1 = flx.Button(flex=1, text='Hi')
                        self.b2 = flx.Button(flex=0, text='Helloooo world!')
                        self.b3 = flx.Button(flex=3, text='Foo bar')

                    # flx.Widget(flex=1)  # spacer widget

                with flx.VFix(style='border:1px solid #777;'):

                    flx.Label(text='Flex 0 0 0 (space divided equally)',
                              style='')
                    with flx.HFix():
                        self.b1 = flx.Button(text='Hi')
                        self.b2 = flx.Button(text='Helloooo world!')
                        self.b3 = flx.Button(text='Foo bar')

                    flx.Label(text='Flex 1 1 1', style='')
                    with flx.HFix():
                        self.b1 = flx.Button(flex=1, text='Hi')
                        self.b2 = flx.Button(flex=1, text='Helloooo world!')
                        self.b3 = flx.Button(flex=1, text='Foo bar')

                    flx.Label(
                        text='Flex 1 0 3 (the widget with zero collapses')
                    with flx.HFix():
                        self.b1 = flx.Button(flex=1, text='Hi')
                        self.b2 = flx.Button(flex=0, text='Helloooo world!')
                        self.b3 = flx.Button(flex=3, text='Foo bar')
    def init(self):

        with flx.HSplit():

            with flx.VBox(flex=1):

                flx.Label(html='<b>Box mode</b> (aware of natural size)')
                flx.Label(text='flex: 1, sub-flexes: 0, 0, 0')
                with flx.HBox(flex=1):
                    Panel(text='A', flex=0)
                    Panel(text='B', flex=0)
                    Panel(text='C is a bit longer', flex=0)
                flx.Label(text='flex: 0, sub-flexes: 1, 1, 1')
                with flx.HBox(flex=0):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=1)
                    Panel(text='C is a bit longer', flex=1)
                flx.Label(text='flex: 1, sub-flexes: 1, 0, 2')
                with flx.HBox(flex=1):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=0)
                    Panel(text='C is a bit longer', flex=2)
                flx.Label(text='flex: 2, sub-flexes: 1, 2, 3')
                with flx.HBox(flex=2):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=2)
                    Panel(text='C is a bit longer', flex=3)

            with flx.VBox(flex=1):

                flx.Label(html='<b>Fix mode</b> (high level layout)')
                flx.Label(text='flex: 1, sub-flexes: 0, 0, 0')
                with flx.HFix(flex=1):
                    Panel(text='A', flex=0)
                    Panel(text='B', flex=0)
                    Panel(text='C is a bit longer', flex=0)
                flx.Label(text='flex: 0 (collapses), sub-flexes: 1, 1, 1')
                with flx.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)
                flx.Label(text='flex: 1, sub-flexes: 1, 0, 2')
                with flx.HFix(flex=1):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=0)
                    Panel(text='C is a bit longer', flex=2)
                flx.Label(text='flex: 2, sub-flexes: 1, 2, 3')
                with flx.HFix(flex=2):
                    Panel(text='A', flex=1)
                    Panel(text='B', flex=2)
                    Panel(text='C is a bit longer', flex=3)
Ejemplo n.º 6
0
    def init(self, topic):

        self.server_name = topic.split("/")[1]
        self.service_name = "/" + self.server_name + "/start_stop"

        self.nodes = {}
        self.subscribe(topic, "rosmon_msgs/State", self.callback)
        self.list_container = flx.VBox(flex=1)
        with self.list_container:
            with flx.HBox(flex=1):
                self.expand = flx.Button(flex=0, text=">")
                self.label = flx.Label(flex=0, text=self.server_name + ":")
                self.launch_state = flx.Label(flex=0,
                                              text="IDLE",
                                              style='color: #F00;')
                #self.expand = flx.Button(text="Expand")
                flx.Widget(flex=1)
                self.start_stop = flx.Button(flex=0, text="Stop")
            self.base_layout = flx.VBox(flex=1, style='border:1px solid #777;')
            with self.base_layout:
                with flx.HFix():
                    flx.Label(text="Name")
                    flx.Label(text="State")
                    flx.Label(text="CPU")
                    flx.Label(text="Memory")
                    flx.Label(text="Restarts")
                    flx.Label(text="Action")
        self.base_layout.set_parent(None)
Ejemplo n.º 7
0
 def init(self, additional_style="width: 100%; height: 100%;"):
     with flx.VFix(flex=1, style=additional_style) as self.frame:
         with flx.VFix(flex=1) as self.page:
             self.custom = flx.VFix(flex=1, style="width: 100%; height: 100%; border: 5px solid green;")
             with flx.HFix(flex=1):
                 self.but = flx.Button(text="Replace by PyWidget2")
                 self.but_close = flx.Button(text="Close")
             self.input = flx.LineEdit(text="input")
Ejemplo n.º 8
0
    def init(self):

        with flx.VFix():
            flx.Widget(flex=1)
            with flx.HFix(flex=2):
                flx.Widget(flex=1)
                Drawing(flex=2)
                flx.Widget(flex=1)
            flx.Widget(flex=1)
Ejemplo n.º 9
0
    def init(self):
        # Put a label and some sliders deep in the hierarchy

        with flx.VBox():
            self.label = flx.Label()
            with flx.HFix(flex=1):
                for j in range(2):
                    with flx.VBox(flex=1):
                        for i in range(5):
                            flx.Slider(value=i / 5)
Ejemplo n.º 10
0
    def init(self):
        super().init()

        with flx.VBox():

            flx.Label(text='You should see 5 pairs of buttons')

            with flx.HFix():  # Use minsize in CSS of button widget
                with flx.GroupWidget(title='asdas'):
                    with flx.HFix():
                        flx.Button(text='foo')
                        flx.Button(text='bar')

            with flx.HFix(minsize=50):  # Set minsize prop on container
                flx.Button(text='foo')
                flx.Button(text='bar')

            with flx.HFix():  # Set minsize prop on widget
                flx.Button(text='foo', minsize=50)
                flx.Button(text='bar')

            with flx.HFix():  # Old school setting of style
                flx.Button(text='foo', style='min-height:50px;')
                flx.Button(text='bar', )

            with flx.Widget():  # Singleton widgets (e.g. custom classes)
                with flx.HFix():
                    flx.Button(text='foo')
                    flx.Button(text='bar')

            flx.Widget(flex=1, style='background:#f99;')  # spacer
Ejemplo n.º 11
0
 def init(self):
     with flx.VBox():
         with flx.VBox(style='border:1px solid #777;'):
             flx.Label(text='zhibo8数据采集')
             for i in range(10):
                 with flx.HFix(
                         flex=1,
                         style=
                         'border-bottom:1px solid #ddd; font-size: 14px;'):
                     self.b1 = flx.Label(flex=1, text='数据采集' + str(i))
                     self.b2 = flx.Label(flex=1,
                                         text='数据采集 world!' + str(i))
                     self.b3 = flx.Label(flex=1, text='Foo 数据采集' + str(i))
Ejemplo n.º 12
0
    def init(self, service_name):

        self.service_name = service_name
        self.node_name = ""
        self.node_ns = ""

        with flx.HFix():
            self.name = flx.Label(text="AA")
            self.state = flx.Label(text="BB")
            self.user_load = flx.Label(text="CC")
            self.memory = flx.Label(text="DD")
            self.restarts = flx.Label(text="EE")
            self.start_stop = flx.Button(text="Stop")
Ejemplo n.º 13
0
    def init(self):

        with flx.HFix():
            with flx.FormLayout() as self.form:
                self.b1 = flx.LineEdit(title='Name:', text='Hola')
                self.b2 = flx.LineEdit(title='Age:', text='Hello world')
                self.b3 = flx.LineEdit(title='Favorite color:', text='Foo bar')
                flx.Button(text='Submit')
            with flx.FormLayout() as self.form:
                self.b4 = flx.LineEdit(title='Name:', text='Hola')
                self.b5 = flx.LineEdit(title='Age:', text='Hello world')
                self.b6 = flx.LineEdit(title='Favorite color:', text='Foo bar')
                flx.Button(text='Submit')
                flx.Widget(flex=1)  # Add a spacer
Ejemplo n.º 14
0
 def init(self,
          width=4,
          height=4,
          path=lambda x, y: "/images/starting_image.png",
          handler=lambda o, x, y: print(x, y)):
     self.width = width
     self.height = height
     self.path = path
     self.handler = handler
     self.imageGrid = [[None for idy in range(height)]
                       for idx in range(width)]
     with flx.HFix():
         for idx in range(width):
             with flx.VFix(flex=1):
                 for idy in range(height):
                     self.imageGrid[idx][idy] = ClickableImage(path(
                         idx, idy),
                                                               flex=1)
                     a, b = idx, idy
                     self.imageGrid[idx][idy].node.addEventListener(
                         "click", self._on_click_handler(a, b))
Ejemplo n.º 15
0
    def init(self, py):
        self.py = py
        print(self.py)

        with flx.HFix(flex=3):
            with flx.VBox(title='leftside'):
                # Model para
                self.model_params = ModelParametersWidget(minsize=(300, 500),
                                                          maxsize=(300, 500))
                with flx.HBox():
                    self.run_button = flx.Button(text='RUN', flex=1)
                    self.stop_button = flx.Button(text='STOP', flex=1)
            flx.Widget(flex=1, maxsize=(20, 1000))
            with flx.VBox(title='rightside'):
                # algo param widget
                self.algo_params = AlgoParamWidget(minsize=(200, 200))

                # constants
                self.constant_params = ConstantsParamWidget(minsize=(200, 240))
                # paths
                self.path_params = PathsParamWidget(minsize=(120, 120))
Ejemplo n.º 16
0
    def init(self):
        self.t = time()

        with flx.HFix():
            self.label1 = flx.Label(flex=2,
                                    style='overflow-y:scroll; font-size:60%;')
            flx.Widget(flex=1)
            with flx.VFix(flex=2):
                flx.Widget(flex=1)
                test_widget1 = flx.Widget(flex=2, style='background: #afa;')
                flx.Widget(flex=1)
                test_widget2 = flx.Widget(flex=2, style='background: #faa;')
                flx.Widget(flex=1)
            flx.Widget(flex=1)
            self.label2 = flx.Label(flex=1,
                                    style='overflow-y:scroll; font-size:60%;')

        for name in [
                'pointerdown', 'pointermove', 'pointerup', 'pointercancel',
                'mousedown', 'mousemove', 'mouseup', 'click', 'dblclick',
                'touchstart', 'touchmove', 'touchend', 'touchcancel'
        ]:
            test_widget1.node.addEventListener(
                name, lambda e: self.show_event1(e.type))

        def reaction(*events):
            for ev in events:
                self.show_event2(ev.type)

        test_widget2.reaction(
            reaction,
            'pointer_down',
            'pointer_move',
            'pointer_up',
            'pointer_cancel',
            'pointer_click',
            'pointer_double_click',
        )
Ejemplo n.º 17
0
    def init(self):

        with flx.HFix():
            flx.Widget(flex=1)
            with flx.VBox(flex=0, style='min-width:200px'):
                with flx.GroupWidget(title='Plot options'):
                    flx.Label(text='Month')
                    self.month = flx.ComboBox(options=months,
                                              selected_index=12,
                                              style='width: 100%')
                    self.smoothing_label = flx.Label(text='Smoothing')
                    self.smoothing = flx.Slider(max=20,
                                                step=2,
                                                text='{value} samples')
                flx.Widget(flex=3)
            with flx.VBox(flex=4):
                self.plot = flx.PlotWidget(flex=1,
                                           xdata=years,
                                           yrange=(-5, 20),
                                           title='Average monthly temperature',
                                           xlabel='year',
                                           ylabel=u'temperature (°C)')
            flx.Widget(flex=1)