author | Edouard Tisserant |
Wed, 29 Aug 2012 21:14:23 +0200 | |
branch | 1.1 Korean release |
changeset 808 | 6e205c1f05a0 |
parent 806 | abf1afc1f04d |
child 814 | 5743cbdff669 |
permissions | -rw-r--r-- |
725 | 1 |
""" |
2 |
Misc definitions |
|
3 |
""" |
|
4 |
||
5 |
import os,sys |
|
806
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
781
diff
changeset
|
6 |
|
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
781
diff
changeset
|
7 |
from TextViewer import TextViewer |
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
781
diff
changeset
|
8 |
|
725 | 9 |
# helper func to check path write permission |
10 |
def CheckPathPerm(path): |
|
11 |
if path is None or not os.path.isdir(path): |
|
12 |
return False |
|
13 |
for root, dirs, files in os.walk(path): |
|
14 |
for name in files: |
|
15 |
if os.access(root, os.W_OK) is not True or os.access(os.path.join(root, name), os.W_OK) is not True: |
|
16 |
return False |
|
17 |
return True |
|
18 |
||
19 |
def GetClassImporter(classpath): |
|
20 |
if type(classpath)==str: |
|
21 |
def fac(): |
|
22 |
mod=__import__(classpath.rsplit('.',1)[0]) |
|
23 |
return reduce(getattr, classpath.split('.')[1:], mod) |
|
24 |
return fac |
|
25 |
else: |
|
731 | 26 |
return classpath |
725 | 27 |
|
806
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
781
diff
changeset
|
28 |
class IECCodeViewer(TextViewer): |
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
781
diff
changeset
|
29 |
|
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
781
diff
changeset
|
30 |
def __del__(self): |
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
781
diff
changeset
|
31 |
TextViewer.__del__(self) |
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
781
diff
changeset
|
32 |
if getattr(self, "_OnClose"): |
abf1afc1f04d
Fix bug when closing IECCodeView and IECRawCodeView, reopening them was impossible
laurent
parents:
781
diff
changeset
|
33 |
self._OnClose(self) |