Ejemplo n.º 1
0
Archivo: deep.py Proyecto: silky/flexx
    def init(self):

        with ui.BoxPanel():

            with ui.BoxPanel():
                Deep1()
                Deep2()
                Deep3()

            with ui.BoxPanel(orientation='vertical'):
                Deep4()
                Deep5()
                Deep6()
Ejemplo n.º 2
0
    def init(self):

        with ui.VBox():

            ui.Label(text='Widgets in BoxPanels in a widget in a vbox')

            with ui.Widget(flex=1):
                with ui.BoxPanel(orientation='v'):
                    with ui.BoxPanel(orientation='h'):
                        Red(flex=1)
                        Red(flex=1)
                    with ui.BoxPanel(orientation='h'):
                        Red(flex=1)
                        Red(flex=1)
Ejemplo n.º 3
0
    def init(self):

        with ui.BoxPanel():
            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)
Ejemplo n.º 4
0
 def init(self):
     
     with ui.BoxPanel():
         with ui.FormLayout() as self.form:
             self.b1 = ui.Button(title='Name:', text='Hola')
             self.b2 = ui.Button(title='Age:', text='Hello world')
             self.b3 = ui.Button(title='Favorite color:', text='Foo bar')
         with ui.FormLayout() as self.form:
             self.b4 = ui.Button(title='Name:', text='Hola')
             self.b5 = ui.Button(title='Age:', text='Hello world')
             self.b6 = ui.Button(title='Favorite color:', text='Foo bar')
             ui.Widget(flex=1)  # Add a flexer
Ejemplo n.º 5
0
    def init(self):

        with ui.HBox():

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

                with ui.BoxLayout(flex=1, orientation='horizontal'):
                    ui.Button(text='Box A', flex=0)
                    ui.Button(text='Box B', flex=0)
                    ui.Button(text='Box C is a bit longer', flex=0)
                with ui.BoxLayout(flex=0, orientation='horizontal'):
                    ui.Button(text='Box A', flex=1)
                    ui.Button(text='Box B', flex=1)
                    ui.Button(text='Box C is a bit longer', flex=1)
                with ui.BoxLayout(flex=1, orientation='horizontal'):
                    ui.Button(text='Box A', flex=1)
                    ui.Button(text='Box B', flex=0)
                    ui.Button(text='Box C is a bit longer', flex=2)
                with ui.BoxLayout(flex=2, orientation='horizontal'):
                    ui.Button(text='Box A', flex=1)
                    ui.Button(text='Box B', flex=2)
                    ui.Button(text='Box C is a bit longer', flex=3)

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

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

                with ui.BoxPanel(flex=1, orientation='horizontal'):
                    ui.Button(text='Box A', flex=0)
                    ui.Button(text='Box B', flex=0)
                    ui.Button(text='Box C is a bit longer', flex=0)
                with ui.BoxPanel(flex=0, orientation='horizontal'):
                    ui.Button(text='Box A', flex=1)
                    ui.Button(text='Box B', flex=1)
                    ui.Button(text='Box C is a bit longer', flex=1)
                with ui.BoxPanel(flex=1, orientation='horizontal'):
                    ui.Button(text='Box A', flex=1)
                    ui.Button(text='Box B', flex=0)
                    ui.Button(text='Box C is a bit longer', flex=2)
                with ui.BoxPanel(flex=2, orientation='horizontal'):
                    ui.Button(text='Box A', flex=1)
                    ui.Button(text='Box B', flex=2)
                    ui.Button(text='Box C is a bit longer', flex=3)
Ejemplo n.º 6
0
 def init(self):
     
     #self.b0 = ui.Button(self, 'This is behind the box layout')
     
     TEST = 11
     
     if TEST == 0:
         ui.Button(text='Hola', flex=1)
         
     if TEST == 1:
         with ui.BoxPanel(flex=1) as self.hbox1:
             # self.b1 = ui.Widget(flex=1, style='background: #a22;', min_size=(100, 100), max_size=(500,0))
             # self.b2 = ui.Widget(flex=0, style='background: #2a2;', min_size=(100, 0), max_size=(500,0))
             # self.b3 = ui.Widget(flex=0, style='background: #22a;', min_size=(100, 0), max_size=(500,0))
             # self.b4 = ui.Widget(flex=1, style='background: #aaa;', min_size=(100, 0), max_size=(500,0))
             self.b1 = ui.Widget(flex=1, style='background: #a22; min-width:100px; max-width:500px')
             self.b2 = ui.Widget(flex=0, style='background: #2a2; min-width:100px; max-width:500px')
             self.b3 = ui.Widget(flex=0, style='background: #22a; min-width:100px; max-width:500px')
             self.b4 = ui.Widget(flex=1, style='background: #aaa; min-width:100px; max-width:500px')
     
     if TEST == 2:
         with self:
             with ui.HBox():
                 ui.Widget(flex=1)
                 
                 with ui.VBox(flex=1) as self.vbox:
                     
                     ui.Label(text='Flex 0 0 0', flex=0)
                     with ui.HBox(flex=0) as self.hbox1:
                         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.hbox2:
                         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 20 (around layout)', flex=0)
                     with ui.HBox(flex=0, margin=20) as self.hbox3:
                         self.b1 = ui.Button(text='Hola', flex=1)
                         self.b2 = ui.Button(text='Hello world', flex=1)
                         self.b3 = ui.Button(text='Foo bar', flex=1)
                     
                     ui.Label(text='spacing 20 (inter-widget)', flex=0)
                     with ui.HBox(flex=0, spacing=20) as self.hbox3:
                         self.b1 = ui.Button(text='Hola', flex=1)
                         self.b2 = ui.Button(text='Hello world', flex=1)
                         self.b3 = ui.Button(text='Foo bar', flex=1)
                     
                     ui.Widget(flex=1)
                     ui.Label(text='Note the spacer Widget above', flex=0)
     
     if TEST == 3:
         with ui.HBox(spacing=20):
             with ui.FormLayout() as self.form:
                 # e.g. self.b1 = ui.Button(label='Name', text='Hola')
                 self.b1 = ui.Button(title='Name:', text='Hola')
                 self.b2 = ui.Button(title='Age:', text='Hello world')
                 self.b3 = ui.Button(title='Favorite color:', 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
                 self.b1 = ui.Button(title='Name:', text='Hola')
                 self.b2 = ui.Button(title='Age:', text='Hello world')
                 self.b3 = ui.Button(title='Favorite color:', text='Foo bar')
                 ui.Widget(flex=1)
     if TEST == 4:
         with ui.GridPanel() 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.SplitPanel():
             ui.Widget(style='background:#aaa;')
             with ui.PinboardLayout() 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))
                 with ui.DockPanel(pos=(0.5, 0.5), size=(0.3, 0.3)) as self.d:
                     self.a = ui.Widget(style='background:#a00;')
                     self.b = ui.Widget(style='background:#0a0;')
                     self.c = ui.Widget(style='background:#00a;')
     
     if TEST == 6:
         with ui.SplitPanel():
             self.a = ui.Button(text='Right A', style='min-width:120px')
             self.b = ui.Button(text='Right B', style='min-width:70px')
             with ui.SplitPanel(orientation='v'):
                 self.c = ui.Button(text='Right C')
                 self.d = ui.Button(text='Right D')
                 with ui.DockPanel():
                     ui.Slider(title='slider')
                     ui.LineEdit(title='edit', text='AAA')
                     self.g = ui.ProgressBar(title='progress', value=0.4)
 
     if TEST == 7:
         with ui.HBox():
             ui.Button(text='Button in hbox', flex=0)
             with ui.SplitPanel(flex=1, orientation='v'):
                 ui.Button(text='Button in splitter', style='min-width:100px')
                 with ui.HBox(style='min-width:100px'):
                     ui.Button(text='Right A', flex=0, style='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')
     
     if TEST == 9:
         with ui.VBox():
             ui.Button(text='AAA', flex=0)
             with ui.SplitPanel(flex=1, orientation='v'):
                 ui.Button(text='CCC')
                 ui.Button(text='DDD')
                 self.e = ui.Button(text='EEE')
             ui.Button(text='BBB', flex=1)
                      
     if TEST == 10:
         with ui.TabPanel():
             self.a = ui.Widget(title='red', style='background:#a00;')
             self.b = ui.Widget(title='green', style='background:#0a0;')
             self.c = ui.Widget(title='blue', style='background:#00a;')
     
     if TEST == 11:
         with ui.BoxPanel(spacing=10):
             with ui.GridPanel() as self.g1:
                 self.a = ui.Widget(style='background:#a00;', pos=(0, 0), flex=1)
                 self.b = ui.Widget(style='background:#0a0;', pos=(1, 0))
                 self.c = ui.Widget(style='background:#00a; min-width:200px; min-height:200px', pos=(1, 1))
             with ui.GridPanel() as self.g2:
                 self.a = ui.Widget(style='background:#a00;', pos=(0, 0), flex=2)
                 self.b = ui.Widget(style='background:#0a0; max-width:100px;', pos=(1, 0), flex=1)
                 self.c = ui.Widget(style='background:#00a;', pos=(1, 1), flex=1)
     
     if TEST == 12:
         with ui.HBox():
             with ui.VBox():
                 self.buta = ui.Button(text='red')
                 self.butb = ui.Button(text='green')
                 self.butc = ui.Button(text='blue')
             with ui.StackedPanel(flex=1) as self.stack:
                     self.a = ui.Widget(style='background:#a00;')
                     self.b = ui.Widget(style='background:#0a0;')
                     self.c = ui.Widget(style='background:#00a;')
Ejemplo n.º 7
0
 def init(self):
     with ui.BoxPanel():
         ui.BokehWidget(plot=p1)
         ui.BokehWidget(plot=p2)