コード例 #1
0
ファイル: nq.py プロジェクト: pombredanne/pykram
def apply(this,parent=[]):
  _ = pykram.document()
  return _.html(_.head(_.meta(
      content="%s" % (this.binqlogreport.version),
      name="binqlogreport.version"),_.meta(
      content="text/html; charset=utf-8",
      http_equiv="Content-Type"),_.style(_._bare("%s" % (file('../src/test/css/d.css').read())),
      type="text/css"),_.script(_._bare("%s" % (file('../src/test/js/a.js').read())),
      type="text/javascript"),_.script(_._bare("%s" % (file('../src/test/js/b.js').read())),
      type="text/javascript"),_.script(_._bare("%s" % (file('../src/test/js/c.js').read())),
      type="text/javascript")),_.body(_.div(_.span("binqlogreport",
        id="header-title"),_.span(_.a("summary",
          href="#content",
          class_="nav-link"),_.a("details",
          href="#details",
          class_="nav-link"),_.a("queries",
          href="#queries",
          class_="nav-link"),
        class_="nav"),
      id="header",
      class_="header",
      summary="Header"),_.div(_.span(_.a("summary",
          href="#content",
          class_="nav-link"),_.a("details",
          href="#details",
          class_="nav-link"),_.a("queries",
          href="#queries",
          class_="nav-link"),
        class_="nav"),
      id="footer"),_.div(_.table(_.thead(_.tr(_.th(),_.th("Logical Summary",
              colspan="4"),_.th("Physical Summary",
              colspan="4"),
            class_="summary header",
            id="summary-header"),_.tr(_.th("Logical Id",
              title="This is a general hash for all logical queries. It is generated irrespective of numeric and string constants in the logical query."),_.th("#of Queries",
              title="The number of occurrences of this logical query."),_.th("Avg Rows",
              title="The average number of rows."),_.th("Avg RT",
              title="The average response times."),_.th("%Successful",
              title="The percetange of successful completions."),_.th("#of Queries",
              title=""),_.th("Avg Rows",
              title=""),_.th("Avg RT",
              title=""),_.th("Avg Bytes",
              title=""),
            class_="summary header",
            id="summary-headers")),_.tbody(
          [block1(_pyk,this) for _pyk in this.summary]),
        class_="alternate",
        id="results"),_.div(
        [block2(_pyk,this) for _pyk in this.logical_sqlids],
        class_="alternate",
        id="details"),_.div(
        [block4(_pyk,this) for _pyk in this.queries],
        id="queries"),_.div(_.h3("Selection buffer"),_.textarea(
          id="buffer"),
        id="selection"),
      id="content"),
    id="nav-top"))
コード例 #2
0
ファイル: nq.py プロジェクト: pombredanne/pykram
def block3(this,parent=[]):
  sqlids = this
  _ = pykram.document()
  return _.tr(_.td("%s" % (this.sqlid),
    class_="sqlid q%s" % (this.sqlid)),_.td("%s" % (this.rows),
    class_="rows"),_.td("%s" % (this.response),
    class_="resposne"),_.td("%s" % (this.lineno),
    class_="lineno"),_.td("%s" % (this.file_name),
    class_="file file-%s key-%s" % (this.file_hash,this.key)),
              class_="q%s key-%s" % (this.sqlid,this.log_key))
コード例 #3
0
ファイル: nq.py プロジェクト: pombredanne/pykram
def block1(this,parent=[]):
  summary = this
  _ = pykram.document()
  return _.tr(_.th(_.a("%s" % (this.logical.logid),
      href="#q%s" % (this.logical.logid)),
    class_="logid"),_.td("%s" % (this.logical.count),
    class_="l-count"),_.td("%s" % (this.logical.rows),
    class_="l-rows"),_.td("%s" % (this.logical.response),
    class_="l-response"),_.td("%s" % (this.logical.successful),
    class_="l-successful"),_.td("%s" % (this.physical.count),
    class_="p-count"),_.td("%s" % (this.physical.rows),
    class_="p-rows"),_.td("%s" % (this.physical.response),
    class_="p-response"),_.td("%s" % (this.physical.bytes),
    class_="p-bytes"),
            class_="summary query q%s" % (this.logical.logid))
コード例 #4
0
ファイル: nq.py プロジェクト: pombredanne/pykram
def block2(this,parent=[]):
  logical_sqlids = this
  _ = pykram.document()
  return _.div(_.table(_.tr(_.th(_.a("%s" % (this.logical_id),
          name="q%s" % (this.logical_id)),
        title=""),_.td(_.div("%s" % (this.data),
          class_="data q%s" % (this.sqlid)),_.table(_.thead(_.tr(_.th("Logical Queries",
                title="",
                rowspan="5"),_.th("Physical Queries",
                title="",
                colspan="4")),_.tr(_.th("sqlid",
                title=""),_.th("rows",
                title=""),_.th("response",
                title=""),_.th("line",
                title=""),_.th("file",
                title=""))),_.tbody(
            [block3(_pyk,this) for _pyk in this.sqlids]),
          class_="details q%s" % (this.sqlid))))),
          class_="query-details")
コード例 #5
0
ファイル: html.py プロジェクト: pombredanne/pykram
   b
    c
     d
      e
       f
        g
         h
        i
       j
      k
     l
    m
   n
  o"""

_ = pykram.document()
metal = _._ns("metal","http://www.xmtl.org/version/2010/04")

style = pyelyts.document()
style(".aword")(color="red")
style(".adigit")(color="blue")

html = _.html(
  _.head(
    _.title("test"),
    _.meta(http_equiv_='Content-Type', content="charset=utf-8"),
    _.style(_._bare(str(style)), type="text/css")
  ),
  _.body(
    _.div(_empty=True),
    _.ul(
コード例 #6
0
ファイル: nq.py プロジェクト: pombredanne/pykram
def block4(this,parent=[]):
  queries = this
  _ = pykram.document()
  return _.div(_.pre("%s" % (this.sqlid)),_.textarea("%s" % (this.data),
    readonly="readonly",
    class_="data"))
コード例 #7
0
ファイル: json.py プロジェクト: pombredanne/pykram
  import pykram
except ImportError:
  try:
    import os
    import sys
    sys.path.append(os.path.dirname(sys.argv[0]))
    import pykram
  except ImportError:
    try:
      sys.path.append(os.path.join(os.path.dirname(sys.argv[0]),'..'))
      import pykram
    except ImportError:
      print __doc__
      sys.exit( 1 )

_ = pykram.document(pykram.mode.json)

#["menu", { "id": "file", "value": "File" },
#  ["popup",
#    ["menuitem", {"value":"New", "onclick":"CreateNewDoc()"} ],
#    ["menuitem", {"value":"Open", "onclick":"OpenDoc()"} ],
#    ["menuitem", {"value":"Close", "onclick":"CloseDoc()"} ]
#  ]
#]

json = _.menu(
  _.popup(
    _.menuitem(value="New", onclick="CreateNewDoc()"),
    _.menuitem(value="Open", onclick="OpenDoc()"),
    _.menuitem(value="Close", onclick="CloseDoc()") ),
  id="file", value="File" )
コード例 #8
0
ファイル: struxt.py プロジェクト: pombredanne/pykram
"""
This module illustrates the use of the pykram.py module.
"""

try:
  import pykram
except ImportError:
  try:
    import os
    import sys
    sys.path.append(os.path.dirname(sys.argv[0]))
    import pykram
  except ImportError:
    try:
      sys.path.append(os.path.join(os.path.dirname(sys.argv[0]),'..'))
      import pykram
    except ImportError:
      print __doc__
      sys.exit( 1 )

_ = pykram.document(pykram.mode.struxt)

struxt = _.menu(
  _.popup(
    _.menuitem(value="New", onclick="CreateNewDoc()"),
    _.menuitem(value="Open", onclick="OpenDoc()"),
    _.menuitem(value="Close", onclick="CloseDoc()") ),
  id="file", value="File" )

print struxt