示例#1
0
    def setDNATDescription(self):
        # Present a nice description of the rule:
        # DNAT
        network = unicode(self.dnat_source_combo.currentText())
        if not network:
            return
        dnat_source_icon = self.getNetwork(network).getIcon()
        network = unicode(self.dnat_translate_combo.currentText())
        if not network:
            return
        dnat_destination_icon = self.getNetwork(network).getIcon()

        table = [ [htmlImage(dnat_source_icon), htmlImage(":/icons/go-next.png"), htmlImage(Resource.ICONS[INTERFACE_RESTYPE]), htmlImage(":/icons/go-next.png"), htmlImage(dnat_destination_icon)] ]

        src = self.dnat_source_combo.currentText()
        if self.dnat_port_combo.currentIndex() != 0:
            src += ' : ' +  self.dnat_port_combo.currentText()

        dst = self.dnat_translate_combo.currentText()
        if self.dnat_port_combo.currentIndex() != 0 and self.dnat_port_nated_checkbox.checkState() == Qt.Checked:
            dst += ' : ' + self.dnat_port_nated_combo.currentText()

        table += [ [src, '', tr('Firewall'), '', dst] ]
        desc  = htmlMultiColTable(table)
        self.dnat_description.setText(unicode(desc))
示例#2
0
    def setSNATDescription(self):
        # Present a nice description of the rule:
        # DNAT
        network = unicode(self.snat_source_combo.currentText())
        if not network:
            return
        dnat_source_icon = self.getNetwork(network).getIcon()
        network = unicode(self.snat_translate_combo.currentText())
        if not network:
            return
        dnat_destination_icon = self.getNetwork(network).getIcon()

        table = [ [htmlImage(dnat_source_icon), htmlImage(":/icons/go-next.png"), htmlImage(Resource.ICONS[INTERFACE_RESTYPE]), htmlImage(":/icons/go-next.png"), htmlImage(dnat_destination_icon)] ]

        src = self.snat_source_combo.currentText()
        dst = self.snat_translate_combo.currentText()

        table += [ [src, '', tr('Firewall'), '', dst] ]
        desc  = htmlMultiColTable(table)
        self.snat_description.setText(unicode(desc))