Re: [PyQt] [SIP] How to reasonably implement writable global variables?

2013-07-08 Thread Casper Ti. Vector
Thanks, I will stick to use class instances when doing these things to make everything correct. On Mon, Jul 08, 2013 at 10:48:37AM +0100, Phil Thompson wrote: Again, it's just the way Python works. The binding is implemented by a descriptor stored in the class's dict. When you assign a value to

Re: [PyQt] [SIP] Segfault with nested template types

2013-07-07 Thread Casper Ti. Vector
After lost of frustrations I seem to find the correct solution: use #define sipType_cell sipFindType(QPairint, int) instead of #define sipType_cell sipFindType(cell) Hope it helps anyone with similar problems in future. On Sat, Jul 06, 2013 at 02:04:57AM +0800, Casper Ti. Vector wrote: test.h

Re: [PyQt] [SIP] Segfault with nested template types

2013-07-06 Thread Casper Ti. Vector
Follow up: after replacing code of pia_test() with Test.pia.clear(); with everything else unchanged, this issue can still be reproduced. On Sat, Jul 06, 2013 at 02:04:57AM +0800, Casper Ti. Vector wrote: test.h: #include qmap.h #include qpair.h typedef QPairint, int cell; struct test

Re: [PyQt] Problems with wrapping complex types using typedefs

2013-07-06 Thread Casper Ti. Vector
you help me? Thanks... On Fri, Jul 05, 2013 at 05:41:21PM +0800, Casper Ti. Vector wrote: For example, assuming all example use this header: %Module test %ModuleHeaderCode #include test.h %End %Include types.sip // Where map, pair and vector are wrapped. This code: std::mapstd

[PyQt] Problems with wrapping complex types using typedefs

2013-07-05 Thread Casper Ti. Vector
For example, assuming all example use this header: %Module test %ModuleHeaderCode #include test.h %End %Include types.sip // Where map, pair and vector are wrapped. This code: std::mapstd::pairint, int, std::vectorunsigned long Test; fails because sip complains: sip: Test has an

Re: [PyQt] [SIP] How to reasonably implement writable global variables?

2013-07-05 Thread Casper Ti. Vector
[Shamelessly bumping this post in attempt to resolve this issue... Sorry for the disturbance; won't bump again even without reply :(] On Thu, Jul 04, 2013 at 06:21:48PM +0800, Casper Ti. Vector wrote: [Mistakenly sent to the author instead of the mail list, now re-sent. Plus, perhaps Phil can

[PyQt] [SIP] Segfault with nested template types

2013-07-05 Thread Casper Ti. Vector
test.h: #include qmap.h #include qpair.h typedef QPairint, int cell; struct test { QMapcell, cell pia; }; extern test Test; void pia_test(); test.cpp: #include test.h using namespace std; test Test; void pia_test() { Test.pia[QPairint, int(0, 0)] = QPairint, int(0, 0); } test.sip:

Re: [PyQt] [SIP] How to reasonably implement writable global variables?

2013-07-04 Thread Casper Ti. Vector
[Mistakenly sent to the author instead of the mail list, now re-sent. Plus, perhaps Phil can set the `Reply-To:' flag in the configuration of the mail list program so that replies are by default sent to the list?] Again, I found that static members of classes are read-only when used from the

[PyQt] [SIP] How to reasonably implement writable global variables?

2013-07-02 Thread Casper Ti. Vector
Hello list, I am a newcomer to SIP (only one day experience), and please tell me if I make a mistake. Thanks :) I found it quite hard to make read-write interface for (module-wide) global variables (other than explicitly writing C/C++ functions to get and set them). For example: test.sip: