def stop(self, restore_menu=False): logger.debug('stop(restore_menu=%r)', restore_menu) if self.visible and self.dialog and restore_menu: self.dialog = audio.show_play_state(dialog.PLAY_STATE_STOP, self.item, self.get_time_info) self.dialog.show() global _player_ _player_ = None self.player.stop() self.running = False if self.visible: rc.remove_app(self.player) if restore_menu: skin.draw('player', self.item, transition=skin.TRANSITION_OUT) self.visible = False if self.dialog: self.dialog.hide() self.dialog.finish() self.dialog = None if self.menuw and not self.menuw.visible and restore_menu: self.menuw.show()
def refresh(self, reload=0): menu = self.menustack[-1] if not isinstance(menu, Menu): # Do not draw if there are any children if self.children: return False return menu.refresh() # We need to unmount devices but only at the top menu if len(self.menustack) == 1: if self.menustack[-1].umount_all == 1: util.umount_all() if reload: if menu.reload_func: reload = menu.reload_func() if reload: self.menustack[-1] = reload if self.force_page_rebuild: self.force_page_rebuild = False self.rebuild_page() self.init_page() skin.draw('menu', self, self.menustack[-1], self.screen_transition) self.screen_transition = skin.TRANSITION_NONE
def rebuild(self, start_time, stop_time, selected_fn, force=False): """ rebuild the guide This is neccessary we change the set of programs that have to be displayed, this is the case when the user moves around in the menu. """ logger.log( 9, 'rebuild(start_time=%r, stop_time=%r, selected_fn=%r)', start_time, stop_time, selected_fn) start_channel_idx = self.start_channel_idx if self.selected_channel_idx > self.start_channel_idx + (self.n_items - 1): self.start_channel_idx = self.selected_channel_idx - (self.n_items - 1) elif self.selected_channel_idx < self.start_channel_idx: self.start_channel_idx = self.selected_channel_idx if force or self.start_time != start_time or self.start_channel_idx != start_channel_idx: end_idx = self.start_channel_idx + self.n_items channel_list = self.channels[self.start_channel_idx:end_idx] self.display_up_arrow = self.start_channel_idx > 0 self.display_down_arrow = end_idx < len(self.channels) channels = tv.epg.get_grid(start_time+1, stop_time-1, channel_list) self.start_time = start_time self.stop_time = stop_time # table header header = ['Chan'] for i in range(int(self.n_cols)): header.append( start_time + self.col_time * i * 60 ) table = [header, self.selected] flag_selected = False for chan in channels: if not chan.programs: prg = TvProgram(chan.id, 0, 0, 2147483647, CHAN_NO_DATA, desc='') chan.programs = [ prg ] table.append(chan) self.table = table selected_channel_offset = (self.selected_channel_idx - self.start_channel_idx) + 2 if selected_fn: for p in self.table[selected_channel_offset].programs: if selected_fn(p): flag_selected = True self.selected = p self.table[1] = p break if not flag_selected: p = self.table[selected_channel_offset].programs[0] self.table[1] = p self.selected = p skin.draw(self.type, self, transition=self.transition) self.transition = skin.TRANSITION_NONE
def hide(self): logger.debug('hide() self.visible=%r', self.visible) if self.visible: skin.draw('player', self.item, transition=skin.TRANSITION_OUT) self.visible = False # skin.clear() rc.remove_app(self.player) if self.dialog: self.dialog.hide() self.dialog.finish() self.dialog = None
def stop(self, restore_menu=False): logger.debug("stop(restore_menu=%r)", restore_menu) global _player_ _player_ = None self.player.stop() self.running = False if self.visible: rc.remove_app(self.player) skin.draw("player", self.item, transition=skin.TRANSITION_OUT) if self.menuw and not self.menuw.visible and restore_menu: self.menuw.show()
def stop(self, restore_menu=False): logger.debug('stop(restore_menu=%r)', restore_menu) global _player_ _player_ = None self.player.stop() self.running = False if self.visible: rc.remove_app(self.player) skin.draw('player', self.item, transition=skin.TRANSITION_OUT) if self.menuw and not self.menuw.visible and restore_menu: self.menuw.show()
def refresh(self, force_update=True): """refresh the guide This function is called automatically by freevo whenever this menu is opened or reopened. """ _debug_('refresh(force_update=True)', 2) if self.menuw.children: return _debug_('tvguide: setting context to %s' % self.event_context, 2) rc.set_context(self.event_context) self.update(force_update) skin.draw(self.type, self)
def __init__(self, menuw): tvguide = menuw.menustack[-1] prg = tvguide.selected if prg is None: name = _('No Information Available') description = '' else: name = prg.title description = prg.getattr('time') + u'\n' + prg.desc item = MenuItem(name=name) item.description = description self.visible = True self.menuw = menuw self.menuw.hide(clear=False) rc.app(self) skin.draw('tvguideinfo', item)
def refresh(self): """ Give information to the skin.. """ if not self.visible: return if not self.running: return # Calculate some new values if not self.item.length: self.item.remain = 0 else: self.item.remain = self.item.length - self.item.elapsed skin.draw('player', self.item) return
class ShowHeadlineDetails: """ Screen to show the details of the headline items """ def __init__(self, (item, menuw)): self.menuw = menuw self.menuw.hide(clear=False) rc.app(self) skin.draw('headlines', item)
def __init__(self, iArg=None, iMenuw=None, iWeather=None): self.arg = iArg self.menuw = iMenuw self.weather = iWeather self.menuw.hide(clear=False) rc.app(self) self.skins = ('day', 'forecast', 'week', 'doplar') self.subtitles = (_('Current Conditions'), _('Today\'s Forecast'), _('Extended Forecast'), _('Radar Map')) self.curSkin = 0 self.title = self.weather.name self.subtitle = self.subtitles[0] # Fire up splashscreen and load the plugins skin.draw('weather', self)
def __init__(self, arg=None, menu=None, weather=None): """ """ logger.log(9, "WeatherDetailHandler.__init__(arg=%r, menu=%r, weather=%r)", arg, menu, weather) self.arg = arg self.menuw = menu self.weather = weather self.menuw.hide(clear=False) rc.add_app(self) self.skins = ("day", "forecast", "week", "map") self.skin_num = 0 self.subtitles = (_("Current Conditions"), _("Today's Forecast"), _("Extended Forecast"), _("Radar Map")) self.title = "" self.subtitle = self.getSubtitle(self.skin_num) # Fire up splashscreen and load the plugins skin.draw("oneclick", self, transition=skin.TRANSITION_IN)
def refresh(self): """ Give information to the skin """ logger.log(9, "refresh()") if not self.visible: return if not self.running: return elapsed = int(time.time() - self.start_time + 0.5) hr = elapsed / (60 * 60) mn = elapsed % (60 * 60) / 60 sc = elapsed % (60 * 60) % 60 # Is there any point is having elapsed? # if hr > 0: # self.item.elapsed = '%d:%02d:%02d' % (hr, mn, sc) # else: # self.item.elapsed = '%d:%02d' % (mn, sc) skin.draw("player", self.item)
def __init__(self, iArg=None, iMenuw=None, iWeather=None ): print iMenuw print iWeather self.arg = iArg self.menuw = iMenuw self.mpd = iWeather self.menuw.hide(clear=False) rc.add_app(self) self.skins = ('mpd') self.subtitles = (_('mpd')) self.curSkin = 0 print self.mpd.name self.title = self.mpd.name self.subtitle = self.subtitles[0] # Fire up splashscreen and load the plugins skin.draw('mpd', self)
def __init__(self, iArg=None, iMenuw=None, iWeather=None): print iMenuw print iWeather self.arg = iArg self.menuw = iMenuw self.mpd = iWeather self.menuw.hide(clear=False) rc.app(self) self.skins = ('mpd') self.subtitles = (_('mpd')) self.curSkin = 0 print self.mpd.name self.title = self.mpd.name self.subtitle = self.subtitles[0] # Fire up splashscreen and load the plugins skin.draw('mpd', self)
def __init__(self, iArg=None, iMenuw=None, iWeather=None): self.arg = iArg self.menuw = iMenuw self.weather = iWeather self.menuw.hide(clear=False) rc.app(self) self.skins = ('day', 'forecast', 'week', 'doplar') self.subtitles = (_('Current Conditions'), _("Today's Forecast"), _("Extended Forecast"), _("Radar Map")) self.curSkin = 0 self.title = self.weather.name self.subtitle = self.subtitles[0] # Fire up splashscreen and load the plugins skin.draw('weather', self)
def refresh(self): """ Give information to the skin """ logger.log(9, 'refresh()') if not self.visible: return if not self.running: return elapsed = int(time.time() - self.start_time + 0.5) hr = elapsed / (60 * 60) mn = elapsed % (60 * 60) / 60 sc = elapsed % (60 * 60) % 60 # Is there any point is having elapsed? #if hr > 0: # self.item.elapsed = '%d:%02d:%02d' % (hr, mn, sc) #else: # self.item.elapsed = '%d:%02d' % (mn, sc) skin.draw('player', self.item)
def __init__(self, arg=None, menu=None, weather=None): """ """ _debug_('WeatherDetailHandler.__init__(arg=%r, menu=%r, weather=%r)' % (arg, menu, weather), 2) self.arg = arg self.menuw = menu self.weather = weather self.menuw.hide(clear=False) rc.app(self) self.skins = ('day', 'forecast', 'week', 'map') self.skin_num = 0 self.subtitles = (_('Current Conditions'), _('Today\'s Forecast'), _('Extended Forecast'), _('Radar Map')) self.title = '' self.subtitle = self.getSubtitle(self.skin_num) # Fire up splashscreen and load the plugins skin.draw('oneclick', self)
def __init__(self, arg=None, menu=None, weather=None): """ """ logger.log( 9, 'WeatherDetailHandler.__init__(arg=%r, menu=%r, weather=%r)', arg, menu, weather) self.arg = arg self.menuw = menu self.weather = weather self.menuw.hide(clear=False) rc.add_app(self) self.skins = ('day', 'forecast', 'week', 'map') self.skin_num = 0 self.subtitles = (_('Current Conditions'), _('Today\'s Forecast'), _('Extended Forecast'), _('Radar Map')) self.title = '' self.subtitle = self.getSubtitle(self.skin_num) # Fire up splashscreen and load the plugins skin.draw('oneclick', self, transition=skin.TRANSITION_IN)
def refresh(self): """ Give information to the skin """ logger.log(8, 'refresh() visible=%r running=%r', self.visible, self.running) if not self.visible: return if not self.running: return # Calculate some new values if not self.item.length: self.item.remain = 0 else: self.item.remain = self.item.length - self.item.elapsed if self.first_drawing: transition = skin.TRANSITION_IN self.first_drawing = False else: transition = skin.TRANSITION_NONE skin.draw('player', self.item, transition=transition) if self.visible and self.dialog and self.seeking >= 0: if self.seeking > 0: self.seeking = self.seeking - 1 return if self.paused: self.dialog = audio.show_play_state(dialog.PLAY_STATE_PAUSE, self.item, self.get_time_info) else: self.dialog = audio.show_play_state(dialog.PLAY_STATE_PLAY, self.item, self.get_time_info) self.dialog.show() self.seeking = -1
def eventhandler(self, event, menuw=None): '''eventhandler''' if event == 'MENU_BACK_ONE_MENU': rc.remove_app(self) self.menuw.show() return True elif event == 'MENU_SELECT': # toggle mpc off on execMPC("mpc toggle","") skin.draw( 'mpd', self ) return True elif event in ('MENU_DOWN', 'MENU_RIGHT'): # Skip to the next track. print execMPC("mpc next","") skin.draw( 'mpd', self ) return True elif event in ('MENU_UP', 'MENU_LEFT'): # Move to the previous track. execMPC("mpc prev","") skin.draw( 'mpd', self ) return True return False
def eventhandler(self, event, menuw=None): """eventhandler""" _debug_('eventhandler(event=%s, menuw=%r)' % (event, menuw), 2) if event == 'MENU_BACK_ONE_MENU': rc.app(None) self.menuw.show() return True elif event == 'MENU_SELECT': self.weather.getForecast(force=1) skin.clear() skin.draw('oneclick', self) return True elif event in ('MENU_DOWN', 'MENU_RIGHT'): self.nextSkin() skin.draw('oneclick', self) return True elif event in ('MENU_UP', 'MENU_LEFT'): self.prevSkin() skin.draw('oneclick', self) return True return False
def eventhandler(self, event, menuw=None): '''eventhandler''' if event == 'MENU_BACK_ONE_MENU': rc.app(None) self.menuw.show() return True elif event == 'MENU_SELECT': # TODO: update the current forecast data, and refresh self.weather.getForecast(force=1) skin.clear() skin.draw('weather', self) return True elif event in ('MENU_DOWN', 'MENU_RIGHT'): # Fire up the next skin self.nextSkin() skin.draw('weather', self) return True elif event in ('MENU_UP', 'MENU_LEFT'): # Fire up the previous skin self.prevSkin() skin.draw('weather', self) return True return False
def eventhandler(self, event, menuw=None): """eventhandler""" logger.log(9, "eventhandler(event=%s, menuw=%r)", event, menuw) if event == "MENU_BACK_ONE_MENU": rc.remove_app(self) self.menuw.show() return True elif event == "MENU_SELECT": self.weather.getForecast(force=1) skin.clear() skin.draw("oneclick", self, transition=skin.TRANSITION_IN) return True elif event in ("MENU_DOWN", "MENU_RIGHT"): self.nextSkin() skin.draw("oneclick", self, transition=skin.TRANSITION_PAGE) return True elif event in ("MENU_UP", "MENU_LEFT"): self.prevSkin() skin.draw("oneclick", self, transition=skin.TRANSITION_PAGE) return True return False
def eventhandler(self, event, menuw=None): '''eventhandler''' if event == 'MENU_BACK_ONE_MENU': rc.app(None) self.menuw.show() return True elif event == 'MENU_SELECT': # toggle mpc off on execMPC("mpc toggle", "") skin.draw('mpd', self) return True elif event in ('MENU_DOWN', 'MENU_RIGHT'): # Skip to the next track. print execMPC("mpc next", "") skin.draw('mpd', self) return True elif event in ('MENU_UP', 'MENU_LEFT'): # Move to the previous track. execMPC("mpc prev", "") skin.draw('mpd', self) return True return False
def eventhandler(self, event, menuw=None): """eventhandler""" logger.log( 9, 'eventhandler(event=%s, menuw=%r)', event, menuw) if event == 'MENU_BACK_ONE_MENU': rc.remove_app(self) self.menuw.show() return True elif event == 'MENU_SELECT': self.weather.getForecast(force=1) skin.clear() skin.draw('oneclick', self, transition=skin.TRANSITION_IN) return True elif event in ('MENU_DOWN', 'MENU_RIGHT'): self.nextSkin() skin.draw('oneclick', self, transition=skin.TRANSITION_PAGE) return True elif event in ('MENU_UP', 'MENU_LEFT'): self.prevSkin() skin.draw('oneclick', self, transition=skin.TRANSITION_PAGE) return True return False
def eventhandler(self, event, menuw=None): """eventhandler""" logger.log(9, 'eventhandler(event=%s, menuw=%r)', event, menuw) if event == 'MENU_BACK_ONE_MENU': rc.remove_app(self) self.menuw.show() return True elif event == 'MENU_SELECT': self.weather.getForecast(force=1) skin.clear() skin.draw('oneclick', self, transition=skin.TRANSITION_IN) return True elif event in ('MENU_DOWN', 'MENU_RIGHT'): self.nextSkin() skin.draw('oneclick', self, transition=skin.TRANSITION_PAGE) return True elif event in ('MENU_UP', 'MENU_LEFT'): self.prevSkin() skin.draw('oneclick', self, transition=skin.TRANSITION_PAGE) return True return False
def refresh(self): """ Give information to the skin """ logger.log( 8, 'refresh() visible=%r running=%r', self.visible, self.running) if not self.visible: return if not self.running: return # Calculate some new values if not self.item.length: self.item.remain = 0 else: self.item.remain = self.item.length - self.item.elapsed if self.first_drawing: transition = skin.TRANSITION_IN self.first_drawing = False else: transition = skin.TRANSITION_NONE skin.draw('player', self.item, transition=transition) if self.visible and self.dialog and self.seeking >= 0: if self.seeking > 0: self.seeking = self.seeking - 1 return if self.paused: self.dialog = audio.show_play_state(dialog.PLAY_STATE_PAUSE, self.item, self.get_time_info) else: self.dialog = audio.show_play_state(dialog.PLAY_STATE_PLAY, self.item, self.get_time_info) self.dialog.show() self.seeking = -1
def refresh(self): """ Give information to the skin """ logger.log(8, "refresh() visible=%r running=%r", self.visible, self.running) if not self.visible: return if not self.running: return # Calculate some new values if not self.item.length: self.item.remain = 0 else: self.item.remain = self.item.length - self.item.elapsed if self.first_drawing: transition = skin.TRANSITION_IN self.first_drawing = False else: transition = skin.TRANSITION_NONE skin.draw("player", self.item, transition=transition)
def refresh(self, reload=0): menu = self.menustack[-1] if not isinstance(menu, Menu): # Do not draw if there are any children if self.children: return False return skin.draw(menu.type, menu) if self.menustack[-1].umount_all == 1: util.umount_all() if reload: if menu.reload_func: reload = menu.reload_func() if reload: self.menustack[-1] = reload if self.force_page_rebuild: self.force_page_rebuild = False self.rebuild_page() self.init_page() skin.draw('menu', self, self.menustack[-1])
def refresh(self): """ Give information to the skin """ logger.log(8, 'refresh() visible=%r running=%r', self.visible, self.running) if not self.visible: return if not self.running: return # Calculate some new values if not self.item.length: self.item.remain = 0 else: self.item.remain = self.item.length - self.item.elapsed if self.first_drawing: transition = skin.TRANSITION_IN self.first_drawing = False else: transition = skin.TRANSITION_NONE skin.draw('player', self.item, transition=transition)
def progress(self, pos): """ set the progress position and refresh the screen """ self.pos = pos skin.draw('splashscreen', None)
def DrawCallInfo(self): skin.draw()
def rebuild(self, start_time, stop_time, selected_fn, force=False): """ rebuild the guide This is neccessary we change the set of programs that have to be displayed, this is the case when the user moves around in the menu. """ logger.log(9, 'rebuild(start_time=%r, stop_time=%r, selected_fn=%r)', start_time, stop_time, selected_fn) start_channel_idx = self.start_channel_idx if self.selected_channel_idx > self.start_channel_idx + (self.n_items - 1): self.start_channel_idx = self.selected_channel_idx - ( self.n_items - 1) elif self.selected_channel_idx < self.start_channel_idx: self.start_channel_idx = self.selected_channel_idx if force or self.start_time != start_time or self.start_channel_idx != start_channel_idx: end_idx = self.start_channel_idx + self.n_items channel_list = self.channels[self.start_channel_idx:end_idx] self.display_up_arrow = self.start_channel_idx > 0 self.display_down_arrow = end_idx < len(self.channels) channels = tv.epg.get_grid(start_time + 1, stop_time - 1, channel_list) self.start_time = start_time self.stop_time = stop_time # table header header = ['Chan'] for i in range(int(self.n_cols)): header.append(start_time + self.col_time * i * 60) table = [header, self.selected] for chan in channels: if not chan.programs: prg = TvProgram(chan.id, 0, 0, 2147483647, CHAN_NO_DATA, desc='') chan.programs = [prg] table.append(chan) self.table = table flag_selected = False selected_channel_offset = (self.selected_channel_idx - self.start_channel_idx) + 2 if selected_fn: for p in self.table[selected_channel_offset].programs: if selected_fn(p): flag_selected = True self.selected = p self.table[1] = p break if not flag_selected: p = self.table[selected_channel_offset].programs[0] self.table[1] = p self.selected = p skin.draw(self.type, self, transition=self.transition) self.transition = skin.TRANSITION_NONE