Esempio n. 1
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
Esempio n. 2
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
Esempio n. 3
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),
        })
Esempio n. 4
0
    def __init__(self):
        self.invert = False
        self.EChooser = TestEmbeddedChooserClass("E1", flags=Choose.CH_MULTI)
        Form.__init__(self, r"""STARTITEM {id:rNormal}
BUTTON YES* Yeah
BUTTON NO Nope
BUTTON CANCEL Nevermind
Form Test

{FormChangeCb}
This is a string:  |+{cStr1}+
This is an address:|+{cAddr1}+
This is some HTML: |+{cHtml1}+
This is a number:  |+{cVal1}+

<#Hint1#Enter text  :{iStr1}>
<#Hint2#Select color:{iColor1}>
Browse test
<#Select a file to open#Browse to open:{iFileOpen}>
<#Select a file to save#Browse to save:{iFileSave}>
<#Select dir#Browse for dir:{iDir}>
Misc
<##Enter a selector value:{iSegment}>
<##Enter a raw hex       :{iRawHex}>
<##Enter a character     :{iChar}>
<##Enter an address      :{iAddr}>
<##Write a type name     :{iType}>
Button test: <##Button1:{iButton1}> <##Button2:{iButton2}>

<##Check boxes##Error output:{rError}> | <##Radio boxes##Green:{rGreen}>
<Normal output:{rNormal}>              | <Red:{rRed}>
<Warnings:{rWarnings}>{cGroup1}>       | <Blue:{rBlue}>{cGroup2}>

<Embedded chooser:{cEChooser}>
The end!
""", {
            'cStr1': Form.StringLabel("Hello"),
            'cHtml1': Form.StringLabel("<span style='color: red'>Is this red?<span>", tp=Form.FT_HTML_LABEL),
            'cAddr1': Form.NumericLabel(0x401000, Form.FT_ADDR),
            'cVal1' : Form.NumericLabel(99, Form.FT_HEX),
            'iStr1': Form.StringInput(),
            'iColor1': Form.ColorInput(),
            'iFileOpen': Form.FileInput(open=True),
            'iFileSave': Form.FileInput(save=True),
            'iDir': Form.DirInput(),
            'iType': Form.StringInput(tp=Form.FT_TYPE),
            'iSegment': Form.NumericInput(tp=Form.FT_SEG),
            'iRawHex': Form.NumericInput(tp=Form.FT_RAWHEX),
            'iAddr': Form.NumericInput(tp=Form.FT_ADDR),
            'iChar': Form.NumericInput(tp=Form.FT_CHAR),
            'iButton1': Form.ButtonInput(self.OnButton1),
            'iButton2': Form.ButtonInput(self.OnButton2),
            'cGroup1': Form.ChkGroupControl(("rNormal", "rError", "rWarnings")),
            'cGroup2': Form.RadGroupControl(("rRed", "rGreen", "rBlue")),
            'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
            'cEChooser' : Form.EmbeddedChooserControl(self.EChooser)
        })
Esempio n. 5
0
    def __init__(self):
        Form.__init__(self, r"""STARTITEM 0
BUTTON YES* Yeah
BUTTON NO Nope
BUTTON CANCEL NONE
Form Test

{FormChangeCb}
<Multilinetext:{txtMultiLineText}>
""", {
            'txtMultiLineText': Form.MultiLineTextControl(text="Hello"),
            'FormChangeCb': Form.FormChangeCb(self.OnFormChange),
        })
    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()