def __init__(self, manager):
        self.cnn = manager.connector
        self.Kconf = manager.Kconf
        self.listView = ConnectionListView(manager)

        dpItems = self.Kconf['cnns'].keys()
        if self.Kconf['default-cnn'] is not None:
            defaultIndex = self.Kconf['cnns'].keys().index(
                self.Kconf['default-cnn'])

        else:
            defaultIndex = 0

        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.
<Protocol :{txtProtocol}>
<Server   :{txtServer}>
<Port     :{txtPort}>
Login Info:
<User     :{txtUser}>
<Password :{txtPw}>
<Update / Add:{btnUpdate}>
<Default threshold :{txtSim}>
<Default top-K     :{txtTopK}>
<Default connector :{dpCnn}>
<  >
""", {
                'fvChooser':
                Form.EmbeddedChooserControl(self.listView),
                'FormChangeCb':
                Form.FormChangeCb(self.OnFormChange),
                'txtServer':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'txtProtocol':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'txtPort':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'txtUser':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'txtPw':
                Form.StringInput(swidth=30, tp=Form.FT_ASCII),
                'btnRemove':
                Form.ButtonInput(self.OnButtonRemove),
                'btnUpdate':
                Form.ButtonInput(self.OnButtonUpdate),
                'txtSim':
                Form.StringInput(swidth=25,
                                 tp=Form.FT_ASCII,
                                 value=str(self.Kconf['default-threshold'])),
                'txtTopK':
                Form.StringInput(swidth=25,
                                 tp=Form.FT_ASCII,
                                 value=str(self.Kconf['default-topk'])),
                'dpCnn':
                Form.DropdownListControl(swidth=45,
                                         width=45,
                                         selval=defaultIndex,
                                         items=dpItems,
                                         readonly=True)
            })
        self.Compile()
예제 #2
0
    def __init__(self):
        self.invert = False
        self.EChooser = TestEmbeddedChooserClass("E1", flags=Choose2.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}+

Escape\{control}
This is a string: '{cStr2}'
This is a number: {cVal1}

<#Hint1#Enter name:{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}>
Type
<#Select type#Write a type:{iType}>
Numbers
<##Enter a selector value:{iSegment}>
<##Enter a raw hex:{iRawHex}>
<##Enter a character:{iChar}>
<##Enter an address:{iAddr}>
Button test
<##Button1:{iButton1}> <##Button2:{iButton2}>

Check boxes:
<Error output:{rError}>
<Normal output:{rNormal}>
<Warnings:{rWarnings}>{cGroup1}>

Radio boxes:
<Green:{rGreen}>
<Red:{rRed}>
<Blue:{rBlue}>{cGroup2}>
<Embedded chooser:{cEChooser}>
The end!
""", {
                'cStr1': Form.StringLabel("Hello"),
                'cStr2': Form.StringLabel("StringTest"),
                '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)
            })
예제 #3
0
    def __init__(self, modules, recentOnEnter, recentOnLeave):
        Form.__init__(
            self, r"""STARTITEM {id:module}
BUTTON YES* Save
BUTTON CANCEL Cancel
Arbitrary Hook

                        !!! MAKE SURE YOU KNOW WHAT YOU ARE DOING HERE !!!

<Module\: :{module}> <##Address\::{address}>
<##Comment\::{comment}>

<Instruction:{set_inst}><Function:{set_func}>{hook_type}><Once:{set_once}><Permanent:{set_perm}>{trigger}>

Recent onEnter script file:{src_file_enter}
<##onEnter script\::{script_enter}>
<##Load from file:{loadfile_enter}><##Update from file:{update_enter}>
Recent onLeave script file:{src_file_leave}
<##onLeave script\::{script_leave}>
<##Load from file:{loadfile_leave}><##Update from file:{update_leave}>
""", {
                'module':
                Form.DropdownListControl(items=modules,
                                         readonly=True,
                                         selval=0,
                                         swidth=20,
                                         width=20),
                'address':
                Form.NumericInput(swidth=20, tp=Form.FT_HEX),
                'comment':
                Form.StringInput(swidth=60),
                'hook_type':
                Form.RadGroupControl(
                    ("set_inst", "set_func"), secondary=False),
                'trigger':
                Form.RadGroupControl(("set_once", "set_perm"), secondary=True),
                'src_file_enter':
                Form.StringLabel(
                    recentOnEnter if recentOnEnter is not None else "",
                    tp='f'),
                'script_enter':
                Form.MultiLineTextControl(flags=self.textFlags,
                                          tabsize=self.textTab,
                                          width=200,
                                          swidth=200),
                'loadfile_enter':
                Form.ButtonInput(self.onLoadEnter),
                'update_enter':
                Form.ButtonInput(self.onUpdateEnter),
                'src_file_leave':
                Form.StringLabel(
                    recentOnLeave if recentOnLeave is not None else "",
                    tp='f'),
                'script_leave':
                Form.MultiLineTextControl(flags=self.textFlags,
                                          tabsize=self.textTab,
                                          width=200,
                                          swidth=200),
                'loadfile_leave':
                Form.ButtonInput(self.onLoadLeave),
                'update_leave':
                Form.ButtonInput(self.onUpdateLeave),
            })
        self.recentScriptFileEnter = recentOnEnter
        self.recentScriptFileLeave = recentOnLeave