You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Python
		
	
"""
 | 
						|
 | 
						|
"""
 | 
						|
import os
 | 
						|
import cms
 | 
						|
 | 
						|
def _getPath(_config):
 | 
						|
    _layout = _config['layout']
 | 
						|
    path = os.sep.join([_layout['location'],_layout['root'],'_assets','themes'])
 | 
						|
    return path
 | 
						|
@cms.Plugin(mimetype='application/json')
 | 
						|
def List (**_args) :
 | 
						|
    """
 | 
						|
    This will list available css themes we have on disk
 | 
						|
    """
 | 
						|
    _rq = _args['request']
 | 
						|
    _config = _args['config']
 | 
						|
    path = _getPath(_config) #os.sep.join([_config['layout']['location'],_config['layout']['root'],'_assets','themes'])
 | 
						|
    
 | 
						|
    return os.listdir(path)
 | 
						|
def register ():
 | 
						|
    """
 | 
						|
    Registering 
 | 
						|
    """
 | 
						|
    pass
 | 
						|
def Get (**_args):
 | 
						|
    _request = _args['request']
 | 
						|
    _config = _args['config']
 | 
						|
    print (_request.args['theme'])
 | 
						|
    _theme = 'default' if 'theme' not in _request.args else _request.args['theme']
 | 
						|
    path = os.sep.join([_getPath(_config),_theme])
 | 
						|
    files = os.listdir(path)
 | 
						|
    _out = {}
 | 
						|
    for file in files  :
 | 
						|
        f = open (os.sep.join([path,file]))
 | 
						|
        _out[file.split('.')[0]] = f.read()
 | 
						|
        f.close()
 | 
						|
    return {_theme:_out},"application/json"
 |