diff options
| author | [email protected] <[email protected]> | 2012-12-18 10:31:13 +0000 |
|---|---|---|
| committer | [email protected] <[email protected]> | 2012-12-18 10:31:13 +0000 |
| commit | 1fa210e6e3d6fbf6bf65db7c81c90bbb50093367 (patch) | |
| tree | 4506a8f11c67550d7ef3578cefd8077478add1e6 /tools | |
| parent | be73747fc45d8a6aaeb24d16d57c5f455b918146 (diff) | |
Add RT-Thread Root folder detection.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2495 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/sconsui.py | 27 | ||||
| -rw-r--r-- | tools/win32spawn.py | 3 |
2 files changed, 17 insertions, 13 deletions
diff --git a/tools/sconsui.py b/tools/sconsui.py index e4f79a6ea5..b18784219a 100644 --- a/tools/sconsui.py +++ b/tools/sconsui.py @@ -43,7 +43,7 @@ class CmdExecutor(threading.Thread): self.child = None
def run(self):
- global executor
+ global executor, builder, lock
if platform.system() == 'Windows':
from win32spawn import Win32Spawn
@@ -182,6 +182,16 @@ class SconsUI(): if os.environ.has_key('RTT_ROOT'):
self.RTTRoot.set_path(os.environ['RTT_ROOT'])
+ if self.RTTRoot.get_path() == '':
+ rtt_root = ''
+ # detect RT-Thread directory
+ if os.path.exists(os.path.join('..', 'include', 'rtthread.h')):
+ rtt_root = os.path.join('..')
+ elif os.path.exists(os.path.join('..', '..', 'include', 'rtthread.h')):
+ rtt_root = os.path.join('..', '..')
+ if rtt_root:
+ self.RTTRoot.set_path(os.path.abspath(rtt_root))
+
# detect compiler path
if platform.system() == 'Windows':
# Keil MDK
@@ -388,22 +398,15 @@ class SconsUI(): exit(0)
def StartSConsUI(path=None):
- global val, root
+ global val, root, builder, lock
root = Tk()
root.title('RT-Thread SCons UI')
- root.geometrygeometry('590x510+50+50')
+ #root.geometrygeometry('590x510+50+50')
lock = threading.RLock()
builder = SconsUI(root)
if path:
builder.BSPRoot.set_path(path)
- root.mainloop
+ root.mainloop()
if __name__ == '__main__':
- global val, root
- root = Tk()
- root.title('scons_builder')
- root.geometry('590x510+50+50')
- lock = threading.RLock()
- scons_ui = SconsUI(root)
- builder = scons_ui
- root.mainloop()
+ StartSConsUI()
diff --git a/tools/win32spawn.py b/tools/win32spawn.py index f513ec3ea4..28a181510e 100644 --- a/tools/win32spawn.py +++ b/tools/win32spawn.py @@ -139,7 +139,8 @@ class Win32Spawn(object): try:
finished = 0
hr, data = win32file.ReadFile(handle, bytesToRead, None)
- self.queue.put_nowait(data)
+ if data:
+ self.queue.put_nowait(data)
except win32api.error:
finished = 1
|
