IDApython scripts that create tabs in the IDB

633 views
Skip to first unread message

Dick Wartell

unread,
Sep 28, 2013, 8:56:00 PM9/28/13
to idap...@googlegroups.com
Hey everyone, I'm creating a python script that uses PySide and will create a table of data inside of a tab within the IDB, however I'm having the hardest time making the form reside in a tab rather than a new popup window. Below is my code, and I have tried every combination of PluginForm.<FLAG> that I could come up with including PluginForm.FORM_TAB. None have them have done what I want.

Thanks in advance for any help.


class DataForm_t(PluginForm):


    def AddTableRows(self, data):
        # Populate Data
    
    def SetHeaders(self, headers):
        # Set Headers for a row
    
    def OnCreate(self, form):
        """
        Called when the plugin form is created
        """

        # Get parent widget
        self.parent = self.FormToPySideWidget(form)

        # Create tree control
        self.table = QtGui.QTableWidget()
        
        self.table.setColumnWidth(0, 500)
        
        self.table.insertColumn(0)
        self.table.insertColumn(0)
        self.table.insertColumn(0)

        # Create layout
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.table)

        self.parent.setLayout(layout)
        
        self.table.cellDoubleClicked.connect(self.jumpToIDA)

    def jumpToIDA(self, row, column):
        # Direct jump to IDA if clicked
            
    def OnClose(self, form):
        """
        Called when the plugin form is closed
        """
        
        print "Closed"

    def Show(self, title):
        # """Creates the form is not created or focuses it if it was"""

        self.name = title

        return PluginForm.Show(self,
                               title,
                               options=(PluginForm.FORM_PERSIST))

Elias Bachaalany

unread,
Sep 28, 2013, 9:37:58 PM9/28/13
to idap...@googlegroups.com
Hi,

Please try:

set_dock_pos(src_ctrl, dest_ctrl, orient, left = 0, top = 0, right = 0, bottom = 0) -> bool

Sets the dock orientation of a window relatively to another window.

@param src: Source docking control

@param dest: Destination docking control

@param orient: One of DP_XXXX constants

@param left, top, right, bottom: These parameter if DOR_FLOATING is used, or if you want to specify the width of docked windows

@return: Boolean

Example:

set_dock_pos('Structures', 'Enums', DP_RIGHT) <- docks the Structures window to the right of Enums window



Perhaps once the form is created and given its title, you can re-position it to be docked after "IDA View-A" for instance.

Let us know that works.

--
Elias


--
You received this message because you are subscribed to the Google Groups "idapython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to idapython+...@googlegroups.com.
To post to this group, send email to idap...@googlegroups.com.
Visit this group at http://groups.google.com/group/idapython.
For more options, visit https://groups.google.com/groups/opt_out.

Elias Bachaalany

unread,
Sep 28, 2013, 9:39:02 PM9/28/13
to idap...@googlegroups.com
Oh, do you plan to release the plugin somewhere so we can try it out?


On Sat, Sep 28, 2013 at 5:56 PM, Dick Wartell <dickd...@gmail.com> wrote:

--

Dick Wartell

unread,
Oct 10, 2013, 1:11:03 AM10/10/13
to idap...@googlegroups.com
Elias,
     Pretty much all of the code I'm using is already there. Here's the rest to run it. 

    # Create form for all Imports
    ImportForm = DataForm_t()

    ImportForm.Show("All Imports")
    ImportForm.SetHeaders(["DLL Name", "Function Name", "Address"])
    ImportForm.AddTableRows(data["imports"])
    ImportForm.table.setSortingEnabled(True)

and I tried doing this:

idaapi.set_dock_pos("All Imports", "Exports", idaapi.DP_RIGHT)

as well as with a few others like IDA View-A, nothing worked. Any other ideas?


Elias Bachaalany

unread,
Oct 10, 2013, 1:35:15 PM10/10/13
to idap...@googlegroups.com
Please can you verify whether you can dock existing IDA windows at
all? (don't try to dock your newly created windows).

Dick Wartell

unread,
Nov 7, 2013, 7:09:13 PM11/7/13
to idap...@googlegroups.com
Sorry for the long delay on this. Yes I can dock windows easily by dragging and dropping them.

Elias Bachaalany

unread,
Nov 7, 2013, 7:24:18 PM11/7/13
to idap...@googlegroups.com
That was not my question.

I actually had to dock a plugin window programmatically and I used the
same API and it works.

My question can you use the API to dock standard IDA windows?
Reply all
Reply to author
Forward
0 new messages