Exemplo n.º 1
0
 def init(self):
     with flx.VSplit():
         with flx.HSplit():
             CollisionWidget()
             CollisionWidget()
         with flx.HSplit():
             CollisionWidget()
             CollisionWidget()
Exemplo n.º 2
0
    def init(self):
        with flx.VBox(
                style='border:2px solid gray;border-radius: 5px; align:left'):
            with flx.VBox(style='border:2px solid gray;border-radius: 5px'):
                with flx.HSplit(flex=1, style='text-align:left;'):
                    ui.Label(text='vxlan encap data:')
                    ui.Label(text='eth src:')
                    self.eth_src = ui.LineEdit(text='0')
                    ui.Label(text='eth dst:')
                    self.eth_dst = ui.LineEdit(text='0')
                    ui.Label(text='eth type:')
                    self.eth_type = ui.LineEdit(text='0x0800')
                    ui.Label(text='ip src:')
                    self.ip_src = ui.LineEdit(text='0')
                    ui.Label(text='ip dst:')
                    self.ip_dst = ui.LineEdit(text='0')
                    ui.Label(text='udp src:')
                    self.udp_src = ui.LineEdit(text='0')
                    ui.Label(text='udp dst:')
                    self.udp_dst = ui.LineEdit(text='4789')
                    ui.Label(text='vni:')
                    self.vni = ui.LineEdit(text='123')
                with flx.HBox():
                    self.encap_disp = ui.Label(text='encap_data:')
            with flx.HSplit():
                self.smacs = flx.CheckBox(text="set_mac_src", flex=2)
                self.smacs_v = ui.LineEdit(text='192.168.1.2', flex=2)
                self.smacd = flx.CheckBox(text="set_mac_dst", flex=2)
                self.smacd_v = ui.LineEdit(text='192.168.1.5', flex=2)
                self.sip4s = flx.CheckBox(text="set_ipv4_src", flex=2)
                self.sip4s_v = ui.LineEdit(text='192.168.1.2', flex=2)
                self.sip4d = flx.CheckBox(text="set_ipv4_dst", flex=2)
                self.sip4d_v = ui.LineEdit(text='192.168.1.5', flex=2)
                self.stps = flx.CheckBox(text="set_tp_src", flex=2)
                self.stps_v = ui.LineEdit(text='3456', flex=1)
                self.stpd = flx.CheckBox(text="set_tp_dst", flex=2)
                self.stpd_v = ui.LineEdit(text='3446', flex=1)
            with flx.HBox():
                self.cnt = flx.CheckBox(text="count")
                self.decap = flx.CheckBox(text="vxlan_decap")
                self.encap = flx.CheckBox(text="vxlan_encap")

                self.stag = flx.CheckBox(text="set_tag")
                self.stag_v = ui.LineEdit(text='12')

                self.fate = ui.ComboBox(editable=True,
                                        selected_key='jump',
                                        options=('jump', 'drop', 'rss',
                                                 'queue', 'port id'))
                self.fate_v = ui.LineEdit(text='2')
                self.add = flx.Button(text='add')
            with flx.HBox():
                self.flow_detail = ui.Label(text="Flow to be added")
Exemplo n.º 3
0
    def init(self):

        with flx.HSplit():
            flx.Widget(style='background:#f00')
            with flx.VSplit():
                flx.Widget(style='background:#0f0')
                with flx.HSplit():
                    flx.Widget(style='background:#ff0')
                    with flx.VSplit():
                        flx.Widget(style='background:#f0f')
                        with flx.HSplit():
                            flx.Widget(style='background:#0ff')
                            flx.Widget(style='background:#00f')
Exemplo n.º 4
0
 def init(self, py):
     self.py = py
     self.file_name = flx.StringProp('')
     self.file_input = FileInput()
     with flx.VBox():
         flx.Label(style="background:#cfc;", wrap=1, text="")
         with flx.HSplit(flex=1):
             with flx.VBox(style="border:1px solid #777;", ):
                 flx.Label(text="Properties Tree")
                 self.tree = TreeWithControls(py, flex=1, max_selected=1)
             with flx.VBox(style="border:1px solid #777;"):
                 flx.Label(text="Property", style="")
                 with flx.VBox(flex=1):
                     with flx.VBox(flex=1, style=""):
                         self.combo = ui.ComboBox(editable=True, options=())
                         self.field = ui.LineEdit(
                             placeholder_text="type here")
                         with flx.HBox(flex=1, style="max-height: 20px;"):
                             self.pick_file = ui.Button(text='...')
                             self.do_upload = ui.Button(text='Upload',
                                                        disabled=True)
                     with flx.VBox(flex=5):
                         flx.Label(text="Info", style="")
                         self.info = flx.Label(
                             text="", style="white-space: pre-line;")
                 with flx.VBox(style="border:1px solid #777;", flex=1):
                     flx.Label(text="Raw", style="")
                     self.rawLabel = flx.Label(
                         text="", style="white-space: pre-line;")
         self.update_btn = ui.Button(text="Apply", style="width: 100px;")
Exemplo n.º 5
0
 def init(self):
     
     with flx.HSplit():
         with flx.TreeWidget(max_selected=1, flex=1) as self.videolist:
             for name in sorted(videos):
                 flx.TreeItem(text=name)
         
         self.player = flx.VideoWidget(flex=5)
Exemplo n.º 6
0
    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)
Exemplo n.º 7
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')
Exemplo n.º 8
0
    def init(self):

        # Create our store instance
        self._mutate_store(Store())

        # Imagine this being a large application with many sub-widgets,
        # and the UserInput and SomeInfoWidget being used somewhere inside it.
        with flx.HSplit():
            UserInput()
            flx.Widget(style='background:#eee;')
            SomeInfoWidget()
Exemplo n.º 9
0
 def init(self):
     self.f*g = F*g()
     self.cnt = 0
     self.flag = 0
     self.ql = []
     self.num = 0
     # self.apply_style('overflow-y: scroll;')  # enable scrolling
     with flx.VBox() as self.vb1:
         with flx.HSplit() as self.hb1:
             self.lb1 = flx.Label(text='题目数量:')
             self.le1 = flx.LineEdit(placeholder_text='输入题目数量,不要超过1000')
             self.b1 = flx.Button(text='产生题目')
             self.b2 = flx.Button(text='导出题目')
             self.b3 = flx.Button(text='开始答题')
         with flx.HSplit() as self.hb2:
             self.lb2 = flx.Label(text='输入答案: ')
             self.le2 = flx.LineEdit(placeholder_text='输入你的答案')
             self.lb3 = flx.Label(text='提示框:')
             self.le3 = flx.LineEdit()
         self.le4 = flx.Label()
Exemplo n.º 10
0
 def init(self):
     with flx.HSplit():
         with flx.VBox(flex=1):
             self.summary = flx.TreeWidget(flex=1, max_selected=1)
         with flx.VSplit(flex=1):
             with flx.GroupWidget(css_class="list", flex=6, title="Detail"):
                 self.detail = flx.Label(flex=1, css_class="detail")
                 self.detail.set_wrap(2)
             with flx.GroupWidget(css_class="list", flex=4,
                                  title="hexdump"):
                 self.hexdump = flx.Label(flex=1, css_class="detail")
                 self.hexdump.set_wrap(1)
Exemplo n.º 11
0
 def init(self, model, module_list, file_list):
     self.model = model
     self.connection_list = []
     self.running = False
     with flx.HSplit():
         with flx.Widget(flex=3):
             self.mpane = ModulePane(self)
         with flx.Widget(flex=1):
             self.menu = MenuPane(self,
                                  self.mpane,
                                  module_list,
                                  file_list,
                                  style="height:100%;")
    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)
Exemplo n.º 13
0
 def init(self):
     self.box = []
     with flx.HSplit(flex=1,
                     style='border:2px solid gray;border-radius: 5px'):
         with flx.VBox(flex=1):
             flx.Label(text=' ', flex=1)
             flx.Label(text='Device List', flex=1)
             flx.Label(text=' ', flex=1)
         with flx.VBox(flex=3):
             for i, dev in enumerate(self.root.interface_list):
                 txt = " PCI_ID: " + self.root.pci_list[
                     i] + " mac: " + self.root.mac_list[i].upper(
                     ) + "Interface: " + dev
                 self.box.append(flx.CheckBox(text=txt))
Exemplo n.º 14
0
 def init(self):
     with flx.HSplit():
         with flx.TreeWidget(flex=1, max_selected=1) as self.tree:
             for t in ['foo', 'bar', 'spam', 'eggs']:
                 with flx.TreeItem(text=t, checked=None):
                     for i in range(4):
                         item2 = flx.TreeItem(text=t + ' %i' % i,
                                              checked=False)
                         if i == 2:
                             with item2:
                                 flx.TreeItem(title='A',
                                              text='more info on A')
                                 flx.TreeItem(title='B',
                                              text='more info on B')
Exemplo n.º 15
0
    def init(self):
        self.nsamples = 200
        self.start_time = time()
        self.status = flx.Label(text='...')
        self.plot_num = 3
        self.plot = []
        self.plot_combobox = []
        self.plot_label = []
        self.plot_latest_val = []
        self.latest_params_names = {}
        self.latest_params_values = {}


        with flx.HSplit(flex=1):
            with flx.GroupWidget(flex=1, title="Plot options", minsize=(270,0)):  
                    with flx.VBox():
                        self.buttons = {}
                        button_list = list(SolarData.commands.keys())
                        for button_name in button_list:
                            with flx.HBox():    
                                self.buttons[button_name] = flx.Button(text=button_name)
                                setattr(self.buttons[button_name],'button_action', button_name)
                                self.buttons[button_name].reaction(self._on_button_pressed, 'pointer_click')
                                self.buttons[button_name].reaction(self._on_button_down, 'pointer_down')
                                self.buttons[button_name].reaction(self._on_button_up, 'pointer_up')
                                flx.Widget(flex=1)

                        for i in range(0, self.plot_num):
                            with flx.HBox():
                                self.plot_combobox[i] = flx.ComboBox(options=list(SolarData.params.keys()), editable=False, selected_index=i) 
                                self.plot_combobox[i].reaction(self.combobox_changed, 'user_selected')
                                self.plot_label[i] = flx.Label(text='Value:')
                                self.plot_latest_val[i] = flx.Label(text='')
                                flx.Widget(flex=1)

                        for i in range(0, len(SolarData.params.keys())):
                            with flx.HBox():
                                name = list(SolarData.params.keys())[i]
                                self.latest_params_names[name] = flx.Label(text='{0}:'.format(name))
                                self.latest_params_values[name] = flx.Label(text='NaN')
                                flx.Widget(flex=1)

                        flx.Widget(flex=1)

            with flx.VBox(flex=4):
                for i in range(0, self.plot_num):
                    self.plot[i] = flx.PlotWidget(flex=1, minsize=(270,0), style='width: 640px; height: 320px;',xdata=[], yrange=(0, 100),ylabel='Plot ' + str(i+1))
                    self.update_plot_range(i)
Exemplo n.º 16
0
 def init(self):
     with FocusBox(flex=1, title="Scapy GUI", tabindex=0) as self.pnl_app:
         with flx.HBox():
             flx.Label(html=title_html, css_class="status")
             self.lbl_status = flx.Label(text='...', flex=1, css_class="status")
             self.btn_back = flx.Button(text="Apply & Back", disabled = 1, css_class = "disabled")
         with flx.VBox(flex=1) as self.pnl_root:
             with flx.HSplit(flex=1) as self.pnl_main:
                 with flx.VBox(flex=2):
                     flx.Label(html=logo_html)
                     self.pnl_config = PanelConfig(flex=1)
                 with flx.VBox(flex=8):
                     self.pnl_source = PanelSource() 
                     self.pnl_tx = PanelTx(flex=15)
             self.pnl_active = self.pnl_main
             self.pnl_rx = PanelRx(flex=1)
             self.pnl_rx.set_parent(None)
             self.pnl_browser = PanelBrowser(flex=1)
             self.pnl_browser.set_parent(None)
     self.load_config("test", [["Ether", {}], ["IP", {}], ["Raw", {"load":"'abcd'"}]])
Exemplo n.º 17
0
 def init(self):
     global main
     main = self
     global url
     url = window.location['origin']
     print(url)
     self.update_screen_list()
     self.update_media_list()
     global is_admin
     is_admin = self.send_request('GET', url + '/auth', '').responseText == 'admin'
     with flx.FormLayout():
         with flx.HSplit():
             self.logout = flx.Button(title='logout', text='Logout', flex=1)
             flx.Widget(flex=5)
             self.new_dashboard = flx.Button(title='new_dashboard', text='New Dashboard', flex=1)
         with flx.TabLayout(flex=5):
             EditDisplay(title='Edit a Display')
             Defaults(title='Modify Defaults')
             if is_admin:
                 Events(title='Modify Events')
                 System(title='System')
         self.edit_media = EditMedia(flex=2)
Exemplo n.º 18
0
 def init(self):
     with flx.HSplit():
         flx.Button(text='foo')
         with flx.VBox():
             flx.Widget(style='background:red;', flex=1)
             flx.Widget(style='background:blue;', flex=1)