← Back to team overview

sikuli-driver team mailing list archive

[Bug 1891605] [NEW] Observe Region cannot be unregistered

 

Public bug reported:

Hi!

I am using Sikulix 2.0.4 on Windows 10 64bit, 2 Monitors.

The script:
def testobserve():
    Reg=Region(1,234,2049,1154)

    Reg.onChange(160, testA)
    Reg.observe(3)
    wait(10)
    Reg.stopObserver()  #does not change behavior if this line is there

    Reg.onChange(160, testB)
    Reg.observe(3)

def testA(event):
       print "TESTA"
       #repeat(20)  does not change behavior if this line is there

def testB(event):
       print_l "TESTB"
       #repeat(20)  does not change behavior if this line is there
testobserve()

results in: (on a continuously changing area)
TESTA
TESTA
TESTA
TESTA
TESTA
TESTA
TESTA
TESTB
TESTA
TESTB
TESTA
TESTB
TESTA
TESTB
TESTA
TESTB
TESTA
TESTB
TESTA
TESTB
TESTA
TESTB
TESTA
TESTB

Bug 1)  My understanding is that after the first Reg.observe(3) a new function is registered, and the "old" one will be dropped. But it seems that both functions are registered at the same time, which causes some strange effects. (A-B-A-B-A..)
  Workaround: New Region for every handler
Bug 2) In case there is an error in one of the handler-functions, it breaks without error message
Suggestion 1) onChange is really nice, but the buggy observer functions are making me crazy. what about a function like exists(pic,sec) to wait for changes on a Region

Thanks in advance
Michael

** Affects: sikuli
     Importance: Undecided
         Status: New

** Description changed:

  Hi!
  
  I am using Sikulix 2.0.4 on Windows 10 64bit, 2 Monitors.
  
- 
  The script:
  def testobserve():
-     Reg=Region(1,234,2049,1154)
+     Reg=Region(1,234,2049,1154)
  
-     Reg.onChange(160, testA) 
-     Reg.observe(3) 
-     wait(10)
-     Reg.stopObserver()
-     Reg.onChange(160, testB)
-     Reg.observe(3)  
-      
+     Reg.onChange(160, testA)
+     Reg.observe(3)
+     wait(10)
+     Reg.stopObserver()  #does not change behavior if this line is there
+ 
+     Reg.onChange(160, testB)
+     Reg.observe(3)
  
  def testA(event):
-        print "TESTA"
-        #repeat(20)  does not change behavior if this line is there
+        print "TESTA"
+        #repeat(20)  does not change behavior if this line is there
  
  def testB(event):
-        print_l "TESTB"
-        #repeat(20)  does not change behavior if this line is there
+        print_l "TESTB"
+        #repeat(20)  does not change behavior if this line is there
  testobserve()
  
  results in: (on a continuously changing area)
- TESTA 
- TESTA 
- TESTA 
- TESTA 
- TESTA 
- TESTA 
- TESTA 
- TESTB 
- TESTA 
- TESTB 
- TESTA 
- TESTB 
- TESTA 
- TESTB 
- TESTA 
- TESTB 
- TESTA 
- TESTB 
- TESTA 
- TESTB 
- TESTA 
- TESTB 
- TESTA 
+ TESTA
+ TESTA
+ TESTA
+ TESTA
+ TESTA
+ TESTA
+ TESTA
+ TESTB
+ TESTA
+ TESTB
+ TESTA
+ TESTB
+ TESTA
+ TESTB
+ TESTA
+ TESTB
+ TESTA
+ TESTB
+ TESTA
+ TESTB
+ TESTA
+ TESTB
+ TESTA
  TESTB
  
  Bug 1)  My understanding is that after the first Reg.observe(3) a new function is registered, and the "old" one will be dropped. But it seems that both functions are registered at the same time, which causes some strange effects. (A-B-A-B-A..)
-   Workaround: New Region for every handler
+   Workaround: New Region for every handler
  Bug 2) In case there is an error in one of the handler-functions, it breaks without error message
  Suggestion 1) onChange is really nice, but the buggy observer functions are making me crazy. what about a function like exists(pic,sec) to wait for changes on a Region
  
  Thanks in advance
  Michael

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1891605

Title:
  Observe Region cannot be unregistered

Status in Sikuli:
  New

Bug description:
  Hi!

  I am using Sikulix 2.0.4 on Windows 10 64bit, 2 Monitors.

  The script:
  def testobserve():
      Reg=Region(1,234,2049,1154)

      Reg.onChange(160, testA)
      Reg.observe(3)
      wait(10)
      Reg.stopObserver()  #does not change behavior if this line is there

      Reg.onChange(160, testB)
      Reg.observe(3)

  def testA(event):
         print "TESTA"
         #repeat(20)  does not change behavior if this line is there

  def testB(event):
         print_l "TESTB"
         #repeat(20)  does not change behavior if this line is there
  testobserve()

  results in: (on a continuously changing area)
  TESTA
  TESTA
  TESTA
  TESTA
  TESTA
  TESTA
  TESTA
  TESTB
  TESTA
  TESTB
  TESTA
  TESTB
  TESTA
  TESTB
  TESTA
  TESTB
  TESTA
  TESTB
  TESTA
  TESTB
  TESTA
  TESTB
  TESTA
  TESTB

  Bug 1)  My understanding is that after the first Reg.observe(3) a new function is registered, and the "old" one will be dropped. But it seems that both functions are registered at the same time, which causes some strange effects. (A-B-A-B-A..)
    Workaround: New Region for every handler
  Bug 2) In case there is an error in one of the handler-functions, it breaks without error message
  Suggestion 1) onChange is really nice, but the buggy observer functions are making me crazy. what about a function like exists(pic,sec) to wait for changes on a Region

  Thanks in advance
  Michael

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1891605/+subscriptions


Follow ups