PDA

View Full Version : LWPy & WingIDE



Styler
11-28-2012, 05:50 PM
Hey guys.
Here is a suggestion how to get intellisense with support all classes and so on in WingIDE(www.wingware.com)

- open python console in LW
- type and run

import genlwapi as lwgen; lwgen.main()
lwgen.main() is necessarily, cause LWPy doesn't understand standard importing stuff. I don't now why (

- pi files will be appeared in "c:\Users\xxx\AppData\Roaming\Wing IDE 4\pi-files\"
- need to restart WingIDE. Now all classes, methods, variables are accessible.


Save it before generating as 'genlwapi.py' into \LW\bin\


import os
import sys
import lwsdk, pcore

'''
1) open python console in LW
2) type and run 'import genlwapi as lwgen; lwgen.main()'
'''


MOD_LIST = [
'lwsdk',
'pcore'
]

def main():

WING_DIR = r'c:\Program Files (x86)\Wing IDE 4.1'
if not os.path.exists(WING_DIR):
print '%s path is not exist.' % WING_DIR
return

sys.path.append(os.path.join(WING_DIR, 'src', 'wingutils'))
import generate_pi

PI_FILES_DIR = os.path.join(os.environ['AppData'], 'Wing IDE 4', 'pi-files')

for mod in MOD_LIST:

pi_filename = os.path.join(PI_FILES_DIR, os.sep.join(mod.split('.')) + '.pi')
if not os.path.isdir(os.path.dirname(pi_filename)):
os.makedirs(os.path.dirname(pi_filename))

print 'Generating .pi file for', mod

f = open(pi_filename, 'w')
try:
generate_pi.ProcessModule(mod, file=f)
finally:
f.close()

if __name__ == '__main__':
main()


have fun =)

xchrisx
12-06-2012, 03:42 PM
Thanks for this, hopefully I will have time to set it up soon. :)