Пример #1
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;")
Пример #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")
Пример #3
0
 def init(self):
     with ui.VBox():
         with ui.HFix():
             ui.Label(text="Port:", flex=2)
             iface = self.root.pnl_config.get_section_config("common", "iface", "lo")
             self.lst_ifnames = ui.ComboBox(editable=False, options=ifnames, selected_key=iface, flex=2)
             ui.Label(text=" ", flex=3)
             ui.Label(text='Count:', flex=2)
             self.txt_count = ui.LineEdit(text='1', flex=2)
             ui.Label(text=" ", flex=3)
             ui.Label(text='Interval(ms):', flex=3)
             self.txt_interval = ui.LineEdit(text='0', flex=2)
             ui.Label(text=" ", flex=3)
             self.btn_send = ui.Button(text='(S)end', flex=2)
Пример #4
0
    def init(self):

        combo_options = ['Paris', 'New York', 'Enschede', 'Tokio']

        with ui.HBox():
            self.tree = TreeWithControls(flex=1, max_selected=1)
            self.combo = ui.ComboBox(flex=1,
                                     options=combo_options,
                                     editable=True)

        with self.tree:
            for cat in ('foo', 'bar', 'spam'):
                with ui.TreeItem(text=cat):
                    for name in ('Martin', 'Kees', 'Hans'):
                        item = ui.TreeItem(title=name)
                        item.checked = cat == 'foo' or None
Пример #5
0
 def init(self):
     self.box = []
     with flx.VBox(flex=1,
                   style='border:2px solid gray;border-radius: 5px'):
         flx.Label(text='Add flow', flex=1, style='text-align:center')
         with flx.HBox(style='border:2px solid gray;border-radius: 5px'):
             ui.Label(text='attr:')
             self.attr = ui.ComboBox(editable=True,
                                     selected_key='ingress',
                                     options=('ingress', 'egress',
                                              'transfer'))
             ui.Label(text='port_id:')
             self.port_id = ui.LineEdit(text='0')
             ui.Label(text='group:')
             self.group_id = ui.LineEdit(text='1')
         self.item = ItemBox()
         self.action = ActionBox()
Пример #6
0
 def init(self):
     
     with ui.HFix():
         ui.Widget(flex=1)
         with ui.VBox(flex=0, style='min-width:200px'):
             with ui.GroupWidget(title='Plot options'):
                 ui.Label(text='Month')
                 self.month = ui.ComboBox(options=months, selected_index=12, style='width: 100%')
                 self.smoothing_label = ui.Label(text='Smoothing')
                 self.smoothing = ui.Slider(max=20, step=2, text='{value} samples')
             ui.Widget(flex=3)
         with ui.VBox(flex=4):
             self.plot = ui.PlotWidget(flex=1,
                                       xdata=years, yrange=(-5, 20),
                                       title='Average monthly temperature',
                                       xlabel='year', ylabel=u'temperature (°C)')
         ui.Widget(flex=1)
Пример #7
0
 def init(self):
     self.pattern = "pattern "
     with flx.VBox(flex=1,
                   style='border:2px solid gray;border-radius: 5px'):
         with flx.HBox(flex=0):
             ui.Label(text='pattern:')
             self.item = ui.ComboBox(editable=True,
                                     selected_key='eth',
                                     options=('eth', 'ipv4', 'ipv6', 'tcp',
                                              'udp', 'vlan', 'vxlan',
                                              'tag'))
             self.al = ui.Label(text='src:')
             self.av = ui.LineEdit(text='1')
             self.am = ui.Label(text='src_mask:')
             self.amv = ui.LineEdit(text='1')
             self.bl = ui.Label(text='dst:')
             self.bv = ui.LineEdit(text='1')
             self.bm = ui.Label(text='dst_mask:')
             self.bmv = ui.LineEdit(text='1')
             self.add = flx.Button(text='add')
             self.cl = flx.Button(text='clear')
         with flx.HBox():
             self.showitem = ui.Label(text="No pattern")
Пример #8
0
    def init(self):
        def head_table(table):
            with table:
                with ui.html.thead():
                    with ui.html.tr():
                        ui.html.th(text="track")
                        ui.html.th(text="title")
                        ui.html.th(text="album")
                        ui.html.th(text="artist")
                with ui.html.tfoot():
                    with ui.html.tr():
                        ui.html.th(text="track")
                        ui.html.th(text="title")
                        ui.html.th(text="album")
                        ui.html.th(text="artist")

        self.progress = ui.ProgressBar(value=0, flex=0, style="display: none;")
        with ui.TabPanel(flex=0.9) as self.tab:
            with ui.HBox(title="Search") as self.search_widget:
                with ui.VBox(flex=0.3):
                    ui.Label(style="font-size: 0.5em;",
                             text="A and B => A/B; A or B => A , B")
                    with ui.HBox(flex=0.1):
                        ui.Label(text="Query", flex=0)
                        self.search_query = ui.LineEdit(text="", flex=1)
                    self.search_button = ui.Button(text="Search", flex=0.5)
                    with ui.HBox(flex=0.5):
                        self.put_to_cache = ui.Button(text="Put to cache")
                        self.select_all = ui.Button(text="Select all")
                        self.select_none = ui.Button(text="Select none")
                with ui.Layout(css_class="table", flex=0.7):
                    self.search_results = ui.html.table()
                    head_table(self.search_results)

            with ui.HBox(title="Play"):
                with ui.VBox(flex=0.1):
                    with ui.HBox():
                        ui.Label(text="cache", flex=0)
                        self.cache_list = ui.ComboBox(editable=True, flex=1)
                    with ui.HBox(flex=0.1):
                        self._reset_cache = ui.Button(text="↻", flex=0.2)
                        self.remove = ui.Button(text="🗑", flex=0.1)
                    with ui.HBox(flex=1):
                        self.play_button = ui.Button(text="▶☛", flex=0.2)
                        self.show_button = ui.Button(text="☝", flex=0.1)
                    with ui.HBox(flex=0.1):
                        self.toggle_button = ui.ToggleButton(text="▶",
                                                             flex=0.2)
                        self.shuffle_button = ui.ToggleButton(text="🎲",
                                                              flex=0.2)
                        self.repeat_button = ui.ToggleButton(text="🔁",
                                                             flex=0.1)
                    with ui.HBox(flex=0.2):
                        self.prev_button = ui.Button(text="⏮", flex=0.7)
                        self.seekbackward_button = ui.Button(text="⏪",
                                                             flex=0.2)
                        self.seekforward_button = ui.Button(text="⏩", flex=0.2)
                        self.next_button = ui.Button(text="⏭", flex=0.7)
                    ui.Label(text="Speed")
                    with ui.HBox(flex=0.2):
                        self.slower = ui.Button(text="-", flex=0.7)
                        self.playback_rate = ui.LineEdit(text="1",
                                                         style="width: 2em;")
                        self.faster = ui.Button(text="+", flex=0.7)
                with ui.Layout(css_class="table", flex=0.6):
                    self.cache = ui.html.table(flex=0.5)
                    head_table(self.cache)
            with ui.FormLayout(title="Cache"):
                self.clear_cache = ui.Button(text="Clear cache", flex=0)
                self.remove_cache = ui.Button(text="Remove cache", flex=0)
                with ui.HBox(flex=0):
                    self.estimate = ui.Label()
                    self.update_estimate = ui.Button(text="Update estimate")
                    self.quota_request = ui.LineEdit(text="100")
                    self.quota_request_button = ui.Button(text="Request quota")
                with ui.HBox(flex=0):
                    self.cache_old_name = ui.Label()
                    self.cache_new_name = ui.LineEdit(text="")
                    self.rename_cache = ui.Button(text="Rename cache", flex=0)
            with ui.FormLayout(title="Config"):
                self.update = ui.Button(text="Update", flex=1)
                self._beet_url = ui.LineEdit(title="Beet url")
                self._beet_username = ui.LineEdit(title="Username")
                self._beet_password = ui.LineEdit(title="Password",
                                                  password_mode=True)
        with ui.HBox(flex=0):
            self.audio = ui.html.audio(flex=1)
        with ui.HBox(flex=0):
            self.time_min = ui.Label(text="15", flex=0.1)
            ui.Label(text="min", flex=0.1)
            self.time_sec = ui.Label(text="00", flex=0.1)
            ui.Label(text="s", flex=0.1)
            self.timeminus = ui.Button(text="-1", flex=0.5)
            self.timeplus = ui.Button(text="+1", flex=0.5)
            self.run_timer = ui.ToggleButton(text="Run", flex=0.5)
            self.timereset = ui.Button(text="Reset", flex=0.5)