示例#1
0
    def toggle_radio (self, on):
        if Touchevent.event():   # brightness control
            Sound.play(CONFIG.CLICK_SOUND)

            request = CONFIG.RADIO.BASE_URL
            request += "showapp" if on else "radiooff"
            self.call_url(request)
示例#2
0
 def reset_counter(self):
     """resets the timer and switches alarm off"""
     if Touchevent.event():  # brightness control
         Sound.play(CONFIG.CLICK_SOUND)
         self.reset_event = True
         countdown.reset()
         self.timer.set("")
         self.timerdisplay.pack_forget()
示例#3
0
    def play(self, station_url):
        if Touchevent.event():  # brightness control
            Sound.play(CONFIG.CLICK_SOUND)

            Log(f"Playing {station_url}")
            if self.radio_process is not None:
                self.stop_play()

            self.radio_process = subprocess.Popen(["cvlc", station_url])
示例#4
0
 def toggle (self):
     if Touchevent.event():   # brightness control
         Sound.play(CONFIG.CLICK_SOUND)
         try:
             urlopen(CONFIG.URL_ANTEROOM_CONTROL, timeout=2)
         except (HTTPError, URLError):
             Log("HTTPError, URLError: {0[0]} {0[1]}".format(sys.exc_info()))
         except socket.timeout:
             Log("socket.timeout: {0[0]} {0[1]}".format(sys.exc_info()))
示例#5
0
    def stop_play(self, nosound=False):
        if Touchevent.event():  # brightness control
            if not nosound:
                Sound.play(CONFIG.CLICK_SOUND)

            Log("Stopping radio station.")
            if self.radio_process:
                self.radio_process.terminate()
                self.radio_process.communicate()
                self.radio_process = None
示例#6
0
 def set_counter(self, value):
     """sets the counter/countdown
        and displays the countdown to the screen"""
     if Touchevent.event():  # brightness control
         Sound.play(CONFIG.CLICK_SOUND)
         if self.alarm_id is not None:
             self.set_event = True
         countdown.alter(value * 60)
         if countdown.counter > 0:
             self.timerdisplay.pack(padx=5, pady=5)
             self.reset_event = False
示例#7
0
 def toggle_light (self):
     if Touchevent.event():   # brightness control
         Sound.play(CONFIG.CLICK_SOUND)
         self.call_url(CONFIG.URL_ANTEROOM_CONTROL)
 def turn_page(self):
     """send the touch event to the brightness controller.
        if brightness was not at full level, the brightness
        controller sets brightness to full. in this case, no
        pagination shall be done."""
     return Touchevent.event()