コード例 #1
0
 def set_profile(self, profile):
     self.clear_body()
     self.profile.set_profile(profile)
     title = SimpleTitleElement('Profile:  %s' % profile,
                                bgcolor='IndianRed',
                                width='100%')
     self.body.appendChild(title)
     rows = self.profile.get_trait_rows()
     ptitle = Anchor('edit.traits.%s' % self.profile.current.profile,
                     'Traits')
     self.body.appendChild(SectionTitle(ptitle))
     #self.body.appendChild(SectionTitle('Traits'))
     if len(rows):
         self.body.appendChild(TraitTable(rows, bgcolor='IndianRed1'))
     vtitle = Anchor('edit.variables.%s' % self.profile.current.profile,
                     'Variables')
     self.body.appendChild(SectionTitle(vtitle))
     erows = self.profile._env.get_rows()
     if len(erows):
         self.body.appendChild(PVarTable(erows, bgcolor='MistyRose2'))
     etitle = Anchor('edit.families.%s' % self.profile.current.profile,
                     'Families')
     self.body.appendChild(SectionTitle(etitle))
     families = self.profile.get_families()
     flist = UnorderedList()
     for f in families:
         flist.appendChild(ListItem(f))
     self.body.appendChild(flist)
コード例 #2
0
 def __init__(self, fields, idcol, action, record, **atts):
     BaseElement.__init__(self, 'table', **atts)
     self.record = record
     refdata = None
     if hasattr(record, '_refdata'):
         refdata = record._refdata
     for field in fields:
         row = BaseElement('tr')
         key = TD(bgcolor='DarkSeaGreen')
         key.appendChild(Bold(field))
         row.appendChild(key)
         val = TD()
         if refdata is not None and field in refdata.cols:
             ridcol = refdata.cols[field]
             refrec = refdata.data[field][record[ridcol]]
             node = refdata.object[field](refrec)
             if action:
                 url = '.'.join(map(str, [action, field, record[idcol]]))
                 val.appendChild(Anchor(url, node))
             else:
                 val.appendChild(node)
         elif action:
             url = '.'.join(map(str, [action, field, record[idcol]]))
             val.appendChild(Anchor(url, record[field]))
         else:
             node = Text()
             node.data = record[field]
             val.appendChild(node)
         row.appendChild(val)
         self.val = val
         self.key = key
         self.appendChild(row)
コード例 #3
0
 def __init__(self, app, key, href=None, **atts):
     BaseDbElement.__init__(self, app, 'p', **atts)
     data = self.makeParagraph(key)
     if href is not None:
         node = Anchor(href, data)
     else:
         node = Text()
         node.data = data
     self.appendChild(node)
コード例 #4
0
ファイル: machine.py プロジェクト: pombredanne/paella-svn
 def _make_footer_anchors(self, name, value):
     newanchor = Anchor('new.%s.foo' % name, 'new')
     editanchor = Anchor('edit.%s.%s' % (name, value), 'edit')
     deleteanchor = Anchor('delete.%s.%s' % (name, value), 'delete')
     self.body.appendChild(HR())
     self.body.appendChild(editanchor)
     self.body.appendChild(BR())
     self.body.appendChild(deleteanchor)
     self.body.appendChild(BR())
     self.body.appendChild(newanchor)
コード例 #5
0
ファイル: machine.py プロジェクト: pombredanne/paella-svn
 def _add_table_row(self, table, fields, row):
     trow = TR()
     for field in fields:
         val = row[field]
         trow.appendChild(TxtTD(val))
     durl = 'delete.%s.%s' % (table.context, row[fields[0]])
     eurl = 'edit.%s.%s' % (table.context, row[fields[0]])
     delanchor = Anchor(durl, 'delete')
     editanchor = Anchor(eurl, 'edit')
     td = TD()
     td.appendChild(editanchor)
     td.appendChild(BR())
     td.appendChild(delanchor)
     trow.appendChild(td)
     #trow.appendChild(TxtTD(delanchor))
     table.appendChild(trow)
コード例 #6
0
 def __init__(self, rows, **atts):
     BaseElement.__init__(self, 'table', **atts)
     for row in rows:
         trow = TR()
         fake_template = ',,,'.join([row.package, row.template.replace('.', ',')])
         ta = Anchor('show.template.%s' % fake_template, row.template)
         td = TD()
         td.appendChild(ta)
         trow.appendChild(td)
         td = TD()
         ea = Anchor('edit.template.%s' % fake_template, '(edit)')
         td.appendChild(ea)
         trow.appendChild(td)
         p = TxtTD(row.package)
         trow.appendChild(p)
         self.appendChild(trow)
コード例 #7
0
ファイル: machine.py プロジェクト: pombredanne/paella-svn
 def set_machine(self, machine):
     self.machine.set_machine(machine)
     self.clear_body()
     title = SimpleTitleElement('Machine:  %s' % machine,
                                bgcolor='IndianRed',
                                width='100%')
     self.body.appendChild(title)
     mtable = BaseElement('table')
     for k, v in self.machine.current.items():
         trow = TR()
         trow.appendChild(TxtTD(Bold(k)))
         trow.appendChild(TxtTD(v))
         mtable.appendChild(trow)
     self.body.appendChild(mtable)
     newanchor = Anchor('new.machine.foo', 'new')
     editanchor = Anchor('edit.machine.%s' % machine, 'edit')
     self.body.appendChild(HR())
     self.body.appendChild(editanchor)
     self.body.appendChild(BR())
     self.body.appendChild(newanchor)
コード例 #8
0
 def __init__(self, row):
     self.actionid = row.actionid
     url = "show.action.%d" % self.actionid
     self.anchor = Anchor(url, row.subject)
     # element = TitleTable(self.anchor)
     element = SubjectTable(self.anchor, row.action, row.author, row.posted)
     element.setAttribute("width", "100%")
     element.setAttribute("border", "0")
     url = "new.action.%d" % self.actionid
     ListItem.__init__(self, element)
     self.appendChild(Anchor(url, " (respond)"))
コード例 #9
0
class ActionItem(ListItem):
    def __init__(self, row):
        self.actionid = row.actionid
        url = "show.action.%d" % self.actionid
        self.anchor = Anchor(url, row.subject)
        # element = TitleTable(self.anchor)
        element = SubjectTable(self.anchor, row.action, row.author, row.posted)
        element.setAttribute("width", "100%")
        element.setAttribute("border", "0")
        url = "new.action.%d" % self.actionid
        ListItem.__init__(self, element)
        self.appendChild(Anchor(url, " (respond)"))

    def show_data(self, data):
        anchor = self.anchor
        child = self.lastChild
        anchor.setAttribute("href", "hide.action.%d" % self.actionid)
        self.data = data
        self.insertBefore(TextElement("p", data), child)

    def hide_data(self):
        self.anchor.setAttribute("href", "show.action.%d" % self.actionid)
        del self.childNodes[1]
コード例 #10
0
ファイル: machine.py プロジェクト: pombredanne/paella-svn
 def _setup_section(self, name, fields, rows):
     title = SimpleTitleElement(name)
     title.set_font(color='DarkViolet')
     td = TD()
     anchor = Anchor('new.%s.mtype' % name, 'new')
     td.appendChild(anchor)
     title.row.appendChild(td)
     self.body.appendChild(title)
     if len(rows):
         table = self._make_table(name,
                                  fields,
                                  rows,
                                  border=1,
                                  cellspacing=1)
         color_header(table, 'MediumOrchid2')
         self.body.appendChild(table)
コード例 #11
0
 def set_trait(self, trait):
     self.clear_body()
     self.trait.set_trait(trait)
     title = SimpleTitleElement('Trait: %s' % trait, bgcolor='IndianRed', width='100%')
     self.body.appendChild(title)
     self.body.appendChild(HR())
     plist = UnorderedList()
     parents = self.trait.parents(trait=trait)
     parent_section = SectionTitle('Parents')
     parent_section.create_rightside_table()
     parent_section.append_rightside_anchor(Anchor('hello.there.dude', 'edit'))
     parent_section.append_rightside_anchor(Anchor('hello.there.dudee', 'edit2'))
     self.body.appendChild(parent_section)
     for parent in parents:
         pp = Anchor('show.parent.%s' % parent, parent)
         plist.appendChild(ListItem(pp))
     self.body.appendChild(plist)
     #ptitle_anchor = Anchor('edit.packages.%s' % trait, 'Packages')
     ptitle = SectionTitle('Packages')
     ptitle_anchor = Anchor('new.package.%s' % trait, '(new)')
     td = TD()
     td.appendChild(ptitle_anchor)
     ptitle.row.appendChild(td)
     self.body.appendChild(ptitle)
     rows = self.trait.packages(trait=trait, action=True)
     self.body.appendChild(PackageTable(rows, bgcolor='SkyBlue3'))
     ttitle = Anchor('edit.templates.%s' % trait, 'Templates')
     self.body.appendChild(SectionTitle(ttitle))
     rows = self.trait.templates(trait=trait, fields=['package', 'template', 'templatefile'])
     if len(rows):
         self.body.appendChild(TemplateTable(rows, bgcolor='DarkSeaGreen3'))
     self.body.appendChild(SectionTitle('Variables', href='foo.var.ick'))
     if len(self.trait.environ.keys()):
         env = TraitEnvTable(trait, self.trait.environ, bgcolor='MistyRose3')
         self.body.appendChild(env)
     self.body.appendChild(SectionTitle('Scripts'))
     slist = UnorderedList()
     for row in self.trait._scripts.scripts(trait=trait):
         script  = row.script
         p = Paragraph()
         sa = Anchor('show.script.%s' % script, script)
         ea = Anchor('edit.script.%s' % script, '  (edit)')
         p.appendChild(sa)
         p.appendChild(ea)
         slist.appendChild(ListItem(p))
     self.body.appendChild(slist)
コード例 #12
0
 def set_family(self, family):
     self.family.set_family(family)
     parents = self.family.parents()
     erows = self.family.environment_rows()
     self.clear_body()
     title = SimpleTitleElement('Family:  %s' % family,
                                bgcolor='IndianRed',
                                width='100%')
     self.body.appendChild(title)
     self.body.appendChild(SectionTitle('Parents'))
     if len(parents):
         plist = UnorderedList()
         for p in parents:
             plist.appendChild(ListItem(p))
         self.body.appendChild(plist)
     vtitle = Anchor('edit.variables.%s' % self.family.current, 'Variables')
     self.body.appendChild(SectionTitle(vtitle))
     if len(erows):
         self.body.appendChild(PVarTable(erows, bgcolor='MistyRose2'))