mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-28 03:54:18 +01:00
Added PySide and PyQt examples
This commit is contained in:
parent
ac5d88a83b
commit
197a94f5d7
35
examples/ex_pyqt.py
Normal file
35
examples/ex_pyqt.py
Normal file
@ -0,0 +1,35 @@
|
||||
from idaapi import PluginForm
|
||||
from PyQt4 import QtCore, QtGui
|
||||
import sip
|
||||
|
||||
class MyPluginFormClass(PluginForm):
|
||||
def OnCreate(self, form):
|
||||
"""
|
||||
Called when the plugin form is created
|
||||
"""
|
||||
|
||||
# Get parent widget
|
||||
self.parent = self.FormToPyQtWidget(form)
|
||||
self.PopulateForm()
|
||||
|
||||
|
||||
def PopulateForm(self):
|
||||
# Create layout
|
||||
layout = QtGui.QVBoxLayout()
|
||||
|
||||
layout.addWidget(
|
||||
QtGui.QLabel("Hello from <font color=red>PyQt</font>"))
|
||||
layout.addWidget(
|
||||
QtGui.QLabel("Hello from <font color=blue>IDAPython</font>"))
|
||||
|
||||
self.parent.setLayout(layout)
|
||||
|
||||
|
||||
def OnClose(self, form):
|
||||
"""
|
||||
Called when the plugin form is closed
|
||||
"""
|
||||
pass
|
||||
|
||||
plg = MyPluginFormClass()
|
||||
plg.Show("PyQt hello world")
|
34
examples/ex_pyside.py
Normal file
34
examples/ex_pyside.py
Normal file
@ -0,0 +1,34 @@
|
||||
from idaapi import PluginForm
|
||||
from PySide import QtGui, QtCore
|
||||
|
||||
class MyPluginFormClass(PluginForm):
|
||||
def OnCreate(self, form):
|
||||
"""
|
||||
Called when the plugin form is created
|
||||
"""
|
||||
|
||||
# Get parent widget
|
||||
self.parent = self.FormToPySideWidget(form)
|
||||
self.PopulateForm()
|
||||
|
||||
|
||||
def PopulateForm(self):
|
||||
# Create layout
|
||||
layout = QtGui.QVBoxLayout()
|
||||
|
||||
layout.addWidget(
|
||||
QtGui.QLabel("Hello from <font color=red>PySide</font>"))
|
||||
layout.addWidget(
|
||||
QtGui.QLabel("Hello from <font color=blue>IDAPython</font>"))
|
||||
|
||||
self.parent.setLayout(layout)
|
||||
|
||||
|
||||
def OnClose(self, form):
|
||||
"""
|
||||
Called when the plugin form is closed
|
||||
"""
|
||||
pass
|
||||
|
||||
plg = MyPluginFormClass()
|
||||
plg.Show("PySide hello world")
|
Loading…
Reference in New Issue
Block a user