示例#1
0
class PedalPoller(QtCore.QThread):
	"""Poll pedal driver."""

	def __init__(self, *args):
		QtCore.QThread.__init__(self, *args)
		self.running_mutex = QtCore.QMutex()
		self.running = True
		self.pedal = Pedal()

	def run(self):
		"""Poll pedal."""

		while self.getRunning():
			if self.pedal.waitForPress():
				self.emit(QtCore.SIGNAL("pedalPressed"))

	def getRunning(self):
		"""Get application running status."""

		self.running_mutex.lock()
		running = self.running
		self.running_mutex.unlock()
		return running

	def exit(self):
		"""Stop polling pedal."""

		self.running_mutex.lock()
		self.running = False
		self.running_mutex.unlock()
示例#2
0
	def __init__(self, *args):
		QtCore.QThread.__init__(self, *args)
		self.running_mutex = QtCore.QMutex()
		self.running = True
		self.pedal = Pedal()