← Back to team overview

glaus team mailing list archive

[Merge] lp:~glaus/gross/ui-main-window into lp:gross

 

Joe Pentland has proposed merging lp:~glaus/gross/ui-main-window into lp:gross.

Requested reviews:
  Andrew Moffat (moffat-a-j)

For more details, see:
https://code.launchpad.net/~glaus/gross/ui-main-window/+merge/82743

Added a couple of UI bits.

Doesn't actually work yet but this is just an example merge request for code review purposes.
-- 
https://code.launchpad.net/~glaus/gross/ui-main-window/+merge/82743
Your team Glaus is subscribed to branch lp:~glaus/gross/ui-main-window.
=== added file 'src/Controller.py'
--- src/Controller.py	1970-01-01 00:00:00 +0000
+++ src/Controller.py	2011-11-18 20:56:26 +0000
@@ -0,0 +1,42 @@
+import threading
+
+class Controller( threading.Thread ):
+	""" Controller thread to update UI and hardware """
+
+	def __init__(self, canvas):
+		"""
+		@param canvas Canvas to which hardware views should be drawn
+		"""
+		threading.Thread.__init__(self)
+		self.canvas = canvas
+		self._views = []
+		self._hardware = []
+		self.running = False
+		self.runLock = threading.Lock()
+
+	def addView(self, view):
+		"""
+		Add a view to be drawn on the screen
+		@param view View to be added
+		"""
+		self._views.append(view)
+
+	def addHardware(self, hardwareModel):
+		"""
+		Add a hardware model to be controlled
+		@param hardwareModel Harware model to be controlled
+		"""
+		self._hardware.append(hardwareModel)
+
+	def run(self):
+		"""
+		Run method containing thread logic
+		"""
+
+		while(True):
+			for model in self._hardware:
+				model.clockEdge()
+
+			for view in self._views:
+				view.update()
+				view.draw(self.canvas)

=== modified file 'src/main.py'
--- src/main.py	2011-05-29 11:47:26 +0000
+++ src/main.py	2011-11-18 20:56:26 +0000
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2.6
+#!/usr/bin/env python2
 
 import wx
 from ui import MainFrame


Follow ups