Exemple #1
0
# -*- coding: utf-8 -*-

from riot.tags.tags import parse_tag_from_string
from riot.tags.style import parse_style
from riot.app import run_tag, quit_app

run_tag(parse_tag_from_string('''
        <filler class="bg">
          <text class="streak" align="center">
            <span class="banner">hello world</span>
          </text>
        </filler>
        '''),
        parse_style('''
        .banner {
          foreground: black;
          background: light gray;
        }
        .streak {
          foreground: black;
          background: dark red;
        }
        .bg {
          foreground: black;
          background: dark blue;
        }
        '''),
        unhandled_input=lambda key: key in ('q', 'Q') and quit_app())
Exemple #2
0
  </filler>
  <script>
  import urwid

  def init(self, opts):
      import urwid
      self.name = opts['name']

  def answer(self, edit, text):
      self.name = text
  </script>
</sig>
""",
)

style = """
.highlight {
  foreground: default,bold;
  background: default;
  mono: bold;
}
"""

root = convert_string_to_node("<sig></sig>")

mount(root, "sig", "sig", {"name": "Default"})

app = parse_tag_from_node(root)

run_tag(app, parse_style(style))
Exemple #3
0
    </pile>
  </filler>
  <script>
  import urwid

  def init(self, opts):
      import urwid
      self.name = opts['name']

  def answer(self, edit, text):
      self.name = text
  </script>
</sig>
''')

style = '''
.highlight {
  foreground: default,bold;
  background: default;
  mono: bold;
}
'''

root = convert_string_to_node('<sig></sig>')

mount(root, 'sig', 'sig', {'name': 'Default'})

app = parse_tag_from_node(root)

run_tag(app, parse_style(style))
from riot.tags.style import parse_style
from riot.app import run_tag, quit_app

run_tag(
    parse_tag_from_string(
        '''
        <filler class="bg">
          <text class="streak" align="center">
            <span class="banner">hello world</span>
          </text>
        </filler>
        '''
    ), parse_style(
        '''
        .banner {
          foreground: black;
          background: light gray;
        }
        .streak {
          foreground: black;
          background: dark red;
        }
        .bg {
          foreground: black;
          background: dark blue;
        }
        '''
    ),
    unhandled_input=lambda key: key in ('q', 'Q') and quit_app()
)
<custom>
  <filler class="bg">
    <pile>
      <div class="outside"></div>
      <div class="inside"></div>
      <text align="center" class="streak">
        <span class="banner">hello world</span>
      </text>
      <div class="inside"></div>
      <div class="outside"></div>
    </pile>
  </filler>
</custom>
'''

tag = '''
<solidfill class="bg"></solidfill>
'''

run_tag(
    parse_tag_from_node(
        riot_mount(
            convert_string_to_node(tag),
            'solidfill.bg',
            convert_string_to_node(custom)
        )
    ),
    parse_style(style),
    unhandled_input=lambda key: key in ('Q', 'q') and quit_app()
)
  foreground-high: g7;
  background-high: #d06;
}
'''

custom = '''
<custom>
  <filler class="bg">
    <pile>
      <div class="outside"></div>
      <div class="inside"></div>
      <text align="center" class="streak">
        <span class="banner">hello world</span>
      </text>
      <div class="inside"></div>
      <div class="outside"></div>
    </pile>
  </filler>
</custom>
'''

tag = '''
<solidfill class="bg"></solidfill>
'''

run_tag(parse_tag_from_node(
    riot_mount(convert_string_to_node(tag), 'solidfill.bg',
               convert_string_to_node(custom))),
        parse_style(style),
        unhandled_input=lambda key: key in ('Q', 'q') and quit_app())