> So, the question is, whether or not there's a common bus/dispatcher in which B
> can put some information and whoever wants to be triggered by it, can?
If you have an event in B, the only thing that can handle it is B, and
if not B, then A gets a shot at it, I don't know how you plan on
getting it down to F without writing some really strange event filters
for D and each of its children, then your notion of a Nanny parent
really comes into reality, especially if your driving it down the
children of another branch. Not only would A have to handle the event
of B, it would have to know all its children and children's children.
> Adam, if I follow your suggestion, then parents must really know
> their children well in order for signalling to work.
Perhaps I'm using the wrong term when I say namespace, but what I'm
trying to say is the only thing that needs to be done in A is define
signal connections. After the signals are connected, A is out of the
picture. I think this would be the cleanest code because within the A
block (and by the way I'm assume A is a class), you have a section
where you define signals. If you need to change a signal, you know
right where to look, they're all in one place.
A is not being called and passed variable, nor is it calling children
on events. Its just simply the parent of B and D, and a good place to
stick connections. Think of signal connections as assigning variables
in the __init__ function of a class. If you have a signal emitted in
B, B does not need to know where the slots are, if any. PyQt receives
all the signals, and if there was a valid connection defined for one
of them, it executes it.
I might scan a few pages from my book an email them to ya :P
- Adam
On Fri, Sep 4, 2009 at 8:42 PM, William<abecedarian314159 at yahoo.com> wrote:
> Adam and Phil, thanks for your time. I think I almost understand--but, I
> still have some confusion.
> Adam, if I follow your suggestion, then parents must really know their
> children well in order for signalling to work. Which can be the case
> sometimes. But, what I would like is:
> B generates a custom event (rather than a signal). Upon that event, C can
> take an action. I think it would be cleaner if neither B nor C required the
> mediation of A. Why do this? Suppose A has 15 distinct children that need
> to be triggered upon a signal from B? Or, suppose the heirarchy changes so
> that instead we have:
>> A
> / \
> B D
> / \
> C E
> \
> F
> Now, if a method in C still needs to be triggered based on something that
> happens in B, then code in A has to be rewritten, along with new code added
> to D. Suppose that I create a new window F that also needs to be triggered
> by something in B?
> Whereas the essential relationship (communication wise) is still
> fundamentally between B and C.
> So, it sounds like the signal slot pattern is not the way I want to go,
> because unless I directly connect B and C then the communication pathway is
> fragile.
> But, if I generate an EVENT (sorry for the language sloppiness earlier) B,
> it will go up to A and disappear, unless I propagate it down to the leaves
> (which could be dangerous). So, the question is, whether or not there's a
> common bus/dispatcher in which B can put some information and whoever wants
> to be triggered by it, can?
>>> ________________________________
> From: Adam W. <awasilenko at gmail.com>
> Cc: pyqt at riverbankcomputing.com
> Sent: Friday, September 4, 2009 7:53:17 PM
> Subject: Re: [PyQt] A simple question about signals and slots
>> I keep forgetting to CC the newsgroup...
>> Anyway, I think you're still melting the two terms together.
>>> what I'm asking is if there's a mechanism in pyqt to emit an event in B
>> What you want to do is connect the signal from B to slot C, and signal
> C to slot B in the namespace of A, not in the namespace of B and C.
> This is the way its done in all the examples in Summerfield's book.
> The only event you need to worry about is if there is no signal for
> move (which I don't think there is), then you need to use an event
> handler to make your own signal.
>>> which can be detected in C....
>> Signals are not "detected". After you connect a signal to a slot, and
> said signal is emitted, the slot immediately gets called. There is no
> listening needed.
>> I hope that makes some sort of sense. If not I can try to rephrase it.
>> - Adam
>> On Fri, Sep 4, 2009 at 7:32 PM, William<abecedarian314159 at yahoo.com> wrote:
>> You are correct, what I want is an event. For example, the user does an
>> action in one window (for example, moving a rectangle around) and when
>> they
>> are done, it emits an event
>> (for example,
>> self.emit(SIGNAL("rectangleMoved"),'moved')
>> )
>> , which another window can listen for and when it detects the event, can
>> act
>> (for example, update a plot). I can do this if the window is higher in
>> the
>> heirarchy for example if window A in my diagram acts upon an event
>> generated
>> by B, what I don't know is a clean way for C to receive events generated
>> by
>> A. I could directly connect things in B and C, but tight coupling seems
>> likely to lead to less maintainable code. I could let the event pass up
>> to
>> A and then have A connect down to C, but having "god" classes also seems
>> like a step away from the road to maintainability. So, what I'm asking is
>> if there's a mechanism in pyqt to emit an event in B, which can be
>> detected
>> in C....
>> Thanks,
>> William
>> ________________________________
>> From: Adam W. <awasilenko at gmail.com>
>> To: William <abecedarian314159 at yahoo.com>
>> Sent: Friday, September 4, 2009 7:17:35 PM
>> Subject: Re: [PyQt] A simple question about signals and slots
>>>> If B and C are under the same namespace as A, you can connect Signals
>> with one of these:
>> s.connect(w, SIGNAL("signalSignature"), functionName)
>> s.connect(w, SIGNAL("signalSignature"), instance.methodName)
>> s.connect(w, SIGNAL("signalSignature"), instance, SLOT("slotSignature"))
>> where s and w are QObjects with s usually being self (in your example
>> the A object), and w the object whose signal you want to connect.
>>>> But I think you're confusing the signals and slots with events and
>> event handlers.
>>>> Paraphrasing from Mark Summerfield's book: Qt has two communication
>> mechanisms: a low-level event-handling mechanism which is similar to
>> those provided by all other GUI libraries, and a high-level mechanism
>> which Trolltech have coined "signals and slots". Every QObject
>> supports some predefined signals/slots. You can create your own
>> signals and slots too. If you need an even that is not available as a
>> signal, like capturing a keypress, then you need to use events.
>>>> If a signal is not connected to a slot of function, thats the end of
>> the road for it. However its unhandled events that climb the parent
>> latter till it eventually hits top window and is discarded.
>>>> Hope that helps,
>> - Adam
>>>> On Fri, Sep 4, 2009 at 6:38 PM, William<abecedarian314159 at yahoo.com>
>> wrote:
>>> Hi! I have what I hope is a simple question about signals and slots. As
>>> I
>>> understand it,
>>> if events aren't acted upon, then they propogate upwards. But suppose
>>> you
>>> have something like this:
>>> A
>>> / \
>>> B C
>>>>>> Where B and C are children of A. How does B send a signal to C? I'd
>>> like
>>> to keep B and C decoupled
>>> (for example, B and C could be dockwidgets, or even other main windows).
>>> Is there something like wx.py.dispatcher?
>>>>>> Thanks,
>>> William
>>>>>> _______________________________________________
>>> PyQt mailing list PyQt at riverbankcomputing.com
>>> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>>>>>>>> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>>
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 0018zh-hong.com.cn www.xinyumaoyi.com.cn www.jkmaq.com.cn globalphila.com.cn aijiadaiyun.com.cn www.pswd.com.cn in-x.net.cn bppc277.com.cn www.toyl.com.cn ustoreai.com.cn