Ejemplo n.º 1
0
def configLink(director, id, taskid, type, structureid):
    "Returns link to configuration"
    if not type in FILETYPE:    # Extra protection :)
        return "None"

    inputs  = director.clerk.getQEConfigurations(where="taskid='%s' and type='%s'" % (taskid, type))
    actorName   = "material_simulations/epsc/%s-create" % type
    # Default link
    link = lc.link(label="Create",
                   Class="epsc-action-create",
                   onclick=load(actor      = actorName,
                             id         = id,
                             taskid     = taskid,
                             type       = type,
                             structureid = structureid))
                             
    if not inputs:      # No inputs created, return "Add" link
        return link

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

    # Link to configuration view
    return lc.link(label   = input.filename,
                   onclick = load(actor      = "material_simulations/epsc/config-view",
                               id         = id,
                               taskid     = taskid,
                               type       = type,
                               configid   = input.id))
Ejemplo n.º 2
0
    def _jobId(self, table):
        "Displays id of the current job" 
        jobs        = self._director.clerk.getQEJobs(where="taskid='%s'" % self._task.id)

        if not jobs:
            table.addRow(("Job:", "None", ""))
            return


        self._job  = latestJob(jobs)

        link = lc.link(label   = self._job.id,
                       onclick = load(actor     = 'jobs/jobs-view',
                                      id        = self._simid,
                                      taskid    = self._task.id,
                                      jobid     = self._job.id,
                                      type      = self._type,
                                      package   = "Quantum Espresso"))
        action = lc.link(label    = "All Jobs",
                          Class    = "qe-all-jobs", # Class = "qe-task-action"
                           onclick = load(actor     = 'jobs/jobs-view-all',
                                          id        = self._simid,
                                          taskid    = self._task.id,
                                          type      = self._type,
                                          linkorder = self._linkorder,
                                          package   = "Quantum Espresso"))

        table.addRow(("Job:", link, action))
Ejemplo n.º 3
0
    def _createAPIDocument(self, director):
        w = self.widget
        descriptors = w.getDescriptors()
        descriptors = self._categorizeDescriptors(descriptors)

        doc = lc.document()
        tabs = lc.tabs()
        doc.add(tabs)
        #
        tab1 = tabs.tab(label='Introduction')
        d = self._createIntroductionDocument(descriptors)
        tab1.add(d)
        #
        tab2 = tabs.tab(label='Properties')
        tab2.onselect = select(element=tab2).replaceContent(
            load(actor=self.name, routine='propertiesDocument'))
        #
        tab3 = tabs.tab(label='Events')
        tab3.onselect = select(element=tab3).replaceContent(
            load(actor=self.name, routine='eventsDocument'))
        #
        tab4 = tabs.tab(label='Actions')
        tab4.onselect = select(element=tab4).replaceContent(
            load(actor=self.name, routine='actionsDocument'))
        #
        return doc
Ejemplo n.º 4
0
    def _jobId(self, table):
        "Displays id of the current job"
        jobs = self._director.clerk.getQEJobs(where="taskid='%s'" %
                                              self._task.id)

        if not jobs:
            table.addRow(("Job:", "None", ""))
            return

        self._job = latestJob(jobs)

        link = lc.link(label=self._job.id,
                       onclick=load(actor='jobs/jobs-view',
                                    id=self._simid,
                                    taskid=self._task.id,
                                    jobid=self._job.id,
                                    type=self._type,
                                    package="Quantum Espresso"))
        action = lc.link(
            label="All Jobs",
            Class="qe-all-jobs",  # Class = "qe-task-action"
            onclick=load(actor='jobs/jobs-view-all',
                         id=self._simid,
                         taskid=self._task.id,
                         type=self._type,
                         linkorder=self._linkorder,
                         package="Quantum Espresso"))

        table.addRow(("Job:", link, action))
Ejemplo n.º 5
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
Ejemplo n.º 6
0
def configLink(director, id, taskid, type, structureid):
    "Returns link to configuration"
    if not type in FILETYPE:  # Extra protection :)
        return "None"

    inputs = director.clerk.getQEConfigurations(
        where="taskid='%s' and type='%s'" % (taskid, type))
    actorName = "material_simulations/epsc/%s-create" % type
    # Default link
    link = lc.link(label="Create",
                   Class="epsc-action-create",
                   onclick=load(actor=actorName,
                                id=id,
                                taskid=taskid,
                                type=type,
                                structureid=structureid))

    if not inputs:  # No inputs created, return "Add" link
        return link

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

    # Link to configuration view
    return lc.link(label=input.filename,
                   onclick=load(actor="material_simulations/epsc/config-view",
                                id=id,
                                taskid=taskid,
                                type=type,
                                configid=input.id))
Ejemplo n.º 7
0
        def _createfield_for_phonons(obj):
            # this is a method of mold.
            self = drawer.mold

            # imports
            import luban.content as lc
            from luban.content import load, select
            from luban.content.FormSelectorField import FormSelectorField

            # utils
            orm = self.orm

            # data
            record = self.orm(obj)
            referred_record = record.phonons and record.phonons.id \
                              and record.phonons.dereference(self.orm.db)

            # widget
            doc = lc.document(Class='container',
                              id='phonons-selector-container')
            sp = doc.splitter()
            left = sp.section()
            right = sp.section()
            #
            selector = FormSelectorField(label='Phonons:', name='phonons')
            left.add(selector)
            #
            plotcontainer = right.document(Class='container')
            #
            loadplot = lambda uid: load(
                actor='orm/phonons', routine='createGraphicalView', uid=uid)

            # default selection
            if referred_record:
                value = orm.db.getUniqueIdentifierStr(referred_record)
                plotcontainer.oncreate = select(element=plotcontainer).append(
                    loadplot(value))
            else:
                value = None

            # choices
            #  get matter
            matter = orm.db.dereference(record.matter)
            matterid = matter.id
            #  dynamically load choices
            entries = load(
                actor='orm/atomicstructures',
                routine='getSelectorEntriesForPhonons',
                id=matterid,
                include_none_entry=1,
            )
            selector.oncreate = select(element=selector).setAttr(
                entries=entries, value=value)
            selector.onchange = select(element=plotcontainer).replaceContent(
                loadplot(select(element=selector).getAttr('value')))

            return doc
Ejemplo n.º 8
0
        def _createfield_for_sqe(obj):
            # this is a method of mold.
            self = drawer.mold

            # imports
            import luban.content as lc
            from luban.content import load, select
            from luban.content.FormSelectorField import FormSelectorField
            
            # utils
            orm = self.orm

            # data 
            record = self.orm(obj)
            referred_record = record.sqe and record.sqe.id \
                              and record.sqe.dereference(self.orm.db)

            # widget
            doc = lc.document(Class='container', id='sqe-selector-container')
            sp = doc.splitter()
            left = sp.section(); right = sp.section()
            #
            selector = FormSelectorField(label='Sqe:', name='sqe')
            left.add(selector)
            #
            plotcontainer = right.document(Class='container')
            #
            loadplot = lambda uid: load(
                actor='orm/sqe', routine='createGraphicalView',
                uid=uid)

            # default selection
            if referred_record:
                value=orm.db.getUniqueIdentifierStr(referred_record)
                plotcontainer.oncreate = select(element=plotcontainer).append(
                    loadplot(value))
            else:
                value=None

            # choices
            #  get matter
            matter = orm.db.dereference(record.matter)
            matterid = matter.id
            #  dynamically load choices
            entries = load(
                actor='orm/atomicstructures',
                routine='getSelectorEntriesForSqe',
                id = matterid,
                include_none_entry = 1,
                )
            selector.oncreate = select(element=selector).setAttr(entries=entries, value=value)
            selector.onchange = select(element=plotcontainer).replaceContent(
                loadplot(select(element=selector).getAttr('value')))
            
            return doc
Ejemplo n.º 9
0
    def _viewIndicator(self, director, section):
        qelink  = load( actor           = 'materialsimulation',
                        filter_key      = 'type',
                        filter_value    = 'qesimulations')

        path = []
        path.append(('Simulations ', load(actor='materialsimulation')))
        path.append(('Quantum Espresso ', qelink))
        path.append(('%s ' % self.id, load(actor    = 'material_simulations/espresso/sim-view',
                                           id       = self.id)))
        path.append('Convergence Tests')
        section.add(director.retrieveVisual('view-indicator', path=path))
Ejemplo n.º 10
0
        def _createfield_for_neutrons(obj):
            # this is a method of mold.
            self = drawer.mold

            # imports
            import luban.content as lc
            from luban.content import load, select
            from luban.content.FormSelectorField import FormSelectorField
            
            # utils
            orm = self.orm

            # data 
            record = self.orm(obj)
            referred_record = record.neutrons and record.neutrons.id \
                              and record.neutrons.dereference(self.orm.db)

            # widget
            doc = lc.document(Class='container', id='neutrons-selector-container')
            sp = doc.splitter(orientation='horizontal')
            left = sp.section(); right = sp.section()
            #
            selector = FormSelectorField(label='Neutrons:', name='neutrons')
            left.add(selector)
            #
            viewcontainer = right.document(Class='container')
            #
            loadview = lambda uid: load(
                actor='orm/neutronstorages', routine='createGraphicalView',
                uid=uid, start=0, end=2)

            # default selection
            if referred_record:
                value=orm.db.getUniqueIdentifierStr(referred_record)
                viewcontainer.oncreate = select(element=viewcontainer).append(
                    loadview(value))
            else:
                value=None

            # choices
            #  dynamically load choices
            entries = load(
                actor='orm/neutronplayers',
                routine='getSelectorEntriesForReference',
                refname = 'neutrons',
                include_none_entry = 1,
                )
            selector.oncreate = select(element=selector).setAttr(entries=entries, value=value)
            selector.onchange = select(element=viewcontainer).replaceContent(
                loadview(select(element=selector).getAttr('value')))
            
            return doc
    def createViewIndicator(self):
        path = []

        actor = self.actor
        path.append(('Atomic Structures', lc.load(actor=actor)))

        label = self.getAtomicStructureLabel()
        action = lc.load(actor=actor, routine='showOverview', id = self.id,)
        path.append((label,action))

        path.append('edit')
        
        return self.director.retrieveVisual('view-indicator', path=path)
Ejemplo n.º 12
0
    def _viewIndicator(self, director, section):
        qelink = load(actor='materialsimulation',
                      filter_key='type',
                      filter_value='qesimulations')

        path = []
        path.append(('Simulations ', load(actor='materialsimulation')))
        path.append(('Quantum Espresso ', qelink))
        path.append(('%s ' % self.id,
                     load(actor='material_simulations/espresso/sim-view',
                          id=self.id)))
        path.append('Convergence Tests')
        section.add(director.retrieveVisual('view-indicator', path=path))
Ejemplo n.º 13
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
Ejemplo n.º 14
0
    def _createTabsForDemoPanelAndCodeViewer(self, func, director, deps=None):
        '''create a "tabs" widget with one tab for demo, another tab for code

        func: the function that creates a docuemnt for the demo
        deps: the functions that "func" depends on. we need to show code for
          all of them to give a complet view. It is good that func and deps
          are in the same actor.
        '''
        tabs = lc.tabs()
        demotab = tabs.tab(label='Demo')
        demotab.Class = 'demo'
        funcname = func.im_func.func_name
        demotab.onselect = select(element=demotab).replaceContent(
            load(actor=self.name, routine=funcname))

        codetab = tabs.tab(label='Code')
        codetab.Class = 'code'

        demotab.add(func(director))

        lines = getSourceLines(func)
        blocks = [lines]

        if deps:
            for dep in deps:
                blocks.append(getSourceLines(dep))

        codedoc = createCodeDoc(blocks)
        codetab.add(codedoc)
        # codetab.onselect = select(element=codetab).replaceContent(codedoc)
        return tabs
Ejemplo n.º 15
0
 def _refreshAction(self, section):
     section.add(
         lc.link(label="Refresh",
                 Class="qe-action-back",
                 onclick=load(
                     actor='material_simulations/espresso-convergence/view',
                     id=self.id)))
Ejemplo n.º 16
0
    def deleteSimulation(self, director):
        #
        clerk = director.clerk
        clerk.importAllDataObjects()

        #
        id = self.inventory.id
        if not id:
            return alert("id of simulation not specified")

        # get record
        record = self._getRecord(director)

        # check ownership
        username = director.sentry.username
        if hasattr(record, 'creator') and record.creator != username:
            return alert("simulation %s not owned by you" % id)

        # make sure it is ok to delete
        from vnf.utils.db.findreferrals import hasreferral
        orm = clerk.orm
        if hasreferral(record, clerk):
            return alert("simulation %s still in use" % id)

        # delete
        obj = orm.record2object(record)
        orm.destroy(obj)

        #
        return load(actor='materialsimulation')
Ejemplo n.º 17
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
Ejemplo n.º 18
0
    def back(self, link):
        if len(link) != 0 and link[0] is not None:

            return HtmlDocument(text='<img src="images/icons/back.png"/>',
                            Class = "stepper-item",
                            onclick=load(actor=link[0], routine=self.routine(link[1]), id=link[2]))

        return Paragraph(Class="stepper-space-back")
Ejemplo n.º 19
0
 def _backAction(self, section):
     "Back button"
     section.add(
         lc.link(label="Back",
                 Class="qe-action-back",
                 onclick=load(
                     actor='material_simulations/espresso/sim-view',
                     id=self.id)))
Ejemplo n.º 20
0
    def createViewIndicator(self):
        path = []

        actor = self.actor
        path.append(('Atomic Structures', lc.load(actor=actor)))

        label = self.getAtomicStructureLabel()
        action = lc.load(
            actor=actor,
            routine='showOverview',
            id=self.id,
        )
        path.append((label, action))

        path.append('edit')

        return self.director.retrieveVisual('view-indicator', path=path)
Ejemplo n.º 21
0
def load_manual_instrument_configuration(experiment_id):
    from luban.content import load
    return load(
        actor='loadvisual',
        visual='neutronexperiment/edit/instrumentpanel',
        mode = 'manualconfiguration',
        id=experiment_id
        )
Ejemplo n.º 22
0
    def _pwInputAction(self, section):
        "Shows PW input action button"
        if not self._input: # No input created
            section.add(lc.link(label="Create PW Input",
                                Class="qe-action-new",  
                                onclick = load(actor      = 'material_simulations/espresso/sim-view',
                                                 id         = self.id))
                        )
            return

        # Otherwise show PW link
        section.add(lc.link(label="PW",
                            Class="qe-action-default",  
                            onclick = load(actor    = 'material_simulations/espresso-convergence/input-view',
                                           inputid  = self._input.id,
                                           id       = self.id))
                    )
Ejemplo n.º 23
0
 def getId(self, experiment):
     label = experiment.id
     link = Link(label=label,
                 onclick=load(
                     actor='experiment',
                     routine='showExperimentView',
                     id=experiment.id,
                 ))
     return link
Ejemplo n.º 24
0
def getDescription(record):
    label = record.short_description
    link = Link(label=label,
                onclick=load(
                    actor='atomicstructure',
                    routine='showOverview',
                    id=record.id,
                ))
    return link
Ejemplo n.º 25
0
 def _newTestAction(self, section):
     section.add(
         lc.link(
             label="Create New Test",
             Class="qe-action-new",
             onclick=load(
                 actor=
                 'material_simulations/espresso-convergence/conv-create',
                 id=self.id)))
Ejemplo n.º 26
0
def runLink(director, id, taskid):
    "Returns run link"
    return lc.link(label    = "Run Simulation",
                   Class    = "epsc-run-task",
                   onclick  = load(actor     ='jobs/submit',
                                  routine   = 'submit',
                                  id        = id,
                                  taskid    = taskid,
                                  subtype   = "epsc",   # Used to identify job type!
                                  package   = "epsc"))
Ejemplo n.º 27
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
Ejemplo n.º 28
0
def getId(record):
    label = record.id
    link = Link(
        label = label,
        onclick = load(
            actor='job', routine='view',
            id = record.id,
            )
        )
    return link
Ejemplo n.º 29
0
 def getId(self, experiment):
     label = experiment.id
     link = Link(
         label = label,
         onclick = load(
             actor='experiment', routine='showExperimentView',
             id = experiment.id,
             )
         )
     return link
Ejemplo n.º 30
0
 def _refreshAction(self, section):
     "Refresh button"
     section.add(
         lc.link(
             label="Refresh",
             Class="qe-action-edit",
             onclick=load(
                 actor=analyseActor(self.simtype),
                 simtype=self.simtype,  # pass simtype
                 id=self.id)))
Ejemplo n.º 31
0
def getDescription(record):
    label = record.short_description
    link = Link(
        label = label,
        onclick = load(
            actor='atomicstructure', routine='showOverview',
            id = record.id,
            )
        )
    return link
Ejemplo n.º 32
0
    def back(self, link):
        if len(link) != 0 and link[0] is not None:

            return HtmlDocument(text='<img src="images/icons/back.png"/>',
                                Class="stepper-item",
                                onclick=load(actor=link[0],
                                             routine=self.routine(link[1]),
                                             id=link[2]))

        return Paragraph(Class="stepper-space-back")
Ejemplo n.º 33
0
def allJobsLink(director, id, taskid):
    "Returns link to all jobs"
    return lc.link(label    = "All Jobs",
                   Class    = "qe-all-jobs", # Class = "qe-task-action"
                   onclick = load(actor     = 'jobs/jobs-view-all',
                                  id        = id,
                                  taskid    = taskid,
                                  type      = "epsc",
                                  linkorder = 0,
                                  package   = "EPSC"))
Ejemplo n.º 34
0
    def _taskId(self, table):
        tid     = self._task.id
        link    = lc.link(label    = tid,
                           onclick  = load(actor     = 'material_simulations/espresso/task-view',
                                           id        = self._simid,
                                           taskid    = tid,
                                           type      = self._type,
                                           linkorder = self._linkorder)
                            )

        table.addRow(("Task:", link, ""))
Ejemplo n.º 35
0
    def _taskId(self, table):
        tid = self._task.id
        link = lc.link(label=tid,
                       onclick=load(
                           actor='material_simulations/espresso/task-view',
                           id=self._simid,
                           taskid=tid,
                           type=self._type,
                           linkorder=self._linkorder))

        table.addRow(("Task:", link, ""))
Ejemplo n.º 36
0
 def _cancelLink(self):
     "Returns 'Cancel' link"
     link = lc.link(label    = "Cancel",
                    Class    = "qe-cancel-task",
                    onclick  = load(actor    ='jobs/cancel',
                                   routine   = 'cancel',
                                   simid     = self._simid,
                                   jobid     = self._job.id,
                                   taskid    = self._task.id)
                     )
     return link
Ejemplo n.º 37
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
Ejemplo n.º 38
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
Ejemplo n.º 39
0
def allJobsLink(director, id, taskid):
    "Returns link to all jobs"
    return lc.link(
        label="All Jobs",
        Class="qe-all-jobs",  # Class = "qe-task-action"
        onclick=load(actor='jobs/jobs-view-all',
                     id=id,
                     taskid=taskid,
                     type="epsc",
                     linkorder=0,
                     package="EPSC"))
Ejemplo n.º 40
0
    def getLink(self, id):      # simulation
        settings  = self._director.clerk.getConfigurations(where="simulationId='%s' AND type='%s'" % (id, self._type))

        link = Link(label="Add", Class="action-link",
                    onclick=load(actor      = "espresso/settings-add",
                                 routine    = "link",
                                 id         = id)
                    )

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

        return link
Ejemplo n.º 41
0
 def _createLinkForOrigin(self, id, origin, director):
     '''id: id of the phonons record
     origin: data object of the original computation for the phonons
     '''
     link = lc.link(label='computed from %s %s' %
                    (origin.getTableName(), origin.id),
                    onclick=load(actor='computation',
                                 routine='view',
                                 type=origin.getTableName(),
                                 id=origin.id))
     return link
Ejemplo n.º 42
0
    def _pwInputAction(self, section):
        "Shows PW input action button"
        if not self._input:  # No input created
            section.add(
                lc.link(label="Create PW Input",
                        Class="qe-action-new",
                        onclick=load(
                            actor='material_simulations/espresso/sim-view',
                            id=self.id)))
            return

        # Otherwise show PW link
        section.add(
            lc.link(label="PW",
                    Class="qe-action-default",
                    onclick=load(
                        actor=
                        'material_simulations/espresso-convergence/input-view',
                        inputid=self._input.id,
                        id=self.id)))
Ejemplo n.º 43
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
Ejemplo n.º 44
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
Ejemplo n.º 45
0
def settingsLink(director, id):
    "Returns link to settings of simulation"
    settings  = director.clerk.getQESettings(where="simulationid='%s'" % id )

    # Default link
    link = lc.link(label="Create",
                Class="epsc-action-create",
                tip     = "Set simulation environment",
                onclick=load(actor      = "material_simulations/epsc/settings-add",
                             id         = id))

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

    return link
Ejemplo n.º 46
0
def runLink(director, id, taskid):
    "Returns run link"
    return lc.link(
        label="Run Simulation",
        Class="epsc-run-task",
        onclick=load(
            actor='jobs/submit',
            routine='submit',
            id=id,
            taskid=taskid,
            subtype="epsc",  # Used to identify job type!
            package="epsc"))
Ejemplo n.º 47
0
    def _viewIndicator(self, director, label):
        "Displays the navigation path on the top"
        # director.redirect() does not pass variables. Get them from inventory instead
        self.id     = self.inventory.id
        self.taskid = self.inventory.taskid
        self.type   = self.inventory.type

        qelink  = load( actor           = 'materialsimulation',
                        filter_key      = 'type',
                        filter_value    = 'qesimulations')

        path = []
        path.append(('Simulations ',        load(actor='materialsimulation')))
        path.append(('Quantum Espresso ',   qelink))
        path.append(('%s ' % self.id,       load(actor    = 'material_simulations/espresso/sim-view',
                                                id       = self.id)))
        path.append(('%s Task ' % self.type, load(actor    = 'material_simulations/espresso/task-view',
                                                  id       = self.id,
                                                  taskid   = self.taskid,
                                                  type     = self.type)))
        path.append(label)
        return director.retrieveVisual('view-indicator', path=path)
Ejemplo n.º 48
0
    def _action(self, routine):
        "General action that calls specific routine"
        if not self._job or not self._task:
            return ""

        return lc.link(label="Refresh",
                       Class="qe-task-action",
                       onclick=load(actor='jobs/status',
                                    routine=routine,
                                    id=self._simid,
                                    taskid=self._task.id,
                                    jobid=self._job.id,
                                    linkorder=self._linkorder))
Ejemplo n.º 49
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
Ejemplo n.º 50
0
    def action(self):
        "Returns link to action that refreshes the status of results"
        if not self._job: #or not self._task:
            return ""   # Default value

        return lc.link(label = "Check",
                       id = "qe-check-results",
                       onclick=load(actor       = "jobs/getresults",
                                    routine     = "retrieveStatus",
                                    id          = self._simid,
                                    taskid      = self._task.id,
                                    jobid       = self._job.id)
                  )
Ejemplo n.º 51
0
 def welcome(self):
     # the overall frame
     frame = lc.frame(title='my application')
     # a document in the frame
     doc = frame.document(title='Hello world!', id='doc1')
     # a button in the document
     b = lc.button(label='click me to show an alert'); doc.add(b)
     b.onclick = lc.alert('clicked!')
     # another button
     b2 = lc.button(label='click me to add a new paragraph'); doc.add(b2)
     b2.onclick = lc.load(routine='onbutton2')
     # weave to produce html
     return self.weaver.weave(frame)
Ejemplo n.º 52
0
    def _action(self, routine):
        "General action that calls specific routine"
        if not self._job or not self._task:
            return ""

        return lc.link(label    ="Refresh",
                      Class     = "qe-task-action",
                      onclick   = load(actor     = 'jobs/status',
                                       routine   = routine,
                                       id        = self._simid,
                                       taskid    = self._task.id,
                                       jobid     = self._job.id,
                                       linkorder = self._linkorder)
                     )
Ejemplo n.º 53
0
 def _runLink(self):
     "Returns 'Run Task' link"
     # If not job created or is not running
     link = lc.link(label    = "Run Task",
                    Class    = "qe-run-task",
                    onclick  = load(actor     ='jobs/submit',    # 'jobs/checksubmit'
                                   routine   = 'submit',
                                   id        = self._simid,
                                   taskid    = self._task.id,
                                   subtype   = self._task.subtype,
                                   optlevel  = self._optlevel(),
                                   package   = "espresso")
                     )
     return link
Ejemplo n.º 54
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
Ejemplo n.º 55
0
def jobLink(director, id, taskid):
    "Returns link to job"
    jobs        = director.clerk.getQEJobs(where="taskid='%s'" % taskid)

    if not jobs:
        return "None"

    job  = latestJob(jobs)

    return lc.link(label   = job.id,
                   onclick = load(actor     = 'jobs/jobs-view',
                                  id        = id,
                                  taskid    = taskid,
                                  jobid     = job.id,
                                  type      = "epsc",
                                  package   = "EPSC"))