def __init__(self): """ Initialise the transcode idlebar plug-in """ _debug_('transcode.PluginInterface.__init__()', 2) IdleBarPlugin.__init__(self) self.plugin_name = 'idlebar.transcode' self.background = os.path.join(config.ICON_DIR, 'status/enc_background.png') self.leftclamp = os.path.join(config.ICON_DIR, 'status/enc_leftclamp.png') self.rightclamp = os.path.join(config.ICON_DIR, 'status/enc_rightclamp.png') self.notrunning = os.path.join(config.ICON_DIR, 'status/enc_notrunning.png') self.nojobs = os.path.join(config.ICON_DIR, 'status/enc_nojobs.png') self.audio = os.path.join(config.ICON_DIR, 'status/enc_audio.png') self.video = os.path.join(config.ICON_DIR, 'status/enc_video.png') self.video1 = os.path.join(config.ICON_DIR, 'status/enc_video1.png') self.video2 = os.path.join(config.ICON_DIR, 'status/enc_video2.png') self.video3 = os.path.join(config.ICON_DIR, 'status/enc_video3.png') self.multiplex = os.path.join(config.ICON_DIR, 'status/enc_multiplex.png') self.cacheimg = {} self.background_w, self.background_h = (0, 0) self.leftclamp_w, self.leftclamp_h = (0, 0) self.rightclamp_w, self.rightclamp_h = (0, 0) self.remaining_min = re.compile('[0-9]*') self.remaining = '' self.progress = 0 self.progress_x = None self.leftclamp_x = 0 self.rightclamp_x = 0 self.poll_interval = 82 # 82*1/120th seconds (~1sec) self.draw_interval = self.poll_interval self.last_interval = self.poll_interval self.lastdraw = 0 self.lastpoll = 0 self.drawtime = 0 server_string = 'http://%s:%s/' % (config.ENCODINGSERVER_IP, config.ENCODINGSERVER_PORT) self.server = xmlrpclib.Server(server_string, allow_none=1) self.skin = skin.get_singleton() self.calculate = True self.jobs = '' self.mode = 'Not Running' self.state = 'noserver' self.laststate = None self.percent = 0.0 self.running = False self.font = self.skin.get_font('small0') if self.font == skin.get_font('default'): self.font = skin.get_font('info value') _debug_('transcode.PluginInterface.__init__() done.')
def __init__(self): skin.Area.__init__(self, 'content') # Weather display fonts self.key_font = skin.get_font('medium0') self.val_font = skin.get_font('medium1') self.small_font = skin.get_font('small0') self.big_font = skin.get_font('huge0') # set the multiplier to be used in all screen drawing self.xmult = float(osd.width - (config.OSD_OVERSCAN_LEFT+config.OSD_OVERSCAN_RIGHT)) / 800 self.ymult = float(osd.height - (config.OSD_OVERSCAN_TOP+config.OSD_OVERSCAN_BOTTOM)) / 600 self.update_functions = (self.update_day, self.update_forecast, self.update_week, self.update_doplar)
def __init__(self): print "init MpdBaseScreen" skin.Area.__init__(self, 'content') # Weather display fonts self.key_font = skin.get_font('medium0') self.val_font = skin.get_font('medium1') self.small_font = skin.get_font('small0') self.big_font = skin.get_font('huge0') # set the multiplier to be used in all screen drawing self.xmult = float(osd.width - config.OSD_OVERSCAN_LEFT - config.OSD_OVERSCAN_RIGHT) / 800 self.ymult = float(osd.height - config.OSD_OVERSCAN_TOP - config.OSD_OVERSCAN_BOTTOM) / 600 self.update_functions = (self.update_info, self.update_info, self.update_info, self.update_info)
def __init__(self): skin.Area.__init__(self, 'content') # Weather display fonts self.key_font = skin.get_font('medium0') self.val_font = skin.get_font('medium1') self.small_font = skin.get_font('small0') self.big_font = skin.get_font('huge0') # set the multiplier to be used in all screen drawing self.xmult = float(osd.width - 2 * config.OSD_OVERSCAN_X) / 800 self.ymult = float(osd.height - 2 * config.OSD_OVERSCAN_Y) / 600 self.update_functions = (self.update_day, self.update_forecast, self.update_week, self.update_doplar)
def __init__(self): logger.log(9, "WeatherBaseScreen.__init__()") skin.Area.__init__(self, "content") # Weather display fonts self.key_font = skin.get_font("medium0") self.val_font = skin.get_font("medium1") self.small_font = skin.get_font("small0") self.big_font = skin.get_font("huge0") # set the multiplier to be used in all screen drawing self.xmult = float(osd.width - (config.OSD_OVERSCAN_LEFT + config.OSD_OVERSCAN_RIGHT)) / 800 self.ymult = float(osd.height - (config.OSD_OVERSCAN_TOP + config.OSD_OVERSCAN_BOTTOM)) / 600 self.xscale = lambda x: int(x * self.xmult) self.yscale = lambda y: int(y * self.ymult) self.update_functions = (self.update_day, self.update_forecast, self.update_week, self.update_map)
def __init__(self): _debug_('WeatherBaseScreen.__init__()', 2) skin.Area.__init__(self, 'content') # Weather display fonts self.key_font = skin.get_font('medium0') self.val_font = skin.get_font('medium1') self.small_font = skin.get_font('small0') self.big_font = skin.get_font('huge0') # set the multiplier to be used in all screen drawing self.xmult = float(osd.width - (config.OSD_OVERSCAN_LEFT+config.OSD_OVERSCAN_RIGHT)) / 800 self.ymult = float(osd.height - (config.OSD_OVERSCAN_TOP+config.OSD_OVERSCAN_BOTTOM)) / 600 self.xscale = lambda x: int(x * self.xmult) self.yscale = lambda y: int(y * self.ymult) self.update_functions = (self.update_day, self.update_forecast, self.update_week, self.update_map)
def __init__(self): _debug_('encoding.PluginInterface.__init__(self)', 2) plugin.DaemonPlugin.__init__(self) #IdleBarPlugin.__init__(self) self.poll_interval = 82 # 82*1/120th seconds (~1sec) self.draw_interval = self.poll_interval self.last_interval = self.poll_interval self.lastdraw = 0 self.lastpoll = 0 self.plugin_name = 'video.encodingstatus' server_string = 'http://%s:%s/' % \ (config.ENCODINGSERVER_IP, config.ENCODINGSERVER_PORT) self.server = xmlrpclib.Server(server_string, allow_none=1) self.skin = skin.get_singleton() self.barimg = os.path.join(config.ICON_DIR, 'status/encoding_bar.png') self.boximg = os.path.join(config.ICON_DIR, 'status/encoding_box.png') self.boxborder = 3 self.padding = 5 # internal padding for box vs text self.image = None self.cacheimg = {} self.muted = False self.encoding = -1 self.progress = 0 self.jobname = '' self.calculate = True self.jobs = '' self.mode = 'Not Running' self.text = [] self.percent = 0.0 self.running = False self.drawtime = 0 self.polltime = 0 self.state = 'noserver' self.laststate = None self.font = self.skin.get_font('detachbar') if self.font == skin.get_font('default'): self.font = skin.get_font('info value')
def set_info(self, info, timeout=5): """ Pass a info message on to the screen. @param info: text to draw @param timeout: how long to display """ logger.debug('set_info(info=%r, timeout=%r)', info, timeout) font = skin.get_font('widget') w = font.stringsize(info) h = font.height x = config.OSD_OVERSCAN_LEFT+5 x = int(float(x) / config.OSD_PIXEL_ASPECT) y = config.OSD_OVERSCAN_TOP+5 s = Surface((w, h), 0, 32) logger.debug('s=%r info=%r font=%r x=%r y=%r w=%r h=%r', s, info, font, x, y, w, h) self.infodata = (s, info, font, x, y, w, h) self.m_timer = time.time() self.m_timeout = timeout
def set_message(self, message, timeout=5): """ Pass a message to the screen. @message: text to draw @timeout: how long to display """ font = skin.get_font('detachbar') w = font.stringsize(message) h = font.height x = 10 y = 10 s = Surface((w,h), 0, 32) osd.drawstringframed(message, 0, 0, w, h, font, mode='hard', layer=s) self.m_timer = time.time() self.m_timeout = timeout self.message = (s, x, y, w, h)
def set_info(self, info, timeout=5): """ Pass a info message on to the screen. @param info: text to draw @param timeout: how long to display """ _debug_('set_info(info=%r, timeout==%r)' % (info, timeout), 2) font = skin.get_font('widget') w = font.stringsize(info) h = font.height x = config.OSD_OVERSCAN_LEFT + 5 y = config.OSD_OVERSCAN_TOP + 5 s = Surface((w, h), 0, 32) osd.drawstringframed(info, 0, 0, w, h, font, mode='hard', layer=s) self.m_timer = time.time() self.m_timeout = timeout self.info = (s, x, y, w, h)
class PluginInterface(plugin.DaemonPlugin): """ osd plugin. This plugin shows messages send from other parts of Freevo on the screen for 2 seconds. activate with | plugin.activate('plugin.tiny_osd') """ def __init__(self): """ init the osd """ plugin.DaemonPlugin.__init__(self) self.poll_interval = 2 self.plugins = None plugin.register(self, 'osd') self.visible = True self.message = '' # set to 2 == we have no idea right now if # we have an idlebar self.idlebar_visible = 2 self.poll_menu_only = False def draw(self, (type, object), renderer): """ draw current message """ if not self.message: return # check for the idlebar plugin if self.idlebar_visible == 2: self.idlebar_visible = plugin.getbyname('idlebar') try: font = renderer.get_font('osd') except AttributeError: font = skin.get_font('osd') w = font.stringsize(self.message) if type == 'osd': x = config.OSD_OVERSCAN_LEFT y = config.OSD_OVERSCAN_TOP renderer.drawstringframed( self.message, config.OSD_OVERSCAN_LEFT, config.OSD_OVERSCAN_TOP + 10, renderer.width - 10 - (config.OSD_OVERSCAN_LEFT + config.OSD_OVERSCAN_RIGHT), -1, font, align_h='right', mode='hard') else: y = renderer.y + 10 if self.idlebar_visible: y += 60 renderer.drawstring(self.message, font, None, (renderer.x + renderer.width - w - 10), y, w, -1, 'right', 'center')