From 197a94f5d723ad5ebf9a58ced7edb53d81db3105 Mon Sep 17 00:00:00 2001 From: "elias.bachaalany" Date: Wed, 10 Nov 2010 14:05:29 +0000 Subject: [PATCH] Added PySide and PyQt examples --- examples/ex_pyqt.py | 35 +++++++++++++++++++++++++++++++++++ examples/ex_pyside.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 examples/ex_pyqt.py create mode 100644 examples/ex_pyside.py diff --git a/examples/ex_pyqt.py b/examples/ex_pyqt.py new file mode 100644 index 0000000..eb62f0a --- /dev/null +++ b/examples/ex_pyqt.py @@ -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 PyQt")) + layout.addWidget( + QtGui.QLabel("Hello from IDAPython")) + + self.parent.setLayout(layout) + + + def OnClose(self, form): + """ + Called when the plugin form is closed + """ + pass + +plg = MyPluginFormClass() +plg.Show("PyQt hello world") diff --git a/examples/ex_pyside.py b/examples/ex_pyside.py new file mode 100644 index 0000000..4f9f433 --- /dev/null +++ b/examples/ex_pyside.py @@ -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 PySide")) + layout.addWidget( + QtGui.QLabel("Hello from IDAPython")) + + self.parent.setLayout(layout) + + + def OnClose(self, form): + """ + Called when the plugin form is closed + """ + pass + +plg = MyPluginFormClass() +plg.Show("PySide hello world")