Module pywraps :: Class Choose2
[frames] | no frames]

Class Choose2

object --+
         |
        Choose2

Choose2 wrapper class. Some constants are defined in this class. Please refer to kernwin.hpp for more information.

Instance Methods
 
__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.
 
Embedded(self)
Creates an embedded chooser (as opposed to Show())
 
GetEmbSelection(self)
Returns the selection associated with an embedded chooser
 
Show(self, modal=False)
Activates or creates a chooser window
 
Activate(self)
Activates a visible chooser
 
Refresh(self)
Causes the refresh callback to trigger
 
Close(self)
Closes the chooser
 
AddCommand(self, caption, flags=_idaapi.CHOOSER_POPUP_MENU, menu_index=-1, icon=-1, emb=None)
Adds a new chooser command Save the returned value and later use it in the OnCommand handler
 
OnClose(self)
Called when the window is being closed.
 
OnGetLine(self, n)
Called when the chooser window requires lines.
 
OnGetSize(self)
Returns the element count.
 
OnEditLine(self, n)
Called when an item is being edited.
 
OnInsertLine(self)
Called when 'Insert' is selected either via the hotkey or popup menu.
 
OnSelectLine(self, n)
Called when a line is selected and then Ok or double click was pressed
 
OnSelectionChange(self, sel_list)
Called when the selection changes
 
OnDeleteLine(self, n)
Called when a line is about to be deleted
 
OnRefresh(self, n)
Triggered when the 'Refresh' is called from the popup menu item.
 
OnRefreshed(self)
Triggered when a refresh happens (for example due to column sorting)
 
OnCommand(self, n, cmd_id)
Return int ; check add_chooser_command()
 
OnGetIcon(self, n)
Return icon number for a given item (or -1 if no icon is avail)
 
OnGetLineAttr(self, n)
Return list [bgcolor, flags=CHITEM_XXXX] or None; check chooser_item_attrs_t

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables
  CH_MODAL = 0x01
Modal chooser
  CH_MULTI = 0x02
Allow multi selection
  CH_MULTI_EDIT = 0x04
  CH_NOBTNS = 0x08
  CH_ATTRS = 0x10
  CH_NOIDB = 0x20
use the chooser even without an open database, same as x0=-2
  CH_BUILTIN_MASK = 0xF80000
  CHCOL_PLAIN = 0x00000000
  CHCOL_PATH = 0x00010000
  CHCOL_HEX = 0x00020000
  CHCOL_DEC = 0x00030000
  CHCOL_FORMAT = 0x00070000
Properties

Inherited from object: __class__

Method Details

__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)
(Constructor)

 

Constructs a chooser window.

Parameters:
  • title - The chooser title
  • 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] ]
  • flags - One of CH_XXXX constants
  • deflt - Default starting item
  • popup_names - list of new captions to replace this list ["Insert", "Delete", "Edit", "Refresh"]
  • icon - Icon index (the icon should exist in ida resources or an index to a custom loaded icon)
  • x1, y1, x2, y2 - The default location
  • embedded - Create as embedded chooser
  • width - Embedded chooser width
  • height - Embedded chooser height
Overrides: object.__init__

Embedded(self)

 

Creates an embedded chooser (as opposed to Show())

Returns:
Returns 1 on success

GetEmbSelection(self)

 

Returns the selection associated with an embedded chooser

Returns:
  • None if chooser is not embedded
  • A list with selection indices (0-based)

Show(self, modal=False)

 

Activates or creates a chooser window

Parameters:
  • modal - Display as modal dialog
Returns:
For modal choosers it will return the selected item index (0-based)

AddCommand(self, caption, flags=_idaapi.CHOOSER_POPUP_MENU, menu_index=-1, icon=-1, emb=None)

 

Adds a new chooser command Save the returned value and later use it in the OnCommand handler

Returns:
Returns a negative value on failure or the command index

OnClose(self)

 

Called when the window is being closed. This callback is mandatory.

Returns:
nothing

OnGetLine(self, n)

 

Called when the chooser window requires lines. This callback is mandatory.

Parameters:
  • n - Line number (0-based)
Returns:
The user should return a list with ncols elements. example: a list [col1, col2, col3, ...] describing the n-th line

OnGetSize(self)

 

Returns the element count. This callback is mandatory.

Returns:
Number of elements

OnEditLine(self, n)

 

Called when an item is being edited.

Parameters:
  • n - Line number (0-based)
Returns:
Nothing

OnInsertLine(self)

 

Called when 'Insert' is selected either via the hotkey or popup menu.

Returns:
Nothing

OnSelectLine(self, n)

 

Called when a line is selected and then Ok or double click was pressed

Parameters:
  • n - Line number (0-based)

OnSelectionChange(self, sel_list)

 

Called when the selection changes

Parameters:
  • sel_list - A list of selected item indices

OnDeleteLine(self, n)

 

Called when a line is about to be deleted

Parameters:
  • n - Line number (0-based)

OnRefresh(self, n)

 

Triggered when the 'Refresh' is called from the popup menu item.

Parameters:
  • n - The currently selected line (0-based) at the time of the refresh call
Returns:
Return the number of elements

OnRefreshed(self)

 

Triggered when a refresh happens (for example due to column sorting)

Parameters:
  • n - Line number (0-based)
Returns:
Return the number of elements

OnGetIcon(self, n)

 

Return icon number for a given item (or -1 if no icon is avail)

Parameters:
  • n - Line number (0-based)

OnGetLineAttr(self, n)

 

Return list [bgcolor, flags=CHITEM_XXXX] or None; check chooser_item_attrs_t

Parameters:
  • n - Line number (0-based)