Commits

Henning Schröder committed f281a76

small fixes

Comments (0)

Files changed (1)

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_()
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.