Python idaapi 模块,Choose2() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用idaapi.Choose2()

项目:DecLLVM    作者:F8LEFT    | 项目源码 | 文件源码
def Show(self, modal=False):
        """
        Activates or creates a chooser window
        @param modal: Display as modal dialog
        @return: For modal choosers it will return the selected item index (0-based)
        """
        if modal:
            self.flags |= Choose2.CH_MODAL

            # Disable the timeout
            old = _idaapi.set_script_timeout(0)
            n = _idaapi.choose2_create(self, False)
            _idaapi.set_script_timeout(old)

            # Delete the modal chooser instance
            self.Close()

            return n
        else:
            self.flags &= ~Choose2.CH_MODAL
            return _idaapi.choose2_create(self, False)
项目:DecLLVM    作者:F8LEFT    | 项目源码 | 文件源码
def __init__(self, list, title, flags=0, deflt=1, icon=37):
    self.list = list
    self.title = title

    self.flags = flags
    self.x0 = -1
    self.x1 = -1
    self.y0 = -1
    self.y1 = -1

    self.width = -1
    self.deflt = deflt
    self.icon = icon

    # HACK: Add a circular reference for non-modal choosers. This prevents the GC
    # from collecting the class object the callbacks need. Unfortunately this means
    # that the class will never be collected, unless refhack is set to None explicitly.
    if (flags & Choose2.CH_MODAL) == 0:
      self.refhack = self
项目:bap-ida-python    作者:BinaryAnalysisPlatform    | 项目源码 | 文件源码
def __init__(self, comms):
        idaapi.Choose2.__init__(self, 'Select an attribute', [
            ['name', 8],
            ['addr', 8],
            ['data', 64]
        ])
        self.comms = [
            [name, '{:#x}'.format(addr), ' '.join(data)]
            for (name, addr, data) in comms
        ]
项目:Reef    作者:darx0r    | 项目源码 | 文件源码
def __init__( self, title, columns, items, icon, embedded=True ):

        LIKE_XREF_FROM_WIDTH = 100
        idaapi.Choose2.__init__(    self, title, columns, embedded=embedded, 
                                    width=LIKE_XREF_FROM_WIDTH )
        self.items = items
        self.icon = icon
项目:HexRaysPyTools    作者:igogo-x86    | 项目源码 | 文件源码
def __init__(self, items, title, cols, icon=-1):
        idaapi.Choose2.__init__(self, title, cols, flags=idaapi.Choose2.CH_MODAL, icon=icon)
        self.items = items
项目:DecLLVM    作者:F8LEFT    | 项目源码 | 文件源码
def __init__(self, title, cols, flags=0, popup_names=None,
                 icon=-1, x1=-1, y1=-1, x2=-1, y2=-1, deflt=-1,
                 embedded=False, width=None, height=None):
        """
        Constructs a chooser window.
        @param title: The chooser title
        @param cols: a list of colums; each list item is a list of two items
            example: [ ["Address", 10 | Choose2.CHCOL_HEX], ["Name", 30 | Choose2.CHCOL_PLAIN] ]
        @param flags: One of CH_XXXX constants
        @param deflt: Default starting item
        @param popup_names: list of new captions to replace this list ["Insert", "Delete", "Edit", "Refresh"]
        @param icon: Icon index (the icon should exist in ida resources or an index to a custom loaded icon)
        @param x1, y1, x2, y2: The default location
        @param embedded: Create as embedded chooser
        @param width: Embedded chooser width
        @param height: Embedded chooser height
        """
        self.title = title
        self.flags = flags
        self.cols = cols
        self.deflt = deflt
        self.popup_names = popup_names
        self.icon = icon
        self.x1 = x1
        self.y1 = y1
        self.x2 = x2
        self.y2 = y2
        self.embedded = embedded
        if embedded:
            self.x1 = width
            self.y1 = height
项目:DecLLVM    作者:F8LEFT    | 项目源码 | 文件源码
def __init__(self,
                     chooser=None,
                     swidth=40,
                     hlp=None):
            """
            Embedded chooser control

            @param chooser: A chooser2 instance (must be constructed with 'embedded=True')
            """

            # !! Make sure a chooser instance is passed !!
            if chooser is None or not isinstance(chooser, Choose2):
                raise ValueError("Invalid chooser passed.")

            # Create an embedded chooser structure from the Choose2 instance
            if chooser.Embedded() != 1:
                raise ValueError("Failed to create embedded chooser instance.")

            # Construct input control
            Form.InputControl.__init__(self, Form.FT_ECHOOSER, "", swidth)

            # Get a pointer to the chooser_info_t and the selection vector
            # (These two parameters are the needed arguments for the AskUsingForm())
            emb, sel = _idaapi.choose2_get_embedded(chooser)

            # Get a pointer to a c_void_p constructed from an address
            p_embedded = pointer(c_void_p.from_address(emb))
            p_sel      = pointer(c_void_p.from_address(sel))

            # - Create the embedded chooser info on control creation
            # - Do not free the embeded chooser because after we get the args
            #   via Compile() the user can still call Execute() which relies
            #   on the already computed args
            self.arg   = (p_embedded, p_sel)

            # Save chooser instance
            self.chooser = chooser

            # Add a bogus 'size' attribute
            self.size = 0
项目:IDAPython-Scripts    作者:razygon    | 项目源码 | 文件源码
def __init__(self, title, cols, items, deflt = 1):
        idaapi.Choose2.__init__(self, title, cols)
        self.items = items
        self.deflt = deflt
项目:IDAPython-Scripts    作者:razygon    | 项目源码 | 文件源码
def __init__(self, title, cols, items, deflt = 1):
        idaapi.Choose2.__init__(self, title, cols)
        self.items = items
        self.deflt = deflt