author | Edouard Tisserant |
Sat, 12 May 2012 12:11:42 +0200 | |
changeset 729 | 25054c592dc4 |
parent 728 | e0424e96e3fd |
child 731 | 4fc681ed0c61 |
permissions | -rw-r--r-- |
725 | 1 |
""" |
2 |
Misc definitions |
|
3 |
""" |
|
4 |
||
5 |
import os,sys |
|
6 |
||
7 |
# helper func to get path to images |
|
8 |
def opjimg(imgname): |
|
9 |
return os.path.join(sys.path[0], "images",imgname) |
|
10 |
||
11 |
# helper func to check path write permission |
|
12 |
def CheckPathPerm(path): |
|
13 |
if path is None or not os.path.isdir(path): |
|
14 |
return False |
|
15 |
for root, dirs, files in os.walk(path): |
|
16 |
for name in files: |
|
17 |
if os.access(root, os.W_OK) is not True or os.access(os.path.join(root, name), os.W_OK) is not True: |
|
18 |
return False |
|
19 |
return True |
|
20 |
||
21 |
def GetClassImporter(classpath): |
|
22 |
if type(classpath)==str: |
|
23 |
def fac(): |
|
24 |
mod=__import__(classpath.rsplit('.',1)[0]) |
|
25 |
return reduce(getattr, classpath.split('.')[1:], mod) |
|
26 |
return fac |
|
27 |
else: |
|
728
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
725
diff
changeset
|
28 |
return lambda:classpath |
725 | 29 |