def action(self, tag_name): """ Action that should be performed on a click. """ if tag_name == 'btn_name': keyboard = Keyboard(self.screen, _("Set station name")) keyboard.title_color = FIFTIES_YELLOW keyboard.text = self.station_name self.station_name = keyboard.show() self.update() self.show() elif tag_name == 'btn_URL': keyboard = Keyboard(self.screen, _("Set station URL")) keyboard.title_color = FIFTIES_YELLOW keyboard.text = self.station_URL self.station_URL = keyboard.show() self.update() self.show() elif tag_name == 'btn_cancel': self.close() elif tag_name == 'btn_ok': if self.station_name != "" and self.station_URL != "": config_file.setting_set('Radio stations', self.station_name, self.station_URL) self.close()
def action(self, tag_name): """ Action that should be performed on a click. :param tag_name: The identifying tag_name of the clicked widget. """ search_label = tag_name if tag_name == 'btn_cancel': self.close() return elif tag_name == 'btn_artists': self.search_type = 'artist' search_label = _("Search artists") elif tag_name == 'btn_albums': self.search_type = 'album' search_label = _("Search albums") elif tag_name == 'btn_songs': self.search_type = 'song' search_label = _("Search songs") # Open on-screen keyboard for entering search string keyboard = Keyboard(self.screen, search_label) keyboard.title_color = FIFTIES_YELLOW self.search_text = keyboard.show() # Get entered search text self.close()