def init(self): self.getContext().addPropertyChangeListener( self) #ThrottleFrame change self.addressPanel = self.getContext().getCurrentThrottleFrame( ).getAddressPanel() self.addressPanel.addAddressListener( self) # change of throttle in Current frame self.throttle = self.getContext().getCurrentThrottleFrame( ).getAddressPanel().getThrottle() # the throttle self.speedAction = SpeedAction() #Speed increase thread self.speedAction.setThrottle(self.throttle) self.speedTimer = Timer( valueSpeedTimerRepeat, self.speedAction ) # Very important to use swing Timer object (see Swing and multithreading doc) self.speedTimer.setRepeats(True) self.label = JButton( ImageIcon(self.getFolder() + "/WiimoteThrottle2.png", "WiiMote")) #label self.label.addMouseListener( self.getMouseListeners() [0]) # In order to get the popupmenu on the button too self.add(self.label) self.lastTimeButton1 = Calendar.getInstance().getTimeInMillis() self.lastTimeButton2 = Calendar.getInstance().getTimeInMillis() self.advFunctions = AdvFunctions() self.lastTimeEStop = Calendar.getInstance().getTimeInMillis() self.wiiDevice = None self.sync = thread.allocate_lock() # A lock protecting bellow self.evt self.evt = None java.lang.System.setProperty("bluecove.jsr82.psm_minimum_off", "true") # Required for Bluecove + WiiRemoteJ WiiRemoteJ.findRemotes(self, 1) # Search for 1 Wiimote, and call back
def quit(self): self.speedTimer.stop() WiiRemoteJ.stopFind() if ((self.wiiDevice != None) and (self.wiiDevice.isConnected())): self.wiiDevice.removeWiiRemoteListener(self) self.wiiDevice.disconnect() self.wiiDevice = None self.speedAction = None self.speedTimer = None self.throttle = None self.getContext().removePropertyChangeListener(self) self.addressPanel.removeAddressListener(self) self.addressPanel = None
def init(self): self.getContext().addPropertyChangeListener(self) #ThrottleFrame change self.addressPanel=self.getContext().getCurrentThrottleFrame().getAddressPanel(); self.addressPanel.addAddressListener(self) # change of throttle in Current frame self.throttle = self.getContext().getCurrentThrottleFrame().getAddressPanel().getThrottle() # the throttle self.speedAction = SpeedAction() #Speed increase thread self.speedAction.setThrottle( self.throttle ) self.speedTimer = Timer(valueSpeedTimerRepeat, self.speedAction ) # Very important to use swing Timer object (see Swing and multithreading doc) self.speedTimer.setRepeats(True) self.label = JButton(ImageIcon(self.getFolder() + "/WiimoteThrottle.png","WiiMote")) #label self.label.addMouseListener(self.getMouseListeners()[0]) # In order to get the popupmenu on the button too self.add(self.label) self.lastTimeButton1 = Calendar.getInstance().getTimeInMillis() self.lastTimeButton2 = Calendar.getInstance().getTimeInMillis() self.lastTimeEStop = Calendar.getInstance().getTimeInMillis() self.wiiDevice = None self.sync = thread.allocate_lock() # A lock protecting bellow self.evt self.evt = None java.lang.System.setProperty("bluecove.jsr82.psm_minimum_off", "true"); # Required for Bluecove + WiiRemoteJ WiiRemoteJ.findRemotes(self, 1) # Search for 1 Wiimote, and call back