def respond2(self,translations,medium): for trans in translations: if "good" in trans: speak("well Ia m glad you are doing so well",medium) elif "bad" in trans: speak("awwww, I am so sorry to hear that. feel better soon",medium) else: speak("yes, I understand. talk to you later Watson",medium) Node.closeAll(self.tree) return self.tree
def affirmFull(self,translations,medium): for i in range(4,len(self.lines)-2): report = self.lines[i][:-6] report=re.sub('Sun ','Sunday ',report) report=re.sub('Mon ','Monday ',report) report=re.sub('Tue ','Tuesday ',report) report=re.sub('Wed ','Wednesday ',report) report=re.sub('Thu ','Thursday ',report) report=re.sub('Fri ','Friday ',report) report=re.sub('Sat ','Saturday ',report) speak(report,medium) Node.closeAll(self.tree) return self.tree
def affirmTime(self,translations,medium):#1,0 speak("ok, creating alarm now",medium) cron = CronTab(user='******') job=cron.new(command="sudo /home/pi/Room/commands/alarm.sh") job.minute.on(self.min) job.hour.on(self.hr) if job.is_valid(): job.enable() cron.write() Node.closeAll(self.tree) return self.tree else: speak("error creating cron job. peter fix me. I hate being quasi functional.",medium) return self.tree
def daffirmFull(self,translations,medium): speak("ok then",medium) Node.closeAll(self.tree) return self.tree
def noText(self,translations,medium): speak("Ok, I'll just tell you.",medium) Node.closeAll(self.tree) return self.tree
def yesText(self,translations,medium): speak("ok great. glad that is over. I will text you this reminder",medium) Node.closeAll(self.tree) return self.tree
def daffirmTime(self,translations,medium):#1,1 speak("sorry, say that again please. I promise i'll figure it out this time.",medium) Node.closeAll(self.tree) return self.tree