Beispiel #1
0
def htmlTitle(title, *icons):
    title = Html(title)
    for icon in icons:
        if not icon:
            continue
        title += u' ' + htmlImage(icon)
    return htmlHeader(3, title)
Beispiel #2
0
def showSession(window, session):
    user = session['user']
    html = htmlHeader(2, tr("Session:"))
    roles = htmlList(user['roles'])
    groups = htmlList(user['groups'])
    html += htmlTable((
        (tr("Login"), user['login']),
        (tr("Roles"), roles),
        (tr("Groups"), groups),
    ))
    QMessageBox.information(window,
        tr("Session Information"),
        unicode(html))
Beispiel #3
0
 def success(self, result):
     duration = time() - self.before
     self.window.unfreeze()
     self.window.clearErrors()
     seconds = u"%.1f" % duration
     html = htmlHeader(3, tr('Rule set'))
     if 'consistency_errors' in result:
         self.consistency_error = bool(result['consistency_errors'])
     else:
         # Old ufwi_ruleset backend
         self.consistency_error = (not result['applied'])
     if result['applied']:
         html += htmlParagraph(tr("Rules applied correctly in %s sec.") % seconds)
     else:
         html += htmlParagraph(tr("Unable to apply rules!"))
     result_html = self.formatResult(result)
     if result_html:
         html += result_html
     self.window.disableRepaint()
     try:
         self.window.setInfo(html, is_error=not result['applied'], show_dock=True)
         self.consistencyFilter(result)
     finally:
         self.window.enableRepaint()