本文整理汇总了Python中gns3.dialogs.configuration_dialog.ConfigurationDialog.exec_方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationDialog.exec_方法的具体用法?Python ConfigurationDialog.exec_怎么用?Python ConfigurationDialog.exec_使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gns3.dialogs.configuration_dialog.ConfigurationDialog
的用法示例。
在下文中一共展示了ConfigurationDialog.exec_方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _qemuVMEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _qemuVMEditSlot(self):
"""
Edits a QEMU VM.
"""
item = self.uiQemuVMsTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
qemu_vm = self._qemu_vms[key]
dialog = ConfigurationDialog(qemu_vm["name"], qemu_vm, QemuVMConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
# update the icon
Controller.instance().getSymbolIcon(qemu_vm["symbol"], qpartial(self._setItemIcon, item))
if qemu_vm["name"] != item.text(0):
new_key = "{server}:{name}".format(server=qemu_vm["server"], name=qemu_vm["name"])
if new_key in self._qemu_vms:
QtWidgets.QMessageBox.critical(self, "QEMU VM", "QEMU VM name {} already exists for server {}".format(qemu_vm["name"],
qemu_vm["server"]))
qemu_vm["name"] = item.text(0)
return
self._qemu_vms[new_key] = self._qemu_vms[key]
del self._qemu_vms[key]
item.setText(0, qemu_vm["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(qemu_vm)
示例2: _iosRouterEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _iosRouterEditSlot(self):
"""
Edits an IOS router.
"""
item = self.uiIOSRoutersTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
ios_router = self._ios_routers[key]
dialog = ConfigurationDialog(ios_router["name"], ios_router, IOSRouterConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
# update the icon
item.setIcon(0, QtGui.QIcon(ios_router["symbol"]))
if ios_router["name"] != item.text(0):
# rename the IOS router
new_key = "{server}:{name}".format(server=ios_router["server"], name=ios_router["name"])
if new_key in self._ios_routers:
QtWidgets.QMessageBox.critical(self, "IOS router", "IOS router name {} already exists for server {}".format(ios_router["name"],
ios_router["server"]))
ios_router["name"] = item.text(0)
return
self._ios_routers[new_key] = self._ios_routers[key]
del self._ios_routers[key]
item.setText(0, ios_router["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(ios_router)
示例3: _editCloudNodeSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _editCloudNodeSlot(self):
"""
Edits a cloud node.
"""
item = self.uiCloudNodesTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
cloud_node = self._cloud_nodes[key]
dialog = ConfigurationDialog(cloud_node["name"], cloud_node, CloudConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
# update the icon
Controller.instance().getSymbolIcon(cloud_node["symbol"], qpartial(self._setItemIcon, item))
if cloud_node["name"] != item.text(0):
new_key = "{server}:{name}".format(server=cloud_node["compute_id"], name=cloud_node["name"])
if new_key in self._cloud_nodes:
QtWidgets.QMessageBox.critical(self, "Cloud node", "Cloud node name {} already exists for server {}".format(cloud_node["name"],
cloud_node["compute_id"]))
cloud_node["name"] = item.text(0)
return
self._cloud_nodes[new_key] = self._cloud_nodes[key]
del self._cloud_nodes[key]
item.setText(0, cloud_node["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(cloud_node)
示例4: _iouDeviceEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _iouDeviceEditSlot(self):
"""
Edits an IOU device.
"""
item = self.uiIOUDevicesTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
iou_device = self._iou_devices[key]
dialog = ConfigurationDialog(iou_device["name"], iou_device, iouDeviceConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
# update the icon
Controller.instance().getSymbolIcon(iou_device["symbol"], qpartial(self._setItemIcon, item))
if iou_device["name"] != item.text(0):
new_key = "{server}:{name}".format(server=iou_device["compute_id"], name=iou_device["name"])
if new_key in self._iou_devices:
QtWidgets.QMessageBox.critical(self, "IOU device", "IOU device name {} already exists for server {}".format(iou_device["name"],
iou_device["compute_id"]))
iou_device["name"] = item.text(0)
return
self._iou_devices[new_key] = self._iou_devices[key]
del self._iou_devices[key]
item.setText(0, iou_device["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(dialog.settings)
示例5: _vmwareVMEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _vmwareVMEditSlot(self):
"""
Edits a VMware VM.
"""
item = self.uiVMwareVMsTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
vmware_vm = self._vmware_vms[key]
dialog = ConfigurationDialog(vmware_vm["name"], vmware_vm, VMwareVMConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
# update the icon
item.setIcon(0, QtGui.QIcon(vmware_vm["symbol"]))
if vmware_vm["name"] != item.text(0):
new_key = "{server}:{name}".format(server=vmware_vm["server"], name=vmware_vm["name"])
if new_key in self._vmware_vms:
QtWidgets.QMessageBox.critical(self, "VMware VM", "VMware VM name {} already exists for server {}".format(vmware_vm["name"],
vmware_vm["server"]))
vmware_vm["name"] = item.text(0)
return
self._vmware_vms[new_key] = self._vmware_vms[key]
del self._vmware_vms[key]
item.setText(0, vmware_vm["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(vmware_vm)
示例6: _qemuVMEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _qemuVMEditSlot(self):
"""
Edits a QEMU VM.
"""
item = self.uiQemuVMsTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
qemu_vm = self._qemu_vms[key]
dialog = ConfigurationDialog(qemu_vm["name"], qemu_vm, QemuVMConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
if qemu_vm["name"] != item.text(0):
new_key = "{server}:{name}".format(server=qemu_vm["server"], name=qemu_vm["name"])
if new_key in self._qemu_vms:
QtGui.QMessageBox.critical(self, "QEMU VM", "QEMU VM name {} already exists for server {}".format(qemu_vm["name"],
qemu_vm["server"]))
qemu_vm["name"] = item.text(0)
return
self._qemu_vms[new_key] = self._qemu_vms[key]
del self._qemu_vms[key]
item.setText(0, qemu_vm["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
if qemu_vm["server"] == 'cloud':
self._uploadImages(qemu_vm)
self._refreshInfo(qemu_vm)
示例7: _editEthernetHubSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _editEthernetHubSlot(self):
"""
Edits an Ethernet hub.
"""
item = self.uiEthernetHubsTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
ethernet_hub = self._ethernet_hubs[key]
dialog = ConfigurationDialog(ethernet_hub["name"], ethernet_hub, EthernetHubConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
# update the icon
Controller.instance().getSymbolIcon(ethernet_hub["symbol"], qpartial(self._setItemIcon, item))
if ethernet_hub["name"] != item.text(0):
new_key = "{server}:{name}".format(server=ethernet_hub["compute_id"], name=ethernet_hub["name"])
if new_key in self._ethernet_hubs:
QtWidgets.QMessageBox.critical(self, "Ethernet hub", "Ethernet hub name {} already exists for server {}".format(ethernet_hub["name"],
ethernet_hub["compute_id"]))
ethernet_hub["name"] = item.text(0)
return
self._ethernet_hubs[new_key] = self._ethernet_hubs[key]
del self._ethernet_hubs[key]
item.setText(0, ethernet_hub["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(ethernet_hub)
示例8: _dockerImageEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _dockerImageEditSlot(self):
"""
Edits a Docker image.
"""
item = self.uiDockerVMsTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
docker_container = self._docker_containers[key]
dialog = ConfigurationDialog(docker_container["name"], docker_container, DockerVMConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
# update the icon
Controller.instance().getSymbolIcon(docker_container["symbol"], qpartial(self._setItemIcon, item))
if docker_container["name"] != item.text(0):
new_key = "{server}:{name}".format(server=docker_container["compute_id"], name=docker_container["name"])
if new_key in self._docker_containers:
QtWidgets.QMessageBox.critical(self, "Docker container", "Docker container name {} already exists for server {}".format(docker_container["name"],
docker_container["compute_id"]))
docker_container["name"] = item.text(0)
return
self._docker_containers[new_key] = self._docker_containers[key]
del self._docker_containers[key]
item.setText(0, docker_container["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(docker_container)
示例9: _dockerImageEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _dockerImageEditSlot(self):
"""Edits a Docker image"""
item = self.uiDockerVMsTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
docker_image = self._docker_images[key]
dialog = ConfigurationDialog(
docker_image["imagename"], docker_image,
DockerVMConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
if docker_image["imagename"] != item.text(0):
new_key = "{server}:{imagename}".format(
server=docker_image["server"],
name=docker_image["imagename"])
if new_key in self._docker_images:
QtWidgets.QMessageBox.critical(
self, "Docker image",
"Docker image name {} already exists for server {}".format(
docker_image["imagename"],
docker_image["server"]))
docker_image["imagename"] = item.text(0)
return
self._docker_images[new_key] = self._docker_images[key]
del self._docker_images[key]
item.setText(0, docker_image["imagename"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(docker_image)
示例10: _editVPCSSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _editVPCSSlot(self):
"""
Edits a VPCS node template.
"""
item = self.uiVPCSTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
vpcs_node = self._vpcs_nodes[key]
dialog = ConfigurationDialog(vpcs_node["name"], vpcs_node, VPCSNodeConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
# update the icon
Controller.instance().getSymbolIcon(vpcs_node["symbol"], qpartial(self._setItemIcon, item))
if vpcs_node["name"] != item.text(0):
new_key = "{server}:{name}".format(server=vpcs_node["server"], name=vpcs_node["name"])
if new_key in self._vpcs_nodes:
QtWidgets.QMessageBox.critical(self, "VPCS node", "VPCS node name {} already exists for server {}".format(vpcs_node["name"],
vpcs_node["server"]))
vpcs_node["name"] = item.text(0)
return
self._vpcs_nodes[new_key] = self._vpcs_nodes[key]
del self._vpcs_nodes[key]
item.setText(0, vpcs_node["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(vpcs_node)
示例11: _iosRouterEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _iosRouterEditSlot(self):
"""
Edits an IOS router.
"""
item = self.uiIOSRoutersTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
ios_router = self._ios_routers[key]
dialog = ConfigurationDialog(ios_router["name"], ios_router, IOSRouterConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
if ios_router["name"] != item.text(0):
# rename the IOS router
new_key = "{server}:{name}".format(server=ios_router["server"], name=ios_router["name"])
if new_key in self._ios_routers:
QtGui.QMessageBox.critical(self, "IOS router", "IOS router name {} already exists for server {}".format(ios_router["name"],
ios_router["server"]))
ios_router["name"] = item.text(0)
return
self._ios_routers[new_key] = self._ios_routers[key]
del self._ios_routers[key]
# rename the base startup-config file
default_startup_config_name = "{}_base_startup-config.txt".format(normalize_filename(item.text(0)))
if os.path.isfile(ios_router["startup_config"]) and ios_router["startup_config"] != self._base_startup_config_template \
and os.path.basename(ios_router["startup_config"]) == default_startup_config_name:
try:
new_base_config_name = "{}_base_startup-config.txt".format(normalize_filename(ios_router["name"]))
new_base_startup_config_path = os.path.join(os.path.dirname(ios_router["startup_config"]), new_base_config_name)
os.rename(ios_router["startup_config"], new_base_startup_config_path)
ios_router["startup_config"] = new_base_startup_config_path
except OSError as e:
QtGui.QMessageBox.critical(self, "IOS router", "Could not rename {} to {}: {}".format(ios_router["startup_config"], new_base_startup_config_path, e))
# rename the base private-config file
default_private_config_name = "{}_base_private-config.txt".format(normalize_filename(item.text(0)))
if os.path.isfile(ios_router["private_config"]) and ios_router["private_config"] != self._base_private_config_template \
and os.path.basename(ios_router["private_config"]) == default_private_config_name:
try:
new_base_private_config = os.path.join(os.path.dirname(ios_router["private_config"]), "{}_base_private-config.txt".format(normalize_filename(ios_router["name"])))
os.rename(ios_router["private_config"], new_base_private_config)
ios_router["private_config"] = new_base_private_config
except OSError as e:
QtGui.QMessageBox.critical(self, "IOS router", "Could not rename {} to {}: {}".format(ios_router["private_config"], new_base_private_config, e))
item.setText(0, ios_router["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(ios_router)
示例12: _vboxVMEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _vboxVMEditSlot(self):
"""
Edits a VirtualBox VM.
"""
item = self.uiVirtualBoxVMsTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
vbox_vm = self._virtualbox_vms[key]
dialog = ConfigurationDialog(vbox_vm["vmname"], vbox_vm, VirtualBoxVMConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
# update the icon
item.setIcon(0, QtGui.QIcon(vbox_vm["symbol"]))
if vbox_vm["name"] != item.text(0):
item.setText(0, vbox_vm["name"])
self._refreshInfo(vbox_vm)
示例13: _iouDeviceEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _iouDeviceEditSlot(self):
"""
Edits an IOU device.
"""
item = self.uiIOUDevicesTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
iou_device = self._iou_devices[key]
dialog = ConfigurationDialog(iou_device["name"], iou_device, iouDeviceConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
if iou_device["name"] != item.text(0):
new_key = "{server}:{name}".format(server=iou_device["server"], name=iou_device["name"])
if new_key in self._iou_devices:
QtGui.QMessageBox.critical(self, "IOU device", "IOU device name {} already exists for server {}".format(iou_device["name"],
iou_device["server"]))
iou_device["name"] = item.text(0)
return
self._iou_devices[new_key] = self._iou_devices[key]
del self._iou_devices[key]
item.setText(0, iou_device["name"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(iou_device)
示例14: _vboxVMEditSlot
# 需要导入模块: from gns3.dialogs.configuration_dialog import ConfigurationDialog [as 别名]
# 或者: from gns3.dialogs.configuration_dialog.ConfigurationDialog import exec_ [as 别名]
def _vboxVMEditSlot(self):
"""
Edits a VirtualBox VM.
"""
item = self.uiVirtualBoxVMsTreeWidget.currentItem()
if item:
key = item.data(0, QtCore.Qt.UserRole)
vbox_vm = self._virtualbox_vms[key]
dialog = ConfigurationDialog(vbox_vm["vmname"], vbox_vm, virtualBoxVMConfigurationPage(), parent=self)
dialog.show()
if dialog.exec_():
if vbox_vm["vmname"] != item.text(0):
new_key = "{server}:{vmname}".format(server=vbox_vm["server"], name=vbox_vm["vmname"])
if new_key in self._virtualbox_vms:
QtGui.QMessageBox.critical(self, "VirtualBox VM", "VirtualBox VM name {} already exists for server {}".format(vbox_vm["vmname"],
vbox_vm["server"]))
vbox_vm["vmname"] = item.text(0)
return
self._virtualbox_vms[new_key] = self._virtualbox_vms[key]
del self._virtualbox_vms[key]
item.setText(0, vbox_vm["vmname"])
item.setData(0, QtCore.Qt.UserRole, new_key)
self._refreshInfo(vbox_vm)