Exemple #1
0
    def __init__(self):
        self.__n = 0
        Form.__init__(self,
r"""BUTTON YES* Yeah
BUTTON NO Nope
BUTTON CANCEL NONE
Dropdown list test

{FormChangeCb}
<Dropdown list (readonly):{cbReadonly}> <Add element:{iButtonAddelement}> <Set index:{iButtonSetIndex}>
<Dropdown list (editable):{cbEditable}> <Set string:{iButtonSetString}>
""", {
            'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
            'cbReadonly': Form.DropdownListControl(
                        items=["red", "green", "blue"],
                        readonly=True,
                        selval=1),
            'cbEditable': Form.DropdownListControl(
                        items=["1MB", "2MB", "3MB", "4MB"],
                        readonly=False,
                        selval="4MB"),
            'iButtonAddelement': Form.ButtonInput(self.OnButtonNop),
            'iButtonSetIndex': Form.ButtonInput(self.OnButtonNop),
            'iButtonSetString': Form.ButtonInput(self.OnButtonNop),
        })
Exemple #2
0
            def __init__(self, signatures_root, projects, current):
                description = '''
                <h2>Project Selector</h2>
                <div>
                Select project you wish to work on from your
                signatures root:
                </div>
                <div><pre>{}</pre></div>
                <div><i>(Note: You may change this in config.ini)</i></div>
                <div>
                    <a href="https://github.com/doronz88/fa#projects">
                    For more info</a>
                </div>
                '''.format(signatures_root)

                Form.__init__(self,
                              r"""BUTTON YES* OK
                              FA Project Select
                              {{FormChangeCb}}
                              {{StringLabel}}
                              <Set Project :{{cbReadonly}}>
                              """.format(signatures_root), {
                                  'FormChangeCb':
                                      Form.FormChangeCb(self.OnFormChange),
                                  'cbReadonly':
                                      Form.DropdownListControl(
                                          items=projects,
                                          readonly=True,
                                          selval=projects.index(current)
                                          if current in projects else 0),
                                  'StringLabel':
                                      Form.StringLabel(description,
                                                       tp=Form.FT_HTML_LABEL),
                              })
                self.__n = 0
Exemple #3
0
            def __init__(self, signatures_root, use_template):
                description = '''
                <h2>Settings</h2>
                <div>
                Here you can change global FA settings.
                </div>
                <div>
                    <a href="https://github.com/doronz88/fa">
                    For more info</a>
                </div>
                '''

                Form.__init__(self,
                              r"""BUTTON YES* Save
                              FA Settings
                              {{FormChangeCb}}
                              {{StringLabel}}
                              <Signatures root :{{signaturesRoot}}>
                              <Temp signature generation :{{signatureGeneration}}>
                              """.format(signatures_root), {
                                  'FormChangeCb':
                                      Form.FormChangeCb(self.OnFormChange),
                                  'signaturesRoot':
                                      Form.DirInput(value=signatures_root),
                                  'StringLabel':
                                      Form.StringLabel(description,
                                                       tp=Form.FT_HTML_LABEL),
                                  'signatureGeneration':
                                      Form.DropdownListControl(
                                          items=['Default',
                                                 'Using function bytes'],
                                          readonly=True,
                                          selval=use_template),
                              })
                self.__n = 0
    def __init__(self, manager):
        self.cnn = manager.connector
        self.configuration = manager.configuration
        self.listView = ConnectionListView(manager)

        apps = self.configuration['apps'].keys()
        app_default = self.configuration['default-app']

        if app_default is not None:
            default_index = apps.index(app_default)

        else:
            default_index = 0

        # indent matters:
        Form.__init__(
            self, r"""BUTTON YES* OK 
BUTTON CANCEL NONE 
Kam1n0 - Manage connections
{FormChangeCb}
Manage Connections:
<(Click to edit):{fvChooser}>
<Remove :{btnRemove}> Remove selected connection.
<App URL  :{txtServer}>
Login Info:
<User     :{txtUser}>
<Password :{txtPw}>
<Update / Add:{btnUpdate}>
<Threshold:{txtSim}>
<Top-K    :{txtTopK}>
<Avoid Same Binary  :{chkSameBin}>{chkGroup}>
<Connector:{dpCnn}>
""", {
                'fvChooser':
                Form.EmbeddedChooserControl(self.listView),
                'FormChangeCb':
                Form.FormChangeCb(self.OnFormChange),
                'txtServer':
                Form.StringInput(swidth=60, tp=Form.FT_ASCII),
                'txtUser':
                Form.StringInput(swidth=60, tp=Form.FT_ASCII),
                'txtPw':
                Form.StringInput(swidth=60, tp=Form.FT_ASCII),
                'btnRemove':
                Form.ButtonInput(self.OnButtonRemove),
                'btnUpdate':
                Form.ButtonInput(self.OnButtonUpdate),
                'txtSim':
                Form.StringInput(swidth=45,
                                 tp=Form.FT_ASCII,
                                 value=str(
                                     self.configuration['default-threshold'])),
                'txtTopK':
                Form.StringInput(swidth=45,
                                 tp=Form.FT_ASCII,
                                 value=str(
                                     self.configuration['default-topk'])),
                'chkGroup':
                Form.ChkGroupControl(("chkSameBin", "")),
                'dpCnn':
                Form.DropdownListControl(swidth=60,
                                         width=60,
                                         selval=default_index,
                                         items=apps,
                                         readonly=True)
            })
        self.Compile()