def show_program_info(self, arg=None, menuw=None): """ open the 'Full description' screen """ tvguide = menuw.menustack[-1] prg = ProgramItem(tvguide, tvguide.selected, context='guide') prg.show_description(menuw=menuw)
def show_program_info(self, arg=None, menuw=None): """ open the 'Full description' screen """ tvguide = menuw.menustack[-1] prg = ProgramItem(tvguide, tvguide.selected, context = 'guide') prg.show_description(menuw=menuw)
def show_options(self, arg=None, menuw=None): """ show the available options as a overlay menu. """ if arg is None: tvguide = menuw.menustack[-1] pi = ProgramItem(tvguide, prog=tvguide.selected, context='guide') arg = pi.actions() menuw.pushmenu(DialogMenu(arg, menuw)) skin_object.redraw()
def browse(self, arg=None, menuw=None): """ build the items for the menu """ showings = {} for p in tv.epg.search(category=self.category): if p.title in showings: s = showings[p.title] else: s = [] showings[p.title] = s s.append(ProgramItem(self, p)) items = [] for show in sorted(showings.keys()): s = showings[show] if len(s) > 1: items.append(ProgamShowings(self, show, s)) else: items.append(s[0]) item_menu = Menu(self.name, items, item_types='tv') menuw.pushmenu(item_menu) self.menu = item_menu self.menuw = menuw
def search_for_programs(self, menuw, text): if not text: dialog.show_alert(_('Please specify something to search for!')) return pdialog = ProgressDialog(_('Searching, please wait...')) pdialog.show() programs = tv.epg.search(keyword=text, time=(time.time(), 0)) items = [] for prog in programs: items.append(ProgramItem(self.parent, prog, context='search')) if len(items) >= MAX_RESULTS: break items.sort(lambda x, y: cmp(x.prog.start, y.prog.start)) pdialog.hide() if len(items) == 0: dialog.show_alert(_('No matches found for %s') % text) return search_menu = Menu(_('Search Results'), items, item_types='tv program menu') menuw.pushmenu(search_menu) menuw.refresh()
def search_for_programs(self, menuw, text): pop = PopupBox(text=_('Searching, please wait...')) pop.show() (result, matches) = self.findMatches(text) pop.destroy() items = [] if result: _debug_('search found %s matches' % len(matches)) f = lambda a, b: cmp(a.start, b.start) matches.sort(f) for prog in matches: items.append(ProgramItem(self, prog, context='search')) else: if matches == 'no matches': msgtext = _('No matches found for %s') % text AlertBox(text=msgtext).show() return AlertBox(text=_('Cannot find program: %s') % matches).show() return search_menu = Menu(_('Search Results'), items, item_types='tv program menu') menuw.pushmenu(search_menu) menuw.refresh()
def search_for_more(arg=None, menuw=None): parent, title = arg # this might take some time, thus we open a popup messages logger.log( 9, String('searching for: %s', title)) pop = dialog.show_working_indicator(_('Searching, please wait...')) # do the search (status, matches) = RecordClient().findMatchesNow(title) pop.hide() if status: items = [] logger.log( 9, 'search found %s matches', len(matches)) # sort by start times f = lambda a, b: cmp(a.start, b.start) matches.sort(f) for prog in matches: items.append(ProgramItem(parent, prog, context='search')) elif matches == 'no matches': # there have been no matches msgtext = _('No matches found for %s') % self.title dialog.show_alert(msgtext) return else: # something else went wrong msgtext = _('Search failed') +(':\n%s' % matches) dialog.show_alert(msgtext) return # create a menu from the search result search_menu = Menu(_('Search Results'), items, item_types='tv program menu') # do not return from the search list to the submenu # where the search was initiated menuw.delete_submenu(refresh = False) menuw.pushmenu(search_menu) menuw.refresh()
def more_programs(self, arg=None, menuw=None): pdialog = ProgressDialog(_('Searching, please wait...')) pdialog.show() now = time.time() programs = tv.epg.search(title=self.current_prog.prog.title, time=(now, 0)) items = [] for prog in programs: items.append( ProgramItem(self.current_prog, prog, context='more_programs')) items.sort(lambda x, y: cmp(x.prog.start, y.prog.start)) pdialog.hide() search_menu = Menu(_('Search Results'), items, item_types='tv program menu') menuw.pushmenu(search_menu) menuw.refresh()
def get_items(self): items = [] if not self.recordclient.pingNow(): AlertBox(self.recordclient.recordserverdown).show() return [] (status, progs) = self.recordclient.getScheduledRecordingsNow() if status: f = lambda a, b: cmp(a.start, b.start) progs.sort(f) for prog in progs: items.append(ProgramItem(self, prog, context='schedule')) else: AlertBox( _('Get scheduled recordings failed') + (':\n%s' % schedule)).show() return [] return items
def __init__(self, parent, prog): ProgramItem.__init__(self, parent, prog)