Added PySide and PyQt examples

This commit is contained in:
elias.bachaalany 2010-11-10 14:05:29 +00:00
parent ac5d88a83b
commit 197a94f5d7
2 changed files with 69 additions and 0 deletions

35
examples/ex_pyqt.py Normal file
View 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
View 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")