Exemple #1
0
    def get_ui_flags(self, desc):
        v = self.tcp_flags

        return UI.LayoutTableRow(
            UI.Label(text=desc),
            UI.Select(UI.SelectOption(text='Ignore',
                                      value='ign',
                                      selected=v[1] is None),
                      UI.SelectOption(text='Are',
                                      value='nrm',
                                      selected=not v[0] and v[1] is not None),
                      UI.SelectOption(text='Are not',
                                      value='inv',
                                      selected=v[0] and v[1] is not None),
                      name='tcpflags-mode'),
            UI.LayoutTableCell(UI.LayoutTable(
                UI.LayoutTableRow(
                    UI.Label(text='Check:'), *[
                        UI.Checkbox(text=x,
                                    name='tcpflags-vals[]',
                                    value=x,
                                    checked=x in v[2] if v[2] else False)
                        for x in self.flags
                    ]),
                UI.LayoutTableRow(
                    UI.Label(text='Mask:'), *[
                        UI.Checkbox(text=x,
                                    name='tcpflags-mask[]',
                                    value=x,
                                    checked=x in v[1] if v[1] else False)
                        for x in self.flags
                    ])),
                               colspan=2))
Exemple #2
0
 def get_ui_states(self, desc):
     v = self.state
     return UI.LayoutTableRow(
         UI.Label(text=desc),
         UI.Select(UI.SelectOption(text='Ignore',
                                   value='ign',
                                   selected=v[1] is None),
                   UI.SelectOption(text='Is',
                                   value='nrm',
                                   selected=not v[0] and v[1] is not None),
                   UI.SelectOption(text='Isn\'t',
                                   value='inv',
                                   selected=v[0] and v[1] is not None),
                   name='state-mode'),
         UI.LayoutTableCell(UI.LayoutTable(
             UI.LayoutTableRow(*[
                 UI.Checkbox(text=x,
                             name='state[]',
                             value=x,
                             checked=v[1] and x in v[1])
                 for x in self.states
             ])),
                            colspan=2))