Пример #1
0
    def _get_label(self):
        acl = self.label.split(' ')[0].split(':')

        if len(acl) != 3:
            return ''

        return createLink(':/icons-20/Acl.png', lambda: self.show_acl(acl), self.tr("Show filtering rule in the firewall"))
Пример #2
0
    def __init__(self, client, key, value, parent=None):
        QFrame.__init__(self, parent)

        self.setFrameShape(QFrame.StyledPanel)
        self.setFrameShadow(QFrame.Raised)
        self.setContentsMargins(2, 2, 2, 2)

        self.parent_widget = parent

        filterbox = QHBoxLayout(self)
        filterbox.setContentsMargins(1, 1, 1, 1)

        self.client = client
        try:
            self.arg_data = arg_types[key].data(key, value, GenericFetcher(self.client), parent.compatibility)
            self.arg_filter = arg_types[key].filter(self.client, key, value, parent.compatibility)
        except KeyError:
            raise FilterWidgetError()

        if isinstance(self.arg_data.label, QObject):
            raise FilterWidgetError()

        self.arglabel = QLabel('<b>%s</b>' % arg_types[key].label)
        self.argvalue = QLabel('%s' % self.arg_data.label)
        self.argunit = QLabel(arg_types[key].unit)
        filterbox.insertWidget(self.KEY_POS, self.arglabel)
        filterbox.insertWidget(self.VALUE_POS, self.argvalue)
        filterbox.insertWidget(self.UNIT_POS, self.argunit)

        self.argedit = createLink(':/icons-20/edit.png', self.editFilter)
        self.argedit.setStyleSheet('')
        self.argremove = createLink(':/icons-20/wrong.png', self.removeFilter)
        self.argremove.setStyleSheet('')

        if isinstance(self.arg_filter, QLineEdit):
            self.connect(self.arg_filter, SIGNAL('returnPressed()'), self.editFilter)
        elif isinstance(self.arg_filter, QSpinBox):
            self.connect(self.arg_filter, SIGNAL('editingFinished()'), self.editFilter)

        filterbox.insertWidget(self.EDIT_POS, self.argedit)
        filterbox.insertWidget(self.REMOVE_POS, self.argremove)

        self.edditing = False
Пример #3
0
    def __init__(self, client, parent=None):
        QWidget.__init__(self, parent)

        self.client = client
        self.filtersWidgetsList = []
        self.args = {}
        self.filters = []

        self.filtersWidget = QHBoxLayout(self)
        self.filtersWidget.setContentsMargins(5, 1, 1, 1)

        label = u'<h3>%s</h3>' % tr("Filters:")
        self.filtersWidget.addWidget(QLabel(label))
        self.add_link = createLink(':/icons-20/add.png', self.addFilter)
        self.filtersWidget.addWidget(self.add_link)
        self.filtersWidget.addStretch()

        self.compatibility = None