Exemplo n.º 1
0
    def getLink(self, id):  # simulation
        settings = self._director.clerk.getQESettings(
            where="simulationid='%s'" % id)

        link = Link(label="Add",
                    Class="action-link",
                    tip="Set simulation environment",
                    onclick=load(
                        actor="material_simulations/espresso/settings-add",
                        type=self._sim.type,
                        id=id,
                    ))

        if settings:
            s = settings[0]
            if s:
                link = Link(
                    label=s.sname,
                    Class="action-link",
                    onclick=load(
                        actor="material_simulations/espresso/settings-view",
                        id=id,
                        configid=s.id))

        return link
Exemplo n.º 2
0
    def chain(self, id):
        inputs = self._director.clerk.getConfigurations(
            where="simulationId='%s'" % id)
        orderedInputs = self._orderInput(self._simlist, inputs)

        splitter = Splitter(orientation='horizontal')
        listsize = len(self._simlist)

        for i in range(listsize):
            section = splitter.section()
            section.add(Paragraph(text=self._simlist[i]))  # Simulation type
            section.add(
                Link(label=self._inputText(orderedInputs[i]),
                     Class="action-link",
                     onclick=load(actor=self._getActor(orderedInputs[i]),
                                  routine="link",
                                  id=id,
                                  type=self._simlist[i],
                                  configid=self._getId(
                                      self._simlist[i],
                                      inputs)))  # Passes config type (not id)
            )

            if i != listsize - 1:  # No arrow for last config
                sep = splitter.section()  # Separator
                sep.add(Paragraph(text=" ----> "))

        return splitter
Exemplo n.º 3
0
    def _linkAdd(self):
        "Returns link 'Add'"
        (actor, routine) = (GENERATOR, ROUTINE)

        if self._type in QETYPES:  # If task type is QE types
            (actor, routine) = getattr(
                self,
                "locator" + self._routineExt())()  # Example: self.locatorPW()

        try:
            linkorder = int(self._linkorder)  # should be int, but just in case
        except:
            linkorder = -1

        # NEEDS TESTING!!!
        # There might be a problem that result.outputFile() is empty although
        # the results are retrieved. This happened (for some reason).
        # If it continues to fail fix outputFile() or try to use JobStatus instead
        result = getResult(self._director, self._id, self._sim,
                           linkorder - 1)  # Previous result

        if linkorder == 0 or (result != None and result.outputFile()
                              ):  # First task or results are retrieved!
            link = Link(label="Add",
                        onclick=load(actor=actor,
                                     routine=routine,
                                     id=self._id,
                                     taskid=self._taskid,
                                     type=self._type,
                                     simtype=self._simType(),
                                     linkorder=self._linkorder,
                                     structureid=self._structureId()))
        else:
            prevtask = ""
            if self._sim and self._sim.type in SIMCHAINS.keys(
            ) and linkorder >= 1:
                prevtask = SIMCHAINS[self._sim.type][
                    linkorder - 1]  # Find type of previous task

            link = Link(
                label="Add",
                onclick=alert(
                    'Please run simulation or retrieve (check) result for previous %s task. When result is retrieved, make sure to click on "Refresh Status"'
                    % prevtask))

        return link
Exemplo n.º 4
0
 def getId(self, experiment):
     label = experiment.id
     link = Link(label=label,
                 onclick=load(
                     actor='experiment',
                     routine='showExperimentView',
                     id=experiment.id,
                 ))
     return link
Exemplo n.º 5
0
def getDescription(record):
    label = record.short_description
    link = Link(label=label,
                onclick=load(
                    actor='atomicstructure',
                    routine='showOverview',
                    id=record.id,
                ))
    return link
Exemplo n.º 6
0
def getId(record):
    label = record.id
    link = Link(label=label,
                onclick=load(
                    actor='sample',
                    routine='view',
                    id=record.id,
                    type=record.getTableName(),
                ))
    return link
Exemplo n.º 7
0
def getId(record):
    label = record.id
    link = Link(
        label = label,
        onclick = load(
            actor='job', routine='view',
            id = record.id,
            )
        )
    return link
Exemplo n.º 8
0
 def getId(self, matsim):
     label = matsim.id
     link = Link(
         label = label,
         onclick = load(
             actor='computation', routine='view',
             id = matsim.id,
             type = matsim.getTableName(),
             )
         )
     return link
Exemplo n.º 9
0
def tableController(headers, actor):
    s = Splitter(Class="table-controller", orientation='horizontal')
    s_filter = s.section()
    s_filter.add(FormTextField(label='Filter', Class="table-filter"))
    s_formselect = s.section()
    s_formselect.add(FormSelectorField(entries=enumerate(headers)))

    s_pagination = s.section()
    p = Document(Class="table-pagination")
    p.add(
        Link(label="Prev",
             Class="pagination-link",
             onclick=load(actor=actor, routine='link')))
    p.add(
        Link(label="Next",
             Class="pagination-link",
             onclick=load(actor=actor, routine='link')))

    s_pagination.add(p)

    return s
Exemplo n.º 10
0
    def buildPath(self):
        from luban.content.Paragraph import Paragraph
        from luban.content.Document import Document
        from luban.content import load
        from luban.content.Link import Link

        doc     = Document(id='path-content')

        for i in range(self.path.size()):
            item    = self.path.item(i)
            if item.isLink():
                if item.id:     # Handling id
                    pi = Link(label=item.label, onclick=load(actor=item.actor, routine=item.routine, id=item.id))
                else:
                    pi = Link(label=item.label, onclick=load(actor=item.actor, routine=item.routine))
                    
                sep = Paragraph(text=self.separator)
                doc.add(pi)
                doc.add(sep)
            else:
                pi = Paragraph(text=item.label)
                doc.add(pi)

        return doc
Exemplo n.º 11
0
    def getServer(self, id):  # simulation id
        settings = self._clerk.getConfigurations(
            where="simulationId='%s' AND type='%s'" % (id, self._type))
        servername = self._serverName(settings)

        if servername != '':
            text = Link(label=servername,
                        Class="action-link",
                        onclick=load(actor="server-view",
                                     routine="link",
                                     sname=servername))
        else:
            text = Paragraph(text="None")

        return text
Exemplo n.º 12
0
    def getDescription(self, record):
        desc = record.short_description
        if not desc:
            desc = self.createDescription(record)

        label = desc
        link = Link(
            label=label,
            onclick=load(
                actor=self.actorname,
                routine='showGraphicalViewWithLinkToTable',
                id=record.id,
            ),
            tip="click to view details",
        )
        return link
Exemplo n.º 13
0
def getId(record):
    label = record.id
    link = Link(
        label = label,
        onclick = load(
            actor='computation', routine='view',
            id = record.id,
            type = record.getTableName(),
            )
        # no need for a redirection
        #    onclick = load(
        #        actor='materialsimulation', routine='showMaterialSimulation',
        #        id = matsim.id,
        #        type = matsim.getTableName(),
        #        )
        )
    return link
Exemplo n.º 14
0
    def getLink(self):  # simulation
        inputs = self._director.clerk.getQEConfigurations(where="taskid='%s'" %
                                                          self._taskid)

        link = self._linkAdd()
        if not inputs:  # No inputs created, return "Add" link
            return link

        input = latestInput(inputs)
        if not input:  # No input, return "Add" link
            return link

        return Link(
            label=input.filename,
            onclick=load(actor="material_simulations/espresso/input-view",
                         id=self._id,
                         taskid=self._taskid,
                         type=self._type,
                         configid=input.id)  # Some more?
        )
Exemplo n.º 15
0
    def getLink(self, id):      # simulation id
        server = None
        link = "None"

        settings    = self._director.clerk.getQESettings(where="simulationid='%s'" % id )
        if not settings:# or not settings[0]:
            return link

        setting     = settings[0]
        if setting.serverid is not None:
            server = self._director.clerk.getServers(id = setting.serverid )

        if not server:
            return link

        
        link = Link(label   = server.address,
                    Class   = "action-link",
                    tip     = "Show details of computational cluster",
                    onclick = select(id='').append(load(actor='server/load', routine='createDialog'))
                    )

        return link
Exemplo n.º 16
0
 def name(i):
     link = Link(label=names[i],
                 onclick=load(actor='espresso/sim-view',
                              routine='link',
                              id=ids[i]))
     return link
Exemplo n.º 17
0
 def jobid(i):
     link = Link(label=jobids[i],
                 onclick=load(actor='jobs/view',
                              routine='link',
                              id=jobids[i]))
     return link
Exemplo n.º 18
0
 def delete(i):
     link = Link(label="Delete",
                 onclick=load(actor='jobs/delete',
                              routine='link',
                              id=jobids[i]))
     return link
Exemplo n.º 19
0
 def refresh(i):
     link = Link(label="Refresh",
                 onclick=load(actor='jobs/index',
                              routine='link',
                              id=jobids[i]))  #ids[i]
     return link
Exemplo n.º 20
0
 def _cast(self, value):
     from luban.content.Link import Link
     return value or Link()
Exemplo n.º 21
0
def link(**kwds):
    return Link(**kwds)
Exemplo n.º 22
0
 def edit(i):
     link = Link(label="Edit",
                 onclick=load(actor='espresso/sim-edit',
                              routine='link',
                              id=ids[i]))
     return link
Exemplo n.º 23
0
 def use(i):
     link = Link(label="Clone",
                 onclick=load(actor='espresso/sim-use',
                              routine='link',
                              id=ids[i]))
     return link
Exemplo n.º 24
0
 def delete(i):
     link = Link(label="Delete",
                 onclick=load(actor='espresso/sim-delete',
                              routine='link',
                              id=ids[i]))
     return link