def ButtonPressed(self, button): if (button < len(self.sounds)): sound = self.sounds[button] else: sound = self.randomSounds[randint(0, len(self.randomSounds) - 1)] feeling_IO.playSound(sound) feeling_IO.setDisplay('Now Playing', Sound_Mode.getFileName(sound))
def applyConfig(self): chosenJob = Admin_Mode.configJobs[self.jobToApply] if (chosenJob == 'NetConfig'): interfaces = '' for iface in ni.interfaces(): ipv4s = ni.ifaddresses(iface).get(ni.AF_INET, []) for entry in ipv4s: addr = entry.get('addr') if not addr: continue interfaces = interfaces + ' ' + addr feeling_IO.setDisplay('Interfaces:', interfaces) elif (chosenJob == 'Restart'): feeling_IO.setDisplay('Restarting now', 'please wait') time.sleep(1) os.system('sudo shutdown -r now') elif (chosenJob == 'Update'): feeling_IO.setDisplay('Updating services', 'please wait') time.sleep(1) scriptPath = os.path.join(os.path.dirname(__file__), '../updateFB.sh') os.system(scriptPath) elif (chosenJob == 'Shutdown'): feeling_IO.setDisplay('Shutting down', 'Bye cruel world!') time.sleep(1) os.system('sudo shutdown -h now') elif (chosenJob == 'Sound'): self.status.setMode('sound') elif (chosenJob == 'Test'): feeling_IO.makeGreatJobSound() feeling_IO.playSound('sounds/mittagessen.mp3') feeling_rest.CallHipchatRestApi('DEFAULT')
def ButtonPressed(self, button): if (button == 0): self.jobToApply = (self.jobToApply - 1) % len( Admin_Mode.configJobs) if (button == 1): self.jobToApply = (self.jobToApply + 1) % len( Admin_Mode.configJobs) if (button == 2): self.applyConfig() return if (button == 3): self.status.resetMode() return feeling_IO.setDisplay(Admin_Mode.configJobs[self.jobToApply], 'Mit Rot bestaetigen')
def ButtonPressed(self, button): if self.Button_Activate_Time < datetime.now(): error, achievement = feeling_rest.addFeelingBoardEntry( self.status.RFID_uid, 3 - button) self.Button_Activate_Time = datetime.now( ) + User_Mode.BUTTON_REPEAT_DELAY if not error: if achievement != '': feeling_IO.setDisplay('New Achievement!', achievement, 5) time.sleep(5) if self.status.Code: feeling_IO.setDisplay('Danke ' + self.status.RFID_name, 'Dein Code: ' + self.status.Code, 5) else: feeling_IO.setDisplay('Danke ' + self.status.RFID_name, 'fuers Mitmachen!', 5) else: feeling_IO.setDisplay('Error while', 'adding Entry', 5) else: feeling_IO.setDisplay('nicht so schnell', 'Cowboy', 5)
def modeChanged(self): feeling_IO.setDefaultDisplayValues('Admin Mode', 'Chose your action') feeling_IO.setDisplay('Admin Mode', 'Chose your action')
def modeChanged(self): feeling_IO.setDefaultDisplayValues('Sound Mode', 'Chose your sound') feeling_IO.setDisplay('Sound Mode', 'Chose your sound')
def modeChanged(self): feeling_IO.setDefaultDisplayValues('Hallo', 'Wie geht\'s dir?') feeling_IO.setDisplay('Hallo', 'Wie geht\'s dir?')
def userChanged(self, aUid, aUserName): if (aUid == '0'): self.modeChanged() else: feeling_IO.setDisplay('Hallo ' + aUserName, 'Wie geht\'s?')