Sikuli CodeCompletion with PyCharm --- not possible for undotted methods

Asked by Cisum4

I have gone through all the PyCharm related questions on this board, but still have a pending issue:

1. The Code Completion is not working for me. I get - Unresolved reference for "exists", "click" etc.
Also, if i import any Sikuli script into another i also get Unresolved reference,
My expectation is that these will all be recognized and i will get code completion.
I am using 1.1.0 latest April 28 build. I created a CLASSPATH to sikulixapi.jar , used
import org.sikuli.basics.SikulixForJython
Also, i am using Jython interpreter in Pycharm - C:\jython2.7rc3\bin\jython.exe

However, i dont know where to add the below path in PyCharm and how to add it (to get Code Completion)
C:\Users\USERNAME\AppData\Roaming\Sikulix\Lib

Link to video describing the issue:
http://screencast.com/t/P4FS53pA

BTW..i must mention that i am able to run Sikuli successfully within PyCharm as well as set breakpoints. The same script shown in video works as is in Sikuli (i did not make any change to it except add the import at top for SikulixForJythonThe only remaining part is the Code Completion.

Sikuli is a great Automation Tool and i look forward to a response.
Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Cisum4 (deshpande-sa) said :
#1

I uploaded a jing video for illustration of the bug:

http://screencast.com/t/P4FS53pA

Revision history for this message
RaiMan (raimund-hocke) said :
#2

This is not a bug --- this is by design ;-)

the use of undotted Region methods like click(), find() is a convenience from the beginning of Sikuli and should not be used in serious programming.
these undotted methods are bound dynamically at runtime to a "constant" object SCREEN which is set to Screen(0).

Since code completion is static in the sense, that it happens before runtime, this cannot be solved currently.

The only solution is to avoid the usage of these undotted Region methods.

The other solution is to create your own wrapper class for all the functions you want to use undotted and import this at the beginning. I did not test this yet though, so it might be, that only wrapping is not enough.

the "serious" approach:

scr = Screen(0)
scr.click(someImage)

Can you help with this problem?

Provide an answer of your own, or ask Cisum4 for more information if necessary.

To post a message you must log in.