예제 #1
0
파일: remind.py 프로젝트: rishikanthc/Mark2
 def on_event(self, message):
     self.message = message
     print self.message
     m = re.match(self.regex, self.message["text"], re.DOTALL)
     if m:
         self.what = m.group("reminder_text")
         self.when = m.group("remind_time")
         self.when_epoch = nt.parse_natural_time(self.when)
         print self.when_epoch
         try:
             self.remainder = SCHEDULER.add_job(self.rem, "date", name="test", run_date=self.when_epoch)
             print self.remainder
         except ValueError:
             tts.speak("Could not schedule this remainder")
             print "error"
예제 #2
0
    def on_event(self, event, sender):
        m=self.match(event)
        if m:
            if m.group("time"):
                self.when=m.group("time")
                self.when_epoch=nt.parse_natural_time(self.when)
                tts.speak("sir, please enter the full command you wish to execute?")
                self.what=enterbox("command to run at {}".format(self.when_epoch))
                print self.when_epoch
                try:
                    self.remainder=SCHEDULER.add_job(self.runat,'date',run_date=self.when_epoch)

                except ValueError:
                    tts.speak("Could not schedule this run")
            else:
                tts.speak("sir, please enter the full command you wish to execute?")
                self.what=enterbox("command to run")
                comm="gnome-terminal --tab -e {0}".format(self.what)
                self.command(comm)
            return True