summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-09-07 11:14:15 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2011-09-07 11:14:15 +0200
commit806a1fd0553c9c21dc6b3b20d0a8db52fce5741c (patch)
tree24e6329ee84506c61ca734d316452d7067da3775
parente6202ad942e39874a2834c204151f3013403ff1b (diff)
downloadlibuca-806a1fd0553c9c21dc6b3b20d0a8db52fce5741c.tar.gz
libuca-806a1fd0553c9c21dc6b3b20d0a8db52fce5741c.tar.bz2
libuca-806a1fd0553c9c21dc6b3b20d0a8db52fce5741c.tar.xz
libuca-806a1fd0553c9c21dc6b3b20d0a8db52fce5741c.zip
Add: "control" application monitoring `grab`
-rw-r--r--test/CMakeLists.txt1
-rwxr-xr-xtest/run.py31
2 files changed, 32 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 728da6a..e2664bf 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -11,6 +11,7 @@ pkg_check_modules(GTHREAD2 gthread-2.0)
include_directories(${CMAKE_SOURCE_DIR}/src)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/control.glade ${CMAKE_CURRENT_BINARY_DIR})
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/run.py ${CMAKE_CURRENT_BINARY_DIR})
# --- Build targets -----------------------------------------------------------
add_executable(enum enum.c)
diff --git a/test/run.py b/test/run.py
new file mode 100755
index 0000000..7982617
--- /dev/null
+++ b/test/run.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+import Tkinter
+import threading
+import subprocess
+
+class App(object):
+ def __init__(self, parent):
+ self.parent = parent
+ self.canvas = Tkinter.Canvas(root, width=300, height=300)
+ self.canvas.pack()
+ self.rect = self.canvas.create_rectangle(0, 0, 300, 300, fill='yellow')
+ self.run_button = Tkinter.Button(parent, text='Start grabbing', command=self.run_click)
+ self.run_button.pack()
+
+ def run_grab(self):
+ proc = subprocess.Popen(['./grab'])
+ proc.wait()
+ self.canvas.itemconfig(self.rect, fill='red')
+ self.run_button.config(state=Tkinter.NORMAL, text='Close', command=self.parent.destroy)
+
+ def run_click(self):
+ self.canvas.itemconfig(self.rect, fill='green')
+ self.run_button.config(state=Tkinter.DISABLED)
+ thread = threading.Thread(None, self.run_grab)
+ thread.start()
+
+if __name__ == '__main__':
+ root = Tkinter.Tk()
+ app = App(root)
+ root.mainloop()