コード例 #1
0
ファイル: split.py プロジェクト: umair-gujjar/flexx
    def init(self):

        with ui.HSplit():
            ui.Widget(style='background:#f00')
            with ui.VSplit():
                ui.Widget(style='background:#0f0')
                with ui.HSplit():
                    ui.Widget(style='background:#ff0')
                    with ui.VSplit():
                        ui.Widget(style='background:#f0f')
                        with ui.HSplit():
                            ui.Widget(style='background:#0ff')
                            ui.Widget(style='background:#00f')
コード例 #2
0
ファイル: video_viewer.py プロジェクト: umair-gujjar/flexx
    def init(self):

        with ui.HSplit():
            with ui.TreeWidget(max_selected=1, flex=1) as self.videolist:
                for name in sorted(videos):
                    ui.TreeItem(text=name)

            self.player = ui.VideoWidget(flex=5)
コード例 #3
0
    def init(self):

        with ui.HSplit(style='min-height:300px') as self.widget:
            self.plot1 = ui.BokehWidget.from_plot(p1, title='Scatter')
            with ui.VFix(title='Sine'):
                Controls()
                with ui.Widget(style='overflow-y:auto;', flex=1):
                    self.plot2 = ui.BokehWidget.from_plot(p2)
                    self.plot3 = ui.BokehWidget.from_plot(p3)
コード例 #4
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)
コード例 #5
0
ファイル: graphwatch.py プロジェクト: hobeika/graphwatch
    def init(self):

        with ui.VSplit():
            with ui.HFix(flex=0):
                self.previous = ui.Button(text="<-", disabled=True, flex=1)
                self.content = ui.Label(flex=0)
                self.next = ui.Button(text="->", disabled=True, flex=1)
            with ui.HSplit(flex=1, spacing=20):
                self.configure = flx.Widget(css_class="configure", flex=0)
                with ui.HFix(flex=1):
                    self.visjs = VisJS(
                        style="background-color: #dddddd;",
                        flex=1,
                    )
        self.refresh()
コード例 #6
0
ファイル: PanelDump.py プロジェクト: Mellanox/scapy-ui
 def init(self, v=0):
     self.pkt = None
     with ui.VBox():
         with ui.HBox():
             self.lbl_repr = flx.LineEdit(flex=1, css_class="pkt_dump", disabled=1)
             self.btn_toggle = flx.Button(text="-")
             self.btn_save = flx.Button(text='save pcap')
         with ui.VBox(flex=1) as self._cont:
             with ui.VSplit(flex=1, parent=None) as self.splt_v:
                 pass
             with ui.HSplit(flex=1) as self.splt_h:
                 self.txt_show = ui.MultiLineEdit(css_class="pkt_dump", flex=4)
                 self.txt_hex = ui.MultiLineEdit(css_class="pkt_dump", flex=6)
         self.splt = self.splt_h
         self.toggle_layout(v)    
コード例 #7
0
    def init(self):

        #self.b0 = ui.Button(self, 'This is behind the box layout')

        TEST = 3

        if TEST == 1:
            with ui.VBox(self, flex=1) as self.hbox1:
                self.b1 = ui.Button(text='Hola', flex=1)
                self.b2 = ui.Button(text='Hello world', flex=0)
                self.b2 = ui.Button(text='Hello world', flex=0)
                self.b2 = ui.Button(text='Hello world', flex=0)
                self.b3 = ui.Button(text='Foo bar', flex=1)

        if TEST == 2:
            with self:
                with ui.HBox():
                    ui.Widget(flex=1)

                    with ui.VBox(flex=0) as self.vbox:

                        ui.Label(text='Flex 0 0 0', flex=0)
                        with ui.HBox(flex=0) as self.hbox2:
                            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', flex=0)
                        with ui.HBox(flex=0) as self.hbox1:
                            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.Label(text='margin 10 (around layout)', flex=0)
                        with ui.HBox(flex=0, margin=10) as self.hbox2:
                            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='spacing 10 (inter-widget)', flex=0)
                        with ui.HBox(flex=0, spacing=10) as self.hbox2:
                            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.Widget(flex=1)
                        ui.Label(text='Note the spacer Widget above', flex=0)

        if TEST == 3:
            with ui.HBox(self, spacing=20):
                with ui.FormLayout() as self.form:
                    # todo: can this be written with one line per row?
                    # e.g. self.b1 = ui.Button(label='Name', text='Hola')
                    ui.Label(text='Name:')
                    self.b1 = ui.Button(text='Hola')
                    ui.Label(text='Age:')
                    self.b2 = ui.Button(text='Hello world')
                    ui.Label(text='Favorite color:')
                    self.b3 = ui.Button(text='Foo bar')
                with ui.FormLayout() as self.form:
                    # e.g. self.b1 = ui.Button(label='Name', text='Hola')
                    ui.Widget(flex=1)  # Add a flexer
                    ui.Widget()
                    ui.Label(text='Pet name:')
                    self.b1 = ui.Button(text='Hola')
                    ui.Label(text='Pet Age:')
                    self.b2 = ui.Button(text='Hello world')
                    ui.Label(text='Pet\'s Favorite color:')
                    self.b3 = ui.Button(text='Foo bar')
                    ui.Widget(flex=1)
                    ui.Widget()
        if TEST == 4:
            with ui.GridLayout(self) as self.grid:
                self.b1 = ui.Button(text='No flex', pos=(0, 0))
                self.b2 = ui.Button(text='Hola', pos=(1, 1), flex=(1, 1))
                self.b3 = ui.Button(text='Hello world',
                                    pos=(2, 2),
                                    flex=(2, 1))
                self.b4 = ui.Button(text='Foo bar', pos=(4, 4), flex=(1, 2))
                self.b5 = ui.Button(text='no flex again', pos=(5, 5))

        if TEST == 5:
            with ui.PinboardLayout(self) as self.grid:
                self.b1 = ui.Button(text='Stuck at (20, 20)', pos=(20, 30))
                self.b2 = ui.Button(text='Dynamic at (20%, 20%)',
                                    pos=(0.2, 0.2))
                self.b3 = ui.Button(text='Dynamic at (50%, 70%)',
                                    pos=(0.5, 0.7))

        if TEST == 6:
            with ui.HSplitter(self):
                ui.Button(text='Right A', min_size=(120, 0))
                ui.Button(text='Right B', min_size=(70, 0))
                ui.Button(text='Right C')
                # ui.Button(text='Right D', flex=2)
                # ui.Button(text='Right E', flex=2)
                # ui.Button(text='Right F', flex=2)

        if TEST == 7:
            with ui.HBox(self):
                ui.Button(text='Button in hbox', flex=0)
                with ui.HSplit(flex=1):
                    ui.Button(text='Button in splitter', min_size=(100, 0))
                    with ui.HBox(min_size=(100, 0)):
                        ui.Button(text='Right A',
                                  flex=0,
                                  css='background:#f00; padding:2em;')
                        ui.Button(text='Right B', flex=1)
                        ui.Button(text='Right C', flex=2)

        if TEST == 8:
            with ui.MenuBar(self):
                with ui.MenuItem(text='File'):
                    ui.MenuItem(text='New')
                    ui.MenuItem(text='Open')
                    ui.MenuItem(text='Save')
                with ui.MenuItem(text='Edit'):
                    ui.MenuItem(text='Cut')
                    ui.MenuItem(text='Copy')
                    ui.MenuItem(text='Paste')
コード例 #8
0
ファイル: WebUI.py プロジェクト: Brow71189/LaserPlotterGUI
 def init(self):
     with ui.VBox():
         with ui.HSplit(flex=3) as self.hsplit:
             self.tab_panel = TabPanel(flex=2)
             self.plot_panel = PlotPanel(flex=1)
         self.control_panel = ControlPanel(flex=1)