def load(self, filename, copy_content = 1): """ return an object with new skin settings """ logger.debug('load additional skin info: %s', filename) if filename and vfs.isfile(vfs.join(filename, 'folder.fxd')): filename = vfs.abspath(os.path.join(filename, 'folder.fxd')) elif filename and vfs.isfile(filename): filename = vfs.abspath(filename) else: return None settings = self.load_cache(filename) if settings: return settings if copy_content: settings = copy.copy(self.settings) else: settings = xml_skin.XMLSkin() if not settings.load(filename, clear=True): return None self.save_cache(settings, filename) return settings
def __init__(self): """ init the skin engine """ global skin_engine skin_engine = self self.display_style = { 'menu' : 0 } self.force_redraw = True self.last_draw = None, None, None self.screen = screen.get_singleton() self.areas = {} self.suspended = False self.transitioning = False self.current_screen= None self.next_screen = None self.timer = None # load default areas from listing_area import Listing_Area from tvlisting_area import TVListing_Area from view_area import View_Area from info_area import Info_Area from default_areas import Screen_Area, Title_Area, Subtitle_Area, Plugin_Area from scrollabletext_area import Scrollabletext_Area from textentry_area import Textentry_Area from buttongroup_area import Buttongroup_Area for a in ('screen', 'title', 'subtitle', 'view', 'listing', 'info', 'plugin', 'scrollabletext', 'textentry', 'buttongroup'): self.areas[a] = eval('%s_Area()' % a.capitalize()) self.areas['tvlisting'] = TVListing_Area() self.storage_file = os.path.join(config.FREEVO_CACHEDIR, 'skin-%s' % os.getuid()) self.storage = util.read_pickle(self.storage_file) if self.storage: if not config.SKIN_XML_FILE: config.SKIN_XML_FILE = self.storage['SKIN_XML_FILE'] else: logger.log( 9, 'skin forced to %s', config.SKIN_XML_FILE) else: if not config.SKIN_XML_FILE: config.SKIN_XML_FILE = config.SKIN_DEFAULT_XML_FILE self.storage = {} # load the fxd file self.settings = xml_skin.XMLSkin() self.set_base_fxd(config.SKIN_XML_FILE) if config.SKIN_SCREEN_TRANSITION == 'blend': self.do_transition = self.do_blend_transition elif config.SKIN_SCREEN_TRANSITION == 'slide': self.do_transition = self.do_slide_transition else: print 'WARNING: Unknown screen transition, disabling transitions' config.SKIN_USE_SCREEN_TRANSITIONS = False config.SKIN_USE_PAGE_TRANSITIONS = False
def __init__(self): """ init the skin engine """ global skin_engine skin_engine = self self.display_style = {'menu': 0} self.force_redraw = True self.last_draw = None, None, None self.screen = screen.get_singleton() self.areas = {} # load default areas from listing_area import Listing_Area from tvlisting_area import TVListing_Area from view_area import View_Area from info_area import Info_Area from default_areas import Screen_Area, Title_Area, Subtitle_Area, Plugin_Area from scrollabletext_area import Scrollabletext_Area from textentry_area import Textentry_Area from buttongroup_area import Buttongroup_Area for a in ('screen', 'title', 'subtitle', 'view', 'listing', 'info', 'plugin', 'scrollabletext', 'textentry', 'buttongroup'): self.areas[a] = eval('%s_Area()' % a.capitalize()) self.areas['tvlisting'] = TVListing_Area() self.storage_file = os.path.join(config.FREEVO_CACHEDIR, 'skin-%s' % os.getuid()) self.storage = util.read_pickle(self.storage_file) if self.storage: if not config.SKIN_XML_FILE: config.SKIN_XML_FILE = self.storage['SKIN_XML_FILE'] else: _debug_('skin forced to %s' % config.SKIN_XML_FILE, 2) else: if not config.SKIN_XML_FILE: config.SKIN_XML_FILE = config.SKIN_DEFAULT_XML_FILE self.storage = {} # load the fxd file self.settings = xml_skin.XMLSkin() self.set_base_fxd(config.SKIN_XML_FILE)