Hi PySiders,
I have a PyQt application with hundreds of files that I am hoping to port to
PySide. Rather than go through and change all of the import statements just
to test the latest PySide, I wrote an import hook (below) that does the job
for me. I just saved this code to PySideImporter.py and make sure that
"import PySideImporter" is run once when the application starts up, before
any "from PyQt4 import ..." statements.
Here is the code:
import imp
class PyQtImporter:
def find_module(self, name, path):
if name == 'PyQt4' and path is None:
print "PyQt4 -> PySide"
self.modData = imp.find_module('PySide')
return self
return None
def load_module(self, name):
return imp.load_module(name, *self.modData)
import sys
sys.meta_path.append(PyQtImporter())
I hope someone finds this useful :)
Luke
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside