示例#1
0
    def _typeChangedSlot(self, vm_type):
        """
        When the type of QEMU VM is changed.

        :param vm_type: type of VM
        """

        if vm_type == "IOSv":
            self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/iosv_virl.normal.svg"))
            self.uiNameLineEdit.setText("vIOS")
            self.uiHdaDiskImageLabel.setText("IOSv VDMK file:")
        elif vm_type == "IOSv-L2":
            self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/iosv_l2_virl.normal.svg"))
            self.uiNameLineEdit.setText("vIOS-L2")
            self.uiHdaDiskImageLabel.setText("IOSv-L2 VDMK file:")
        elif vm_type == "ASA 8.4(2)":
            self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/asa.normal.svg"))
            self.uiNameLineEdit.setText("ASA")
        elif vm_type == "IDS":
            self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/ids.normal.svg"))
            self.uiNameLineEdit.setText("IDS")
            self.uiHdaDiskImageLabel.setText("Disk image (hda):")
        else:
            self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/icons/qemu.svg"))
            self.uiHdaDiskImageLabel.setText("Disk image (hda):")
            self.uiNameLineEdit.setText("")
示例#2
0
    def _getStyleIcon(self, normal_file, active_file):

        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(normal_file), QtGui.QIcon.Normal,
                       QtGui.QIcon.Off)
        icon.addPixmap(QtGui.QPixmap(active_file), QtGui.QIcon.Active,
                       QtGui.QIcon.Off)
        return icon
示例#3
0
    def _typeChangedSlot(self, image_type):
        """
        When the type of IOU device is changed.

        :param image_type: type of image (L2 or L3)
        """

        if image_type == "L2 image":
            #  L2 image
            self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/multilayer_switch.svg"))
        else:
            #  L3 image
            self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/router.svg"))
示例#4
0
    def setLegacyStyle(self):
        """
        Sets the legacy GUI style.
        """

        self._mw.setStyleSheet("")
        self._mw.uiNewProjectAction.setIcon(QtGui.QIcon(":/icons/new-project.svg"))
        self._mw.uiOpenProjectAction.setIcon(QtGui.QIcon(":/icons/open.svg"))
        self._mw.uiOpenApplianceAction.setIcon(QtGui.QIcon(":/icons/open.svg"))
        self._mw.uiNewTemplateAction.setIcon(QtGui.QIcon(":/icons/plus.svg"))
        self._mw.uiSaveProjectAsAction.setIcon(QtGui.QIcon(":/icons/save-as.svg"))
        self._mw.uiEditProjectAction.setIcon(QtGui.QIcon(":/icons/edit.svg"))
        self._mw.uiImportExportConfigsAction.setIcon(QtGui.QIcon(":/icons/import_export_configs.svg"))
        self._mw.uiImportProjectAction.setIcon(QtGui.QIcon(":/icons/import.svg"))
        self._mw.uiExportProjectAction.setIcon(QtGui.QIcon(":/icons/export.svg"))
        self._mw.uiDeleteProjectAction.setIcon(QtGui.QIcon(":/icons/delete.svg"))
        self._mw.uiScreenshotAction.setIcon(QtGui.QIcon(":/icons/camera-photo.svg"))
        self._mw.uiSnapshotAction.setIcon(QtGui.QIcon(":/icons/snapshot.svg"))
        self._mw.uiQuitAction.setIcon(QtGui.QIcon(":/icons/quit.svg"))
        self._mw.uiPreferencesAction.setIcon(QtGui.QIcon(":/icons/applications.svg"))
        self._mw.uiZoomInAction.setIcon(QtGui.QIcon(":/icons/zoom-in.png"))
        self._mw.uiZoomOutAction.setIcon(QtGui.QIcon(":/icons/zoom-out.png"))
        self._mw.uiShowPortNamesAction.setIcon(QtGui.QIcon(":/icons/show-interface-names.svg"))
        self._mw.uiStartAllAction.setIcon(self._getStyleIcon(":/icons/start.svg", ":/icons/start-hover.svg"))
        self._mw.uiSuspendAllAction.setIcon(self._getStyleIcon(":/icons/pause.svg", ":/icons/pause-hover.svg"))
        self._mw.uiStopAllAction.setIcon(self._getStyleIcon(":/icons/stop.svg", ":/icons/stop-hover.svg"))
        self._mw.uiReloadAllAction.setIcon(QtGui.QIcon(":/icons/reload.svg"))
        self._mw.uiAuxConsoleAllAction.setIcon(QtGui.QIcon(":/icons/aux-console.svg"))
        self._mw.uiConsoleAllAction.setIcon(QtGui.QIcon(":/icons/console.svg"))
        self._mw.uiAddNoteAction.setIcon(QtGui.QIcon(":/icons/add-note.svg"))
        self._mw.uiInsertImageAction.setIcon(QtGui.QIcon(":/icons/image.svg"))
        self._mw.uiDrawRectangleAction.setIcon(self._getStyleIcon(":/icons/rectangle.svg", ":/icons/rectangle-hover.svg"))
        self._mw.uiDrawEllipseAction.setIcon(self._getStyleIcon(":/icons/ellipse.svg", ":/icons/ellipse-hover.svg"))
        self._mw.uiDrawLineAction.setIcon(QtGui.QIcon(":/icons/vertically.svg"))
        self._mw.uiEditReadmeAction.setIcon(QtGui.QIcon(":/icons/edit.svg"))
        self._mw.uiOnlineHelpAction.setIcon(QtGui.QIcon(":/icons/help.svg"))
        self._mw.uiBrowseRoutersAction.setIcon(self._getStyleIcon(":/icons/router.png", ":/icons/router-hover.png"))
        self._mw.uiBrowseSwitchesAction.setIcon(self._getStyleIcon(":/icons/switch.png", ":/icons/switch-hover.png"))
        self._mw.uiBrowseEndDevicesAction.setIcon(self._getStyleIcon(":/icons/PC.png", ":/icons/PC-hover.png"))
        self._mw.uiBrowseSecurityDevicesAction.setIcon(self._getStyleIcon(":/icons/firewall.png", ":/icons/firewall-hover.png"))
        self._mw.uiBrowseAllDevicesAction.setIcon(self._getStyleIcon(":/icons/browse-all-icons.png", ":/icons/browse-all-icons-hover.png"))
        self._mw.uiAddLinkAction.setIcon(self._getStyleIcon(":/icons/connection-new.svg", ":/charcoal_icons/connection-new-hover.svg"))

        # Lock action has 4 different icons
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/icons/lock.svg"), QtGui.QIcon.Normal, QtGui.QIcon.On)
        icon.addPixmap(QtGui.QPixmap(":/icons/lock.svg"), QtGui.QIcon.Active, QtGui.QIcon.On)
        icon.addPixmap(QtGui.QPixmap(":/icons/unlock.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        icon.addPixmap(QtGui.QPixmap(":/icons/unlock.svg"), QtGui.QIcon.Active, QtGui.QIcon.Off)
        self._mw.uiLockAllAction.setIcon(icon)
示例#5
0
    def __init__(self, qemu_vms, parent):

        super().__init__(qemu_vms, parent)
        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/icons/qemu.svg"))

        # Mandatory fields
        self.uiNameWizardPage.registerField("vm_name*", self.uiNameLineEdit)
        self.uiDiskWizardPage.registerField("hda_disk_image*",
                                            self.uiHdaDiskImageLineEdit)
        self.uiInitrdKernelImageWizardPage.registerField(
            "initrd*", self.uiInitrdImageLineEdit)
        self.uiInitrdKernelImageWizardPage.registerField(
            "kernel_image*", self.uiKernelImageLineEdit)

        # Fill image combo boxes
        self.addImageSelector(
            self.uiHdaDiskExistingImageRadioButton,
            self.uiHdaDiskImageListComboBox,
            self.uiHdaDiskImageLineEdit,
            self.uiHdaDiskImageToolButton,
            QemuVMConfigurationPage.getDiskImage,
            create_image_wizard=QemuImageWizard,
            create_button=self.uiHdaDiskImageCreateToolButton,
            image_suffix="-hda")
        self.addImageSelector(self.uiLinuxExistingImageRadioButton,
                              self.uiInitrdImageListComboBox,
                              self.uiInitrdImageLineEdit,
                              self.uiInitrdImageToolButton,
                              QemuVMConfigurationPage.getDiskImage)
        self.addImageSelector(self.uiLinuxExistingImageRadioButton,
                              self.uiKernelImageListComboBox,
                              self.uiKernelImageLineEdit,
                              self.uiKernelImageToolButton,
                              QemuVMConfigurationPage.getDiskImage)
示例#6
0
    def __init__(self, ios_routers, parent):

        QtGui.QWizard.__init__(self, parent)
        self.setupUi(self)
        self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/router.normal.svg"))
        self.setWizardStyle(QtGui.QWizard.ModernStyle)
        if sys.platform.startswith("darwin"):
            # we want to see the cancel button on OSX
            self.setOptions(QtGui.QWizard.NoDefaultButton)

        self.uiRemoteRadioButton.toggled.connect(self._remoteServerToggledSlot)
        self.uiLoadBalanceCheckBox.toggled.connect(self._loadBalanceToggledSlot)
        self.uiIOSImageToolButton.clicked.connect(self._iosImageBrowserSlot)
        self.uiTestIOSImagePushButton.clicked.connect(self._testIOSImageSlot)
        self.uiIdlePCFinderPushButton.clicked.connect(self._idlePCFinderSlot)
        self.uiEtherSwitchCheckBox.stateChanged.connect(self._etherSwitchSlot)
        self.uiPlatformComboBox.currentIndexChanged[str].connect(self._platformChangedSlot)
        self.uiPlatformComboBox.addItems(list(PLATFORMS_DEFAULT_RAM.keys()))

        self._router = None
        # Validate the Idle PC value
        self._idle_valid = False
        idle_pc_rgx = QtCore.QRegExp("^(0x[0-9a-fA-F]{8})?$")
        validator = QtGui.QRegExpValidator(idle_pc_rgx, self)
        self.uiIdlepcLineEdit.setValidator(validator)
        self.uiIdlepcLineEdit.textChanged.connect(self._idlePCValidateSlot)
        self.uiIdlepcLineEdit.textChanged.emit(self.uiIdlepcLineEdit.text())

        # location of the base config templates
        self._base_startup_config_template = get_resource(os.path.join("configs", "ios_base_startup-config.txt"))
        self._base_private_config_template = get_resource(os.path.join("configs", "ios_base_private-config.txt"))
        self._base_etherswitch_startup_config_template = get_resource(os.path.join("configs", "ios_etherswitch_startup-config.txt"))

        # FIXME: hide because of issue on Windows.
        self.uiTestIOSImagePushButton.hide()

        # Mandatory fields
        self.uiNamePlatformWizardPage.registerField("name*", self.uiNameLineEdit)
        self.uiIOSImageWizardPage.registerField("image*", self.uiIOSImageLineEdit)

        self._widget_slots = {0: self.uiSlot0comboBox,
                              1: self.uiSlot1comboBox,
                              2: self.uiSlot2comboBox,
                              3: self.uiSlot3comboBox,
                              4: self.uiSlot4comboBox,
                              5: self.uiSlot5comboBox,
                              6: self.uiSlot6comboBox}

        self._widget_wics = {0: self.uiWic0comboBox,
                             1: self.uiWic1comboBox,
                             2: self.uiWic2comboBox}

        self._ios_routers = ios_routers

        if Dynamips.instance().settings()["use_local_server"]:
            # skip the server page if we use the local server
            self.setStartId(1)

        if not ENABLE_CLOUD:
            self.uiCloudRadioButton.hide()
示例#7
0
    def __init__(self, iou_devices, parent):

        super().__init__(iou_devices, IOU.instance().settings()["use_local_server"], parent)
        self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/multilayer_switch.svg"))

        self.uiTypeComboBox.currentIndexChanged[str].connect(self._typeChangedSlot)

        if sys.platform.startswith("win") or sys.platform.startswith("darwin"):
            # Cannot use IOU locally on Windows and Mac
            self.uiLocalRadioButton.setEnabled(False)

        # Available types
        self.uiTypeComboBox.addItems(["L2 image", "L3 image"])

        # Mandatory fields
        self.uiNameWizardPage.registerField("name*", self.uiNameLineEdit)
        self.uiNameWizardPage.registerField("image*", self.uiIOUImageLineEdit)

        self.uiIOUImageLineEdit.textChanged.connect(self._imageLineEditTextChangedSlot)

        # location of the base config templates
        self._base_iou_l2_config_template = get_resource(os.path.join("configs", "iou_l2_base_startup-config.txt"))
        self._base_iou_l3_config_template = get_resource(os.path.join("configs", "iou_l3_base_startup-config.txt"))

        from ..pages.iou_device_preferences_page import IOUDevicePreferencesPage
        self.addImageSelector(self.uiExistingImageRadioButton, self.uiIOUImageListComboBox, self.uiIOUImageLineEdit, self.uiIOUImageToolButton, IOUDevicePreferencesPage.getIOUImage)
示例#8
0
    def __init__(self, vpcs_nodes, parent):

        super().__init__(vpcs_nodes, parent)

        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/symbols/vpcs_guest.svg"))
        self.uiNameWizardPage.registerField("name*", self.uiNameLineEdit)
示例#9
0
    def __init__(self, ios_routers, parent):

        super().__init__(ios_routers,
                         Dynamips.instance().settings()["use_local_server"],
                         parent)
        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/symbols/router.svg"))

        self.uiTestIOSImagePushButton.clicked.connect(self._testIOSImageSlot)
        self.uiIdlePCFinderPushButton.clicked.connect(self._idlePCFinderSlot)
        self.uiEtherSwitchCheckBox.stateChanged.connect(self._etherSwitchSlot)
        self.uiPlatformComboBox.currentIndexChanged[str].connect(
            self._platformChangedSlot)
        self.uiPlatformComboBox.addItems(list(PLATFORMS_DEFAULT_RAM.keys()))

        self._router = None
        # Validate the Idle PC value
        self._idle_valid = False
        idle_pc_rgx = QtCore.QRegExp("^(0x[0-9a-fA-F]{8})?$")
        validator = QtGui.QRegExpValidator(idle_pc_rgx, self)
        self.uiIdlepcLineEdit.setValidator(validator)
        self.uiIdlepcLineEdit.textChanged.connect(self._idlePCValidateSlot)
        self.uiIdlepcLineEdit.textChanged.emit(self.uiIdlepcLineEdit.text())

        # location of the base config templates
        self._base_startup_config_template = get_resource(
            os.path.join("configs", "ios_base_startup-config.txt"))
        self._base_etherswitch_startup_config_template = get_resource(
            os.path.join("configs", "ios_etherswitch_startup-config.txt"))

        # FIXME: hide because of issue on Windows.
        self.uiTestIOSImagePushButton.hide()

        # Mandatory fields
        self.uiNameWizardPage.registerField("name*", self.uiNameLineEdit)
        self.uiIOSImageWizardPage.registerField("image*",
                                                self.uiIOSImageLineEdit)

        self._widget_slots = {
            0: self.uiSlot0comboBox,
            1: self.uiSlot1comboBox,
            2: self.uiSlot2comboBox,
            3: self.uiSlot3comboBox,
            4: self.uiSlot4comboBox,
            5: self.uiSlot5comboBox,
            6: self.uiSlot6comboBox
        }

        self._widget_wics = {
            0: self.uiWic0comboBox,
            1: self.uiWic1comboBox,
            2: self.uiWic2comboBox
        }

        from ..pages.ios_router_preferences_page import IOSRouterPreferencesPage
        self.addImageSelector(self.uiIOSExistingImageRadioButton,
                              self.uiIOSImageListComboBox,
                              self.uiIOSImageLineEdit,
                              self.uiIOSImageToolButton,
                              IOSRouterPreferencesPage.getIOSImage)
    def savePreferences(self):
        """
        Saves VPCS preferences.
        """

        vpcs_path = self.uiVPCSPathLineEdit.text().strip()
        if vpcs_path and self.uiUseLocalServercheckBox.isChecked(
        ) and not self._checkVPCSPath(vpcs_path):
            return

        new_settings = {
            "vpcs_path":
            vpcs_path,
            "base_script_file":
            self.uiScriptFileEdit.text(),
            "use_local_server":
            self.uiUseLocalServercheckBox.isChecked(),
            "category":
            self.uiCategoryComboBox.itemData(
                self.uiCategoryComboBox.currentIndex())
        }

        symbol_path = self.uiSymbolLineEdit.text()
        pixmap = QtGui.QPixmap(symbol_path)
        if pixmap.isNull():
            QtWidgets.QMessageBox.critical(
                self, "Symbol", "Invalid file or format not supported")
        else:
            new_settings["symbol"] = symbol_path

        VPCS.instance().setSettings(new_settings)
示例#11
0
    def __init__(self, ethernet_hubs, parent):

        super().__init__(ethernet_hubs, parent)

        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/symbols/hub.svg"))
        self.uiNameWizardPage.registerField("name*", self.uiNameLineEdit)
示例#12
0
    def __init__(self, virtualbox_vms, parent):

        super().__init__(virtualbox_vms, VirtualBox.instance().settings()["use_local_server"], parent)
        self._virtualbox_vms = virtualbox_vms
        self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/icons/virtualbox.png"))

        if not Servers.instance().remoteServers():
            # skip the server page if we use the local server
            self.setStartId(1)
示例#13
0
    def __init__(self, traceng_nodes, parent):

        super().__init__(traceng_nodes, parent)
        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/icons/traceng.png"))
        self.uiNameWizardPage.registerField("name*", self.uiNameLineEdit)

        # TraceNG is only supported on a local server
        self.uiRemoteRadioButton.setEnabled(False)
        self.uiVMRadioButton.setEnabled(False)
示例#14
0
    def __init__(self, vmware_vms, parent):

        super().__init__(vmware_vms,
                         VMware.instance().settings()["use_local_server"],
                         parent)
        self._vmware_vms = vmware_vms
        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/symbols/vmware_guest.svg"))

        if not Servers.instance().remoteServers():
            # skip the server page if we use the local server
            self.setStartId(1)
示例#15
0
    def __init__(self, docker_images, parent):

        super().__init__(parent=parent, devices=[], use_local_server=True)
        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/icons/docker.png"))
        self.setWizardStyle(QtWidgets.QWizard.ModernStyle)

        self._docker_images = docker_images

        if Docker.instance().settings()["use_local_server"]:
            # skip the server page if we use the local server
            self.setStartId(1)
示例#16
0
    def __init__(self, docker_containers, parent):

        super().__init__(docker_containers, parent)
        self._docker_containers = docker_containers
        self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/icons/docker.png"))

        self.uiNewImageRadioButton.setChecked(True)
        self._existingImageRadioButtonToggledSlot(False)
        self.uiExistingImageRadioButton.toggled.connect(self._existingImageRadioButtonToggledSlot)

        if ComputeManager.instance().localPlatform().startswith("win") or ComputeManager.instance().localPlatform().startswith("darwin"):
            # Cannot use Docker locally on Windows and Mac
            self._disableLocalServer()
示例#17
0
    def __init__(self,
                 parent,
                 server,
                 filename="disk",
                 folder=None,
                 size=30000):

        super().__init__(parent)

        self._server = server
        self.setupUi(self)
        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/icons/qemu.svg"))

        # Initialize "constants"
        self._mappings = {
            self.uiFormatQcow2Radio:
            ("qcow2", ".qcow2", self.uiQcow2OptionsWizardPage),
            self.uiFormatQcowRadio: ("qcow", ".qcow", None),
            self.uiFormatVhdRadio:
            ("vpc", ".vhd", self.uiVhdOptionsWizardPage),
            self.uiFormatVdiRadio:
            ("vdi", ".vdi", self.uiVdiOptionsWizardPage),
            self.uiFormatVmdkRadio:
            ("vmdk", ".vmdk", self.uiVmdkOptionsWizardPage),
            self.uiFormatRawRadio: ("raw", ".img", None)
        }

        # isComplete() overrides
        self.uiSizeAndLocationWizardPage.isComplete = self._uiSizeAndLocationWizardPage_isComplete
        self.uiBinaryWizardPage.isComplete = self._uiBinaryWizardPage_isComplete

        # Signal connections
        self.uiFormatRadios.buttonClicked.connect(self._formatChangedSlot)
        self.uiLocationLineEdit.textChanged.connect(self._locationChangedSlot)
        self.uiLocationBrowseToolButton.clicked.connect(self._browserSlot)

        # Finisher setup
        self.page(self.pageIds()[-1]).validatePage = self._createDisk

        # Default values
        Qemu.instance().getQemuImgBinariesFromServer(
            self._server, self._getQemuImgBinariesFromServerCallback)
        self.uiLocationLineEdit.setText(filename)
        self.uiSizeSpinBox.setValue(size)
        self._formatChangedSlot(self.uiFormatQcow2Radio)

        # Hide the file browse button for remote servers
        if not self._server.isLocal():
            self.uiLocationBrowseToolButton.hide()
示例#18
0
    def __init__(self, qemu_vms, parent):

        QtGui.QWizard.__init__(self, parent)
        self.setupUi(self)
        self.setPixmap(QtGui.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/icons/qemu.svg"))
        self.setWizardStyle(QtGui.QWizard.ModernStyle)
        if sys.platform.startswith("darwin"):
            # we want to see the cancel button on OSX
            self.setOptions(QtGui.QWizard.NoDefaultButton)

        self.uiRemoteRadioButton.toggled.connect(self._remoteServerToggledSlot)
        self.uiHdaDiskImageToolButton.clicked.connect(
            self._hdaDiskImageBrowserSlot)
        self.uiHdbDiskImageToolButton.clicked.connect(
            self._hdbDiskImageBrowserSlot)
        self.uiInitrdToolButton.clicked.connect(self._initrdBrowserSlot)
        self.uiKernelImageToolButton.clicked.connect(
            self._kernelImageBrowserSlot)
        self.uiTypeComboBox.currentIndexChanged[str].connect(
            self._typeChangedSlot)

        # Available types
        self.uiTypeComboBox.addItems(
            ["Default", "IOSv", "IOSv-L2", "ASA 8.4(2)", "IDS"])

        # Mandatory fields
        self.uiNameWizardPage.registerField("vm_name*", self.uiNameLineEdit)
        self.uiDiskWizardPage.registerField("hda_disk_image*",
                                            self.uiHdaDiskImageLineEdit)
        self.uiDiskImageHdbWizardPage.registerField(
            "hdb_disk_image*", self.uiHdbDiskImageLineEdit)
        self.uiASAWizardPage.registerField("initrd*", self.uiInitrdLineEdit)
        self.uiASAWizardPage.registerField("kernel_image*",
                                           self.uiKernelImageLineEdit)

        self._qemu_vms = qemu_vms

        if Qemu.instance().settings()["use_local_server"]:
            # skip the server page if we use the local server
            self.setStartId(1)

        # By default we use the local server
        self._server = Servers.instance().localServer()

        if not ENABLE_CLOUD:
            self.uiCloudRadioButton.hide()
示例#19
0
    def __init__(self, docker_containers, parent):

        super().__init__(docker_containers,
                         Docker.instance().settings()["use_local_server"],
                         parent)
        self._docker_containers = docker_containers
        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/icons/docker.png"))

        self.uiNewImageRadioButton.setChecked(True)
        self._existingImageRadioButtonToggledSlot(False)
        self.uiExistingImageRadioButton.toggled.connect(
            self._existingImageRadioButtonToggledSlot)

        if sys.platform.startswith("win") or sys.platform.startswith("darwin"):
            # Cannot use Docker locally on Windows and Mac
            self.uiLocalRadioButton.setEnabled(False)
    def __init__(self, iou_devices, parent):

        QtGui.QWizard.__init__(self, parent)
        self.setupUi(self)
        self.setPixmap(QtGui.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/symbols/multilayer_switch.normal.svg"))
        self.setWizardStyle(QtGui.QWizard.ModernStyle)
        if sys.platform.startswith("darwin"):
            # we want to see the cancel button on OSX
            self.setOptions(QtGui.QWizard.NoDefaultButton)

        self.uiRemoteRadioButton.toggled.connect(self._remoteServerToggledSlot)
        self.uiLoadBalanceCheckBox.toggled.connect(
            self._loadBalanceToggledSlot)
        self.uiIOUImageToolButton.clicked.connect(self._iouImageBrowserSlot)
        self.uiTypeComboBox.currentIndexChanged[str].connect(
            self._typeChangedSlot)

        if sys.platform.startswith("win") or sys.platform.startswith("darwin"):
            # Cannot use IOU locally on Windows
            self.uiLocalRadioButton.setEnabled(False)

        # Available types
        self.uiTypeComboBox.addItems(["L2 image", "L3 image"])

        # Mandatory fields
        self.uiNameImageWizardPage.registerField("name*", self.uiNameLineEdit)
        self.uiNameImageWizardPage.registerField("image*",
                                                 self.uiIOUImageLineEdit)

        self._iou_devices = iou_devices

        if IOU.instance().settings()["use_local_server"]:
            # skip the server page if we use the local server
            self.setStartId(1)
        else:
            self.uiIOUImageToolButton.setEnabled(False)

        if not ENABLE_CLOUD:
            self.uiCloudRadioButton.hide()

        # location of the base config templates
        self._base_iou_l2_config_template = get_resource(
            os.path.join("configs", "iou_l2_base_initial-config.txt"))
        self._base_iou_l3_config_template = get_resource(
            os.path.join("configs", "iou_l3_base_initial-config.txt"))
    def __init__(self, virtualbox_vms, parent):

        QtGui.QWizard.__init__(self, parent)
        self.setupUi(self)
        self.setPixmap(QtGui.QWizard.LogoPixmap, QtGui.QPixmap(":/icons/virtualbox.png"))
        self.setWizardStyle(QtGui.QWizard.ModernStyle)
        if sys.platform.startswith("darwin"):
            # we want to see the cancel button on OSX
            self.setOptions(QtGui.QWizard.NoDefaultButton)

        if VirtualBox.instance().settings()["use_local_server"]:
            # skip the server page if we use the local server
            self.setStartId(1)

        self._virtualbox_vms = virtualbox_vms

        # By default we use the local server
        self._server = Servers.instance().localServer()
示例#22
0
    def savePreferences(self):
        """
        Saves VPCS preferences.
        """

        vpcs_path = self.uiVPCSPathLineEdit.text().strip()
        if vpcs_path and self.uiUseLocalServercheckBox.isChecked(
        ) and not self._checkVPCSPath(vpcs_path):
            return

        new_settings = {
            "vpcs_path":
            vpcs_path,
            "base_script_file":
            self.uiScriptFileEdit.text(),
            "use_local_server":
            self.uiUseLocalServercheckBox.isChecked(),
            "category":
            self.uiCategoryComboBox.itemData(
                self.uiCategoryComboBox.currentIndex())
        }

        # save the symbol path
        symbol_path = self.uiSymbolLineEdit.text()
        pixmap = QtGui.QPixmap(symbol_path)
        if pixmap.isNull():
            QtWidgets.QMessageBox.critical(
                self, "Symbol", "Invalid file or format not supported")
        else:
            new_settings["symbol"] = symbol_path

        # save the default name format
        default_name_format = self.uiDefaultNameFormatLineEdit.text().strip()
        if '{0}' not in default_name_format and '{id}' not in default_name_format:
            QtWidgets.QMessageBox.critical(
                self, "Default name format",
                "The default name format must contain at least {0} or {id}")
        else:
            new_settings["default_name_format"] = default_name_format

        VPCS.instance().setSettings(new_settings)
示例#23
0
    def loadPreferences(self):
        """
        Loads the VMware VM preferences.
        """

        vmware_module = VMware.instance()
        self._vmware_vms = copy.deepcopy(vmware_module.VMs())
        self._items.clear()

        for key, vmware_vm in self._vmware_vms.items():
            item = QtWidgets.QTreeWidgetItem(self.uiVMwareVMsTreeWidget)
            item.setText(0, vmware_vm["name"])
            icon = QtGui.QIcon()
            icon.addPixmap(QtGui.QPixmap(vmware_vm["symbol"]))
            item.setIcon(0, icon)
            item.setData(0, QtCore.Qt.UserRole, key)
            self._items.append(item)

        if self._items:
            self.uiVMwareVMsTreeWidget.setCurrentItem(self._items[0])
            self.uiVMwareVMsTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
            self.uiVMwareVMsTreeWidget.setMaximumWidth(self.uiVMwareVMsTreeWidget.sizeHintForColumn(0) + 10)
示例#24
0
    def loadPreferences(self):
        """
        Loads the IOS router preferences.
        """

        dynamips_module = Dynamips.instance()
        self._ios_routers = copy.deepcopy(dynamips_module.VMs())
        self._items.clear()

        for key, ios_router in self._ios_routers.items():
            item = QtWidgets.QTreeWidgetItem(self.uiIOSRoutersTreeWidget)
            item.setText(0, ios_router["name"])
            icon = QtGui.QIcon()
            icon.addPixmap(QtGui.QPixmap(ios_router["symbol"]))
            item.setIcon(0, icon)
            item.setData(0, QtCore.Qt.UserRole, key)
            self._items.append(item)

        if self._items:
            self.uiIOSRoutersTreeWidget.setCurrentItem(self._items[0])
            self.uiIOSRoutersTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
            self.uiIOSRoutersTreeWidget.setMaximumWidth(self.uiIOSRoutersTreeWidget.sizeHintForColumn(0) + 10)
示例#25
0
    def loadPreferences(self):
        """
        Loads the Docker VM preferences.
        """

        docker_module = Docker.instance()
        self._docker_containers = copy.deepcopy(docker_module.VMs())
        self._items.clear()

        for key, docker_image in self._docker_containers.items():
            item = QtWidgets.QTreeWidgetItem(self.uiDockerVMsTreeWidget)
            item.setText(0, docker_image["name"])
            icon = QtGui.QIcon()
            icon.addPixmap(QtGui.QPixmap(docker_image["symbol"]))
            item.setIcon(0, icon)
            item.setData(0, QtCore.Qt.UserRole, key)
            self._items.append(item)

        if self._items:
            self.uiDockerVMsTreeWidget.setCurrentItem(self._items[0])
            self.uiDockerVMsTreeWidget.sortByColumn(0,
                                                    QtCore.Qt.AscendingOrder)
            self.uiDockerVMsTreeWidget.setMaximumWidth(
                self.uiDockerVMsTreeWidget.sizeHintForColumn(0) + 10)
示例#26
0
    def __init__(self, virtualbox_vms, parent):

        super().__init__(virtualbox_vms, parent)
        self._virtualbox_vms = virtualbox_vms
        self.setPixmap(QtWidgets.QWizard.LogoPixmap,
                       QtGui.QPixmap(":/icons/virtualbox.png"))
示例#27
0
    def saveSettings(self, settings, node=None, group=False):
        """
        Saves the VMware VM settings.

        :param settings: the settings (dictionary)
        :param node: Node instance
        :param group: indicates the settings apply to a group of VMs
        """

        # these settings cannot be shared by nodes and updated
        # in the node properties dialog.
        if not group:

            if "name" in settings:
                name = self.uiNameLineEdit.text()
                if not name:
                    QtWidgets.QMessageBox.critical(
                        self, "Name", "VMware name cannot be empty!")
                else:
                    settings["name"] = name

            if "console" in settings:
                settings["console"] = self.uiConsolePortSpinBox.value()

            if "linked_base" in settings:
                settings["linked_base"] = self.uiBaseVMCheckBox.isChecked()

            settings[
                "enable_remote_console"] = self.uiEnableConsoleCheckBox.isChecked(
                )

        else:
            del settings["name"]
            del settings["console"]
            del settings["enable_remote_console"]

        if not node:
            # these are template settings

            # save the default name format
            default_name_format = self.uiDefaultNameFormatLineEdit.text(
            ).strip()
            if '{0}' not in default_name_format and '{id}' not in default_name_format:
                QtWidgets.QMessageBox.critical(
                    self, "Default name format",
                    "The default name format must contain at least {0} or {id}"
                )
            else:
                settings["default_name_format"] = default_name_format

            symbol_path = self.uiSymbolLineEdit.text()
            pixmap = QtGui.QPixmap(symbol_path)
            if pixmap.isNull():
                QtWidgets.QMessageBox.critical(
                    self, "Symbol", "Invalid file or format not supported")
            else:
                settings["symbol"] = symbol_path

            settings["category"] = self.uiCategoryComboBox.itemData(
                self.uiCategoryComboBox.currentIndex())
            port_name_format = self.uiPortNameFormatLineEdit.text()
            if '{0}' not in port_name_format and '{port0}' not in port_name_format and '{port1}' not in port_name_format:
                QtWidgets.QMessageBox.critical(
                    self, "Port name format",
                    "The format must contain at least {0}, {port0} or {port1}")
            else:
                settings[
                    "port_name_format"] = self.uiPortNameFormatLineEdit.text()

            port_segment_size = self.uiPortSegmentSizeSpinBox.value()
            if port_segment_size and '{1}' not in port_name_format and '{segment0}' not in port_name_format and '{segment1}' not in port_name_format:
                QtWidgets.QMessageBox.critical(
                    self, "Port name format",
                    "If the segment size is not 0, the format must contain {1}, {segment0} or {segment1}"
                )
            else:
                settings["port_segment_size"] = port_segment_size

            settings["first_port_name"] = self.uiFirstPortNameLineEdit.text(
            ).strip()

        settings["adapter_type"] = self.uiAdapterTypesComboBox.currentText()
        use_ubridge = self.uiUseUbridgeCheckBox.isChecked()
        if node and settings["use_ubridge"] != use_ubridge:
            for node_port in node.ports():
                if not node_port.isFree():
                    QtWidgets.QMessageBox.critical(
                        self, node.name(),
                        "Changing the use uBridge setting while links are connected isn't supported! Please delete all the links first."
                    )
                    raise ConfigurationError()
        settings["use_ubridge"] = use_ubridge
        settings["use_any_adapter"] = self.uiUseAnyAdapterCheckBox.isChecked()
        settings["headless"] = self.uiHeadlessModeCheckBox.isChecked()
        settings["acpi_shutdown"] = self.uiACPIShutdownCheckBox.isChecked()

        adapters = self.uiAdaptersSpinBox.value()
        if node and settings["adapters"] != adapters:
            # check if the adapters settings have changed
            for node_port in node.ports():
                if not node_port.isFree():
                    QtWidgets.QMessageBox.critical(
                        self, node.name(),
                        "Changing the number of adapters while links are connected isn't supported yet! Please delete all the links first."
                    )
                    raise ConfigurationError()
        settings["adapters"] = adapters
示例#28
0
    def setClassicStyle(self):
        """
        Sets the classic GUI style.
        """

        self._mw.setStyleSheet("")
        self._mw.uiNewProjectAction.setIcon(
            self._getStyleIcon(":/classic_icons/new-project.svg",
                               ":/classic_icons/new-project-hover.svg"))
        self._mw.uiOpenProjectAction.setIcon(
            self._getStyleIcon(":/classic_icons/open.svg",
                               ":/classic_icons/open-hover.svg"))
        self._mw.uiOpenApplianceAction.setIcon(
            self._getStyleIcon(":/classic_icons/open.svg",
                               ":/classic_icons/open-hover.svg"))
        self._mw.uiSaveProjectAsAction.setIcon(
            self._getStyleIcon(":/classic_icons/save-as-project.svg",
                               ":/classic_icons/save-as-project-hover.svg"))
        self._mw.uiImportExportConfigsAction.setIcon(
            self._getStyleIcon(
                ":/classic_icons/import_export_configs.svg",
                ":/classic_icons/import_export_configs-hover.svg"))
        self._mw.uiImportProjectAction.setIcon(
            self._getStyleIcon(":/classic_icons/import.svg",
                               ":/classic_icons/import-hover.svg"))
        self._mw.uiExportProjectAction.setIcon(
            self._getStyleIcon(":/classic_icons/export.svg",
                               ":/classic_icons/export-hover.svg"))
        self._mw.uiScreenshotAction.setIcon(
            self._getStyleIcon(":/classic_icons/camera-photo.svg",
                               ":/classic_icons/camera-photo-hover.svg"))
        self._mw.uiSnapshotAction.setIcon(
            self._getStyleIcon(":/classic_icons/snapshot.svg",
                               ":/classic_icons/snapshot-hover.svg"))
        self._mw.uiQuitAction.setIcon(
            self._getStyleIcon(":/classic_icons/quit.svg",
                               ":/classic_icons/quit-hover.svg"))
        self._mw.uiPreferencesAction.setIcon(
            self._getStyleIcon(":/classic_icons/preferences.svg",
                               ":/classic_icons/preferences-hover.svg"))
        self._mw.uiZoomInAction.setIcon(
            self._getStyleIcon(":/classic_icons/zoom-in.svg",
                               ":/classic_icons/zoom-in-hover.svg"))
        self._mw.uiZoomOutAction.setIcon(
            self._getStyleIcon(":/classic_icons/zoom-out.svg",
                               ":/classic_icons/zoom-out-hover.svg"))
        self._mw.uiShowPortNamesAction.setIcon(
            self._getStyleIcon(
                ":/classic_icons/show-interface-names.svg",
                ":/classic_icons/show-interface-names-hover.svg"))
        self._mw.uiStartAllAction.setIcon(
            self._getStyleIcon(":/classic_icons/start.svg",
                               ":/classic_icons/start-hover.svg"))
        self._mw.uiSuspendAllAction.setIcon(
            self._getStyleIcon(":/classic_icons/pause.svg",
                               ":/classic_icons/pause-hover.svg"))
        self._mw.uiStopAllAction.setIcon(
            self._getStyleIcon(":/classic_icons/stop.svg",
                               ":/classic_icons/stop-hover.svg"))
        self._mw.uiReloadAllAction.setIcon(
            self._getStyleIcon(":/classic_icons/reload.svg",
                               ":/classic_icons/reload-hover.svg"))
        self._mw.uiAuxConsoleAllAction.setIcon(
            self._getStyleIcon(":/classic_icons/aux-console.svg",
                               ":/classic_icons/aux-console-hover.svg"))
        self._mw.uiConsoleAllAction.setIcon(
            self._getStyleIcon(":/classic_icons/console.svg",
                               ":/classic_icons/console-hover.svg"))
        self._mw.uiAddNoteAction.setIcon(
            self._getStyleIcon(":/classic_icons/add-note.svg",
                               ":/classic_icons/add-note-hover.svg"))
        self._mw.uiInsertImageAction.setIcon(
            self._getStyleIcon(":/classic_icons/image.svg",
                               ":/classic_icons/image-hover.svg"))
        self._mw.uiDrawRectangleAction.setIcon(
            self._getStyleIcon(":/classic_icons/rectangle.svg",
                               ":/classic_icons/rectangle-hover.svg"))
        self._mw.uiDrawEllipseAction.setIcon(
            self._getStyleIcon(":/classic_icons/ellipse.svg",
                               ":/classic_icons/ellipse-hover.svg"))
        self._mw.uiEditReadmeAction.setIcon(
            self._getStyleIcon(":/classic_icons/edit.svg",
                               ":/classic_icons/edit.svg"))
        self._mw.uiOnlineHelpAction.setIcon(
            self._getStyleIcon(":/classic_icons/help.svg",
                               ":/classic_icons/help-hover.svg"))
        self._mw.uiBrowseRoutersAction.setIcon(
            self._getStyleIcon(":/classic_icons/router.svg",
                               ":/classic_icons/router-hover.svg"))
        self._mw.uiBrowseSwitchesAction.setIcon(
            self._getStyleIcon(":/classic_icons/switch.svg",
                               ":/classic_icons/switch-hover.svg"))
        self._mw.uiBrowseEndDevicesAction.setIcon(
            self._getStyleIcon(":/classic_icons/pc.svg",
                               ":/classic_icons/pc-hover.svg"))
        self._mw.uiBrowseSecurityDevicesAction.setIcon(
            self._getStyleIcon(":/classic_icons/firewall.svg",
                               ":/classic_icons/firewall-hover.svg"))
        self._mw.uiBrowseAllDevicesAction.setIcon(
            self._getStyleIcon(":/classic_icons/browse-all-icons.svg",
                               ":/classic_icons/browse-all-icons-hover.svg"))

        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/classic_icons/add-link.svg"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        icon.addPixmap(QtGui.QPixmap(":/classic_icons/add-link-hover.svg"),
                       QtGui.QIcon.Active, QtGui.QIcon.Off)
        icon.addPixmap(QtGui.QPixmap(":/classic_icons/add-link-cancel.svg"),
                       QtGui.QIcon.Normal, QtGui.QIcon.On)
        self._mw.uiAddLinkAction.setIcon(icon)
示例#29
0
    def saveSettings(self, settings, node=None, group=False):
        """
        Saves the IOU device settings.

        :param settings: the settings (dictionary)
        :param node: Node instance
        :param group: indicates the settings apply to a group of routers
        """

        # these settings cannot be shared by nodes and updated
        # in the node properties dialog.
        if not group:

            # set the device name
            name = self.uiNameLineEdit.text()
            if not name:
                QtWidgets.QMessageBox.critical(
                    self, "Name", "IOU device name cannot be empty!")
            elif node and not node.validateHostname(name):
                QtWidgets.QMessageBox.critical(
                    self, "Name",
                    "Invalid name detected for IOU device: {}".format(name))
            else:
                settings["name"] = name

            if "console" in settings:
                settings["console"] = self.uiConsolePortSpinBox.value()

            # save the IOU image path
            ios_path = self.uiIOUImageLineEdit.text().strip()
            if ios_path:
                settings["path"] = ios_path
        else:
            del settings["name"]
            del settings["console"]

        if not node:
            # these are template settings

            # save the default name format
            default_name_format = self.uiDefaultNameFormatLineEdit.text(
            ).strip()
            if '{0}' not in default_name_format and '{id}' not in default_name_format:
                QtWidgets.QMessageBox.critical(
                    self, "Default name format",
                    "The default name format must contain at least {0} or {id}"
                )
            else:
                settings["default_name_format"] = default_name_format

            # save the startup-config
            startup_config = self.uiStartupConfigLineEdit.text().strip()
            if not startup_config:
                settings["startup_config"] = ""
            elif startup_config != settings["startup_config"]:
                if self._configFileValid(startup_config):
                    settings["startup_config"] = startup_config
                else:
                    QtWidgets.QMessageBox.critical(
                        self, "Startup-config",
                        "Cannot read the startup-config file")

            # save the private-config
            private_config = self.uiPrivateConfigLineEdit.text().strip()
            if not private_config:
                settings["private_config"] = ""
            elif private_config != settings["private_config"]:
                if self._configFileValid(private_config):
                    settings["private_config"] = private_config
                else:
                    QtWidgets.QMessageBox.critical(
                        self, "Private-config",
                        "Cannot read the private-config file")

            symbol_path = self.uiSymbolLineEdit.text()
            pixmap = QtGui.QPixmap(symbol_path)
            if pixmap.isNull():
                QtWidgets.QMessageBox.critical(
                    self, "Symbol", "Invalid file or format not supported")
            else:
                settings["symbol"] = symbol_path

            settings["category"] = self.uiCategoryComboBox.itemData(
                self.uiCategoryComboBox.currentIndex())

        # save advanced settings
        settings["l1_keepalives"] = self.uiL1KeepalivesCheckBox.isChecked()
        settings[
            "use_default_iou_values"] = self.uiDefaultValuesCheckBox.isChecked(
            )
        settings["ram"] = self.uiRamSpinBox.value()
        settings["nvram"] = self.uiNvramSpinBox.value()

        ethernet_adapters = self.uiEthernetAdaptersSpinBox.value()
        serial_adapters = self.uiSerialAdaptersSpinBox.value()
        if ethernet_adapters + serial_adapters > 16:
            QtWidgets.QMessageBox.warning(
                self, settings["name"],
                "The total number of adapters cannot exceed 16")
            raise ConfigurationError()

        if node:
            if settings["ethernet_adapters"] != ethernet_adapters or settings[
                    "serial_adapters"] != serial_adapters:
                # check if the adapters settings have changed
                node_ports = node.ports()
                for node_port in node_ports:
                    if not node_port.isFree():
                        QtWidgets.QMessageBox.critical(
                            self, node.name(),
                            "Changing the number of adapters while links are connected isn't supported yet! Please delete all the links first."
                        )
                        raise ConfigurationError()

        settings["ethernet_adapters"] = ethernet_adapters
        settings["serial_adapters"] = serial_adapters
示例#30
0
    def setCharcoalStyle(self):
        """
        Sets the charcoal GUI style.
        """

        style_file = QtCore.QFile(":/styles/charcoal.css")
        style_file.open(QtCore.QFile.ReadOnly)
        style = QtCore.QTextStream(style_file).readAll()
        if sys.platform.startswith("darwin"):
            style += "QDockWidget::title {text-align: center; background-color: #535353}"

        self._mw.setStyleSheet(style)
        self._mw.uiNewProjectAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/new-project.svg",
                               ":/charcoal_icons/new-project-hover.svg"))
        self._mw.uiOpenProjectAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/open.svg",
                               ":/charcoal_icons/open-hover.svg"))
        self._mw.uiOpenApplianceAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/open.svg",
                               ":/charcoal_icons/open-hover.svg"))
        self._mw.uiSaveProjectAsAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/save-as-project.svg",
                               ":/charcoal_icons/save-as-project-hover.svg"))
        self._mw.uiImportExportConfigsAction.setIcon(
            self._getStyleIcon(
                ":/charcoal_icons/import_export_configs.svg",
                ":/charcoal_icons/import_export_configs-hover.svg"))
        self._mw.uiImportProjectAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/import.svg",
                               ":/charcoal_icons/import-hover.svg"))
        self._mw.uiExportProjectAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/export.svg",
                               ":/charcoal_icons/export-hover.svg"))
        self._mw.uiScreenshotAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/camera-photo.svg",
                               ":/charcoal_icons/camera-photo-hover.svg"))
        self._mw.uiSnapshotAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/snapshot.svg",
                               ":/charcoal_icons/snapshot-hover.svg"))
        self._mw.uiQuitAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/quit.svg",
                               ":/charcoal_icons/quit-hover.svg"))
        self._mw.uiPreferencesAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/preferences.svg",
                               ":/charcoal_icons/preferences-hover.svg"))
        self._mw.uiZoomInAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/zoom-in.svg",
                               ":/charcoal_icons/zoom-in-hover.svg"))
        self._mw.uiZoomOutAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/zoom-out.svg",
                               ":/charcoal_icons/zoom-out-hover.svg"))
        self._mw.uiShowPortNamesAction.setIcon(
            self._getStyleIcon(
                ":/charcoal_icons/show-interface-names.svg",
                ":/charcoal_icons/show-interface-names-hover.svg"))
        self._mw.uiStartAllAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/start.svg",
                               ":/charcoal_icons/start-hover.svg"))
        self._mw.uiSuspendAllAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/pause.svg",
                               ":/charcoal_icons/pause-hover.svg"))
        self._mw.uiStopAllAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/stop.svg",
                               ":/charcoal_icons/stop-hover.svg"))
        self._mw.uiReloadAllAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/reload.svg",
                               ":/charcoal_icons/reload-hover.svg"))
        self._mw.uiAuxConsoleAllAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/aux-console.svg",
                               ":/charcoal_icons/aux-console-hover.svg"))
        self._mw.uiConsoleAllAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/console.svg",
                               ":/charcoal_icons/console-hover.svg"))
        self._mw.uiAddNoteAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/add-note.svg",
                               ":/charcoal_icons/add-note-hover.svg"))
        self._mw.uiInsertImageAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/image.svg",
                               ":/charcoal_icons/image-hover.svg"))
        self._mw.uiDrawRectangleAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/rectangle.svg",
                               ":/charcoal_icons/rectangle-hover.svg"))
        self._mw.uiDrawEllipseAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/ellipse.svg",
                               ":/charcoal_icons/ellipse-hover.svg"))
        self._mw.uiEditReadmeAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/edit.svg",
                               ":/charcoal_icons/edit.svg"))
        self._mw.uiOnlineHelpAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/help.svg",
                               ":/charcoal_icons/help-hover.svg"))
        self._mw.uiBrowseRoutersAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/router.svg",
                               ":/charcoal_icons/router-hover.svg"))
        self._mw.uiBrowseSwitchesAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/switch.svg",
                               ":/charcoal_icons/switch-hover.svg"))
        self._mw.uiBrowseEndDevicesAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/pc.svg",
                               ":/charcoal_icons/pc-hover.svg"))
        self._mw.uiBrowseSecurityDevicesAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/firewall.svg",
                               ":/charcoal_icons/firewall-hover.svg"))
        self._mw.uiBrowseAllDevicesAction.setIcon(
            self._getStyleIcon(":/charcoal_icons/browse-all-icons.svg",
                               ":/charcoal_icons/browse-all-icons-hover.svg"))

        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/charcoal_icons/add-link-1.svg"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        icon.addPixmap(QtGui.QPixmap(":/charcoal_icons/add-link-1-hover.svg"),
                       QtGui.QIcon.Active, QtGui.QIcon.Off)
        icon.addPixmap(QtGui.QPixmap(":/charcoal_icons/add-link-1-cancel.svg"),
                       QtGui.QIcon.Normal, QtGui.QIcon.On)
        self._mw.uiAddLinkAction.setIcon(icon)