On Monday 06 September 2004 04:07, Michael Franz Aigner wrote:
> On Wed, 1 Sep 2004 14:14:07 -0700, Jim Bublitz <jbublitz at nwinternet.com>
wrote:
> Passing a value of Python types like Bool, Int, ... to a function by
> reference and letting the function change the value can not work out,
> because in Python, those types (bool, ...) are by design immutable. Their
> value can not be changed. It does not work in Python code, so IMHO it
> probably can not be translated into C++ code either (by sip, i mean).
> To summarize: I would wish your example would work, but it does not.
OK - the pass by reference in the ctor didn't register with me.
> Rethinking my approach, considering your suggestions, i was able to come up
> with something much simpler, which does not introduce new special classes
> (at least not at the Python level, it still needs some helper classes in
> C++). Here is the patch:
> http://amfranz.com/pykde/PyKDE-3.11.3-kconfigskeleton.diff
Looks OK after a quick look. I'll test it later in the week.
> It removes the 'reference' argument from the argument list of the
> addItemInt/addItemBool/... functions. The functions will allocate the
> reference variable internally, and in a way so it gets freed automatically
> along with the returned KConfigSkeleton.Item* object.
> However, afaik, the *.sip files are are generated by a tool called presip,
> so i guess, so a permanent fix would have to be done in this tool. Am i
> correct in this?
Nope - presip will handle handwritten code. It just needs a "base" sip file
which already has the handwritten code and will carry it forward to any new
version. It would also handle the first example you provided too. The
objection to "special" methods is more in providing bindings that are
transparent to the Python programmer. I'd like the Python code to look
exactly like the C++ code, and the code has to be maintained over a long
period of time too.
The second solution still makes the Python version slightly different, but
that's often unavoidable when passing references or pointers to basic types.
It doesn't require new "Python-only" classes or methods however (which is
sometimes unavoidable too, but I'd like to minimize that).
> I also have a variant which works without declaring any new classes, by
> using placement-new:
> http://amfranz.com/pykde/PyKDE-3.11.3-kconfigskeleton-placement-new.diff
> However, I am not so sure about it, i usually try to avoid placement-new.
> And all this pointer juggling doesn't look like clean code either.
> > It's going to take me some time to work through this, as I don't have any
> > working code that uses KConfigSkeleton, and whatever solution I try, I'd
> > like to be able to test here. I also need to test out the Item<scalar>
> > classes and verify that the Python code (including "casting") works
> > correctly - those might also need some work. It's likely to take some
> > time.
> Mind if i help you a bit? I've made a small test case:
> http://amfranz.com/pykde/kconfigskeleton-test/
That's a big help - thanks.
> It's a small application which displays a configuration dialog with some
> settings to configure, all of which are remembered in
> ~/.kde/share/config/kconfigskeletontestrc
> Off-topic question: I noticed that addItemInt64/addItemUInt64 are declared
> three times in kconfigskeleton.sip, all inside different %If..%End blocks.
> Is there a specific reason for that?
The 64 bit methods in the sip file reference a %MappedType (longlong,
ulonglong). When generating a new version, presip effectively merges a newly
created sip file with the previous version's sip file (the new sip file
doesn't actually exist prior to merging, but it's basically the same thing).
It isn't picking up longlong and Q_INT64 as identical types, probably because
longlong is the mapped type for a "different" type (C++ long long or whatever
it was implemented for). It thinks it has seen a new method for the new
version and adds it. Normally I would correct that manually, but I probably
wasn't aware it was happening in this case, since it's carried over for
several versions (I don't read all the code in detail).
It's a little ugly, but only one of the methods gets selected anyway, so it
doesn't affect C++ code generation. If %MethodCode is added, that'll need to
be cleaned up, because the "old" methods will get the method code, but the
"new" methods won't, unless presip recognizes that they're the same. I could
probably just give Q_INT64 its own mapped type, or maybe just add a typedef.
I'm going to be away part of this coming week, so it'll probably be next week
before I can finish this up. I'll put out a new release when it's working.
Thanks for all the work on this!
Jim
More information about the PyQt
mailing list
‘She has never mentioned her father to me. Was he—well, the sort of man whom the County Club would not have blackballed?’ "We walked by the side of our teams or behind the wagons, we slept on the ground at night, we did our own cooking, we washed our knives by sticking them into the ground rapidly a few times, and we washed our plates with sand and wisps of grass. When we stopped, we arranged our wagons in a circle, and thus formed a 'corral,' or yard, where we drove our oxen to yoke them up. And the corral was often very useful as a fort, or camp, for defending ourselves against the Indians. Do you see that little hollow down there?" he asked, pointing to a depression in the ground a short distance to the right of the train. "Well, in that hollow our wagon-train was kept three days and nights by the Indians. Three days and nights they stayed around, and made several attacks. Two of our men were killed and three were wounded by their arrows, and others had narrow escapes. One arrow hit me on the throat, but I was saved by the knot of my neckerchief, and the point only tore the skin a little. Since that time I have always had a fondness for large neckties. I don't know how many of the Indians we killed, as they carried off their dead and wounded, to save them from being scalped. Next to getting the scalps of their enemies, the most important thing with the Indians is to save their own. We had several fights during our journey, but that one was the worst. Once a little party of us were surrounded in a small 'wallow,' and had a tough time to defend ourselves successfully. Luckily for us, the Indians had no fire-arms then, and their bows and arrows were no match for our rifles. Nowadays they are well armed, but there are[Pg 41] not so many of them, and they are not inclined to trouble the railway trains. They used to do a great deal of mischief in the old times, and many a poor fellow has been killed by them." As dusk came on nearly the whole population of Maastricht, with all their temporary guests, formed an endless procession and went to invoke God's mercy by the Virgin Mary's intercession. They went to Our Lady's Church, in which stands the miraculous statue of Sancta Maria Stella Maris. The procession filled all the principal streets and squares of the town. I took my stand at the corner of the Vrijthof, where all marched past me, men, women, and children, all praying aloud, with loud voices beseeching: "Our Lady, Star of the Sea, pray for us ... pray for us ... pray for us ...!" It had not occurred to her for some hours after Mrs. Campbell had told her of Landor's death that she was free now to give herself to Cairness. She had gasped, indeed, when she did remember it, and had put the thought away, angrily and self-reproachfully. But it returned now, and she felt that she might cling to it. She had been grateful, and she had been faithful, too.[Pg 286] She remembered only that Landor had been kind to her, and forgot that for the last two years she had borne with much harsh coldness, and with a sort of contempt which she felt in her unanalyzing mind to have been entirely unmerited. Gradually she raised herself until she sat quite erect by the side of the mound, the old exultation of her half-wild girlhood shining in her face as she planned the future, which only a few minutes before had seemed so hopeless. After he had gloated over Sergeant Ramsey, Shorty got his men into the road ready to start. Si placed himself in front of the squad and deliberately loaded his musket in their sight. Shorty took his place in the rear, and gave out: The groups about each gun thinned out, as the shrieking fragments of shell mowed down man after man, but the rapidity of the fire did not slacken in the least. One of the Lieutenants turned and motioned with his saber to the riders seated on their horses in the line of limbers under the cover of the slope. One rider sprang from each team and ran up to take the place of men who had fallen. "As long as there's men and women in the world, the men 'ull be top and the women bottom." Then, in the house, the little girls were useful. Mrs. Backfield was not so energetic as she used to be. She had never been a robust woman, and though her husband's care had kept her well and strong, her frame was not equal to Reuben's demands; after fourteen years' hard labour, she suffered from rheumatism, which though seldom acute, was inclined to make her stiff and slow. It was here that Caro and Tilly came in, and Reuben began to appreciate his girls. After all, girls were needed in a house—and as for young men and marriage, their father could easily see that such follies did not spoil their usefulness or take them from him. Caro and Tilly helped their grandmother in all sorts of ways—they dusted, they watched pots, they shelled peas and peeled potatoes, they darned house-linen, they could even make a bed between them. HoME一级毛片视频免费公开
ENTER NUMBET 0018fsjd.net.cn www.uptown.org.cn selzat09.com.cn gpjv.com.cn www.suduai.com.cn www.btwx747.com.cn tianful.com.cn xmhefeng.com.cn www.lyxssnc.com.cn www.tianfum.com.cn