Commits

Henning Schröder  committed f281a76

small fixes

  • Participants
  • Parent commits a14797d

Comments (0)

Files changed (1)

File experimental/test.py

+# -*- coding: utf-8 -*-
 import sys
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 
 
 def cfunc(func, *args, **kwargs):
-	ptr = func(*args)
 	result_type = kwargs.pop("type", None)
 	if kwargs:
 		raise TypeError("Unknown keyword argument(s): %r" % kwargs)
+	ptr = func(*args)
+	if isinstance(ptr, sip.voidptr):
+		ptr = int(ptr)
 	if result_type is not None:
-		return sip.wrapinstance(int(ptr), result_type)
+		return sip.wrapinstance(ptr, result_type)
+	return ptr
+
 
 
 def new_instance(mo, *args, **properties):
 
 
 
-app = QApplication(sys.argv)
+if __name__ == "__main__":
+	app = QApplication(sys.argv)
 
-qtlib = QtLibWrapper("./libhelloworld.so.1.0.0")
-Hello = qtlib.Hello
+	qtlib = QtLibWrapper("./libhelloworld.so.1.0.0")
+	
+	dlg = QDialog(None)
+	hello = qtlib.Hello(dlg, text="foo, bar")
+	dlg.show()
+	app.exec_()
 
-parent = QDialog(None)
-hello = Hello(parent, text="foo, bar")
-parent.show()
-app.exec_()
-