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 show_working_indicator(message): """ Helper function to show that some work is taking place and that freevo hasn't crashed. @param message: Message to be displayed by the dialog. @return: A dialog object which the caller should call hide() on when work has completed. """ from dialog.dialogs import ProgressDialog dialog = ProgressDialog(message, indeterminate=True) dialog.show() return dialog
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 delete_file(self): dialog = ProgressDialog(_('Deleting...'), indeterminate=True) dialog.show() self.item.files.delete() dialog.hide() if self.menuw: self.menuw.delete_submenu(True, True)
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 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()