Exemplo n.º 1
0
    def renderSignatureLoot(self, signatureKey):
        result = Modal(
            id='lootModal',
            content=[
                T.div(id='containers')[
                    T.div(class_='buttons')[
                            T.button(type='button', class_='btn btn-success', **{'data-level': 'trivial'})['+ Debris'],
                            T.button(type='button', class_='btn btn-success', **{'data-level': 'easy'})['+ Rubble'],
                            T.button(type='button', class_='btn btn-warning', **{'data-level': 'medium'})['+ Remains'],
                            T.button(type='button', class_='btn btn-danger', **{'data-level': 'hard'})['+ Ruins'],
                    ],

                    T.div(id='contentPaste')[
                        Panel(
                            heading='Paste content of container below',
                            content=[
                                T.div(class_='row')[
                                    T.div(class_='col-xs-9')[
                                        T.textarea(class_="form-control", rows="2"),
                                    ],
                                    T.div(class_='col-xs-3')[
                                        T.button(class_='btn btn-default')['Submit'],
                                        T.div(class_='ajaxLoader', style='white-space: nowrap')[
                                            T.img(src='/static/images/ajax-loader.gif'),
                                            ' Processing'
                                        ],
                                    ],
                                ],
                            ]
                        ),
                    ],

                    T.div(class_='row container-list')[
                        T.div(class_='col-xs-3 blueprint')[
                            T.div(class_='thumbnail')[
                                T.img(src='#'),
                                T.div(class_='caption')[
                                    T.strong()['Lorem ipsum'],
                                    T.div(class_='totalWorth')['Lorem ipsum'],
                                ],

                                T.a(href='#', title='Delete', **{'data-toggle': 'tooltip', 'data-placement': 'top'})[
                                    T.span(class_='glyphicon glyphicon-remove-circle')
                                ]
                            ]

                        ]
                    ],
                ]
            ],
            heading=['Loot for signature ', T.strong[signatureKey]],
        )

        return result
Exemplo n.º 2
0
    def doGet(self, request):
        layout = IGBLayout()

        layout.setContent([
            Panel(heading=['How to use scanning tool'],
                  content=[
                      T.p["""
                      This tool alows you to remember all scanned signatures in given solar system. It will try
                      to automatically detect that you changed system, and always show you signatures from system
                      you are currently in
                      """],

                      T.p["""
                      Basic idea for this tool is that, you should copy-and-paste all data from scanning overview to
                      rectangular gray textarea in this tool (and submit) as often as posible. It will automatically
                      detect changes, update existing signatures with more info, delete old signatures, and add new.
                      """],

                      T.p["""
                      This tool has two modes: personal and corporation. All they differ is who sees your submitted
                      data. It might be only you, or all people from your corporation.
                      """],

                      T.p["""
                      To copy-paste signatures from scanning overview, select any signature in your "Probe scanner"
                      window. Then press ctrl+a (select all), then ctrl+c (copy). Then click in IGB window, inside
                      rectangular gray area, and press ctrl+v (paste).
                      """],

                      T.div[
                          T.img(src='/static/images/help_overview.jpg'),
                          T.img(src='/static/images/help_igb_paste.jpg')

                      ],

                      T.p["""
                      """],

                      T.hr(),

                      T.p[
                          'Back to: ',
                          T.a(href=self.getUrl('scanning/personal'))['personal scanner'],
                          ' or ',
                          T.a(href=self.getUrl('scanning/corporation'))['corporation scanner'],
                      ]
                  ])
        ])

        return layout
Exemplo n.º 3
0
def test_dom_traversal_from_macro():
    """macro abuse: self-traversing template"""
    template = (
        assign('selectors', []),
        macro('css_sep', lambda attr:
              attr == 'class' and '.' or '#'
              ),
        macro('get_selectors', lambda tag, is_tag:
              selectors.extend([  # @UndefinedVariable
                  "%s%s%s { }" % (tag.name, css_sep(_k.strip('_')), _v)  # @UndefinedVariable
                  for _k, _v in tag.attrs.items()
                  if _k.strip('_') in ('id', 'class')
              ])
              ),
        macro('extract_css', lambda tag:
              tag.walk(get_selectors, True) and tag  # @UndefinedVariable
              ),
        macro('css_results', lambda selectors:
              T.pre['\n'.join(selectors)]
              ),

        T.html[
            T.head[T.title['macro madness']],
            T.body[extract_css(# @UndefinedVariable
                T.div('class', 'text', 'id', 'main-content')[
                    T.img('src', '/images/breve-logo.png', 'alt', 'breve logo'),
                    T.br,
                    T.span (class_='bold') [ """Hello from Breve!""" ]
                ]
            ), css_results(selectors)]  # @UndefinedVariable
        ]

    )
    output = flatten(template)
    assert output == ('<html><head><title>macro madness</title></head>'
                      '<body><div class="text" id="main-content">'
                      '<img src="/images/breve-logo.png" alt="breve logo"></img>'
                      '<br /><span class="bold">Hello from Breve!</span></div>'
                      '<pre>div.text { }\ndiv#main-content { }\nspan.bold { }</pre>'
                      '</body></html>')
Exemplo n.º 4
0
    def renderResponse(self, helper, signatures):

        layout = IGBLayout()
        layout.addJs('common.js')
        layout.addJs('scanning.js')
        layout.addJs('loot.js')

        if helper.isTrusted:

            content = [
                Panel(
                    heading=[
                        self._renderHeader(helper),
                    ],
                    content=[
                        T.div(class_='row')[
                            T.div(class_='col-xs-8')[
                                T.textarea(class_="form-control",
                                           id="signaturesInput",
                                           rows="2",
                                           style="overflow: hidden; resize: none",
                                           placeholder="Paste scanning content here")
                            ],
                            T.div(class_='col-xs-4')[
                                T.button(class_='btn btn-default', id='processButton')['Submit'],
                                T.img(id='ajaxLoader', src='/static/images/ajax-loader.gif'),
                            ],

                        ]
                    ]
                ),
                Panel(heading=['Known signatures in ', T.strong[helper.systemName],
                               T.div(class_='pull-right')[
                                   T.a(href=self.getUrl('scanning/help'))['How to use this tool']
                               ]],
                      content=[
                          T.div(id='bookmarkContainer')[
                              self.getKnownSignaturesTable(signatures)
                          ],

                      ]),
                T.script[
                    """
                    $(document).ready(function() {
                        BookmarkManager.init({
                            container: document.getElementById('bookmarkContainer'),
                            processButton: document.getElementById('processButton'),
                            signaturesInput: document.getElementById('signaturesInput'),
                            ajaxLoader: document.getElementById('ajaxLoader'),

                            systemName: '%(system)s'
                        });

                        LootInterface.init();
                    });
                    """ % dict(system=helper.systemName)
                ]
            ]

            layout.setContent(content)

        return layout