1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-01 04:38:12 +00:00

Grid size support for projects.

This commit is contained in:
grossmj 2018-04-13 16:54:57 +08:00
parent 9adfb1820d
commit 2de182eff4
4 changed files with 36 additions and 1 deletions

View File

@ -68,7 +68,7 @@ class Project:
def __init__(self, name=None, project_id=None, path=None, controller=None, status="opened", def __init__(self, name=None, project_id=None, path=None, controller=None, status="opened",
filename=None, auto_start=False, auto_open=False, auto_close=True, filename=None, auto_start=False, auto_open=False, auto_close=True,
scene_height=1000, scene_width=2000, zoom=100, show_layers=False, snap_to_grid=False, show_grid=False, scene_height=1000, scene_width=2000, zoom=100, show_layers=False, snap_to_grid=False, show_grid=False,
show_interface_labels=False): grid_size=0, show_interface_labels=False):
self._controller = controller self._controller = controller
assert name is not None assert name is not None
@ -83,6 +83,7 @@ class Project:
self._show_layers = show_layers self._show_layers = show_layers
self._snap_to_grid = snap_to_grid self._snap_to_grid = snap_to_grid
self._show_grid = show_grid self._show_grid = show_grid
self._grid_size = grid_size
self._show_interface_labels = show_interface_labels self._show_interface_labels = show_interface_labels
self._loading = False self._loading = False
@ -235,6 +236,21 @@ class Project:
""" """
self._show_grid = show_grid self._show_grid = show_grid
@property
def grid_size(self):
"""
Grid size
:return: integer
"""
return self._grid_size
@grid_size.setter
def grid_size(self, grid_size):
"""
Setter for grid size
"""
self._grid_size = grid_size
@property @property
def show_interface_labels(self): def show_interface_labels(self):
""" """
@ -760,6 +776,7 @@ class Project:
"show_layers", "show_layers",
"snap_to_grid", "snap_to_grid",
"show_grid", "show_grid",
"grid_size",
"show_interface_labels" "show_interface_labels"
] ]
@ -999,6 +1016,7 @@ class Project:
"show_layers": self._show_layers, "show_layers": self._show_layers,
"snap_to_grid": self._snap_to_grid, "snap_to_grid": self._snap_to_grid,
"show_grid": self._show_grid, "show_grid": self._show_grid,
"grid_size": self._grid_size,
"show_interface_labels": self._show_interface_labels "show_interface_labels": self._show_interface_labels
} }

View File

@ -83,6 +83,7 @@ def project_to_topology(project):
"show_layers": project.show_layers, "show_layers": project.show_layers,
"snap_to_grid": project.snap_to_grid, "snap_to_grid": project.snap_to_grid,
"show_grid": project.show_grid, "show_grid": project.show_grid,
"grid_size": project.grid_size,
"show_interface_labels": project.show_interface_labels, "show_interface_labels": project.show_interface_labels,
"topology": { "topology": {
"nodes": [], "nodes": [],

View File

@ -66,6 +66,10 @@ PROJECT_CREATE_SCHEMA = {
"type": "boolean", "type": "boolean",
"description": "Show the grid on the drawing area" "description": "Show the grid on the drawing area"
}, },
"grid_size": {
"type": "integer",
"description": "Grid size for the drawing area"
},
"show_interface_labels": { "show_interface_labels": {
"type": "boolean", "type": "boolean",
"description": "Show interface labels on the drawing area" "description": "Show interface labels on the drawing area"
@ -125,6 +129,10 @@ PROJECT_UPDATE_SCHEMA = {
"type": "boolean", "type": "boolean",
"description": "Show the grid on the drawing area" "description": "Show the grid on the drawing area"
}, },
"grid_size": {
"type": "integer",
"description": "Grid size for the drawing area"
},
"show_interface_labels": { "show_interface_labels": {
"type": "boolean", "type": "boolean",
"description": "Show interface labels on the drawing area" "description": "Show interface labels on the drawing area"
@ -200,6 +208,10 @@ PROJECT_OBJECT_SCHEMA = {
"type": "boolean", "type": "boolean",
"description": "Show the grid on the drawing area" "description": "Show the grid on the drawing area"
}, },
"grid_size": {
"type": "integer",
"description": "Grid size for the drawing area"
},
"show_interface_labels": { "show_interface_labels": {
"type": "boolean", "type": "boolean",
"description": "Show interface labels on the drawing area" "description": "Show interface labels on the drawing area"

View File

@ -89,6 +89,10 @@ TOPOLOGY_SCHEMA = {
"type": "boolean", "type": "boolean",
"description": "Show the grid on the drawing area" "description": "Show the grid on the drawing area"
}, },
"grid_size": {
"type": "integer",
"description": "Grid size for the drawing area"
},
"show_interface_labels": { "show_interface_labels": {
"type": "boolean", "type": "boolean",
"description": "Show interface labels on the drawing area" "description": "Show interface labels on the drawing area"