[tuxdroid-svn] r657 - api/python/trunk
Status: Beta
Brought to you by:
ks156
From: remi <c2m...@c2...> - 2007-11-06 10:26:45
|
Author: remi Date: 2007-11-06 11:26:43 +0100 (Tue, 06 Nov 2007) New Revision: 657 Modified: api/python/trunk/tuxapi_class.py Log: ADD: api_version in tux object UPD: switch object Modified: api/python/trunk/tuxapi_class.py =================================================================== --- api/python/trunk/tuxapi_class.py 2007-11-06 09:37:29 UTC (rev 656) +++ api/python/trunk/tuxapi_class.py 2007-11-06 10:26:43 UTC (rev 657) @@ -186,9 +186,9 @@ self.monitoring = TUXmonitoring(self) self.wav = TUXwav(self) self.micro = TUXmicro(self) + self._switches = [] + self.api_version = api_version - self.head_switch = TuxSwitch(self, STATUS_HEAD_PUSH_SWITCH) - self.connected=False #deprecated t=threading.Thread(target=self.daemon._loop_auto_connect) t.setName('daemon._loop_auto_connect') @@ -543,7 +543,11 @@ #on monitoring self.monitoring.check_events(data) - self.head_switch._notify(ord(data[4]), ord(data[5])) + for switch in self._switches: + try: + switch._notify(ord(data[4]), ord(data[5])) + except: + pass #-------------------------------------------------------------------------- @@ -5067,7 +5071,7 @@ self.parent = parent self.__wav_path = "" self.__wav_length = 0 - + def destroy(self): self.stop() @@ -5257,7 +5261,7 @@ self.capture_start_free(out_path, length) while self.__capturing: time.sleep(0.05) - + def capture_start_free(self, out_path, length = 0): """ Write the stream in a wav file. @@ -5606,16 +5610,17 @@ self.__status = status self.on_press = EventControl() self.on_release = EventControl() + self.parent._switches.append(self) - def _store_events(self): + def store_events(self): self.on_press.push() self.on_release.push() - def _restore_events(self): + def restore_events(self): self.on_press.pop() self.on_release.pop() - def _clear_events(self): + def clear_events(self): self.on_press.clear() self.on_release.clear() |