示例#1
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 blue;")
             self.but = flx.Button(text="Swap back to a PyWidget1")
示例#2
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))
示例#3
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")
示例#4
0
 def init(self):
     with flx.VFix(flex=1) as self.frame_layout:
         self.dynamic = flx.DynamicWidgetContainer(
             style="width: 100%; height: 100%; border: 5px solid black;",
             flex=1)
         self.but = flx.Button(
             text="Instanciate a PyWidget1 in the dynamic container")
示例#5
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)
示例#6
0
 def init(self):
     self.layer_list = []
     with ui.VFix(flex=18):
         PanelLayers(css_class="title")
         with ui.VSplit(flex=1):
             with flx.VBox() as self.__cont:
                 self._cont = flx.VFix(flex=1)
             self.pnl_dump = PanelDump(0, flex=1)
         self.pnl_send = PanelSend()
    def init(self):

        with flx.HSplit(minsize=300) as self.widget:
            self.plot1 = flx.BokehWidget.from_plot(p1, title='Scatter')
            with flx.VFix(title='Sine'):
                Controls()
                with flx.Widget(style='overflow-y:auto;', flex=1):
                    self.plot2 = flx.BokehWidget.from_plot(p2)
                    self.plot3 = flx.BokehWidget.from_plot(p3)
    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')
示例#9
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))
示例#10
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',
        )