Exemplo n.º 1
0
    def addProduct(self, graph: Digraph, links: bool,
                   productDef: ProductDef) -> None:
        '''Add a node for the given product to this graph.
           Specify node attribs if product is a token and/or combined product
        '''
        productId = productDef.getId()
        nodeAttrib = dict(
            label=productId,
            shape='box',
            peripheries='2' if productDef.isCombined() else '1',
        )
        if productDef['type'] is ProductType.TOKEN:
            nodeAttrib['style'] = _defaultNodeAttrib['style'] + ',dashed'
        if links:
            nodeAttrib['URL'] = '../' + createProductDetailsURL(productId)
            nodeAttrib['target'] = '_parent'

        graph.node(f'prod.{productId}', **nodeAttrib)
Exemplo n.º 2
0
 def checkState(self, record: ProductDef) -> None:
     # TODO: The following code partially duplicates FrameworkDelete
     name = record.getId()
     frameworksIds = [
         frameworkId
         for frameworkId, framework in self.frameworkDB.items()
         if name in framework.getInputs()
         or name in framework.getOutputs()
     ]
     if frameworksIds:
         raise RecordInUseError('framework', createFrameworkDetailsLink,
                                frameworksIds)
Exemplo n.º 3
0
        graph.node(frameworkNodeId, **nodeAttrib)

        for inputDefId in framework.getInputs():
            if inputDefId in productIds:
                graph.edge(f'prod.{inputDefId}', frameworkNodeId)

        for outputDefId in framework.getOutputs():
            if outputDefId in productIds:
                graph.edge(frameworkNodeId, f'prod.{outputDefId}')


legendBuilder = ExecutionGraphBuilder(
    'legend',
    links=False,
    products=(
        ProductDef.create('product'),
        ProductDef.create('combined-product', combined=True),
        ProductDef.create('token-product', prodType=ProductType.TOKEN),
    ),
    frameworks=(Framework.create('framework', (), ()), ),
)


class GraphPanel(Widget):
    '''Presents a graph on a panel, with the same frame and background as
    tables.

    The graph builder should be passed to the present method as "graph".
    '''
    def present(self, **kwargs: object) -> XMLContent:
        proc = cast(PageProcessor, kwargs['proc'])
Exemplo n.º 4
0
from softfab.productdeflib import ProductDef, ProductType

button = 'Graph'
children = ()
icon = 'IconDesign'

graphBuilders = (
    ExecutionGraphBuilder(
        'task',
        links=False,
        frameworks=(Framework.create('build', (), ()), ),
    ),
    ExecutionGraphBuilder(
        'product',
        links=False,
        products=(ProductDef.create('binary'), ),
    ),
    ExecutionGraphBuilder(
        'dependency',
        links=False,
        products=(ProductDef.create('binary'), ),
        frameworks=(Framework.create('build', (), ('binary', )),
                    Framework.create('test', ('binary', ), ())),
    ),
    ExecutionGraphBuilder(
        'token',
        links=False,
        products=(ProductDef.create('app_installed',
                                    prodType=ProductType.TOKEN), ),
    ),
    ExecutionGraphBuilder(
Exemplo n.º 5
0
 def typeName(record: ProductDef) -> str:
     return record.getType().name
Exemplo n.º 6
0
 def presentCell(self, record: ProductDef, **kwargs: object) -> XMLContent:
     return createProductDetailsLink(record.getId())
Exemplo n.º 7
0
# SPDX-License-Identifier: BSD-3-Clause

from softfab.frameworklib import Framework
from softfab.graphview import ExecutionGraphBuilder
from softfab.productdeflib import ProductDef

button = 'FAQ'
children = ()
icon = 'IconDocs'

graphBuilders = (ExecutionGraphBuilder(
    'build',
    links=False,
    products=(ProductDef.create('BINARY'), ),
    frameworks=(Framework.create('build', (), ('BINARY', )),
                Framework.create('test', ('BINARY', ), ())),
), )
Exemplo n.º 8
0
 def createProduct(self, name, local=False, combined=False):
     productDefDB = self.dbs['productDefDB']
     product = ProductDef.create(name=name, local=local, combined=combined)
     productDefDB.add(product)
     self.products.append(name)
     return name