mirror of
https://github.com/GNS3/gns3-gui.git
synced 2026-05-17 00:46:01 +03:00
PEP8
This commit is contained in:
@@ -43,6 +43,6 @@ notifications:
|
||||
install:
|
||||
- "pip install -r dev-requirements.txt"
|
||||
|
||||
script: "xvfb-run py.test --verbose" # Run tests in a fake X server
|
||||
|
||||
|
||||
script:
|
||||
- "xvfb-run py.test --verbose" # Run tests in a fake X server
|
||||
- "pep8"
|
||||
|
||||
@@ -172,7 +172,6 @@ class BaseCloudCtrl(object):
|
||||
|
||||
return self.driver.list_nodes()
|
||||
|
||||
|
||||
def create_key_pair(self, name):
|
||||
""" Create and return a new Key Pair. """
|
||||
|
||||
|
||||
@@ -1,45 +1,67 @@
|
||||
""" Exception classes for CloudCtrl classes. """
|
||||
|
||||
|
||||
class ApiError(Exception):
|
||||
|
||||
""" Raised when the server returns 500 Compute Error. """
|
||||
pass
|
||||
|
||||
|
||||
class BadRequest(Exception):
|
||||
|
||||
""" Raised when the server returns 400 Bad Request. """
|
||||
pass
|
||||
|
||||
|
||||
class ComputeFault(Exception):
|
||||
|
||||
""" Raised when the server returns 400|500 Compute Fault. """
|
||||
pass
|
||||
|
||||
|
||||
class Forbidden(Exception):
|
||||
|
||||
""" Raised when the server returns 403 Forbidden. """
|
||||
pass
|
||||
|
||||
|
||||
class ItemNotFound(Exception):
|
||||
|
||||
""" Raised when the server returns 404 Not Found. """
|
||||
pass
|
||||
|
||||
|
||||
class KeyPairExists(Exception):
|
||||
|
||||
""" Raised when the server returns 409 Conflict Key pair exists. """
|
||||
pass
|
||||
|
||||
|
||||
class MethodNotAllowed(Exception):
|
||||
|
||||
""" Raised when the server returns 405 Method Not Allowed. """
|
||||
pass
|
||||
|
||||
|
||||
class OverLimit(Exception):
|
||||
|
||||
""" Raised when the server returns 413 Over Limit. """
|
||||
pass
|
||||
|
||||
|
||||
class ServerCapacityUnavailable(Exception):
|
||||
|
||||
""" Raised when the server returns 503 Server Capacity Uavailable. """
|
||||
pass
|
||||
|
||||
|
||||
class ServiceUnavailable(Exception):
|
||||
|
||||
""" Raised when the server returns 503 Service Unavailable. """
|
||||
pass
|
||||
|
||||
|
||||
class Unauthorized(Exception):
|
||||
|
||||
""" Raised when the server returns 401 Unauthorized. """
|
||||
pass
|
||||
|
||||
@@ -26,11 +26,14 @@ def ssh_client(host, key_string):
|
||||
"""
|
||||
|
||||
import paramiko
|
||||
|
||||
class AllowAndForgetPolicy(paramiko.MissingHostKeyPolicy):
|
||||
|
||||
"""
|
||||
Custom policy for server host keys: we simply accept the key
|
||||
the server sent to us without storing it.
|
||||
"""
|
||||
|
||||
def missing_host_key(self, *args, **kwargs):
|
||||
"""
|
||||
According to MissingHostKeyPolicy protocol, to accept
|
||||
@@ -56,6 +59,7 @@ def ssh_client(host, key_string):
|
||||
|
||||
|
||||
class ListInstancesThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Helper class to retrieve data from the provider in a separate thread,
|
||||
avoid freezing the gui
|
||||
@@ -76,6 +80,7 @@ class ListInstancesThread(QtCore.QThread):
|
||||
|
||||
|
||||
class CreateInstanceThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Helper class to create instances in a separate thread
|
||||
"""
|
||||
@@ -106,6 +111,7 @@ class CreateInstanceThread(QtCore.QThread):
|
||||
|
||||
|
||||
class DeleteInstanceThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Helper class to remove an instance in a separate thread
|
||||
"""
|
||||
@@ -122,6 +128,7 @@ class DeleteInstanceThread(QtCore.QThread):
|
||||
|
||||
|
||||
class StartGNS3ServerThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Perform an SSH connection to the instances in a separate thread,
|
||||
outside the GUI event loop, and start GNS3 server
|
||||
@@ -207,7 +214,6 @@ killall python3 gns3server gns3dms
|
||||
log.debug('stderr: {}'.format(stderr_data.decode('utf-8')))
|
||||
return stdout_data, stderr_data
|
||||
|
||||
|
||||
def run(self):
|
||||
# We might be attempting a connection before the instance is fully booted, so retry
|
||||
# when the ssh connection fails.
|
||||
@@ -245,6 +251,7 @@ killall python3 gns3server gns3dms
|
||||
|
||||
|
||||
class WSConnectThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Establish a websocket connection with the remote gns3server
|
||||
instance. Run outside the GUI event loop.
|
||||
@@ -283,6 +290,7 @@ class WSConnectThread(QtCore.QThread):
|
||||
|
||||
|
||||
class UploadProjectThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Zip and Upload project to the cloud
|
||||
"""
|
||||
@@ -358,6 +366,7 @@ class UploadProjectThread(QtCore.QThread):
|
||||
|
||||
|
||||
class UploadFilesThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Uploads files to cloud files
|
||||
|
||||
@@ -384,7 +393,7 @@ class UploadFilesThread(QtCore.QThread):
|
||||
log.debug('Uploading image {} to cloud as {}'.format(file_to_upload[0], file_to_upload[1]))
|
||||
provider.upload_file(file_to_upload[0], file_to_upload[1])
|
||||
|
||||
self.update.emit((i+1) * 100 / len(self._files_to_upload))
|
||||
self.update.emit((i + 1) * 100 / len(self._files_to_upload))
|
||||
log.debug('Uploading image completed')
|
||||
except Exception as e:
|
||||
log.exception("Error uploading images to cloud")
|
||||
@@ -397,6 +406,7 @@ class UploadFilesThread(QtCore.QThread):
|
||||
|
||||
|
||||
class DownloadProjectThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Downloads project from cloud storage
|
||||
"""
|
||||
@@ -452,7 +462,9 @@ class DownloadProjectThread(QtCore.QThread):
|
||||
def stop(self):
|
||||
self.quit()
|
||||
|
||||
|
||||
class DownloadImagesThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Downloads multiple files from cloud files
|
||||
"""
|
||||
@@ -493,6 +505,7 @@ class DownloadImagesThread(QtCore.QThread):
|
||||
|
||||
|
||||
class DeleteProjectThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Deletes project from cloud storage
|
||||
"""
|
||||
|
||||
@@ -36,6 +36,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CloudBuilder(QThread):
|
||||
|
||||
"""
|
||||
"""
|
||||
# Notify with progress amount and instance_id
|
||||
@@ -56,7 +57,6 @@ class CloudBuilder(QThread):
|
||||
# Notify when instance id exists with builder and instance_id
|
||||
instanceIdExists = pyqtSignal(object, str)
|
||||
|
||||
|
||||
def __init__(self, parent, cloud_provider, ca_dir):
|
||||
super(QThread, self).__init__(parent)
|
||||
# Store our parent so it can be passed to threads we spawn.
|
||||
@@ -124,7 +124,6 @@ class CloudBuilder(QThread):
|
||||
self.instanceCreated.emit(instance, key_pair)
|
||||
self._waitForPublicIP()
|
||||
|
||||
|
||||
def _waitForPublicIP(self):
|
||||
public_ip = None
|
||||
while public_ip is None:
|
||||
@@ -171,6 +170,7 @@ cp vpcs_0.6_Linux64 /usr/local/bin/vpcs
|
||||
chmod a+x /usr/local/bin/vpcs
|
||||
killall python3 gns3server gns3dms
|
||||
'''
|
||||
|
||||
def exec_command(client, cmd, wait_time=-1):
|
||||
|
||||
cmd += '; exit $?'
|
||||
@@ -195,7 +195,6 @@ killall python3 gns3server gns3dms
|
||||
log.debug('stderr: {}'.format(stderr_data.decode('utf-8')))
|
||||
return stdout_data, stderr_data
|
||||
|
||||
|
||||
# We might be attempting a connection before the instance is fully booted, so retry
|
||||
# when the ssh connection fails.
|
||||
ssh_connected = False
|
||||
|
||||
@@ -23,6 +23,7 @@ POLLING_TIMER = 10000 # in milliseconds
|
||||
|
||||
|
||||
class RunningInstanceState(NodeState):
|
||||
|
||||
"""
|
||||
GNS3 states for running instances
|
||||
"""
|
||||
@@ -32,9 +33,11 @@ class RunningInstanceState(NodeState):
|
||||
|
||||
|
||||
class InstanceTableModel(QtCore.QAbstractTableModel):
|
||||
|
||||
"""
|
||||
A custom table model storing data of cloud instances
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(InstanceTableModel, self).__init__(*args, **kwargs)
|
||||
self._header_data = ['Instance', '', 'Size', 'Devices'] # status has an empty header label
|
||||
@@ -117,7 +120,7 @@ class InstanceTableModel(QtCore.QAbstractTableModel):
|
||||
def addInstance(self, instance):
|
||||
self.beginInsertRows(QtCore.QModelIndex(), self.rowCount(), self.rowCount())
|
||||
if not len(self._instances):
|
||||
self.beginInsertColumns(QtCore.QModelIndex(), 0, self._width-1)
|
||||
self.beginInsertColumns(QtCore.QModelIndex(), 0, self._width - 1)
|
||||
self.endInsertColumns()
|
||||
self._ids.append(instance.id)
|
||||
self._instances[instance.id] = instance
|
||||
@@ -155,7 +158,7 @@ class InstanceTableModel(QtCore.QAbstractTableModel):
|
||||
for field in field_names:
|
||||
setattr(current, field, getattr(instance, field))
|
||||
first_index = self.createIndex(index, 0)
|
||||
last_index = self.createIndex(index, self.columnCount()-1)
|
||||
last_index = self.createIndex(index, self.columnCount() - 1)
|
||||
self.dataChanged.emit(first_index, last_index)
|
||||
else:
|
||||
self.addInstance(instance)
|
||||
@@ -165,6 +168,7 @@ class InstanceTableModel(QtCore.QAbstractTableModel):
|
||||
|
||||
|
||||
class CloudInspectorView(QtGui.QWidget, Ui_CloudInspectorView):
|
||||
|
||||
"""
|
||||
Table view showing data coming from InstanceTableModel
|
||||
|
||||
@@ -342,11 +346,9 @@ class CloudInspectorView(QtGui.QWidget, Ui_CloudInspectorView):
|
||||
self._populate_model(project_instances)
|
||||
self._rebuild_instances(project_instances)
|
||||
|
||||
|
||||
instance_manager = CloudInstances.instance()
|
||||
instance_manager.update_instances(instances)
|
||||
|
||||
|
||||
# Clean up removed instances
|
||||
real = set(i.id for i in project_instances)
|
||||
current = set(self._model.instanceIds)
|
||||
|
||||
@@ -28,6 +28,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CloudInstances(QtCore.QObject):
|
||||
|
||||
"""
|
||||
This class stores the instances that gns3 gui has started. This can be different than the list
|
||||
of instances in the topology that can be changed when switching projects. This list is not touched
|
||||
@@ -38,7 +39,6 @@ class CloudInstances(QtCore.QObject):
|
||||
super(CloudInstances, self).__init__(*args, **kwargs)
|
||||
self._instances = []
|
||||
|
||||
|
||||
@staticmethod
|
||||
def instance():
|
||||
"""
|
||||
|
||||
@@ -69,7 +69,7 @@ class ConsoleView(PyCutExt, ConsoleCmd):
|
||||
For exception handling purposes
|
||||
(see exception hook in the program entry point).
|
||||
"""
|
||||
|
||||
|
||||
return False
|
||||
|
||||
def onKeyPress_Tab(self):
|
||||
@@ -184,7 +184,7 @@ class ConsoleView(PyCutExt, ConsoleCmd):
|
||||
if node and node.name():
|
||||
name = " {}:".format(node.name())
|
||||
server = "from {}:{}".format(node.server().host,
|
||||
node.server().port)
|
||||
node.server().port)
|
||||
|
||||
text = "Server error [{code}] {server}:{name} {message}".format(code=code,
|
||||
server=server,
|
||||
|
||||
@@ -21,6 +21,7 @@ from ..ui.about_dialog_ui import Ui_AboutDialog
|
||||
|
||||
|
||||
class AboutDialog(QtGui.QDialog, Ui_AboutDialog):
|
||||
|
||||
"""
|
||||
About dialog.
|
||||
"""
|
||||
|
||||
@@ -23,7 +23,9 @@ from ..qt import QtGui
|
||||
from ..ui.configuration_dialog_ui import Ui_configurationDialog
|
||||
from .node_configurator_dialog import ConfigurationError
|
||||
|
||||
|
||||
class ConfigurationDialog(QtGui.QDialog, Ui_configurationDialog):
|
||||
|
||||
"""
|
||||
Configuration dialog implementation.
|
||||
|
||||
@@ -61,4 +63,3 @@ class ConfigurationDialog(QtGui.QDialog, Ui_configurationDialog):
|
||||
except ConfigurationError:
|
||||
return
|
||||
QtGui.QDialog.accept(self)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ from ..ui.exec_command_dialog_ui import Ui_ExecCommandDialog
|
||||
|
||||
|
||||
class ExecCommandDialog(QtGui.QDialog, Ui_ExecCommandDialog):
|
||||
|
||||
"""
|
||||
Execute a command and display its output.
|
||||
"""
|
||||
|
||||
@@ -24,6 +24,7 @@ from ..utils.get_resource import get_resource
|
||||
|
||||
|
||||
class GettingStartedDialog(QtGui.QDialog, Ui_GettingStartedDialog):
|
||||
|
||||
"""
|
||||
GettingStarted dialog.
|
||||
"""
|
||||
|
||||
@@ -23,6 +23,7 @@ from ..ui.idlepc_dialog_ui import Ui_IdlePCDialog
|
||||
|
||||
|
||||
class IdlePCDialog(QtGui.QDialog, Ui_IdlePCDialog):
|
||||
|
||||
"""
|
||||
Idle-PC dialog.
|
||||
"""
|
||||
@@ -84,4 +85,3 @@ class IdlePCDialog(QtGui.QDialog, Ui_IdlePCDialog):
|
||||
if result:
|
||||
self._applySlot()
|
||||
QtGui.QDialog.done(self, result)
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from ..utils.progress_dialog import ProgressDialog
|
||||
|
||||
|
||||
class ImportCloudProjectDialog(QtGui.QDialog, Ui_ImportCloudProjectDialog):
|
||||
|
||||
"""
|
||||
Import cloud project dialog implementation.
|
||||
"""
|
||||
|
||||
@@ -23,6 +23,7 @@ from ..settings import ENABLE_CLOUD
|
||||
|
||||
|
||||
class NewProjectDialog(QtGui.QDialog, Ui_NewProjectDialog):
|
||||
|
||||
"""
|
||||
New project dialog.
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ from ..ui.node_configurator_dialog_ui import Ui_NodeConfiguratorDialog
|
||||
|
||||
|
||||
class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
|
||||
"""
|
||||
Node configurator implementation.
|
||||
|
||||
@@ -65,7 +66,7 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
continue
|
||||
group_name = " {} group".format(str(node_item.node()))
|
||||
parent = group_name
|
||||
if not parent in self._parent_items:
|
||||
if parent not in self._parent_items:
|
||||
item = QtGui.QTreeWidgetItem(self.uiNodesTreeWidget, [group_name])
|
||||
item.setIcon(0, QtGui.QIcon(node_item.node().defaultSymbol()))
|
||||
item.setExpanded(True)
|
||||
@@ -165,7 +166,7 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
page.saveSettings(settings, node, group=True)
|
||||
for index in range(0, item.childCount()):
|
||||
child = item.child(index)
|
||||
#child.node().update(settings) #TODO: delete
|
||||
# child.node().update(settings) #TODO: delete
|
||||
child.settings().update(settings)
|
||||
|
||||
# update the nodes with the settings
|
||||
@@ -201,6 +202,7 @@ class NodeConfiguratorDialog(QtGui.QDialog, Ui_NodeConfiguratorDialog):
|
||||
|
||||
|
||||
class ConfigurationPageItem(QtGui.QTreeWidgetItem):
|
||||
|
||||
"""
|
||||
Item for the QTreeWidget instance.
|
||||
Store temporary node settings configured in a page widget.
|
||||
@@ -269,6 +271,7 @@ class ConfigurationPageItem(QtGui.QTreeWidgetItem):
|
||||
|
||||
|
||||
class ConfigurationError(Exception):
|
||||
|
||||
"""
|
||||
Exception to be raised when a configuration error occurs.
|
||||
"""
|
||||
|
||||
@@ -30,6 +30,7 @@ from ..settings import ENABLE_CLOUD
|
||||
|
||||
|
||||
class PreferencesDialog(QtGui.QDialog, Ui_PreferencesDialog):
|
||||
|
||||
"""
|
||||
Preferences dialog implementation.
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ from ..node import Node
|
||||
|
||||
|
||||
class SnapshotsDialog(QtGui.QDialog, Ui_SnapshotsDialog):
|
||||
|
||||
"""
|
||||
Snapshots dialog implementation.
|
||||
|
||||
@@ -145,7 +146,7 @@ class SnapshotsDialog(QtGui.QDialog, Ui_SnapshotsDialog):
|
||||
if hasattr(node, "start") and node.status() == Node.started:
|
||||
node.stop()
|
||||
|
||||
#FIXME: problably a bug when restoring a snapshot and the project name has changed.
|
||||
# FIXME: problably a bug when restoring a snapshot and the project name has changed.
|
||||
thread = ProcessFilesThread(snapshot_path, os.path.dirname(self._project_path), skip_dirs=["snapshots"])
|
||||
thread.deleteLater()
|
||||
progress_dialog = ProgressDialog(thread, "Restoring snapshot", "Copying project files...", "Cancel", parent=self)
|
||||
|
||||
@@ -24,6 +24,7 @@ from ..ui.style_editor_dialog_ui import Ui_StyleEditorDialog
|
||||
|
||||
|
||||
class StyleEditorDialog(QtGui.QDialog, Ui_StyleEditorDialog):
|
||||
|
||||
"""
|
||||
Style editor dialog.
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from ..node import Node
|
||||
|
||||
|
||||
class SymbolSelectionDialog(QtGui.QDialog, Ui_SymbolSelectionDialog):
|
||||
|
||||
"""
|
||||
Symbol selection dialog.
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ from ..ui.text_editor_dialog_ui import Ui_TextEditorDialog
|
||||
|
||||
|
||||
class TextEditorDialog(QtGui.QDialog, Ui_TextEditorDialog):
|
||||
|
||||
"""
|
||||
Text editor dialog.
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class GraphicsView(QtGui.QGraphicsView):
|
||||
|
||||
"""
|
||||
Graphics view that displays the scene.
|
||||
|
||||
@@ -463,7 +464,7 @@ class GraphicsView(QtGui.QGraphicsView):
|
||||
item.setSelected(True)
|
||||
elif is_not_link and event.button() == QtCore.Qt.RightButton and not self._adding_link:
|
||||
if item:
|
||||
#Prevent right clicking on a selected item from de-selecting all other items
|
||||
# Prevent right clicking on a selected item from de-selecting all other items
|
||||
if not item.isSelected():
|
||||
if not event.modifiers() & QtCore.Qt.ControlModifier:
|
||||
for it in self.scene().items():
|
||||
@@ -1093,7 +1094,7 @@ class GraphicsView(QtGui.QGraphicsView):
|
||||
idlepc = router.idlepc()
|
||||
router.computeIdlepcs()
|
||||
|
||||
#TODO: improve to show progress over 10 seconds
|
||||
# TODO: improve to show progress over 10 seconds
|
||||
self._idlepc_progress_dialog = QtGui.QProgressDialog("Computing values...", "Cancel", 0, 0, parent=self)
|
||||
self._idlepc_progress_dialog.setWindowModality(QtCore.Qt.WindowModal)
|
||||
self._idlepc_progress_dialog.setWindowTitle("Idle-PC")
|
||||
@@ -1263,7 +1264,7 @@ class GraphicsView(QtGui.QGraphicsView):
|
||||
if not node_module:
|
||||
raise ModuleError("Could not find any module for {}".format(node_class))
|
||||
|
||||
if not "server" in node_data:
|
||||
if "server" not in node_data:
|
||||
server = node_module.allocateServer(node_class)
|
||||
elif node_data["server"] == "local":
|
||||
server = Servers.instance().localServer()
|
||||
|
||||
@@ -32,6 +32,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HTTPClient:
|
||||
|
||||
"""
|
||||
HTTP client.
|
||||
|
||||
@@ -89,7 +90,7 @@ class HTTPClient:
|
||||
except ValueError as e:
|
||||
log.error("could not get the server version: {}".format(e))
|
||||
|
||||
#FIXME: temporary version check
|
||||
# FIXME: temporary version check
|
||||
if self._version != __version__:
|
||||
if not self._version:
|
||||
raise OSError("Could not determine the server version")
|
||||
@@ -106,7 +107,7 @@ class HTTPClient:
|
||||
:param callback: callback method to call when the server replies.
|
||||
"""
|
||||
|
||||
log.error("OLD Send message. Destination {destination}, {params}".format(destination=destination,params=params))
|
||||
log.error("OLD Send message. Destination {destination}, {params}".format(destination=destination, params=params))
|
||||
# TODO : Remove this method when migration to rest api is done
|
||||
|
||||
def send_notification(self, destination, params=None):
|
||||
@@ -116,7 +117,7 @@ class HTTPClient:
|
||||
:param destination: server destination method
|
||||
:param params: params to send (dictionary)
|
||||
"""
|
||||
log.error("OLD Send notification. Destination {destination}, {params}".format(destination=destination,params=params))
|
||||
log.error("OLD Send notification. Destination {destination}, {params}".format(destination=destination, params=params))
|
||||
# TODO : Remove this method when migration to rest api is done
|
||||
|
||||
def post(self, path, params, callback):
|
||||
@@ -129,8 +130,8 @@ class HTTPClient:
|
||||
"""
|
||||
|
||||
post_data = json.dumps(params)
|
||||
log.debug("POST http://{host}:{port}{path} {data}".format(host=self.host,port=self.port,path=path, data=post_data))
|
||||
url = QtCore.QUrl("http://{host}:{port}{path}".format(host=self.host,port=self.port,path=path))
|
||||
log.debug("POST http://{host}:{port}{path} {data}".format(host=self.host, port=self.port, path=path, data=post_data))
|
||||
url = QtCore.QUrl("http://{host}:{port}{path}".format(host=self.host, port=self.port, path=path))
|
||||
request = QtNetwork.QNetworkRequest(url)
|
||||
request.setRawHeader("Content-Type", "application/json")
|
||||
request.setRawHeader("Content-Length", str(len(post_data)))
|
||||
@@ -139,7 +140,6 @@ class HTTPClient:
|
||||
|
||||
response.finished.connect(partial(self.response_process, response, callback))
|
||||
|
||||
|
||||
def response_process(self, response, callback):
|
||||
if response.error() != QtNetwork.QNetworkReply.NoError:
|
||||
log.debug("Response error: {}".format(response.errorString()))
|
||||
|
||||
@@ -24,6 +24,7 @@ from .shape_item import ShapeItem
|
||||
|
||||
|
||||
class EllipseItem(ShapeItem, QtGui.QGraphicsEllipseItem):
|
||||
|
||||
"""
|
||||
Class to draw an ellipse on the scene.
|
||||
"""
|
||||
|
||||
@@ -26,6 +26,7 @@ from ..ports.port import Port
|
||||
|
||||
|
||||
class EthernetLinkItem(LinkItem):
|
||||
|
||||
"""
|
||||
Ethernet link for the scene.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from ..qt import QtCore, QtGui
|
||||
|
||||
|
||||
class ImageItem(QtGui.QGraphicsPixmapItem):
|
||||
|
||||
"""
|
||||
Class to insert an image on the scene.
|
||||
"""
|
||||
|
||||
@@ -27,6 +27,7 @@ from ..qt import QtCore, QtGui
|
||||
|
||||
|
||||
class LinkItem(QtGui.QGraphicsPathItem):
|
||||
|
||||
"""
|
||||
Base class for link items.
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ from .note_item import NoteItem
|
||||
|
||||
|
||||
class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
|
||||
"""
|
||||
Node for the scene.
|
||||
|
||||
@@ -486,10 +487,10 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
# dynamically change the renderer when this node item is hovered.
|
||||
if not self.isSelected():
|
||||
self.setSharedRenderer(self._hover_renderer)
|
||||
#effect = QtGui.QGraphicsColorizeEffect()
|
||||
#effect.setColor(QtGui.QColor("black"))
|
||||
#effect.setStrength(0.8)
|
||||
#self.setGraphicsEffect(effect)
|
||||
# effect = QtGui.QGraphicsColorizeEffect()
|
||||
# effect.setColor(QtGui.QColor("black"))
|
||||
# effect.setStrength(0.8)
|
||||
# self.setGraphicsEffect(effect)
|
||||
|
||||
def hoverLeaveEvent(self, event):
|
||||
"""
|
||||
@@ -501,4 +502,4 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
# dynamically change the renderer back to the default when this node item is not hovered anymore.
|
||||
if not self.isSelected():
|
||||
self.setSharedRenderer(self._default_renderer)
|
||||
#self.graphicsEffect().setEnabled(False)
|
||||
# self.graphicsEffect().setEnabled(False)
|
||||
|
||||
@@ -23,6 +23,7 @@ from ..qt import QtCore, QtGui
|
||||
|
||||
|
||||
class NoteItem(QtGui.QGraphicsTextItem):
|
||||
|
||||
"""
|
||||
Text note for the QGraphicsView.
|
||||
|
||||
@@ -77,9 +78,9 @@ class NoteItem(QtGui.QGraphicsTextItem):
|
||||
"""
|
||||
|
||||
self._editable = value
|
||||
#if not self._editable:
|
||||
# if not self._editable:
|
||||
# self.setFlag(self.ItemIsSelectable, enabled=False)
|
||||
#else:
|
||||
# else:
|
||||
# self.setFlag(self.ItemIsSelectable)
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
|
||||
@@ -24,6 +24,7 @@ from .shape_item import ShapeItem
|
||||
|
||||
|
||||
class RectangleItem(ShapeItem, QtGui.QGraphicsRectItem):
|
||||
|
||||
"""
|
||||
Class to draw a rectangle on the scene.
|
||||
"""
|
||||
|
||||
@@ -27,6 +27,7 @@ from ..ports.port import Port
|
||||
|
||||
|
||||
class SerialLinkItem(LinkItem):
|
||||
|
||||
"""
|
||||
Serial link for the scene.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from ..qt import QtCore, QtGui
|
||||
|
||||
|
||||
class ShapeItem:
|
||||
|
||||
"""
|
||||
Base class to draw shapes on the scene.
|
||||
"""
|
||||
|
||||
@@ -28,6 +28,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Link(QtCore.QObject):
|
||||
|
||||
"""
|
||||
Link implementation.
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ CLOUD_SETTINGS_GROUP = "Cloud"
|
||||
|
||||
|
||||
class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
|
||||
"""
|
||||
Main window implementation.
|
||||
|
||||
@@ -273,7 +274,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
|
||||
settings_to_persist = self._cloud_settings if persist else CLOUD_SETTINGS
|
||||
for name, value in settings_to_persist.items():
|
||||
settings.setValue(name, value)
|
||||
settings.setValue(name, value)
|
||||
settings.endGroup()
|
||||
|
||||
def _connections(self):
|
||||
@@ -547,7 +548,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
painter.setRenderHint(QtGui.QPainter.SmoothPixmapTransform, True)
|
||||
scene.render(painter)
|
||||
painter.end()
|
||||
#TODO: quality option
|
||||
# TODO: quality option
|
||||
return image.save(path)
|
||||
|
||||
def _screenshotActionSlot(self):
|
||||
@@ -668,7 +669,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
Slot called to reset the port labels on the scene.
|
||||
"""
|
||||
|
||||
#TODO: reset port labels
|
||||
# TODO: reset port labels
|
||||
pass
|
||||
|
||||
def _showNamesActionSlot(self):
|
||||
@@ -676,7 +677,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
Slot called to show the node names on the scene.
|
||||
"""
|
||||
|
||||
#TODO: show/hide node names
|
||||
# TODO: show/hide node names
|
||||
pass
|
||||
|
||||
def _showPortNamesActionSlot(self):
|
||||
@@ -877,13 +878,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
else:
|
||||
latest_release = bytes(network_reply.readAll()).decode().rstrip()
|
||||
if parse_version(__version__) < parse_version(latest_release):
|
||||
reply = QtGui.QMessageBox.question(self,
|
||||
"Check For Update",
|
||||
"Newer GNS3 version {} is available, do you want to visit our website to download it?".format(latest_release),
|
||||
QtGui.QMessageBox.Yes,
|
||||
QtGui.QMessageBox.No)
|
||||
if reply == QtGui.QMessageBox.Yes:
|
||||
QtGui.QDesktopServices.openUrl(QtCore.QUrl("http://www.gns3.net/download/"))
|
||||
reply = QtGui.QMessageBox.question(self,
|
||||
"Check For Update",
|
||||
"Newer GNS3 version {} is available, do you want to visit our website to download it?".format(latest_release),
|
||||
QtGui.QMessageBox.Yes,
|
||||
QtGui.QMessageBox.No)
|
||||
if reply == QtGui.QMessageBox.Yes:
|
||||
QtGui.QDesktopServices.openUrl(QtCore.QUrl("http://www.gns3.net/download/"))
|
||||
elif not is_silent:
|
||||
QtGui.QMessageBox.information(self, "Check For Update", "GNS3 is up-to-date!")
|
||||
return
|
||||
@@ -918,12 +919,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
instructions_files += glob.glob(os.path.join(project_dir, "instructions") + os.sep + "instructions*")
|
||||
if len(instructions_files):
|
||||
path = instructions_files[0]
|
||||
if QtGui.QDesktopServices.openUrl(QtCore.QUrl('file:///' + path, QtCore.QUrl.TolerantMode)) == False and silent == False:
|
||||
if QtGui.QDesktopServices.openUrl(QtCore.QUrl('file:///' + path, QtCore.QUrl.TolerantMode)) is False and silent is False:
|
||||
QtGui.QMessageBox.critical(self, "Lab instructions", "Could not open {}".format(path))
|
||||
elif silent is False:
|
||||
QtGui.QMessageBox.critical(self, "Lab instructions", "No instructions found")
|
||||
|
||||
|
||||
def _aboutQtActionSlot(self):
|
||||
"""
|
||||
Slot to display the Qt About dialog.
|
||||
@@ -1131,7 +1131,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
# not a normal OSError, thrown from the Websocket client.
|
||||
MessageBox(self, "Local server", "Something other than a GNS3 server is already running on {} port {}, please adjust the local server port setting".format(server.host,
|
||||
server.port),
|
||||
e)
|
||||
e)
|
||||
return
|
||||
|
||||
if not servers.localServerAutoStart():
|
||||
@@ -1154,14 +1154,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
return
|
||||
|
||||
if servers.startLocalServer(servers.localServerPath(), server.host, server.port):
|
||||
self._thread = WaitForConnectionThread(server.host, server.port)
|
||||
progress_dialog = ProgressDialog(self._thread,
|
||||
"Local server",
|
||||
"Connecting to server {} on port {}...".format(server.host, server.port),
|
||||
"Cancel", busy=True, parent=self)
|
||||
progress_dialog.show()
|
||||
if not progress_dialog.exec_():
|
||||
return
|
||||
self._thread = WaitForConnectionThread(server.host, server.port)
|
||||
progress_dialog = ProgressDialog(self._thread,
|
||||
"Local server",
|
||||
"Connecting to server {} on port {}...".format(server.host, server.port),
|
||||
"Cancel", busy=True, parent=self)
|
||||
progress_dialog.show()
|
||||
if not progress_dialog.exec_():
|
||||
return
|
||||
else:
|
||||
QtGui.QMessageBox.critical(self, "Local server", "Could not start the local server process: {}".format(servers.localServerPath()))
|
||||
return
|
||||
@@ -1413,7 +1413,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
|
||||
except OSError as e:
|
||||
QtGui.QMessageBox.critical(self, "Load", "Could not load project {}: {}".format(os.path.basename(path), e))
|
||||
#log.error("exception {type}".format(type=type(e)), exc_info=1)
|
||||
# log.error("exception {type}".format(type=type(e)), exc_info=1)
|
||||
return False
|
||||
except ValueError as e:
|
||||
QtGui.QMessageBox.critical(self, "Load", "Invalid file: {}".format(e))
|
||||
|
||||
@@ -33,6 +33,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Builtin(Module):
|
||||
|
||||
"""
|
||||
Built-in module.
|
||||
"""
|
||||
@@ -137,7 +138,7 @@ class Builtin(Module):
|
||||
if not all(using_local_server) and len(remote_servers):
|
||||
# a module is not using a local server
|
||||
|
||||
if not True in using_local_server and len(remote_servers) == 1:
|
||||
if True not in using_local_server and len(remote_servers) == 1:
|
||||
# no module is using a local server and there is only one
|
||||
# remote server available, so no need to ask the user.
|
||||
return next(iter(servers))
|
||||
@@ -147,7 +148,7 @@ class Builtin(Module):
|
||||
for remote_server in remote_servers:
|
||||
server_list.append("{}".format(remote_server))
|
||||
|
||||
#TODO: move this to graphics_view
|
||||
# TODO: move this to graphics_view
|
||||
from gns3.main_window import MainWindow
|
||||
mainwindow = MainWindow.instance()
|
||||
(selection, ok) = QtGui.QInputDialog.getItem(mainwindow, "Server", "Please choose a server", server_list, 0, False)
|
||||
|
||||
@@ -36,6 +36,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Cloud(Node):
|
||||
|
||||
"""
|
||||
Dynamips cloud.
|
||||
|
||||
@@ -311,7 +312,7 @@ This is a pseudo-device for external connections
|
||||
"properties": {"name": self.name(),
|
||||
"nios": self._settings["nios"]},
|
||||
"server_id": self._server.id(),
|
||||
}
|
||||
}
|
||||
|
||||
# add the ports
|
||||
if self._ports:
|
||||
|
||||
@@ -24,6 +24,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Host(Cloud):
|
||||
|
||||
"""
|
||||
Pseudo host based on a Dynamips Cloud.
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from ..ui.cloud_configuration_page_ui import Ui_cloudConfigPageWidget
|
||||
|
||||
|
||||
class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for clouds.
|
||||
"""
|
||||
@@ -105,7 +106,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
interface = self.uiGenericEthernetLineEdit.text()
|
||||
if interface:
|
||||
nio = "nio_gen_eth:{interface}".format(interface=interface)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiGenericEthernetListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -154,7 +155,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
interface = self.uiLinuxEthernetLineEdit.text()
|
||||
if interface:
|
||||
nio = "nio_gen_linux:{interface}".format(interface=interface)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiLinuxEthernetListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -212,7 +213,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
nio = "nio_udp:{lport}:{rhost}:{rport}".format(lport=local_port,
|
||||
rhost=remote_host,
|
||||
rport=remote_port)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIOUDPListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
self.uiLocalPortSpinBox.setValue(local_port + 1)
|
||||
@@ -268,7 +269,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
tap_interface = self.uiNIOTAPLineEdit.text()
|
||||
if tap_interface:
|
||||
nio = "nio_tap:{}".format(tap_interface.lower())
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIOTAPListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -325,7 +326,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
if local_file and remote_file:
|
||||
nio = "nio_unix:{local}:{remote}".format(local=local_file,
|
||||
remote=remote_file)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIOUNIXListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -381,7 +382,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
local_file = self.uiVDELocalFileLineEdit.text()
|
||||
if local_file and control_file:
|
||||
nio = "nio_vde:{control}:{local}".format(control=control_file, local=local_file)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIOVDEListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
@@ -433,7 +434,7 @@ class CloudConfigurationPage(QtGui.QWidget, Ui_cloudConfigPageWidget):
|
||||
identifier = self.uiNIONullIdentiferLineEdit.text()
|
||||
if identifier:
|
||||
nio = "nio_null:{}".format(identifier)
|
||||
if not nio in self._nios:
|
||||
if nio not in self._nios:
|
||||
self.uiNIONullListWidget.addItem(nio)
|
||||
self._nios.append(nio)
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_cloudConfigPageWidget(object):
|
||||
|
||||
def setupUi(self, cloudConfigPageWidget):
|
||||
cloudConfigPageWidget.setObjectName(_fromUtf8("cloudConfigPageWidget"))
|
||||
cloudConfigPageWidget.resize(542, 500)
|
||||
@@ -418,4 +421,3 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), _translate("cloudConfigPageWidget", "NIO NULL", None))
|
||||
self.uiNameLabel.setText(_translate("cloudConfigPageWidget", "Name:", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_7), _translate("cloudConfigPageWidget", "Misc.", None))
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Dynamips(Module):
|
||||
|
||||
"""
|
||||
Dynamips module.
|
||||
"""
|
||||
@@ -211,7 +212,7 @@ class Dynamips(Module):
|
||||
:param path: path to the local project files directory
|
||||
"""
|
||||
|
||||
#self._delete_dynamips_files() #FIXME: cause issues
|
||||
# self._delete_dynamips_files() #FIXME: cause issues
|
||||
self._working_dir = path
|
||||
log.info("local working directory for Dynamips module: {}".format(self._working_dir))
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ ADAPTER_MATRIX = {"C1700-MB-1FE": {"nb_ports": 1,
|
||||
"port": FastEthernetPort},
|
||||
|
||||
"C7200-IO-FE": {"nb_ports": 1,
|
||||
"wics": 0,
|
||||
"port": FastEthernetPort},
|
||||
"wics": 0,
|
||||
"port": FastEthernetPort},
|
||||
|
||||
"C7200-IO-GE-E": {"nb_ports": 1,
|
||||
"wics": 0,
|
||||
@@ -125,4 +125,4 @@ ADAPTER_MATRIX = {"C1700-MB-1FE": {"nb_ports": 1,
|
||||
"PA-POS-OC3": {"nb_ports": 1,
|
||||
"wics": 0,
|
||||
"port": POSPort},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ PLATFORM_TO_CLASS = {
|
||||
|
||||
|
||||
class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
|
||||
"""
|
||||
Wizard to create an IOS router.
|
||||
|
||||
@@ -94,7 +95,7 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
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.
|
||||
# FIXME: hide because of issue on Windows.
|
||||
self.uiTestIOSImagePushButton.hide()
|
||||
|
||||
# Mandatory fields
|
||||
@@ -226,10 +227,10 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
if state:
|
||||
# forces the name to EtherSwitch
|
||||
self.uiNameLineEdit.setText("EtherSwitch router")
|
||||
#self.uiNameLineEdit.setEnabled(False)
|
||||
# self.uiNameLineEdit.setEnabled(False)
|
||||
else:
|
||||
self.uiNameLineEdit.setText(self.uiPlatformComboBox.currentText())
|
||||
#self.uiNameLineEdit.setEnabled(True)
|
||||
# self.uiNameLineEdit.setEnabled(True)
|
||||
|
||||
def createdSlot(self, node_id):
|
||||
"""
|
||||
@@ -326,7 +327,7 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
for slot_number, slot_adapters in ADAPTER_MATRIX[platform][chassis].items():
|
||||
self._widget_slots[slot_number].setEnabled(True)
|
||||
|
||||
if type(slot_adapters) == str:
|
||||
if isinstance(slot_adapters, str):
|
||||
# only one default adapter for this slot.
|
||||
self._widget_slots[slot_number].addItem(slot_adapters)
|
||||
else:
|
||||
@@ -394,7 +395,7 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
if ios_router["name"] == name:
|
||||
QtGui.QMessageBox.critical(self, "Name", "{} is already used, please choose another name".format(name))
|
||||
return False
|
||||
#if self.uiEtherSwitchCheckBox.isChecked() and ios_router["etherswitch"]:
|
||||
# if self.uiEtherSwitchCheckBox.isChecked() and ios_router["etherswitch"]:
|
||||
# QtGui.QMessageBox.critical(self, "EtherSwitch router", "A router has already been configured to be used as the EtherSwitch router".format(name))
|
||||
# return False
|
||||
if self.currentPage() == self.uiIdlePCWizardPage:
|
||||
@@ -425,7 +426,7 @@ class IOSRouterWizard(QtGui.QWizard, Ui_IOSRouterWizard):
|
||||
server = "{}:{}".format(server.host, server.port)
|
||||
else:
|
||||
server = self.uiRemoteServersComboBox.currentText()
|
||||
else: # Cloud is selected
|
||||
else: # Cloud is selected
|
||||
server = "cloud"
|
||||
|
||||
settings = {
|
||||
|
||||
@@ -29,6 +29,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ATMSwitch(Node):
|
||||
|
||||
"""
|
||||
Dynamips ATM switch.
|
||||
|
||||
@@ -455,7 +456,7 @@ class ATMSwitch(Node):
|
||||
"description": str(self),
|
||||
"properties": {"name": self.name()},
|
||||
"server_id": self._server.id(),
|
||||
}
|
||||
}
|
||||
|
||||
if self._settings["mappings"]:
|
||||
atmsw["properties"]["mappings"] = self._settings["mappings"]
|
||||
|
||||
@@ -23,6 +23,7 @@ from .router import Router
|
||||
|
||||
|
||||
class C1700(Router):
|
||||
|
||||
"""
|
||||
Dynamips c1700 router.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from .router import Router
|
||||
|
||||
|
||||
class C2600(Router):
|
||||
|
||||
"""
|
||||
Dynamips c2600 router.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from .router import Router
|
||||
|
||||
|
||||
class C2691(Router):
|
||||
|
||||
"""
|
||||
Dynamips c2691 router.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from .router import Router
|
||||
|
||||
|
||||
class C3600(Router):
|
||||
|
||||
"""
|
||||
Dynamips c3600 router.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from .router import Router
|
||||
|
||||
|
||||
class C3725(Router):
|
||||
|
||||
"""
|
||||
Dynamips c3725 router.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from .router import Router
|
||||
|
||||
|
||||
class C3745(Router):
|
||||
|
||||
"""
|
||||
Dynamips c3745 router.
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ from .router import Router
|
||||
|
||||
|
||||
class C7200(Router):
|
||||
|
||||
"""
|
||||
Dynamips c7200 router.
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EthernetHub(Node):
|
||||
|
||||
"""
|
||||
Dynamips Ethernet hub.
|
||||
|
||||
@@ -170,7 +171,6 @@ class EthernetHub(Node):
|
||||
|
||||
self._settings["ports"] = new_settings["ports"].copy()
|
||||
|
||||
|
||||
params = {}
|
||||
if "name" in new_settings and new_settings["name"] != self.name():
|
||||
if self.hasAllocatedName(new_settings["name"]):
|
||||
|
||||
@@ -28,6 +28,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class EthernetSwitch(Node):
|
||||
|
||||
"""
|
||||
Dynamips Ethernet switch.
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ from gns3.node import Node
|
||||
|
||||
|
||||
class EtherSwitchRouter(Router):
|
||||
|
||||
"""
|
||||
EtherSwitch router.
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FrameRelaySwitch(Node):
|
||||
|
||||
"""
|
||||
Dynamips Frame-Relay switch.
|
||||
|
||||
@@ -398,7 +399,7 @@ class FrameRelaySwitch(Node):
|
||||
port_info += " Port {} is empty\n".format(port.name())
|
||||
else:
|
||||
port_info += " Port {name} {description}\n".format(name=port.name(),
|
||||
description=port.description())
|
||||
description=port.description())
|
||||
|
||||
for source, destination in self._settings["mappings"].items():
|
||||
source_port, source_dlci = source.split(":")
|
||||
|
||||
@@ -36,6 +36,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Router(Node):
|
||||
|
||||
"""
|
||||
Dynamips router (client implementation).
|
||||
|
||||
@@ -363,12 +364,12 @@ class Router(Node):
|
||||
|
||||
# push the startup-config
|
||||
if "startup_config" in new_settings and self._settings["startup_config"] != new_settings["startup_config"] \
|
||||
and not self.server().isLocal() and os.path.isfile(new_settings["startup_config"]):
|
||||
and not self.server().isLocal() and os.path.isfile(new_settings["startup_config"]):
|
||||
params["startup_config_base64"] = self._base64Config(new_settings["startup_config"])
|
||||
|
||||
# push the private-config
|
||||
if "private_config" in new_settings and self._settings["private_config"] != new_settings["private_config"] \
|
||||
and not self.server().isLocal() and os.path.isfile(new_settings["private_config"]):
|
||||
and not self.server().isLocal() and os.path.isfile(new_settings["private_config"]):
|
||||
params["private_config_base64"] = self._base64Config(new_settings["private_config"])
|
||||
|
||||
log.debug("{} is updating settings: {}".format(self.name(), params))
|
||||
@@ -791,7 +792,7 @@ class Router(Node):
|
||||
|
||||
slot_info = ""
|
||||
for name, value in self._settings.items():
|
||||
if name.startswith("slot") and value != None:
|
||||
if name.startswith("slot") and value is not None:
|
||||
slot_number = int(name[-1])
|
||||
adapter_name = value
|
||||
nb_ports = ADAPTER_MATRIX[adapter_name]["nb_ports"]
|
||||
@@ -819,7 +820,7 @@ class Router(Node):
|
||||
slot_info += " {port_name} {port_description}\n".format(port_name=port_name,
|
||||
port_description=port_info.description())
|
||||
|
||||
if name.startswith("wic") and value != None:
|
||||
if name.startswith("wic") and value is not None:
|
||||
wic_slot_number = int(name[-1])
|
||||
wic_name = value
|
||||
nb_ports = WIC_MATRIX[wic_name]["nb_ports"]
|
||||
@@ -875,7 +876,7 @@ class Router(Node):
|
||||
|
||||
# get info about JIT sharing
|
||||
jitsharing_group_info = "No JIT blocks sharing enabled"
|
||||
if self._settings["jit_sharing_group"] != None:
|
||||
if self._settings["jit_sharing_group"] is not None:
|
||||
jitsharing_group_info = "JIT blocks sharing group is {group}".format(group=self._settings["jit_sharing_group"])
|
||||
|
||||
# get info about Idle-PC
|
||||
@@ -911,7 +912,7 @@ class Router(Node):
|
||||
disk0=self._settings["disk0"],
|
||||
disk1=self._settings["disk1"])
|
||||
|
||||
#gather information about PA, their interfaces and connections
|
||||
# gather information about PA, their interfaces and connections
|
||||
slot_info = self._slot_info()
|
||||
return info + slot_info
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from ..ui.atm_bridge_configuration_page_ui import Ui_atmBridgeConfigPageWidget
|
||||
|
||||
|
||||
class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for ATM bridges.
|
||||
"""
|
||||
@@ -74,7 +75,7 @@ class ATMBridgeConfigurationPage(QtGui.QWidget, Ui_atmBridgeConfigPageWidget):
|
||||
"""
|
||||
|
||||
item = self.uiMappingTreeWidget.currentItem()
|
||||
if item != None:
|
||||
if item is not None:
|
||||
self.uiDeletePushButton.setEnabled(True)
|
||||
else:
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
|
||||
@@ -25,6 +25,7 @@ from ..ui.atm_switch_configuration_page_ui import Ui_atmSwitchConfigPageWidget
|
||||
|
||||
|
||||
class ATMSwitchConfigurationPage(QtGui.QWidget, Ui_atmSwitchConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for ATM switches.
|
||||
"""
|
||||
@@ -85,7 +86,7 @@ class ATMSwitchConfigurationPage(QtGui.QWidget, Ui_atmSwitchConfigPageWidget):
|
||||
"""
|
||||
|
||||
item = self.uiMappingTreeWidget.currentItem()
|
||||
if item != None:
|
||||
if item is not None:
|
||||
self.uiDeletePushButton.setEnabled(True)
|
||||
else:
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
|
||||
@@ -29,6 +29,7 @@ from ..settings import DYNAMIPS_SETTINGS
|
||||
|
||||
|
||||
class DynamipsPreferencesPage(QtGui.QWidget, Ui_DynamipsPreferencesPageWidget):
|
||||
|
||||
"""
|
||||
QWidget preference page for Dynamips.
|
||||
"""
|
||||
@@ -46,7 +47,7 @@ class DynamipsPreferencesPage(QtGui.QWidget, Ui_DynamipsPreferencesPageWidget):
|
||||
self.uiUseLocalServercheckBox.stateChanged.connect(self._useLocalServerSlot)
|
||||
self.uiTestSettingsPushButton.clicked.connect(self._testSettingsSlot)
|
||||
|
||||
#FIXME: temporally hide test button
|
||||
# FIXME: temporally hide test button
|
||||
self.uiTestSettingsPushButton.hide()
|
||||
|
||||
def _dynamipsPathBrowserSlot(self):
|
||||
|
||||
@@ -25,6 +25,7 @@ from ..ui.ethernet_hub_configuration_page_ui import Ui_ethernetHubConfigPageWidg
|
||||
|
||||
|
||||
class EthernetHubConfigurationPage(QtGui.QWidget, Ui_ethernetHubConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for Ethernet hubs.
|
||||
"""
|
||||
|
||||
@@ -25,6 +25,7 @@ from ..ui.ethernet_switch_configuration_page_ui import Ui_ethernetSwitchConfigPa
|
||||
|
||||
|
||||
class EthernetSwitchConfigurationPage(QtGui.QWidget, Ui_ethernetSwitchConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for Ethernet switches.
|
||||
"""
|
||||
|
||||
@@ -24,6 +24,7 @@ from ..ui.frame_relay_switch_configuration_page_ui import Ui_frameRelaySwitchCon
|
||||
|
||||
|
||||
class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for Frame Relay switches.
|
||||
"""
|
||||
@@ -65,7 +66,7 @@ class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfig
|
||||
"""
|
||||
|
||||
item = self.uiMappingTreeWidget.currentItem()
|
||||
if item != None:
|
||||
if item is not None:
|
||||
self.uiDeletePushButton.setEnabled(True)
|
||||
else:
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
@@ -108,7 +109,7 @@ class FrameRelaySwitchConfigurationPage(QtGui.QWidget, Ui_frameRelaySwitchConfig
|
||||
|
||||
item = self.uiMappingTreeWidget.currentItem()
|
||||
if item:
|
||||
#connected_ports = self.node.getConnectedInterfaceList()
|
||||
# connected_ports = self.node.getConnectedInterfaceList()
|
||||
source = item.text(0)
|
||||
source_port = int(source.split(':')[0])
|
||||
destination = item.text(1)
|
||||
|
||||
@@ -29,6 +29,7 @@ from ..settings import CHASSIS, ADAPTER_MATRIX, WIC_MATRIX
|
||||
|
||||
|
||||
class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for IOS routers.
|
||||
"""
|
||||
@@ -168,7 +169,7 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
for slot_number, slot_adapters in ADAPTER_MATRIX[platform][chassis].items():
|
||||
self._widget_slots[slot_number].setEnabled(True)
|
||||
|
||||
if type(slot_adapters) == str:
|
||||
if isinstance(slot_adapters, str):
|
||||
# only one default adapter for this slot.
|
||||
self._widget_slots[slot_number].addItem(slot_adapters)
|
||||
else:
|
||||
@@ -313,7 +314,7 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
else:
|
||||
self.uiPowerSupply2ComboBox.setCurrentIndex(1)
|
||||
else:
|
||||
self.uiTabWidget.removeTab(4) # environment tab
|
||||
self.uiTabWidget.removeTab(4) # environment tab
|
||||
|
||||
# all platforms but c7200 have the iomem feature
|
||||
# let"s hide these widgets.
|
||||
@@ -399,7 +400,7 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
if index != -1:
|
||||
self._widget_slots[slot_number].setCurrentIndex(index)
|
||||
QtGui.QMessageBox.critical(self, node.name(), "A link is connected to port {} on adapter {}, please remove it first".format(node_port.name(),
|
||||
adapter))
|
||||
adapter))
|
||||
raise ConfigurationError()
|
||||
|
||||
def _checkForLinkConnectedToWIC(self, wic_number, settings, node):
|
||||
@@ -432,7 +433,7 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
:param group: indicates the settings apply to a group of routers
|
||||
"""
|
||||
|
||||
#print("saving {}".format(group))
|
||||
# print("saving {}".format(group))
|
||||
|
||||
# these settings cannot be shared by nodes and updated
|
||||
# in the node configurator.
|
||||
@@ -458,16 +459,16 @@ class IOSRouterConfigurationPage(QtGui.QWidget, Ui_iosRouterConfigPageWidget):
|
||||
settings["aux"] = self.uiAuxPortSpinBox.value()
|
||||
|
||||
# check and save the base MAC address
|
||||
#mac = self.uiBaseMACLineEdit.text()
|
||||
#if mac and not re.search(r"""^([0-9a-fA-F]{4}\.){2}[0-9a-fA-F]{4}$""", mac):
|
||||
# mac = self.uiBaseMACLineEdit.text()
|
||||
# if mac and not re.search(r"""^([0-9a-fA-F]{4}\.){2}[0-9a-fA-F]{4}$""", mac):
|
||||
# QtGui.QMessageBox.critical(self, "MAC address", "Invalid MAC address (format required: hhhh.hhhh.hhhh)")
|
||||
#elif mac != "":
|
||||
# elif mac != "":
|
||||
# settings["mac_addr"] = mac
|
||||
|
||||
# save the IOS image path
|
||||
path = self.uiIOSImageLineEdit.text()
|
||||
#settings["path"] = path
|
||||
settings["image"] = path#os.path.basename(path)
|
||||
# settings["path"] = path
|
||||
settings["image"] = path # os.path.basename(path)
|
||||
|
||||
else:
|
||||
del settings["name"]
|
||||
|
||||
@@ -48,6 +48,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IOSRouterPreferencesPage(QtGui.QWidget, Ui_IOSRouterPreferencesPageWidget):
|
||||
|
||||
"""
|
||||
QWidget preference page for IOS routers.
|
||||
"""
|
||||
|
||||
@@ -191,7 +191,7 @@ C7200_PAS = (
|
||||
IO_C7200 = ("C7200-IO-FE",
|
||||
"C7200-IO-2FE",
|
||||
"C7200-IO-GE-E"
|
||||
)
|
||||
)
|
||||
|
||||
"""
|
||||
Build the adapter compatibility matrix:
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_atmBridgeConfigPageWidget(object):
|
||||
|
||||
def setupUi(self, atmBridgeConfigPageWidget):
|
||||
atmBridgeConfigPageWidget.setObjectName(_fromUtf8("atmBridgeConfigPageWidget"))
|
||||
atmBridgeConfigPageWidget.resize(432, 358)
|
||||
@@ -164,4 +167,3 @@ class Ui_atmBridgeConfigPageWidget(object):
|
||||
self.uiDeletePushButton.setText(_translate("atmBridgeConfigPageWidget", "&Delete", None))
|
||||
self.uiGeneralGroupBox.setTitle(_translate("atmBridgeConfigPageWidget", "General", None))
|
||||
self.uiNameLabel.setText(_translate("atmBridgeConfigPageWidget", "Name:", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_atmSwitchConfigPageWidget(object):
|
||||
|
||||
def setupUi(self, atmSwitchConfigPageWidget):
|
||||
atmSwitchConfigPageWidget.setObjectName(_fromUtf8("atmSwitchConfigPageWidget"))
|
||||
atmSwitchConfigPageWidget.resize(459, 419)
|
||||
@@ -198,4 +201,3 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiDestinationPortLabel.setText(_translate("atmSwitchConfigPageWidget", "Port:", None))
|
||||
self.uiDestinationVPILabel.setText(_translate("atmSwitchConfigPageWidget", "VPI:", None))
|
||||
self.uiDestinationVCILabel.setText(_translate("atmSwitchConfigPageWidget", "VCI:", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_DynamipsPreferencesPageWidget(object):
|
||||
|
||||
def setupUi(self, DynamipsPreferencesPageWidget):
|
||||
DynamipsPreferencesPageWidget.setObjectName(_fromUtf8("DynamipsPreferencesPageWidget"))
|
||||
DynamipsPreferencesPageWidget.resize(430, 539)
|
||||
@@ -271,4 +274,3 @@ class Ui_DynamipsPreferencesPageWidget(object):
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiAdvancedSettingsTabWidget), _translate("DynamipsPreferencesPageWidget", "Advanced settings", None))
|
||||
self.uiTestSettingsPushButton.setText(_translate("DynamipsPreferencesPageWidget", "Test settings", None))
|
||||
self.uiRestoreDefaultsPushButton.setText(_translate("DynamipsPreferencesPageWidget", "Restore defaults", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_ethernetHubConfigPageWidget(object):
|
||||
|
||||
def setupUi(self, ethernetHubConfigPageWidget):
|
||||
ethernetHubConfigPageWidget.setObjectName(_fromUtf8("ethernetHubConfigPageWidget"))
|
||||
ethernetHubConfigPageWidget.resize(381, 270)
|
||||
@@ -70,4 +73,3 @@ class Ui_ethernetHubConfigPageWidget(object):
|
||||
self.uiSettingsGroupBox.setTitle(_translate("ethernetHubConfigPageWidget", "Settings", None))
|
||||
self.uiNameLabel.setText(_translate("ethernetHubConfigPageWidget", "Name:", None))
|
||||
self.uiPortsLabel.setText(_translate("ethernetHubConfigPageWidget", "Number of ports:", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
|
||||
def setupUi(self, ethernetSwitchConfigPageWidget):
|
||||
ethernetSwitchConfigPageWidget.setObjectName(_fromUtf8("ethernetSwitchConfigPageWidget"))
|
||||
ethernetSwitchConfigPageWidget.resize(397, 315)
|
||||
@@ -138,4 +141,3 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
self.uiPortTypeComboBox.setItemText(2, _translate("ethernetSwitchConfigPageWidget", "qinq", None))
|
||||
self.uiAddPushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Add", None))
|
||||
self.uiDeletePushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Delete", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
|
||||
def setupUi(self, frameRelaySwitchConfigPageWidget):
|
||||
frameRelaySwitchConfigPageWidget.setObjectName(_fromUtf8("frameRelaySwitchConfigPageWidget"))
|
||||
frameRelaySwitchConfigPageWidget.resize(499, 405)
|
||||
@@ -161,4 +164,3 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
self.uiDestinationDLCILabel.setText(_translate("frameRelaySwitchConfigPageWidget", "DLCI:", None))
|
||||
self.uiAddPushButton.setText(_translate("frameRelaySwitchConfigPageWidget", "&Add", None))
|
||||
self.uiDeletePushButton.setText(_translate("frameRelaySwitchConfigPageWidget", "&Delete", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_iosRouterConfigPageWidget(object):
|
||||
|
||||
def setupUi(self, iosRouterConfigPageWidget):
|
||||
iosRouterConfigPageWidget.setObjectName(_fromUtf8("iosRouterConfigPageWidget"))
|
||||
iosRouterConfigPageWidget.resize(435, 510)
|
||||
@@ -635,4 +638,3 @@ class Ui_iosRouterConfigPageWidget(object):
|
||||
self.uiSensor4Label.setText(_translate("iosRouterConfigPageWidget", "NPE outlet:", None))
|
||||
self.uiSensor4SpinBox.setSuffix(_translate("iosRouterConfigPageWidget", " C", None))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiEnvironmentPageWidget), _translate("iosRouterConfigPageWidget", "Environment", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_IOSRouterPreferencesPageWidget(object):
|
||||
|
||||
def setupUi(self, IOSRouterPreferencesPageWidget):
|
||||
IOSRouterPreferencesPageWidget.setObjectName(_fromUtf8("IOSRouterPreferencesPageWidget"))
|
||||
IOSRouterPreferencesPageWidget.resize(672, 521)
|
||||
@@ -83,4 +86,3 @@ class Ui_IOSRouterPreferencesPageWidget(object):
|
||||
self.uiDecompressIOSPushButton.setText(_translate("IOSRouterPreferencesPageWidget", "&Decompress", None))
|
||||
self.uiEditIOSRouterPushButton.setText(_translate("IOSRouterPreferencesPageWidget", "&Edit", None))
|
||||
self.uiDeleteIOSRouterPushButton.setText(_translate("IOSRouterPreferencesPageWidget", "Delete", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_IOSRouterWizard(object):
|
||||
|
||||
def setupUi(self, IOSRouterWizard):
|
||||
IOSRouterWizard.setObjectName(_fromUtf8("IOSRouterWizard"))
|
||||
IOSRouterWizard.resize(517, 398)
|
||||
@@ -327,4 +330,3 @@ class Ui_IOSRouterWizard(object):
|
||||
self.uiIdlePCWizardPage.setSubTitle(_translate("IOSRouterWizard", "An idle-pc value is necessary to prevent IOS to use 100% of your processor or one of its core.", None))
|
||||
self.uiIdlepcLabel.setText(_translate("IOSRouterWizard", "Idle-PC:", None))
|
||||
self.uiIdlePCFinderPushButton.setText(_translate("IOSRouterWizard", "Idle-PC finder", None))
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ from .decompress_ios import decompressIOS
|
||||
|
||||
|
||||
class DecompressIOSThread(QtCore.QThread):
|
||||
|
||||
"""
|
||||
Thread to decompress an IOS image.
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ from gns3.qt import QtGui
|
||||
|
||||
|
||||
class TreeWidgetItem(QtGui.QTreeWidgetItem):
|
||||
|
||||
"""
|
||||
QTreeWidgetItem reimplementation to allow numeric sort.
|
||||
"""
|
||||
|
||||
@@ -36,6 +36,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IOU(Module):
|
||||
|
||||
"""
|
||||
IOU module.
|
||||
"""
|
||||
@@ -530,7 +531,7 @@ class IOU(Module):
|
||||
"default_symbol": iou_device["default_symbol"],
|
||||
"hover_symbol": iou_device["hover_symbol"],
|
||||
"categories": [iou_device["category"]]
|
||||
}
|
||||
}
|
||||
)
|
||||
return nodes
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ from .. import IOU
|
||||
|
||||
|
||||
class IOUDeviceWizard(QtGui.QWizard, Ui_IOUDeviceWizard):
|
||||
|
||||
"""
|
||||
Wizard to create an IOU device.
|
||||
|
||||
@@ -203,7 +204,7 @@ class IOUDeviceWizard(QtGui.QWizard, Ui_IOUDeviceWizard):
|
||||
server = "{}:{}".format(server.host, server.port)
|
||||
else:
|
||||
server = self.uiRemoteServersComboBox.currentText()
|
||||
else: # Cloud is selected
|
||||
else: # Cloud is selected
|
||||
server = "cloud"
|
||||
|
||||
settings = {
|
||||
|
||||
@@ -34,6 +34,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IOUDevice(Node):
|
||||
|
||||
"""
|
||||
IOU device.
|
||||
|
||||
@@ -63,7 +64,7 @@ class IOUDevice(Node):
|
||||
"serial_adapters": IOU_DEVICE_SETTINGS["serial_adapters"],
|
||||
"console": None}
|
||||
|
||||
#self._occupied_slots = []
|
||||
# self._occupied_slots = []
|
||||
self._addAdapters(2, 2)
|
||||
|
||||
# save the default settings
|
||||
@@ -79,8 +80,8 @@ class IOUDevice(Node):
|
||||
|
||||
nb_adapters = nb_ethernet_adapters + nb_serial_adapters
|
||||
for slot_number in range(0, nb_adapters):
|
||||
# if slot_number in self._occupied_slots:
|
||||
# continue
|
||||
# if slot_number in self._occupied_slots:
|
||||
# continue
|
||||
for port_number in range(0, 4):
|
||||
if slot_number < nb_ethernet_adapters:
|
||||
port = EthernetPort
|
||||
@@ -93,7 +94,7 @@ class IOUDevice(Node):
|
||||
new_port.setPortNumber(port_number)
|
||||
new_port.setSlotNumber(slot_number)
|
||||
new_port.setPacketCaptureSupported(True)
|
||||
#self._occupied_slots.append(slot_number)
|
||||
# self._occupied_slots.append(slot_number)
|
||||
self._ports.append(new_port)
|
||||
log.debug("port {} has been added".format(port_name))
|
||||
|
||||
@@ -106,8 +107,8 @@ class IOUDevice(Node):
|
||||
|
||||
for port in self._ports.copy():
|
||||
if (port.slotNumber() >= nb_ethernet_adapters and port.linkType() == "Ethernet") or \
|
||||
(port.slotNumber() >= nb_serial_adapters and port.linkType() == "Serial"):
|
||||
#self._occupied_slots.remove(port.slotNumber())
|
||||
(port.slotNumber() >= nb_serial_adapters and port.linkType() == "Serial"):
|
||||
# self._occupied_slots.remove(port.slotNumber())
|
||||
self._ports.remove(port)
|
||||
log.info("port {} has been removed".format(port.name()))
|
||||
|
||||
@@ -247,7 +248,7 @@ class IOUDevice(Node):
|
||||
params[name] = value
|
||||
|
||||
if "initial_config" in new_settings and self._settings["initial_config"] != new_settings["initial_config"] \
|
||||
and not self.server().isLocal() and os.path.isfile(new_settings["initial_config"]):
|
||||
and not self.server().isLocal() and os.path.isfile(new_settings["initial_config"]):
|
||||
params["initial_config_base64"] = self._base64Config(new_settings["initial_config"])
|
||||
|
||||
log.debug("{} is updating settings: {}".format(self.name(), params))
|
||||
@@ -281,7 +282,7 @@ class IOUDevice(Node):
|
||||
|
||||
if nb_adapters_changed:
|
||||
log.debug("number of adapters has changed: Ethernet={} Serial={}".format(self._settings["ethernet_adapters"], self._settings["serial_adapters"]))
|
||||
#TODO: dynamically add/remove adapters
|
||||
# TODO: dynamically add/remove adapters
|
||||
self._ports.clear()
|
||||
self._addAdapters(self._settings["ethernet_adapters"], self._settings["serial_adapters"])
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ from ..ui.iou_device_configuration_page_ui import Ui_iouDeviceConfigPageWidget
|
||||
|
||||
|
||||
class iouDeviceConfigurationPage(QtGui.QWidget, Ui_iouDeviceConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for IOU devices.
|
||||
"""
|
||||
|
||||
@@ -39,6 +39,7 @@ from ..dialogs.iou_device_wizard import IOUDeviceWizard
|
||||
|
||||
|
||||
class IOUDevicePreferencesPage(QtGui.QWidget, Ui_IOUDevicePreferencesPageWidget):
|
||||
|
||||
"""
|
||||
QWidget preference page for IOU image & device preferences.
|
||||
"""
|
||||
@@ -336,5 +337,5 @@ class IOUDevicePreferencesPage(QtGui.QWidget, Ui_IOUDevicePreferencesPageWidget)
|
||||
Saves the IOU devices preferences.
|
||||
"""
|
||||
|
||||
#self._iouImageSaveSlot()
|
||||
# self._iouImageSaveSlot()
|
||||
IOU.instance().setIOUDevices(self._iou_devices)
|
||||
|
||||
@@ -31,6 +31,7 @@ from ..settings import IOU_SETTINGS
|
||||
|
||||
|
||||
class IOUPreferencesPage(QtGui.QWidget, Ui_IOUPreferencesPageWidget):
|
||||
|
||||
"""
|
||||
QWidget preference page for IOU.
|
||||
"""
|
||||
@@ -52,7 +53,7 @@ class IOUPreferencesPage(QtGui.QWidget, Ui_IOUPreferencesPageWidget):
|
||||
self.uiUseLocalServercheckBox.stateChanged.connect(self._useLocalServerSlot)
|
||||
self.uiTestSettingsPushButton.clicked.connect(self._testSettingsSlot)
|
||||
|
||||
#FIXME: temporally hide test button
|
||||
# FIXME: temporally hide test button
|
||||
self.uiTestSettingsPushButton.hide()
|
||||
|
||||
def _iourcPathBrowserSlot(self):
|
||||
@@ -131,7 +132,7 @@ class IOUPreferencesPage(QtGui.QWidget, Ui_IOUPreferencesPageWidget):
|
||||
|
||||
if error:
|
||||
pass
|
||||
#log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
|
||||
# log.error("error while allocating an UDP port for {}: {}".format(self.name(), result["message"]))
|
||||
|
||||
print("Report received")
|
||||
print(result)
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_iouDeviceConfigPageWidget(object):
|
||||
|
||||
def setupUi(self, iouDeviceConfigPageWidget):
|
||||
iouDeviceConfigPageWidget.setObjectName(_fromUtf8("iouDeviceConfigPageWidget"))
|
||||
iouDeviceConfigPageWidget.resize(392, 473)
|
||||
@@ -196,4 +199,3 @@ class Ui_iouDeviceConfigPageWidget(object):
|
||||
self.uiSerialAdaptersLabel.setText(_translate("iouDeviceConfigPageWidget", "Serial adapters:", None))
|
||||
self.uiSerialAdaptersSpinBox.setToolTip(_translate("iouDeviceConfigPageWidget", "1 adapter egals 4 serial interfaces", None))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.tab_2), _translate("iouDeviceConfigPageWidget", "Network", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_IOUDevicePreferencesPageWidget(object):
|
||||
|
||||
def setupUi(self, IOUDevicePreferencesPageWidget):
|
||||
IOUDevicePreferencesPageWidget.setObjectName(_fromUtf8("IOUDevicePreferencesPageWidget"))
|
||||
IOUDevicePreferencesPageWidget.resize(684, 516)
|
||||
@@ -78,4 +81,3 @@ class Ui_IOUDevicePreferencesPageWidget(object):
|
||||
self.uiNewIOUDevicePushButton.setText(_translate("IOUDevicePreferencesPageWidget", "&New", None))
|
||||
self.uiEditIOUDevicePushButton.setText(_translate("IOUDevicePreferencesPageWidget", "&Edit", None))
|
||||
self.uiDeleteIOUDevicePushButton.setText(_translate("IOUDevicePreferencesPageWidget", "Delete", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_IOUDeviceWizard(object):
|
||||
|
||||
def setupUi(self, IOUDeviceWizard):
|
||||
IOUDeviceWizard.setObjectName(_fromUtf8("IOUDeviceWizard"))
|
||||
IOUDeviceWizard.resize(514, 366)
|
||||
@@ -123,4 +126,3 @@ class Ui_IOUDeviceWizard(object):
|
||||
self.uiIOUImageLabel.setText(_translate("IOUDeviceWizard", "IOU image:", None))
|
||||
self.uiIOUImageToolButton.setText(_translate("IOUDeviceWizard", "&Browse...", None))
|
||||
self.uiTypeLabel.setText(_translate("IOUDeviceWizard", "Type:", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_IOUPreferencesPageWidget(object):
|
||||
|
||||
def setupUi(self, IOUPreferencesPageWidget):
|
||||
IOUPreferencesPageWidget.setObjectName(_fromUtf8("IOUPreferencesPageWidget"))
|
||||
IOUPreferencesPageWidget.resize(432, 508)
|
||||
@@ -170,4 +173,3 @@ class Ui_IOUPreferencesPageWidget(object):
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.tab), _translate("IOUPreferencesPageWidget", "Advanced settings", None))
|
||||
self.uiTestSettingsPushButton.setText(_translate("IOUPreferencesPageWidget", "Test settings", None))
|
||||
self.uiRestoreDefaultsPushButton.setText(_translate("IOUPreferencesPageWidget", "Restore defaults", None))
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Module(QtCore.QObject):
|
||||
|
||||
"""
|
||||
Module interface.
|
||||
"""
|
||||
|
||||
@@ -35,6 +35,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Qemu(Module):
|
||||
|
||||
"""
|
||||
QEMU module.
|
||||
"""
|
||||
@@ -335,7 +336,7 @@ class Qemu(Module):
|
||||
"adapters": self._qemu_vms[vm]["adapters"],
|
||||
"adapter_type": self._qemu_vms[vm]["adapter_type"]}
|
||||
|
||||
#FIXME: this is ugly...
|
||||
# FIXME: this is ugly...
|
||||
if self._qemu_vms[vm]["hda_disk_image"]:
|
||||
settings["hda_disk_image"] = self._qemu_vms[vm]["hda_disk_image"]
|
||||
|
||||
@@ -453,8 +454,8 @@ class Qemu(Module):
|
||||
"default_symbol": qemu_vm["default_symbol"],
|
||||
"hover_symbol": qemu_vm["hover_symbol"],
|
||||
"categories": [qemu_vm["category"]]
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
return nodes
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -35,6 +35,7 @@ from ..settings import QEMU_BINARIES_FOR_CLOUD
|
||||
|
||||
|
||||
class QemuVMWizard(QtGui.QWizard, Ui_QemuVMWizard):
|
||||
|
||||
"""
|
||||
Wizard to create a Qemu VM.
|
||||
|
||||
@@ -239,7 +240,7 @@ class QemuVMWizard(QtGui.QWizard, Ui_QemuVMWizard):
|
||||
else:
|
||||
self.uiQemuListComboBox.addItem("{path}".format(path=qemu["path"]), qemu["path"])
|
||||
|
||||
is_64bit = sys.maxsize > 2**32
|
||||
is_64bit = sys.maxsize > 2 ** 32
|
||||
if sys.platform.startswith("win"):
|
||||
if self.uiTypeComboBox.currentText() != "Default" and (Qemu.instance().settings()["use_local_server"] or self.uiLocalRadioButton.isChecked()):
|
||||
search_string = "qemu.exe"
|
||||
@@ -273,10 +274,9 @@ class QemuVMWizard(QtGui.QWizard, Ui_QemuVMWizard):
|
||||
server = "local"
|
||||
elif self.uiRemoteRadioButton.isChecked():
|
||||
server = self.uiRemoteServersComboBox.currentText()
|
||||
else: # Cloud is selected
|
||||
else: # Cloud is selected
|
||||
server = "cloud"
|
||||
|
||||
|
||||
qemu_path = self.uiQemuListComboBox.itemData(self.uiQemuListComboBox.currentIndex())
|
||||
settings = {
|
||||
"name": self.uiNameLineEdit.text(),
|
||||
@@ -322,7 +322,7 @@ class QemuVMWizard(QtGui.QWizard, Ui_QemuVMWizard):
|
||||
settings["category"] = Node.end_devices
|
||||
|
||||
if self.uiTypeComboBox.currentText() != "Default":
|
||||
if not "options" in settings:
|
||||
if "options" not in settings:
|
||||
settings["options"] = ""
|
||||
if server == "local" and (sys.platform.startswith("win") and qemu_path.endswith("qemu.exe")) or (sys.platform.startswith("darwin") and "GNS3.app" in qemu_path):
|
||||
settings["options"] += " -vga none -vnc none"
|
||||
|
||||
@@ -28,6 +28,7 @@ from ..settings import QEMU_SETTINGS
|
||||
|
||||
|
||||
class QemuPreferencesPage(QtGui.QWidget, Ui_QemuPreferencesPageWidget):
|
||||
|
||||
"""
|
||||
QWidget preference page for QEMU.
|
||||
"""
|
||||
|
||||
@@ -37,6 +37,7 @@ from ..settings import QEMU_BINARIES_FOR_CLOUD
|
||||
|
||||
|
||||
class QemuVMConfigurationPage(QtGui.QWidget, Ui_QemuVMConfigPageWidget):
|
||||
|
||||
"""
|
||||
QWidget configuration page for QEMU VMs.
|
||||
"""
|
||||
|
||||
@@ -37,8 +37,8 @@ from ..pages.qemu_vm_configuration_page import QemuVMConfigurationPage
|
||||
from ..dialogs.qemu_vm_wizard import QemuVMWizard
|
||||
|
||||
|
||||
|
||||
class QemuVMPreferencesPage(QtGui.QWidget, Ui_QemuVMPreferencesPageWidget):
|
||||
|
||||
"""
|
||||
QWidget preference page for QEMU VM preferences.
|
||||
"""
|
||||
|
||||
@@ -29,6 +29,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class QemuVM(Node):
|
||||
|
||||
"""
|
||||
QEMU VM.
|
||||
|
||||
@@ -233,7 +234,7 @@ class QemuVM(Node):
|
||||
|
||||
if nb_adapters_changed:
|
||||
log.debug("number of adapters has changed to {}".format(self._settings["adapters"]))
|
||||
#TODO: dynamically add/remove adapters
|
||||
# TODO: dynamically add/remove adapters
|
||||
self._ports.clear()
|
||||
self._addAdapters(self._settings["adapters"])
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ QEMU_VM_SETTING_TYPES = {
|
||||
|
||||
# Use a hardcoded list of binaries rather than a dynamic one so the user
|
||||
# doesn't require a running cloud instance to upload qemu images.
|
||||
QEMU_BINARIES_FOR_CLOUD = [
|
||||
QEMU_BINARIES_FOR_CLOUD = sorted([
|
||||
"qemu-system-arm",
|
||||
"qemu-system-microblaze",
|
||||
"qemu-system-mipsel",
|
||||
@@ -112,5 +112,4 @@ QEMU_BINARIES_FOR_CLOUD = [
|
||||
"qemu-system-ppc64",
|
||||
"qemu-system-sparc",
|
||||
"qemu-system-xtensaeb",
|
||||
]
|
||||
QEMU_BINARIES_FOR_CLOUD.sort()
|
||||
])
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_QemuPreferencesPageWidget(object):
|
||||
|
||||
def setupUi(self, QemuPreferencesPageWidget):
|
||||
QemuPreferencesPageWidget.setObjectName(_fromUtf8("QemuPreferencesPageWidget"))
|
||||
QemuPreferencesPageWidget.resize(432, 586)
|
||||
@@ -159,4 +162,3 @@ class Ui_QemuPreferencesPageWidget(object):
|
||||
self.uiUDPPortRangeLabel.setText(_translate("QemuPreferencesPageWidget", "to", None))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiAdvancedSettingsTabWidget), _translate("QemuPreferencesPageWidget", "Advanced settings", None))
|
||||
self.uiRestoreDefaultsPushButton.setText(_translate("QemuPreferencesPageWidget", "Restore defaults", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_QemuVMConfigPageWidget(object):
|
||||
|
||||
def setupUi(self, QemuVMConfigPageWidget):
|
||||
QemuVMConfigPageWidget.setObjectName(_fromUtf8("QemuVMConfigPageWidget"))
|
||||
QemuVMConfigPageWidget.resize(486, 407)
|
||||
@@ -274,4 +277,3 @@ class Ui_QemuVMConfigPageWidget(object):
|
||||
self.groupBox.setTitle(_translate("QemuVMConfigPageWidget", "Aditional settings", None))
|
||||
self.uiQemuOptionsLabel.setText(_translate("QemuVMConfigPageWidget", "Options:", None))
|
||||
self.uiQemutabWidget.setTabText(self.uiQemutabWidget.indexOf(self.tab_2), _translate("QemuVMConfigPageWidget", "Advanced settings", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_QemuVMPreferencesPageWidget(object):
|
||||
|
||||
def setupUi(self, QemuVMPreferencesPageWidget):
|
||||
QemuVMPreferencesPageWidget.setObjectName(_fromUtf8("QemuVMPreferencesPageWidget"))
|
||||
QemuVMPreferencesPageWidget.resize(706, 543)
|
||||
@@ -79,4 +82,3 @@ class Ui_QemuVMPreferencesPageWidget(object):
|
||||
self.uiNewQemuVMPushButton.setText(_translate("QemuVMPreferencesPageWidget", "&New", None))
|
||||
self.uiEditQemuVMPushButton.setText(_translate("QemuVMPreferencesPageWidget", "&Edit", None))
|
||||
self.uiDeleteQemuVMPushButton.setText(_translate("QemuVMPreferencesPageWidget", "&Delete", None))
|
||||
|
||||
|
||||
@@ -17,13 +17,16 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_QemuVMWizard(object):
|
||||
|
||||
def setupUi(self, QemuVMWizard):
|
||||
QemuVMWizard.setObjectName(_fromUtf8("QemuVMWizard"))
|
||||
QemuVMWizard.resize(514, 366)
|
||||
@@ -222,4 +225,3 @@ class Ui_QemuVMWizard(object):
|
||||
self.uiDiskImageHdbWizardPage.setSubTitle(_translate("QemuVMWizard", "Please add an additional disk image for IDS.", None))
|
||||
self.uiHdbDiskImageLabel.setText(_translate("QemuVMWizard", "Disk image (hdb):", None))
|
||||
self.uiHdbDiskImageToolButton.setText(_translate("QemuVMWizard", "&Browse...", None))
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class VirtualBox(Module):
|
||||
|
||||
"""
|
||||
VirtualBox module.
|
||||
"""
|
||||
|
||||
@@ -31,6 +31,7 @@ from .. import VirtualBox
|
||||
|
||||
|
||||
class VirtualBoxVMWizard(QtGui.QWizard, Ui_VirtualBoxVMWizard):
|
||||
|
||||
"""
|
||||
Wizard to create a VirtualBox VM.
|
||||
|
||||
@@ -105,7 +106,7 @@ class VirtualBoxVMWizard(QtGui.QWizard, Ui_VirtualBoxVMWizard):
|
||||
|
||||
if self.currentPage() == self.uiServerWizardPage:
|
||||
|
||||
#FIXME: prevent users to use "cloud"
|
||||
# FIXME: prevent users to use "cloud"
|
||||
if self.uiCloudRadioButton.isChecked():
|
||||
QtGui.QMessageBox.critical(self, "Cloud", "Sorry not implemented yet!")
|
||||
return False
|
||||
|
||||
@@ -28,6 +28,7 @@ from ..settings import VBOX_SETTINGS
|
||||
|
||||
|
||||
class VirtualBoxPreferencesPage(QtGui.QWidget, Ui_VirtualBoxPreferencesPageWidget):
|
||||
|
||||
"""
|
||||
QWidget preference page for VirtualBox.
|
||||
"""
|
||||
@@ -42,7 +43,7 @@ class VirtualBoxPreferencesPage(QtGui.QWidget, Ui_VirtualBoxPreferencesPageWidge
|
||||
self.uiRestoreDefaultsPushButton.clicked.connect(self._restoreDefaultsSlot)
|
||||
self.uiVboxManagePathToolButton.clicked.connect(self._vboxPathBrowserSlot)
|
||||
|
||||
#FIXME: temporally hide test button
|
||||
# FIXME: temporally hide test button
|
||||
self.uiTestSettingsPushButton.hide()
|
||||
|
||||
def _vboxPathBrowserSlot(self):
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user