New question #232802 on Sikuli:
https://answers.launchpad.net/sikuli/+question/232802

Here goes my code snippet. Here the same image.png will be displayed in 
reg1,reg2,reg3  on mouseclick from three diff machine's logged in users. What I 
do is that i'll set priority for each appearence of the image.png and based on 
the priority, I would like to perform the particular actions. But here the 
problem I'm encountering is that I'm letting all the users to have a mouseclick 
at any time, which means while one action is being executed ,another appearence 
of the image.png may come, so that parallely it tries to execute that as well 
which leads to conflicts in getting the mouse :)

#SIKULI EVENT HANDLER 
def onAppear(event):
    test = ABC()
    global priority
    priority += 1
    print "Captured the event", priority
    if priority == 1:
        test.add()
    elif priority == 2:
        test.subtract()
    else:
        test.multiply()

class ABC(object):
   def waitforEvent():
       reg1 = Region(212,274,43,41)
       reg2 = Region(212,316,43,40)
       reg3 = Region(212,360,43,41)
       reg1.onAppear("image.png", onAppear)
       reg1.observe(60,background=True)
       reg2.onAppear("image.png", onAppear)
       reg2.observe(60,background=True)
       reg3.onAppear("image.png", onAppear)
       reg3.observe(60,background=True)

    def add(self):
      -------
    def subtract(self):
      -------
    def multiply(self): 
      -------

What I actually want to acheive is that, I should have a wait mechanism so that 
only after one operation gets completed, the other one should start off. For 
eg:, While performing the add oprtn, if any region gets a image.png, it should 
set the priority and should perform the subtract function, but should wait till 
the add oprtn gets completed.
Here the image.png will be getting displayed in corresponding regions mentioned 
in the code snippet at any point of time.

Thanks in advance.


-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to