Пример #1
0
def createConfigurationImpl(service, mapped):
    '''
    Generator of particular configuration implementations

    @param service: class
        The service that implements particular configuration API.
    @param mapped: class
        The mapping of Configuration API into particular configuration table.

    @return: The implementation class for the particular configuration API.
        The created class is from the module that calls the function.
    '''
    assert issubclass(
        service, IConfigurationService
    ), 'Invalid service. It should extend the IConfigurationService'
    assert issubclass(
        mapped, ConfigurationDescription
    ), 'Invalid DB mapping. It should extend the ConfigurationDescription mapping'
    assert issubclass(
        mapped, Configuration
    ), 'Invalid DB mapping. It should extend the Configuration class'

    namespace = {
        'ConfigurationMapped': mapped,
        '__module__': callerGlobals()['__name__']
    }
    return type('%sAlchemy' % service.__name__[1:],
                (ConfigurationServiceAlchemy, service), namespace)
Пример #2
0
def getThemePath(file=None):
    '''Provides the file path within the plugin "gui-themes" directory'''
    gl = callerGlobals(1)
    _moduleName, modulePath = gl['__name__'], gl['__file__']
    path = os.path.join(os.path.dirname(modulePath), 'gui-themes')
    if file: path = os.path.join(path, file.replace('/', os.sep))
    return path
Пример #3
0
def getGuiPath(file=None):
    """Provides the file path within the plugin "gui-resources" directory"""
    gl = callerGlobals()
    _moduleName, modulePath = gl["__name__"], gl["__file__"]
    path = os.path.join(os.path.dirname(modulePath), "gui-resources")
    if file:
        path = os.path.join(path, file.replace("/", os.sep))
    return path
Пример #4
0
def getGuiPath(file=None):
    '''Provides the file path within the plugin "gui-resources" directory'''
    gl = callerGlobals()
    moduleName, modulePath = gl['__name__'], gl['__file__']
    for _k in range(0, moduleName.count('.') + 1):
        modulePath = os.path.dirname(modulePath)
    path = os.path.join(modulePath, 'gui-resources')
    if file: path = os.path.join(path, file.replace('/', os.sep))
    return path
Пример #5
0
def getGuiPath(file=None):
    '''Provides the file path within the plugin "gui-resources" directory'''
    gl = callerGlobals()
    moduleName, modulePath = gl['__name__'], gl['__file__']
    for _k in range(0, moduleName.count('.') + 1):
        modulePath = os.path.dirname(modulePath)
    path = os.path.join(modulePath, 'gui-resources')
    if file: path = os.path.join(path, file.replace('/', os.sep))
    return path
Пример #6
0
def createConfigurationImpl(service, mapped):
    '''
    Generator of particular configuration implementations

    @param service: class
        The service that implements particular configuration API.
    @param mapped: class
        The mapping of Configuration API into particular configuration table.

    @return: The implementation class for the particular configuration API.
        The created class is from the module that calls the function.
    '''
    assert issubclass(service, IConfigurationService), 'Invalid service. It should extend the IConfigurationService'
    assert issubclass(mapped, ConfigurationDescription), 'Invalid DB mapping. It should extend the ConfigurationDescription mapping'
    assert issubclass(mapped, Configuration), 'Invalid DB mapping. It should extend the Configuration class'

    namespace = {'ConfigurationMapped': mapped, '__module__': callerGlobals()['__name__']}
    return type('%sAlchemy' % service.__name__[1:], (ConfigurationServiceAlchemy, service), namespace)