Compare commits

...

2102 Commits

Author SHA1 Message Date
Jeremy Grossmann
5f34eb18d1 Merge pull request #3829 from GNS3/release/v2.2.59
Release v2.2.59
2026-05-08 20:06:01 +08:00
grossmj
3a822c02b2 Merge branch 'master' into 2.2 2026-05-08 19:49:31 +08:00
grossmj
84967d4c87 Release v2.2.59 2026-05-08 19:06:04 +08:00
grossmj
6981870554 Update requirements.txt & python_requires 2026-05-08 17:01:14 +08:00
grossmj
7c06038072 Remove psutil version check 2026-05-08 16:41:46 +08:00
grossmj
86be15d474 Fix remaining PyQt6 compatibility issues. Fixes #3822 2026-05-08 13:00:37 +08:00
grossmj
2c64f83d05 Add --title to remote-viewer console commands. Fixes #3783 2026-05-08 12:54:06 +08:00
grossmj
6cc024ed91 Fix deleting drawings. Ref #3810 2026-04-13 12:03:49 +08:00
Jeremy Grossmann
607343292b Merge pull request #3821 from GNS3/release/v2.2.58.1
Release v2.2.58.1
2026-04-12 21:18:16 +08:00
grossmj
03f74d77e4 Development on 2.2.59.dev2 2026-04-12 21:17:21 +08:00
grossmj
1cf86ed4b5 Release v2.2.58.1 2026-04-12 20:59:21 +08:00
Jeremy Grossmann
c4570098a4 Merge pull request #3820 from GNS3/fix/v2.2.58
Fix callback issues in v2.2.58
2026-04-12 20:55:27 +08:00
grossmj
45fe2189f9 Fix tests 2026-04-12 20:53:28 +08:00
grossmj
852ebddf3b Fix callback issues in v2.2.58 2026-04-12 20:49:20 +08:00
grossmj
7baf6af346 Merge branch 'master' into 2.2 2026-04-12 20:35:12 +08:00
grossmj
030c6a4d6d Development on 2.2.59.dev1 2026-04-11 18:05:54 +08:00
Jeremy Grossmann
39759e2da0 Merge pull request #3816 from GNS3/release/v2.2.58
Release v2.2.58
2026-04-11 18:02:02 +08:00
grossmj
9447f21de8 Fix tests 2026-04-11 17:59:48 +08:00
Jeremy Grossmann
0fe25f61b3 Merge branch 'master' into release/v2.2.58 2026-04-11 17:43:12 +08:00
grossmj
96aa00f33b Fix running tests 2026-04-11 17:37:04 +08:00
grossmj
05813736ee Release v2.2.58 2026-04-10 20:36:01 +08:00
grossmj
adf0ed84f4 Update snapshot date & time format 2026-04-09 20:22:39 +08:00
grossmj
5f5c128183 Finish to fix HTTP DELETE requests are silently dropped. Fixes #3810 2026-04-07 23:23:26 +08:00
grossmj
a016726bb1 Fix bug when HTTP DELETE requests are silently dropped. Fixes #3810 2026-04-07 21:44:06 +08:00
grossmj
ec5e0071f8 Fix debug message in http_client.py 2026-04-07 19:12:53 +08:00
Jeremy Grossmann
af2bf23abb Merge pull request #3814 from GNS3/enhancement/3754
Show if a linked base VM or not in device's properties
2026-04-06 23:11:32 +08:00
grossmj
da7a95da97 Show if a linked base VM or not in device's properties 2026-04-06 23:08:09 +08:00
grossmj
da9c36f476 Add HTTP method to response timeout slot. Ref #3810 2026-04-06 22:34:05 +08:00
Jeremy Grossmann
cd7e9221fd Merge pull request #3813 from GNS3/enhancement/3396
Add default link style section in preferences
2026-04-06 19:16:15 +08:00
grossmj
e6c5e2101b Add default link style section in preferences
Update the default style colors based on the interface style
2026-04-06 19:11:45 +08:00
grossmj
5e225020e0 Support bring to front for vnc and spice consoles on Linux. Fixes #3783 2026-04-05 22:40:18 +08:00
grossmj
adb8d37a91 Update appliance schemas 2026-04-04 19:38:57 +08:00
grossmj
f356c743c7 Fix bug when adding multiple nodes at the same time. Fixes #3807 2026-03-25 08:52:32 +08:00
Jeremy Grossmann
e5e9eb02bc Merge pull request #3805 from GNS3/release/v2.2.57
Release v2.2.57
2026-03-24 10:10:28 +08:00
grossmj
898a03f676 Fix QWebSocket error signal. Fixes #3804 2026-03-24 10:07:44 +08:00
grossmj
6a033658ef Fix QWebSocket error signal. Fixes #3804 2026-03-24 09:16:07 +08:00
grossmj
d56b9660c9 Development on 2.2.58.dev1 2026-03-24 08:35:52 +08:00
grossmj
3709b7646d Release v2.2.57 2026-03-23 09:45:47 +08:00
Jeremy Grossmann
b1af4c7f8b Merge pull request #3798 from GNS3/bugfix/3794
Fix error reporting after PyQt6 migration
2026-03-21 10:38:05 +08:00
grossmj
a6e26d8ea9 Fix errors from controller are not reported 2026-03-21 10:31:22 +08:00
grossmj
c98e0753f2 Deactivate 'use default IOU values' by default and update RAM/NVRAM values 2026-03-10 23:33:15 +08:00
grossmj
f34af19101 Fix QMenu parents 2026-02-20 19:07:15 +08:00
grossmj
fb984e5e89 Fix UltraVNC preconfigured command 2026-02-20 16:40:22 +08:00
grossmj
c4deabc3fa Merge branch 'master' into 2.2
# Conflicts:
#	gns3/graphics_view.py
2026-02-20 16:24:41 +08:00
Jeremy Grossmann
05927453b3 Merge pull request #3753 from hjicks/master
settings.py: add OpenBSD packet capture command
2026-02-19 21:20:21 +08:00
grossmj
bc4e5f7300 Add missing QDarkStyle in requirements.txt 2026-02-18 22:56:52 +08:00
grossmj
9568f08058 Backport: dark style 2026-02-18 22:56:45 +08:00
grossmj
b3a4822335 Fix bug when dragging scene 2026-02-18 22:54:27 +08:00
grossmj
699ad62b54 Upgrade pytest and jsonschema dependencies 2026-02-11 17:42:11 +08:00
Jeremy Grossmann
8a24ff6aa8 Merge pull request #3780 from GNS3/release/v2.2.56.1
Release v2.2.56.1
2026-02-11 16:53:04 +08:00
grossmj
2c0f925d5f Merge remote-tracking branch 'origin/2.2' into 2.2 2026-02-11 16:47:31 +08:00
grossmj
457bc6823d Upgrade sentry-sdk and psutil dependencies 2026-02-11 16:46:25 +08:00
Jeremy Grossmann
9e89bb6971 Merge pull request #3785 from anthonyroussel/fix-qt6-tests
Fix tests after PyQt6 migration
2026-02-05 16:58:13 +08:00
Anthony ROUSSEL
e6e2a1cafb Fix tests after PyQt6 migration 2026-02-04 21:06:12 +01:00
Jeremy Grossmann
d60908897f Merge pull request #3784 from mrognor/master
Fix mouse manipulation bug
2026-02-03 21:08:49 +08:00
mrognor
5b7a25c8a7 Fix mouse manipulation bug 2026-02-03 16:03:12 +03:00
Jeremy Grossmann
93a9e44afe Merge pull request #3778 from SalehAlolayan/master
Fixing tab name in Superputty + Adding Superputty VNC support
2026-02-01 11:53:42 +08:00
Saleh Alolayan
2168af80c7 Add Multi VNC tab handling in Superputty 2026-01-30 23:39:58 +03:00
grossmj
00929a2c71 Development on 2.2.57.dev2 2026-01-28 18:44:51 +08:00
grossmj
8b2b639c1b Release v2.2.56.1 2026-01-28 17:00:07 +08:00
grossmj
92e5b06534 Fix line style support for links 2026-01-28 16:50:06 +08:00
grossmj
5e14bbf488 Merge branch 'master' into 2.2 2026-01-28 15:59:57 +08:00
grossmj
c4881446e1 Fix cannot add IOS. Ref #3779 2026-01-27 22:01:55 +08:00
grossmj
cce0bd4009 Fix cannot add IOU. Fixes #3779 2026-01-27 21:55:30 +08:00
Saleh Alolayan
b7cd582384 Handling space in name for Superputty 2026-01-25 20:25:08 +03:00
Saleh Alolayan
265d1c5934 Merge branch 'GNS3:master' into master 2026-01-24 21:25:40 +03:00
Saleh Alolayan
9d14aab04a Fixing tab name in Superputty + Adding Superputty VNC support
Fixing tab name in Superputty + Adding Superputty VNC support
2026-01-24 21:24:34 +03:00
grossmj
de5ad831e2 Upgrade dependencies 2026-01-24 19:21:41 +08:00
grossmj
8593357ab0 Drop Python 3.8 support 2026-01-24 18:52:09 +08:00
grossmj
5b2a102ef4 Development on 2.2.57.dev1 2026-01-24 16:53:48 +08:00
Jeremy Grossmann
5c57de7550 Merge pull request #3775 from GNS3/release/v2.2.56
Release v2.2.56
2026-01-24 16:49:19 +08:00
grossmj
48b0e96e37 Display a warning if SVG image format isn't supported 2026-01-24 01:14:12 +08:00
grossmj
702709b7f9 Fix error in profile selection window after PyQt6 migration 2026-01-23 18:46:49 +08:00
grossmj
b2b50ce273 Release v2.2.56 2026-01-21 22:15:17 +08:00
grossmj
fe2537319b Merge remote-tracking branch 'origin/master' into 2.2 2026-01-17 18:38:34 +08:00
grossmj
ec5800d7fc Fix XDG Config Home support.Fixes #3770 2026-01-17 18:35:53 +08:00
grossmj
ce4b74e4ea Merge remote-tracking branch 'origin/master' into 2.2 2026-01-17 18:29:24 +08:00
grossmj
b3579861d3 Fix double click on device view 2026-01-17 18:19:47 +08:00
grossmj
37ffd741e3 Revert "MacOS testing, disable startup loading"
This reverts commit 6a91bf22f1.
2026-01-09 17:38:13 +08:00
grossmj
6a91bf22f1 MacOS testing, disable startup loading 2026-01-09 17:05:48 +08:00
Jeremy Grossmann
8dc3ef0784 Merge pull request #3773 from SalehAlolayan/master
Fixing tab name in MobaXterm
2026-01-09 15:34:53 +08:00
Saleh Alolayan
862f77fa7b Fixing tab name in MobaXterm 2026-01-02 00:28:32 +03:00
grossmj
55d08125d5 Use pyrcc5 to compile resources 2025-12-16 19:00:17 +08:00
grossmj
81fe00bd31 Add old resources_rc.py 2025-12-16 18:32:18 +08:00
grossmj
0f613c03c6 Reset fonts in preferences.
Ref https://github.com/GNS3/gns3-gui/issues/3547#issuecomment-3659410038
2025-12-16 17:41:53 +08:00
grossmj
64eb41d275 FollowRedirectsAttribute is not supported in Qt6.
Ref https://github.com/GNS3/gns3-gui/issues/3547#issuecomment-3659410038
2025-12-16 17:41:05 +08:00
grossmj
52feb4a07b Development on v2.2.56.dev1 2025-12-16 16:46:35 +08:00
grossmj
b2c5ed755e Fix small issues after PyQt6 migration 2025-12-16 13:19:17 +08:00
Jeremy Grossmann
1219877a90 Merge pull request #3767 from GNS3/pyqt6-migration
PyQt6 migration
2025-12-15 19:42:19 +08:00
grossmj
1cdec97a12 Finalizing PyQt6 migration 2025-12-15 19:27:55 +08:00
grossmj
e6a083eb0e Fix event position issues 2025-12-14 19:52:17 +08:00
grossmj
370dd6ed82 Base migration to PyQt6 2025-12-14 18:19:47 +08:00
Jeremy Grossmann
d892b77012 Merge pull request #3766 from fluoriteByte/master
Add XDG Config Home support
2025-12-13 19:34:58 +10:00
illy
07a8657ec1 Add XDG Config Home support 2025-12-06 03:06:35 +01:00
grossmj
e224a9ac29 Release v2.2.55 2025-11-19 12:13:57 +10:00
grossmj
5b87f36cfd Fix SyntaxWarning: invalid escape sequence. Fixes #3760 2025-11-17 11:47:55 +10:00
grossmj
a9354da184 Support for Python 3.14 2025-11-16 19:30:47 +10:00
grossmj
91d7ed187b Upgrade dependencies 2025-11-16 19:16:44 +10:00
saeed
740fdc40c5 settings.py: add OpenBSD packet capture command 2025-09-05 16:43:33 +03:30
grossmj
0f8724edc4 Merge branch 'master' into 2.2 2025-09-01 18:42:19 +02:00
grossmj
4e7f480af4 Upgrade pywin32 package 2025-08-30 22:02:16 +02:00
grossmj
5ce4863baa Upgrade sentry-sdk package 2025-08-30 21:51:24 +02:00
Jeremy Grossmann
bb5bfee256 Merge pull request #3740 from Raizo62/master
"console connect to all nodes" is now case-insensitively
2025-07-12 18:41:36 +02:00
Raizo62
0a74872ea2 Clicking the "console connect to all nodes" opens all consoles in name order with case-insensitively
ChatGPT : Use `sorted(nodes.keys(), key=str.casefold)` instead of simple sorted()
to ensure case-insensitive ordering. Improves UX by merging uppercase
and lowercase entries seamlessly. Python 3.11+ recommended approach.
2025-06-21 12:00:12 +02:00
grossmj
20ed599e65 Merge branch 'master' into 2.2 2025-05-13 20:48:44 +02:00
grossmj
2722b2854b Development on 2.2.55.dev1 2025-04-21 19:35:19 +07:00
Jeremy Grossmann
6b32d8bad6 Merge pull request #3727 from GNS3/release/v2.2.54
Release v2.2.54
2025-04-21 19:30:42 +07:00
grossmj
fcf62fc507 Release v2.2.54 2025-04-21 17:15:26 +07:00
grossmj
c811c270ec Merge branch 'master' into 2.2 2025-04-21 17:08:42 +07:00
grossmj
dbc519e0af Development on 2.2.54.dev1 2025-04-18 15:05:37 +07:00
grossmj
bcbf8be182 Replace "Docker hub" by "Docker repository" because it is possible to use different repositories 2025-04-16 17:42:44 +07:00
grossmj
43df10520f Upgrade dependencies 2025-04-16 17:08:13 +07:00
grossmj
55b37716a3 Fix bring console in front when clicking on "Open all consoles". Fixes #3706 2025-04-16 16:55:11 +07:00
grossmj
e08253e362 Add -F arg to wmctrl. Ref #3706 2025-02-16 00:10:10 +10:00
Jeremy Grossmann
b9a59183a1 Merge pull request #3699 from GNS3/release/v2.2.53
Release v2.2.53
2025-01-21 09:46:53 +07:00
grossmj
342ca95bd2 Release v2.2.53 2025-01-21 11:52:12 +10:00
grossmj
187ef561fd Update file browser filters for all files and IOU images 2025-01-07 11:32:17 +07:00
grossmj
97070718fa Upgrade dependencies 2024-12-30 10:49:40 +07:00
grossmj
9466b2a1fb Merge branch 'master' into 2.2 2024-12-28 18:03:26 +07:00
grossmj
3edde1274b Fix Linux Mint default terminal configuration 2024-12-25 22:14:25 +07:00
Jeremy Grossmann
e17e7fc033 Merge pull request #3672 from ob7/enable-css-grid-colors
Add CSS Grid Color Customization Support
2024-12-02 19:56:29 +10:00
ob7
bfe11d7976 apply grid color via css property 2024-12-02 00:13:01 -09:00
Jeremy Grossmann
2b98d51ff7 Merge pull request #3668 from GNS3/release/v2.2.52
release/v2.2.52
2024-12-02 11:35:42 +10:00
grossmj
f6fb0100e2 Development on 2.2.53.dev1 2024-12-02 11:34:00 +10:00
grossmj
804b871cd6 Release v2.2.52 2024-12-02 11:14:23 +10:00
grossmj
c604ff70c7 Change title of QMessageBox 2024-12-02 10:55:49 +10:00
grossmj
63a7f36cfe Add iol extension filter. Ref #3664 2024-11-25 10:59:00 +10:00
grossmj
731fee1217 Remove maximum 64GB RAM limitation for QEMU VMs. Fixes #3658 2024-11-18 14:56:00 +10:00
Jeremy Grossmann
714dae44f3 Merge pull request #3659 from GNS3/feature/bring-to-front-linux
Bring to front support for consoles on Linux.
2024-11-10 18:26:21 +10:00
grossmj
c67dc19ec8 Bring to front support for consoles on Linux. 2024-11-10 18:23:01 +10:00
grossmj
1c5f6b362b Relax setuptools requirement to allow for easier Debian packaging on Ubuntu Focal & Jammy 2024-11-08 12:46:56 +10:00
grossmj
683400c204 Development on 2.2.52.dev1 2024-11-07 23:13:31 +10:00
Jeremy Grossmann
5efb3019f4 Merge pull request #3656 from GNS3/release/v2.2.51
release/v2.2.51
2024-11-07 23:13:11 +10:00
grossmj
23e0520cd2 Release v2.2.51 2024-11-07 15:08:27 +10:00
grossmj
1199de27df Merge branch 'master' into 2.2 2024-10-28 17:32:19 +10:00
grossmj
b3140f9d8e Python 3.13 support 2024-10-26 18:38:07 +10:00
grossmj
1b50cdc341 Upgrade dependencies 2024-10-26 18:22:40 +10:00
Jeremy Grossmann
bd15734c30 Merge pull request #3649 from ob7/add-link-shortcut-key
Add Keyboard Shortcut (Ctrl+L) for Add Link Tool
2024-10-24 21:23:15 +10:00
ob7
24fff8972a Add keyboard shortcut for Add Link 2024-10-23 17:13:17 -08:00
grossmj
9614a1253c Development on 2.2.51.dev1 2024-10-21 13:24:14 +10:00
Jeremy Grossmann
a3a0be863e Merge pull request #3644 from GNS3/2.2
Release v2.2.50
2024-10-21 13:22:00 +10:00
grossmj
9b5713df03 Release v2.2.50 2024-10-21 12:14:18 +10:00
grossmj
6df7dc4730 Replace AppVeyor testing with GH Actions 2024-10-19 16:07:54 +10:00
grossmj
e84ef8bf13 Fix issue when pid file contains invalid data 2024-10-16 16:28:46 +10:00
grossmj
f7703e3fa2 Add comment to indicate sentry-sdk is optional. Ref https://github.com/GNS3/gns3-server/issues/2423 2024-10-14 17:46:53 +10:00
grossmj
de8b9bc8f1 Fix f-string syntax error. Fixes #3639 2024-09-28 11:20:39 +07:00
grossmj
f21a530729 Improve information provided when uploading invalid appliance image. Fixes #3637 2024-09-26 16:14:02 +07:00
grossmj
be2b5eecf6 Use "experimental features" option to force listening for HTTP notification streams. Ref #3579 2024-09-24 12:25:26 +07:00
Jeremy Grossmann
2d4f6e6ecf Merge pull request #3635 from GNS3/revert-3633-backport-aux-console-support
Revert "Backport auxiliary console support for Qemu, Docker and Dynamips nodes"
2024-09-23 13:15:32 +07:00
Jeremy Grossmann
c152de84de Revert "Backport auxiliary console support for Qemu, Docker and Dynamips nodes" 2024-09-23 13:11:23 +07:00
Jeremy Grossmann
d34e7b377c Merge pull request #3633 from GNS3/backport-aux-console-support
Backport auxiliary console support for Qemu, Docker and Dynamips nodes
2024-09-22 21:44:25 +07:00
grossmj
74c55241cf Backport auxiliary console support for Qemu, Docker and Dynamips nodes 2024-09-22 18:29:05 +07:00
grossmj
6edb9c9303 Fix to allow packet capture on more than 6 links. Fixes #3594 2024-09-21 16:40:22 +07:00
grossmj
5d14dd9ab8 Merge branch 'master' into 2.2 2024-09-18 17:14:33 +07:00
Jeremy Grossmann
0c7cae2222 Merge pull request #3632 from GNS3/docker-mac-address
Support for custom MAC addresses in Docker containers
2024-09-18 04:05:46 -06:00
grossmj
9b882924c0 Support for configuring MAC address in Docker containers 2024-09-18 16:30:22 +07:00
Jeremy Grossmann
fccfc01f2e Merge pull request #3630 from griffi-gh/patch-1
Add KRDC to pre-configured VNC console commands
2024-09-12 12:08:38 -06:00
griffi-gh
46872c664d Add KRDC to pre-configured VNC console commands 2024-09-12 17:37:16 +02:00
grossmj
89166b9d35 Development on 2.2.50.dev1 2024-08-06 20:33:55 +02:00
Jeremy Grossmann
d0421e8b1f Merge pull request #3616 from GNS3/2.2
Release v2.2.49
2024-08-06 20:32:46 +02:00
grossmj
b35ce7303d Release v2.2.49 2024-08-06 12:55:15 +02:00
grossmj
47432568e6 Upgrade development packages 2024-08-03 12:32:43 +02:00
grossmj
42ea34ca6c Upgrade jsonschema and sentry-sdk packages 2024-08-03 11:57:15 +02:00
grossmj
9f3598d36d Upgrade to PyQt5 v5.15.11 2024-08-03 11:55:40 +02:00
grossmj
8df248a1e6 Add shortcuts info dialog 2024-07-27 16:23:23 +02:00
grossmj
7196aeb3cf Merge branch 'master' into 2.2 2024-07-27 15:46:14 +02:00
Jeremy Grossmann
38657f4112 Merge pull request #3612 from braza2004/master
Control menu Shortcut Keys
2024-07-27 15:43:53 +02:00
Bilal
84017fa0f1 modified Control menu shortcuts further 2024-07-24 07:05:38 +00:00
Bilal
3aa5a5369f modified Control menu shortcuts 2024-07-24 07:02:14 +00:00
athaarnaqvi
0ed791b946 Added Key Shortcuts 2024-07-23 16:59:55 +05:00
Jeremy Grossmann
133732b7ae Merge pull request #3608 from braza2004/FitInViewKeyShortcut
Fit In View Shortcut Key
2024-07-22 23:27:11 +02:00
grossmj
2ed48def9f Add Fit In View Shortcut in Ui file instead 2024-07-22 23:25:05 +02:00
grossmj
279a91d402 Fix tests. Fixes #3605 2024-07-22 18:58:32 +02:00
Bilal_Raza
4906678d13 feature/FitInViewShortcut 2024-07-22 16:53:58 +05:00
grossmj
a5ff9318f0 Development on 2.2.49.dev1 2024-07-13 16:32:13 +02:00
Jeremy Grossmann
faa802d59c Merge pull request #3597 from GNS3/release/v2.2.48.1
Release v2.2.48.1
2024-07-13 14:43:39 +02:00
grossmj
01b5b8bfa8 Release v2.2.48.1 2024-07-12 18:26:17 +02:00
grossmj
b22c5c8442 Development on 2.2.49.dev1 2024-07-09 00:32:45 +02:00
Jeremy Grossmann
141e7d8307 Merge pull request #3592 from GNS3/2.2
Release v2.2.48
2024-07-09 00:31:15 +02:00
grossmj
1e80354e4e Release v2.2.48 2024-07-08 18:44:09 +02:00
grossmj
d340b1f50a Use "experimental features" to allow bypassing hostname validation. Ref #3524 2024-07-08 14:19:42 +02:00
grossmj
d7bb195610 Update appliance_v8.json. Ref https://github.com/GNS3/gns3-registry/pull/897 2024-07-07 17:47:24 +02:00
Jeremy Grossmann
d963dd4746 Merge pull request #3591 from GNS3/feature/keep-compute-ids
Option to keep the compute IDs unchanged when exporting a project
2024-07-06 17:12:42 +02:00
grossmj
60addccd95 Option to keep the compute IDs unchanged when exporting a project 2024-07-06 17:08:16 +02:00
grossmj
80b654ba53 Upgrade sentry-sdk and psutil packages 2024-07-03 18:52:49 +02:00
grossmj
b67a8c87a7 Switch to PyQt5 5.15.10 for macOS build 2024-06-10 17:20:52 +02:00
grossmj
53ece94a08 Development on 2.2.48.dev1 2024-05-23 12:19:15 +07:00
Jeremy Grossmann
a6c7e0be59 Merge pull request #3586 from GNS3/update-ga-workflows
Update GitHub Action workflows
2024-05-17 12:21:05 +07:00
grossmj
fcea25dcbb Update GitHub Action workflows 2024-05-17 12:14:47 +07:00
Jeremy Grossmann
f29c065164 Merge pull request #3585 from GNS3/release/v2.2.47
Release v2.2.47
2024-05-15 17:27:30 +07:00
grossmj
c6b5494ce6 Use system Python 2024-05-15 17:19:54 +07:00
grossmj
02b14f6aea Call pip as a Python module 2024-05-15 17:12:42 +07:00
grossmj
e2cc378aee Use ubuntu:latest for running tests inside Docker container 2024-05-15 17:10:04 +07:00
grossmj
812aedebe3 Release v2.2.47 2024-05-15 12:14:48 +07:00
grossmj
2f0d2063cf Remove maximum size for capture dialog. Ref #3576 2024-05-10 12:58:35 +07:00
Jeremy Grossmann
ce0515f0ae Merge pull request #3582 from GNS3/drop-python3.7
Drop Python 3.7
2024-05-09 19:09:14 +07:00
grossmj
bc10c69a2d Change sentry-sdk version 2024-05-09 19:03:08 +07:00
grossmj
3707758388 Upgrade aiohttp, sentry-sdk and truststore 2024-05-09 18:58:38 +07:00
grossmj
8aaefac91b Upgrade jsonschema and aiohttp 2024-05-09 18:37:41 +07:00
grossmj
19157ab49d Drop Python 3.7 2024-05-09 18:23:59 +07:00
grossmj
38b98cd883 Remove dev requirements for Python 3.6 2024-05-09 18:05:08 +07:00
Jeremy Grossmann
e9419924c5 Merge pull request #3580 from GNS3/feature/nat-symbols
NAT symbols
2024-04-22 19:00:15 +07:00
grossmj
cf3c5c09fa Add NAT symbols 2024-04-22 18:51:29 +07:00
grossmj
9e89cf5ad5 Only show log message if event has "message" 2024-03-07 17:18:30 +01:00
grossmj
131ef09b55 Development on 2.2.47.dev1 2024-03-05 01:07:17 +08:00
grossmj
2df18ee04e Upgrade sentry-sdk to version 1.40.6 2024-03-05 00:45:26 +08:00
Jeremy Grossmann
854e1fded6 Merge pull request #3568 from GNS3/release/v2.2.46
Release v2.2.46
2024-02-26 17:50:19 +08:00
grossmj
31711a9d4e Release v2.2.46 2024-02-26 16:55:13 +08:00
grossmj
fd2e236927 Add GNS3 console command "env" to show what environment variables are used. Ref https://github.com/GNS3/gns3-server/issues/2306 2024-02-14 19:29:07 +08:00
grossmj
21409a899d Add CTRL+C shortcut to copy status bar message. Ref #3561 2024-02-14 17:33:15 +08:00
grossmj
25be9e7ec7 Key modifier (ALT) to ignore snap to grid. Fixes #3538 2024-02-12 17:32:22 +11:00
grossmj
1260c2bc2d Increase timeout to 5s for status bar messages.
The coordinates message has no timeout and can be reset when clicking on the scene. Ref #3561
2024-02-12 16:32:17 +11:00
grossmj
1441e38876 Add reset GUI state feature. Ref #3549 2024-02-12 16:16:07 +11:00
grossmj
3c8cff20b7 Possible fix for hiding Windows terminal. Ref #3290 2024-02-12 15:05:49 +11:00
Jeremy Grossmann
f831d71c3f Merge pull request #3566 from GNS3/feature/drop-python-3.6
Drop support for Python 3.6
2024-02-09 17:02:27 +11:00
grossmj
f71b6dcda1 Change runtime checks for Python version 2024-02-09 16:49:59 +11:00
grossmj
62289e7be3 Drop support for Python 3.6 2024-02-09 16:28:23 +11:00
grossmj
7447e9b7d4 Merge branch 'master' into 2.2 2024-01-27 17:04:54 +11:00
grossmj
c5961f400e Upgrade sentry-sdk, psutil and distro dependencies 2024-01-27 17:04:02 +11:00
grossmj
6ca61905b2 Development on 2.2.46.dev1 2024-01-14 23:45:35 +11:00
Jeremy Grossmann
130e91da76 Merge pull request #3559 from GNS3/2.2
Release v2.2.45
2024-01-14 22:02:24 +11:00
grossmj
bbc5b3e4ac Release v2.2.45 2024-01-12 21:38:26 +11:00
grossmj
2a72ad5e0b Add missing console_type values in appliance_v8.json. Ref https://github.com/GNS3/gns3-registry/issues/849 2024-01-12 16:39:06 +11:00
grossmj
88ed9407b9 Move PATH debug message 2024-01-12 15:46:20 +11:00
grossmj
18be274fed Handle moved project notifications on controller stream 2024-01-12 13:22:48 +11:00
grossmj
fefda50378 Add debug for PATH env variable 2024-01-11 22:57:14 +11:00
grossmj
3df374e784 Add custom executable paths on Windows 2023-12-05 21:24:41 +10:00
grossmj
04fb449b44 Add --suppressApplicationTitle for Windows terminal. Fixes https://github.com/GNS3/gns3-gui/issues/3544 2023-11-28 11:23:20 +10:00
grossmj
fc54b76ee1 Upgrade sentry-sdk and aiohttp 2023-11-22 10:32:51 +10:00
grossmj
59b284e18b Development in 2.2.45.dev3 2023-11-07 19:11:57 +10:00
Jeremy Grossmann
1d4492c911 Merge pull request #3537 from GNS3/release-v2.2.44.1
Release v2.2.44.1
2023-11-07 18:34:54 +10:00
grossmj
9d8b6a172e Release v2.2.44.1 2023-11-07 14:59:28 +10:00
grossmj
8c3ef7a968 Bump version to v2.2.45.dev2 2023-11-07 12:21:39 +10:00
Jeremy Grossmann
947733aada Merge pull request #3536 from GNS3/release-v2.2.44
Release v2.2.44
2023-11-06 17:01:17 +10:00
grossmj
a199fef03b Development on 2.2.45.dev1 2023-11-06 17:00:17 +10:00
grossmj
29b851207b Release v2.2.44 2023-11-06 16:02:23 +10:00
grossmj
ca5557e579 Upgrade sentry-sdk 2023-11-06 15:44:30 +10:00
grossmj
7331ae29ef Fix timeout issue when creating Qemu disk image. Fixes https://github.com/GNS3/gns3-server/issues/2313 2023-11-05 15:41:46 +10:00
grossmj
3a7e06e14b Revert to subprocess.Popen since subprocess.call is the old API 2023-11-03 14:43:25 +10:00
grossmj
0a81af8248 Merge remote-tracking branch 'origin/2.2' into 2.2 2023-10-31 15:53:13 +10:00
grossmj
a882956ec9 Merge branch 'master' into 2.2 2023-10-31 15:52:45 +10:00
Jeremy Grossmann
9f4361d66f Merge pull request #3534 from GNS3/command-variables
Refactor command variables
2023-10-31 15:44:23 +10:00
grossmj
d10c3c7308 Fix tests 2023-10-31 15:40:50 +10:00
Jeremy Grossmann
0cd7d7e4c2 Merge branch '2.2' into command-variables 2023-10-31 15:07:49 +10:00
grossmj
8f3f72ff54 Fix tests 2023-10-31 15:07:35 +10:00
Jeremy Grossmann
7fbc0befa1 Merge branch '2.2' into command-variables 2023-10-31 14:51:53 +10:00
grossmj
9d9668442e Use Python 3.8 in appveyor.yml 2023-10-31 14:48:08 +10:00
grossmj
932083be88 Update custom command help and protect against double quote in project name 2023-10-31 14:43:50 +10:00
grossmj
82e7c151c4 Refactor command variables support 2023-10-31 12:33:52 +10:00
Jeremy Grossmann
7e5c363bc3 Merge pull request #3533 from GNS3/fix/2306
Allow local server to get $PATH environment variable
2023-10-30 14:06:17 +10:00
grossmj
15d029a7fb Pass os.environ in Popen() 2023-10-30 14:03:10 +10:00
Jeremy Grossmann
9087ba8f5a Merge pull request #3512 from magister990/style_edit_width_and_height
Add the ability to edit width and hight in the style edit dialog.
2023-10-24 18:25:58 +10:00
grossmj
3d89d6e6cc Fix issue with line item 2023-10-24 18:01:49 +10:00
grossmj
91bae81300 Merge branch '2.2' into style_edit_width_and_height 2023-10-24 17:40:35 +10:00
Jeremy Grossmann
7de5bf6bd5 Merge pull request #3516 from ventaquil/feature/add-qemu-igb-nic
Add Qemu IGB network device
2023-10-24 17:15:21 +10:00
Jeremy Grossmann
9de238619a Merge branch '2.2' into feature/add-qemu-igb-nic 2023-10-24 17:14:30 +10:00
grossmj
ed88466d63 Upgrade to actions/checkout@v3 and actions/setup-python@v3 2023-10-23 16:17:31 +10:00
grossmj
478b793b04 Merge branch 'master' into 2.2 2023-10-18 17:46:45 +10:00
grossmj
841c29e6f6 Upgrade sentry and psutil dependencies 2023-10-18 14:53:25 +10:00
grossmj
f9d96051f5 Downgrade to PyQt5 v5.15.9 2023-10-18 14:33:27 +10:00
grossmj
607e201674 Fix packaging issue on macOS 2023-10-18 14:29:53 +10:00
grossmj
18950ca64f Upgrade to PyQt5 v5.15.10 2023-10-18 13:24:45 +10:00
grossmj
c0b5f39c4c Add Python 3.12 support. Fixes https://github.com/GNS3/gns3-server/issues/2273 2023-10-09 16:54:47 +10:00
grossmj
3e717999ca Add vendor_logo_url in appliance schemas. Ref https://github.com/GNS3/gns3-registry/pull/825 2023-10-09 16:52:52 +10:00
Konrad Goławski
800d14363d Add Qemu IGB network device 2023-10-02 14:35:09 +02:00
Alex Scott
2dd9d61c57 Add the ability to edit width and hight in the style edit dialog. 2023-09-27 17:08:33 -05:00
grossmj
10afb5a8de Revert "Revert "Install importlib-resources only with Python < '3.9'. Ref #2147""
This reverts commit 3413afe952.
2023-09-23 20:50:39 +10:00
grossmj
3413afe952 Revert "Install importlib-resources only with Python < '3.9'. Ref #2147"
This reverts commit 7222da9512.
2023-09-23 14:47:56 +10:00
grossmj
7222da9512 Install importlib-resources only with Python < '3.9'. Ref #2147 2023-09-23 14:33:15 +10:00
grossmj
dbe8df5a37 Development on 2.2.44.dev1 2023-09-19 21:08:24 +07:00
Jeremy Grossmann
a9890265b9 Merge pull request #3509 from GNS3/release-v2.2.43
Release v2.2.43
2023-09-19 21:04:43 +07:00
grossmj
97b777ceea Release v2.2.43 2023-09-19 20:16:52 +07:00
grossmj
c06e534935 Merge branch 'master' into 2.2 2023-09-19 20:08:11 +07:00
grossmj
025276f8a7 Upgrade sentry-sdk and truststore 2023-09-19 20:07:57 +07:00
grossmj
6777961d29 Add KiTTY to preconfigured telnet consoles. Fixes #3507 2023-09-18 20:23:09 +07:00
grossmj
7f6cace0d5 Fix generic icon in Wayland. Ref #3501 2023-09-15 16:08:45 +07:00
Jeremy Grossmann
1a739c0c37 Merge pull request #3490 from GNS3/appliance-v8-support
Support for appliance version 8 format
2023-08-16 14:18:59 +10:00
grossmj
6d855045ef Show installation instructions when available and fix regression when installing Docker appliance. 2023-08-16 14:11:55 +10:00
grossmj
fef734bbbe Finalize appliance v8 support and add tests. 2023-08-16 00:30:02 +10:00
grossmj
b079443735 Merge remote-tracking branch 'origin/appliance-v8-support' into appliance-v8-support 2023-08-14 12:01:18 +10:00
grossmj
4a32ae9736 Drop "kvm" field. 2023-08-14 12:01:09 +10:00
Jeremy Grossmann
9793d00131 Merge branch '2.2' into appliance-v8-support 2023-08-13 12:21:18 +10:00
grossmj
2b7840279a Downgrade jsonschema 2023-08-12 17:51:24 +10:00
grossmj
9243083321 Upgrade dependencies 2023-08-12 17:47:48 +10:00
Jeremy Grossmann
3a8b3e5c4a Merge pull request #3506 from GNS3/fix/3505
Use importlib instead of pkg_resources
2023-08-12 17:26:51 +10:00
grossmj
e2168a3c81 Use importlib instead of pkg_resources 2023-08-12 17:20:33 +10:00
grossmj
01deb01e6a Upgrade to PyQt 5.15.9 and pywin32 2023-08-11 18:13:41 +10:00
grossmj
1133ee6e1b Development on v2.2.43.dev1 2023-08-09 22:15:15 +10:00
Jeremy Grossmann
7512ffec64 Merge pull request #3503 from GNS3/release-v2.2.42
Release v2.2.42
2023-08-09 22:08:18 +10:00
grossmj
3527e5551c Release v2.2.42 2023-08-09 21:11:57 +10:00
grossmj
72960f8f2b Enable system certificate store later in the code and bump version to 2.2.42.dev4 2023-08-08 17:22:27 +10:00
grossmj
8abb502c72 Use the system's certificate store for SSL connections 2023-08-07 21:33:25 +10:00
grossmj
08c729e83a Upgrade dependencies 2023-08-06 20:39:27 +10:00
grossmj
aac004bd2f Use certifi to get SSL root certificates 2023-08-06 20:37:10 +10:00
grossmj
70677d8f18 Bump version to 2.2.42.dev3 2023-08-06 18:14:22 +10:00
Jeremy Grossmann
fba1ff4208 Merge pull request #3502 from GNS3/use-bundled-cacert
Use bundled cacert file for frozen app
2023-08-05 22:37:08 +10:00
grossmj
e4edbefc23 Use bundled cacert file on Windows and macOS 2023-08-05 22:21:08 +10:00
grossmj
d93f9afe74 Bump version to 2.2.42.dev2 2023-08-05 20:16:30 +10:00
grossmj
162d197e36 Give a node some time to start before opening the console (for console auto start). Fixes #3474 2023-08-02 11:08:58 +10:00
grossmj
5c21dd8a2f Merge branch 'master' into 2.2 2023-08-01 15:50:51 +10:00
Jeremy Grossmann
aa9b9d3b0b Merge pull request #3364 from AbdelbakiBoukerche/feature_rounded_rectangle
Rounded Rectangle
2023-08-01 15:46:32 +10:00
grossmj
eae9eec15b Support for horizontal and vertical corner radius 2023-08-01 15:34:30 +10:00
Jeremy Grossmann
a3bf832721 Merge branch 'master' into feature_rounded_rectangle 2023-07-31 18:34:50 +10:00
Jeremy Grossmann
67890d74d9 Merge pull request #3500 from GNS3/fix/3449
Support for gnome-terminal tabs to be opened in the same window
2023-07-31 18:30:22 +10:00
grossmj
ab4325f951 Remove warning to set open new terminals in tabs for gnome-terminal 2023-07-31 12:32:49 +10:00
grossmj
2a947b9cc5 Add comments for gnome-terminal special case 2023-07-31 01:44:39 +10:00
grossmj
601c082288 Use Mate Terminal by default if installed on Debian, Ubuntu and Linux Mint. 2023-07-31 01:40:20 +10:00
grossmj
7701d57bd0 Check that gnome-terminal is configured to open new terminals in tabs. 2023-07-31 01:34:59 +10:00
grossmj
f0b4148a20 Support for gnome-terminal tabs to be opened in the same window. 2023-07-30 22:15:38 +10:00
grossmj
2fdcbafbc1 Revert "Support for Python 3.12"
This reverts commit 5d82cea935.
2023-07-30 17:50:21 +10:00
grossmj
5d82cea935 Support for Python 3.12 2023-07-30 17:48:30 +10:00
grossmj
b0e3e93c41 Remove import urllib3 and let sentry_sdk import and patch it. Fixes https://github.com/GNS3/gns3-gui/issues/3498 2023-07-30 17:42:52 +10:00
grossmj
535f53737d Merge remote-tracking branch 'origin/master' into 2.2 2023-07-23 12:35:21 +10:00
Jeremy Grossmann
354f3eecec Merge pull request #3497 from kevinchevreuil/master
Add import sys in sudo.py
2023-07-23 12:04:29 +10:00
Kevin Chevreuil - Kaisen
35a6a5c8c7 Add import sys in sudo.py 2023-07-22 23:12:34 +02:00
grossmj
23cba0a28d Development on 2.2.42.dev1 2023-07-12 18:26:26 +10:00
Jeremy Grossmann
9c3d7bc95a Merge pull request #3495 from GNS3/release-v2.2.41
Release v2.2.41
2023-07-12 18:24:05 +10:00
grossmj
cf2802b15a Release v2.2.41 2023-07-12 17:07:39 +10:00
grossmj
b162c55078 Merge remote-tracking branch 'origin/master' into 2.2 2023-07-12 17:03:50 +10:00
grossmj
bb42b0ed0b Change chown in authorize_ubridge.py 2023-07-12 13:28:24 +10:00
grossmj
e108b5194d Bump version to 2.2.41.dev3 2023-07-12 13:26:22 +10:00
grossmj
e9ef8735be Use a small executable to set the correct permissions on uBridge on macOS 2023-07-12 12:40:53 +10:00
grossmj
e8e90bb16a Add debugging for AuthorizationExecuteWithPrivileges 2023-07-11 21:23:15 +10:00
grossmj
49f77930f4 Use alternative method to setuid uBridge on macOS 2023-07-11 18:27:19 +10:00
grossmj
a58451a552 Update to support template_type & template_properties 2023-07-11 17:38:00 +10:00
grossmj
0a43b9e6e9 Fix tests 2023-07-09 20:18:22 +10:00
Jeremy Grossmann
4f32619ed8 Merge pull request #3493 from GNS3/remove-analytics
Remove sending usage stats
2023-07-09 19:04:40 +10:00
grossmj
20740748c1 Remove sending stats to GA 2023-07-09 18:55:31 +10:00
grossmj
8a5ab6b374 Update schema for appliance version 8 2023-07-09 14:10:15 +10:00
grossmj
e11ce27f7b Catch urllib3 exceptions when sending crash report. Ref https://github.com/GNS3/gns3-gui/issues/3483 2023-07-06 17:16:05 +10:00
grossmj
4b7cf4e553 Support legacy "idlepc" field 2023-07-03 19:12:44 +10:00
grossmj
b72358461c Add support for appliance version 8 format 2023-06-25 16:54:12 +09:30
Jeremy Grossmann
2987bcf91a Merge pull request #3489 from GNS3/backport-uefi-boot-mode
Backport UEFI boot mode support for Qemu VMs
2023-06-23 11:31:49 +09:30
grossmj
5e97bc0f86 Backport UEFI boot mode support for Qemu VMs 2023-06-23 11:18:25 +09:30
grossmj
e3a3de5df7 Add debug for dropEvent. Ref https://github.com/GNS3/gns3-server/issues/2242 2023-06-20 14:49:25 +09:30
grossmj
e1693ce113 Developement on v2.2.41.dev2 2023-06-10 21:40:39 +09:30
Jeremy Grossmann
522091d219 Merge pull request #3481 from GNS3/release-v2.2.40.1
Release v2.2.40.1
2023-06-10 21:36:42 +09:30
grossmj
1446748934 Release v2.2.40.1 2023-06-10 20:06:40 +09:30
grossmj
3f0ce380e8 Merge branch 'master' into 2.2 2023-06-10 17:22:50 +09:30
grossmj
bd71383354 Development on v2.2.41.dev1 2023-06-06 12:43:20 +09:30
Jeremy Grossmann
9649895378 Merge pull request #3479 from GNS3/release-v2.2.40
Release v2.2.40
2023-06-06 12:41:46 +09:30
grossmj
8579ffa20a Release v2.2.40 2023-06-06 10:23:42 +09:30
grossmj
3206743329 Merge branch 'master' into 2.2 2023-06-06 10:19:45 +09:30
grossmj
29c87b6e96 Change log messages for Websocket errors 2023-06-03 21:05:26 +09:30
grossmj
93b2721d6a Do not proceed if an appliance symbol cannot be downloaded. Ref #3466 2023-05-23 16:31:51 +08:00
grossmj
1ff369683f Revert "Fix open IPv6 address for HTTP consoles. Fixes #3448"
This reverts commit 7c56a2467c.
2023-05-22 19:39:03 +08:00
grossmj
7c56a2467c Fix open IPv6 address for HTTP consoles. Fixes #3448 2023-05-22 16:46:57 +08:00
grossmj
59ef34c17d Delete a node or link from topology summary view using Delete key. Ref #3445 2023-05-14 21:19:19 +08:00
grossmj
d1fae54049 Fix "Start the capture visualization program" checkbox works only one (first) time for a given link. Fixes #3442 2023-05-14 20:38:34 +08:00
grossmj
49bd61f769 Let the selected link style applied when editing a link. Fixes #3460 2023-05-14 15:33:08 +08:00
grossmj
9a4faddd10 Fix hovered color shown in style editing dialog. Fixes #3460 2023-05-14 14:52:27 +08:00
Jeremy Grossmann
7654681a94 Merge pull request #3468 from GNS3/release-v2.2.39
Release v2.2.39
2023-05-08 20:28:43 +08:00
grossmj
9bfecde957 Development on v2.2.40.dev1 2023-05-08 20:26:40 +08:00
grossmj
705cbf8bb9 Release v2.2.39 2023-05-08 19:17:02 +08:00
Jeremy Grossmann
ab6e0ce496 Merge pull request #3461 from GNS3/fix/3441
Fix nodes are not snapped to the grid at the moment of creation
2023-05-08 17:13:20 +08:00
grossmj
8042c9eb6f Fix tests 2023-05-08 17:08:10 +08:00
grossmj
ad3c8a09db Fix nodes are not snapped to the grid at the moment of creation 2023-04-23 05:18:02 -10:00
grossmj
ea4a7f201e Upgrade sentry-sdk 2023-03-23 21:41:50 -10:00
grossmj
28c82b8718 Upgrade distro and aiohttp dependencies 2023-03-01 18:03:28 +10:00
grossmj
6a4dd59e81 Development on 2.2.39.dev1 2023-02-28 17:09:39 +10:00
Jeremy Grossmann
7418c190a8 Merge pull request #3447 from GNS3/2.2
Release v2.2.38
2023-02-28 14:22:10 +08:00
grossmj
737e32f5c3 Release v2.2.38 2023-02-28 15:35:17 +10:00
grossmj
cfc09d2c14 Merge branch 'master' into 2.2 2023-02-28 15:07:07 +10:00
grossmj
f6ab5cae16 Add long description content type in setup.py 2023-02-01 09:56:02 +08:00
grossmj
39ec7eb8ea Automatically add new issues to GNS3 project 2023-01-31 09:31:52 +08:00
grossmj
64c579d43c Development 2.2.38.dev1 2023-01-25 18:36:39 +08:00
grossmj
98cc82e6fd Release v2.2.37 2023-01-25 15:06:12 +08:00
grossmj
4b795112b4 Merge branch 'master' into 2.2 2023-01-25 14:44:11 +08:00
grossmj
0e186afaf1 Comment AllocConsole() 2023-01-25 14:41:55 +08:00
grossmj
b218f7fdf8 Bump version to 2.2.37.dev3 2023-01-25 14:13:07 +08:00
grossmj
f1cb6d66f3 Try to fix hiding console. Ref #3290 2023-01-25 14:08:52 +08:00
grossmj
29758f1b4f Debug win32console 2023-01-24 22:25:39 +08:00
grossmj
445dcf3e3b Upgrade to PyQt5 v5.15.7 2023-01-24 18:54:15 +08:00
grossmj
f623f28509 Add venv to .gitignore 2023-01-17 13:40:37 +08:00
grossmj
9d02d57162 Bump version to 2.2.37.dev2 2023-01-17 13:30:09 +08:00
Jeremy Grossmann
df03f50e3d Merge pull request #3427 from eantowne/master
Changed Windows Terminal telnet console profile from OS X to Windows ref: #3193
2023-01-17 05:52:31 +05:45
Ean Towne
3b72a66ca5 Changed Windows Terminal telnet console profile from OS X to windows ref: issue #3193 2023-01-16 16:50:57 -05:00
grossmj
f8aee44442 Fix tests 2023-01-10 08:42:25 +08:00
grossmj
6dd4d1700e Convert README to Markdown 2023-01-10 08:16:17 +08:00
grossmj
9b674669db Development on 2.2.37.dev1 2023-01-05 09:13:30 +08:00
grossmj
53073d458f Merge branch '2.2' 2023-01-05 09:12:01 +08:00
grossmj
957d89d450 Release v2.2.36 2023-01-04 19:46:30 +08:00
Jeremy Grossmann
db02cbdb2f Merge pull request #3421 from GNS3/qemu-tpm-support
Trusted Platform Module (TPM) support for Qemu VMs
2023-01-04 10:55:52 +05:45
grossmj
0c9f70152f Add checkbox to enable TPM 2023-01-04 12:45:40 +08:00
grossmj
9016975958 Add Trusted Platform Module (TPM) support for Qemu VMs 2023-01-04 12:13:19 +08:00
grossmj
bf295060fd Add "on_close" setting to appliance schema. Fixes https://github.com/GNS3/gns3-server/issues/2148 2023-01-01 16:23:17 +08:00
grossmj
c22ec9f8bd Add default 'ide' disk interface when manually creating Qemu VM template. Fixes #3360 2022-12-29 08:54:40 +08:00
grossmj
bb49cadc6a Fix zoom factor is multiplied when loading projects. Fixes #3408 2022-12-29 08:49:10 +08:00
grossmj
131a49160c Update sentry-sdk dependency 2022-12-28 15:13:26 +08:00
grossmj
225b829eae Fix syntax error in .whitesource 2022-12-27 12:27:26 +08:00
grossmj
e5ef6180b1 Add more base branches for Mend to scan 2022-12-27 12:25:49 +08:00
grossmj
6e7947eea3 Remove deprecated PuTTY option in preferences. Ref https://github.com/GNS3/gns3-gui/discussions/3415 2022-12-24 11:19:29 +08:00
Jeremy Grossmann
3922d370a8 Create SECURITY.md 2022-12-20 21:28:08 +08:00
grossmj
833b9d00c9 Upgrade dependencies 2022-12-18 14:14:56 +08:00
Jeremy Grossmann
377b8dfcaf Create codeql.yml 2022-12-18 14:08:00 +08:00
grossmj
e68937475f Development on v2.2.36.dev2 2022-11-11 00:36:47 +08:00
grossmj
6f418f0853 Release v2.2.35.1 2022-11-10 22:21:14 +08:00
grossmj
8e59927ada Merge branch 'master' into 2.2 2022-11-10 22:06:25 +08:00
grossmj
1012686053 Development on 2.2.36.dev1 2022-11-09 20:02:20 +08:00
grossmj
672bd850ad Merge branch '2.2' 2022-11-09 20:00:38 +08:00
grossmj
5db5e1f9fe Release v2.2.35 2022-11-08 23:40:25 +08:00
grossmj
ca94c71bf2 Use Visual Studio 2022 in appveyor.yml 2022-11-08 23:09:23 +08:00
grossmj
76264c55ce Merge branch 'master' into 2.2 2022-11-08 19:29:49 +08:00
grossmj
fd243c42a8 Downgrade psutil to v5.9.2 2022-11-08 19:18:07 +08:00
grossmj
a6521ef9e4 Upgrade psutil to v5.9.4 2022-11-08 18:49:31 +08:00
grossmj
9fa833762c Upgrade pywin32 to v305 2022-11-08 18:29:51 +08:00
grossmj
ca0c6468b5 Fix "variables": [] in project file leads to unlimited increase of empty name/value pairs in GUI. Fixes #3397 2022-11-07 22:29:02 +08:00
grossmj
15f6945a94 Upgrade dependencies 2022-11-07 21:48:45 +08:00
grossmj
645deb8c79 Ignore local revision when comparing versions. 2022-11-07 20:03:05 +08:00
grossmj
428f12a2b3 Make version PEP 440 compliant 2022-11-06 17:51:31 +08:00
grossmj
9ad5760ee6 Support for Python 3.11 2022-10-30 19:04:54 +08:00
grossmj
82fc4fb3c9 Revert "Fix issue when using tail.exe with non-ascii paths. Fixes #3021"
This reverts commit df42147d92.
2022-10-19 19:38:43 +08:00
grossmj
df42147d92 Fix issue when using tail.exe with non-ascii paths. Fixes #3021 2022-10-19 19:04:29 +08:00
grossmj
da5520aa90 Upgrade PyQt to 5.15.7 and pywin32 to v304 2022-10-19 18:31:40 +08:00
Jeremy Grossmann
491c66a315 Merge pull request #3395 from GNS3/fix/3393
Update requirements.txt
2022-10-18 22:30:11 +08:00
Jeremy Grossmann
e5c81da700 Merge branch '2.2' into fix/3393 2022-10-18 22:28:32 +08:00
grossmj
65fad1b4f4 Upgrade to Visual Studio 2022 in appveyor.yml 2022-10-18 21:47:10 +08:00
grossmj
34661908d9 Upgrade to Python 3.7 in appveyor.yml 2022-10-18 21:42:51 +08:00
grossmj
aee5ffa17f Upgrade pip and setuptools in appveyor.yml 2022-10-18 21:40:08 +08:00
grossmj
e9e8be42b5 Upgrade pytest. Fixes #3399 2022-10-18 21:16:46 +08:00
grossmj
ae0d928383 Use jsonschema v3.2.0 for Python 3.6 2022-10-12 22:13:34 +08:00
grossmj
8db3c1be42 Allow for more dependency versions at patch level 2022-10-12 22:07:37 +08:00
grossmj
f50da3ebd7 Replace deprecated distro.linux_distribution() call 2022-10-11 23:28:11 +08:00
grossmj
75b52fc9a4 Update dev-requirements.txt 2022-10-11 23:23:15 +08:00
grossmj
1952da5876 Update requirements.txt 2022-10-11 23:01:24 +08:00
Jeremy Grossmann
1f620026d4 Merge pull request #3394 from KaisenCAS/master
CVE-2007-4559 patch
2022-10-10 23:31:52 +08:00
grossmj
1d293618e5 Upgrade dependencies 2022-10-10 14:29:04 +08:00
Kevin Chevreuil - Kaisen
2622549ce6 Add a fix for the CVE-2007-4559 2022-10-09 22:55:15 +02:00
grossmj
900bd1c0b4 Development on 2.2.35dev1 2022-08-29 11:14:44 +02:00
grossmj
0b3dbb2843 Release v2.2.34 2022-08-28 23:28:12 +02:00
grossmj
ef4f6b2b27 Upgrade Sentry dependency 2022-08-28 00:02:54 +02:00
grossmj
e9806345ca Downgrade to pytest v7.0.1 (last version to support 2022-08-27 19:35:36 +02:00
grossmj
ee23e32c75 Upgrade dev dependencies 2022-08-27 19:29:42 +02:00
grossmj
fbeacdcb2a Implement new option (Delete All) to contextual menu in "Console" dock. Fixes #3325 2022-08-16 17:48:58 +02:00
grossmj
b3937c7b94 Fix 2560x1440 resolution for Docker container 2022-08-07 23:56:11 +02:00
Abdelbaki Boukerche
181bf3f360 Rounded Rectangle 2022-08-04 18:20:54 +01:00
grossmj
f2711732db Back to development on v2.2.34dev2 2022-06-21 11:52:58 +02:00
grossmj
148ac4b072 Revert "Development on v2.2.34dev2"
This reverts commit 65eeb79b26.
2022-06-21 11:51:01 +02:00
grossmj
65eeb79b26 Development on v2.2.34dev2 2022-06-21 11:38:09 +02:00
grossmj
537304ce08 Release v2.2.33.1 2022-06-21 10:48:02 +02:00
grossmj
f22df5f016 Development on v2.2.34dev1 2022-06-20 21:47:42 +02:00
grossmj
8dfc8b7714 Release v2.2.33 2022-06-20 20:53:21 +02:00
grossmj
8c6fa9433f Upgrade sentry-sdk and psutil 2022-06-20 20:05:34 +02:00
Jeremy Grossmann
63837578c5 Merge pull request #3340 from GNS3/node-name-checks
Check node names
2022-06-20 19:02:37 +02:00
grossmj
b719703dbe Check that node names for Qemu and Docker are valid 2022-06-18 16:59:14 +02:00
grossmj
084d14c17e Backport reset all console connections. Fixes #2072 2022-06-15 15:58:15 +02:00
grossmj
8c0fca1dd7 Add more video resolutions to Docker containers using VNC. Fixes #3329 2022-06-09 00:26:39 +08:00
grossmj
863d05c923 Add python_requires=">=3.4" in setup.py. Fixes #3326 2022-06-07 18:27:01 +08:00
grossmj
3ebaac8a2c Only allow post release corrective versions of GUI and server to interact 2022-06-07 18:22:06 +08:00
grossmj
16878c9dfa Allow minor versions of GUI and server to interact 2022-06-07 18:06:53 +08:00
grossmj
45da18bb7c Update VirtViewer path. Fixes #3334 2022-06-07 17:35:55 +08:00
grossmj
7a6d06ea0c Development on 2.2.33dev1 2022-04-27 19:51:24 +07:00
grossmj
d371042647 Upgrade distro package to v1.7.0 2022-04-27 19:48:50 +07:00
grossmj
0321c11c34 Release v2.2.32 2022-04-27 18:47:20 +07:00
grossmj
522df41a57 Use public DSNs for Sentry 2022-04-20 18:41:18 +07:00
grossmj
afccdf5b9e Fix exception when doubleclick on NAT node. Fixes #3312 2022-04-20 17:55:16 +07:00
grossmj
b2cd24b511 Upgrade some packages 2022-04-20 17:38:54 +07:00
grossmj
6d131a05f1 Fix "Apply" button in the "Preferences" dialog stays gray when templates/nodes are opened by double-click. Fixes #3307 2022-04-20 16:49:22 +07:00
grossmj
35e6156c6c Add 'reset docks' in the view menu. Ref #3317 2022-04-20 15:53:32 +07:00
grossmj
96d8de4da8 Development on 2.2.32dev1 2022-02-26 20:39:42 +10:30
grossmj
6b5a6f3dfe Release v2.2.31 2022-02-26 18:22:17 +10:30
grossmj
8f82eac321 Development on 2.2.31dev1 2022-02-25 15:59:19 +10:30
grossmj
e03ed64f59 Install setuptools v59.6.0 when using Python 3.6 2022-02-25 15:50:35 +10:30
grossmj
3d702aabd0 Release v2.2.30 2022-02-25 14:51:39 +10:30
grossmj
f5e63c2321 Set setuptools to v60.6.0 2022-02-06 21:02:56 +10:30
grossmj
1047eb916a Upgrade dependencies 2022-02-06 17:33:10 +10:30
grossmj
5dc7d0fbda Upgrade to pywin32 v303. Ref #3290 2022-02-06 17:31:32 +10:30
grossmj
2609be98b6 Fix int() call. Ref #3283 2022-01-15 18:57:15 +10:30
grossmj
6286e596c0 Fix QPoint() as unexpected type 'float'. Fixes #3283 2022-01-15 18:55:38 +10:30
grossmj
3c546086ed Fix painter.drawRect() has unexpected type 'float'. Fixes #3282 2022-01-15 18:32:35 +10:30
grossmj
f4b2c1c5b9 Fix SpinBox.setValue() requires integer. Fixes #3281 2022-01-11 23:12:54 +10:30
grossmj
e578ecdd8a Development on 2.2.30dev1 2022-01-08 22:52:59 +10:30
grossmj
da8adbaa18 Release v2.2.29 2022-01-08 22:14:59 +10:30
grossmj
6d1333f5fe Clear cache when opening symbol selection dialog. Fixes #3256 2021-12-27 12:43:32 +10:30
grossmj
92c858dd07 Fix @ in username issue with HTTP authentication. Fixes #3275 2021-12-25 11:19:07 +10:30
grossmj
0c7a12f68c Merge branch 'master' into 2.2 2021-12-25 10:58:46 +10:30
Jeremy Grossmann
a4d08cce8c Merge pull request #3277 from etiennewan/etiennewan-patch-2
Fixed QPoint called with floats
2021-12-25 10:27:00 +10:00
grossmj
e0dd7a66e1 Use '//' operator instead of int() 2021-12-24 13:39:19 +10:30
grossmj
23be668c97 Fix create drawing item calls since mapToScene() returns a QPointF
https://doc.qt.io/qt-5/qgraphicsview.html#mapToScene-4
2021-12-24 13:38:26 +10:30
Etienne Wan
68d0278140 Fixed QPoint called with floats 2021-12-23 18:37:26 +01:00
Jeremy Grossmann
d8e4c1de4d Merge pull request #3273 from tsndqst/fix_create_link_test
Fix create_link test
2021-12-16 12:26:38 +10:00
Your Name
a5aa9bfb7a Remove problematic lines 2021-12-15 20:13:57 -06:00
grossmj
3e0273848f Development on 2.2.29dev1 2021-12-15 21:38:34 +10:30
grossmj
ec374f173c Release v2.2.28 2021-12-15 13:54:24 +10:30
grossmj
b8abdc79dc Merge branch 'master' into 2.2 2021-12-15 13:52:41 +10:30
Jeremy Grossmann
43744eab7e Merge pull request #3272 from etiennewan/patch-1
Fixed drawLine called with float arguments
2021-12-15 09:28:35 +10:00
Etienne Wan
e16f700e49 Fixed drawLine called with float arguments 2021-12-13 23:27:28 +01:00
Jeremy Grossmann
925d57b2f8 Merge pull request #3263 from FocusedOne/master
Fixed dead VIX API link
2021-11-23 09:15:54 +10:30
FocusedOne
eceaea1317 Fixed dead VIX API link
Replaced old dead vmware link with current 1.17 version download.
2021-11-22 16:40:01 -06:00
grossmj
4326785dfc Development on 2.2.28dev1 2021-11-13 16:31:21 +10:30
grossmj
3920c28bde Release v2.2.27 2021-11-12 15:33:53 +10:30
grossmj
b34f51e4b0 Merge branch 'master' into 2.2 2021-11-12 14:50:55 +10:30
grossmj
ef45b2e0f1 Fix symbols in "Symbol selection" dialog are not placed in alphabetical order. Fixes #3245 2021-11-08 22:20:22 +10:30
grossmj
545a9f53a8 Fix links duplicates in topology summary. Fixes #3251 2021-11-08 21:55:29 +10:30
grossmj
83d9367860 Development on 2.2.27dev1 2021-10-08 21:49:11 +10:30
grossmj
2131f07e5f Merge branch '2.2' 2021-10-08 21:46:38 +10:30
grossmj
cf3e716e63 Release v2.2.26 2021-10-08 21:02:04 +10:30
grossmj
c79f14bcab Open "template configuration" dialog with double click on template name in "Preferences". Fixes #3239 2021-10-08 16:35:25 +10:30
grossmj
acd044a88a Only show "virtio" network adapter when legacy node is enabled. Fixes https://github.com/GNS3/gns3-gui/issues/1969 2021-10-08 15:46:56 +10:30
Jeremy Grossmann
f26c638350 Merge pull request #3237 from SDN-Projects/optimization/pip-no-cache-dir
chore : use --no-cache-dir flag to pip in dockerfiles to save space
2021-09-23 09:59:58 +09:30
Pratik Raj
4ea24e622b chore : use --no-cache-dir flag to pip in dockerfiles to save space
using --no-cache-dir flag in pip install ,make sure downloaded packages
by pip don't cached on system . This is a best practice which make sure
to fetch from repo instead of using local cached one . Further , in case
of Docker Containers , by restricting caching , we can reduce image size.
In term of stats , it depends upon the number of python packages
multiplied by their respective size . e.g for heavy packages with a lot
of dependencies it reduce a lot by don't caching pip packages.

Further , more detail information can be found at

https://medium.com/sciforce/strategies-of-docker-images-optimization-2ca9cc5719b6

Signed-off-by: Pratik Raj <rajpratik71@gmail.com>
2021-09-22 15:13:38 +05:30
grossmj
ab854752d9 Double-click on a template opens "template configuration" dialog. Fixes #3236 2021-09-20 20:28:56 +09:30
grossmj
5cee045a65 Fix "Custom symbols" can't be unfolded after using "Filter" field. Fixes #3231 2021-09-20 18:39:32 +09:30
grossmj
37cd82fb44 Development on v2.2.26dev1 2021-09-14 21:13:04 +09:30
grossmj
334eb5175c Release v2.2.25 2021-09-14 19:20:11 +09:30
grossmj
25841ea7db Fix menu disabled for modal dialogs on macOS. Fixes #3007 2021-09-09 21:21:22 +09:30
grossmj
3d3b4f92b2 Change method to display the recent files menu. Fixes #3007 2021-09-09 09:23:45 +09:30
grossmj
82740da89d Fix bug when using empty port names for custom adapters. Fixes #3228 2021-09-08 16:16:27 +09:30
grossmj
ad19b3dda0 Upgrade PyQt5 to version 5.15.4 for macOS 2021-09-08 15:36:04 +09:30
grossmj
bb8fd18f98 Fix mouse zoom-in/out step value is two times bigger than keyboard one. Fixes #3226 2021-09-08 15:26:56 +09:30
grossmj
336eaf443a Upgrade to Qt 5.15.4 on Windows. Ref #3210 2021-09-08 14:25:25 +09:30
grossmj
0b94be6805 Fix issue with custom adapters at the node level. Fixes #3223 2021-09-05 21:15:30 +09:30
grossmj
671ced78ff Merge branch 'master' into 2.2 2021-09-02 14:45:00 +09:30
Jeremy Grossmann
c8766ce529 Merge pull request #3157 from hrnciar/setuptools
Explicitly require setuptools, utils/get_resource.py imports pkg_resources
2021-08-29 22:06:22 -07:00
Jeremy Grossmann
bec9512c78 Merge branch 'master' into setuptools 2021-08-29 22:02:55 -07:00
grossmj
b2ad5f4158 Development on 2.2.25dev1 2021-08-25 21:23:19 +09:30
grossmj
966873bc6c Release v2.2.24 2021-08-25 20:31:26 +09:30
grossmj
5b9111b55d Merge branch 'master' into 2.2 2021-08-25 20:08:45 +09:30
grossmj
56688f2236 Update dependencies 2021-08-24 21:12:27 +09:30
grossmj
2e656a9d53 Fix incorrect Qemu binary selected when importing template. Fixes https://github.com/GNS3/gns3-gui/issues/3216 2021-08-24 17:26:07 +09:30
grossmj
2790f707c3 Early support for Python3.10 2021-08-15 15:10:02 +09:30
Jeremy Grossmann
ee9002df61 Merge pull request #3217 from GNS3/dependabot/pip/pywin32-301
Bump pywin32 from 300 to 301
2021-08-09 17:59:04 -07:00
dependabot[bot]
52626e9fe9 Bump pywin32 from 300 to 301
Bumps [pywin32](https://github.com/mhammond/pywin32) from 300 to 301.
- [Release notes](https://github.com/mhammond/pywin32/releases)
- [Changelog](https://github.com/mhammond/pywin32/blob/master/CHANGES.txt)
- [Commits](https://github.com/mhammond/pywin32/commits)

---
updated-dependencies:
- dependency-name: pywin32
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-09 20:48:41 +00:00
grossmj
6619c6af97 Add PyQt5==5.12.3 for macOS build 2021-08-07 20:09:41 +09:30
grossmj
60e04c7248 Development on 2.2.24dev1 2021-08-05 21:16:10 +09:30
grossmj
724858f977 Release v2.2.23 2021-08-05 15:58:54 +09:30
Jeremy Grossmann
5a2e05a4fd Merge pull request #3212 from GNS3/handle_no-kvm_deprecated
Handle -no-kvm param deprecated in Qemu >= v5.2
2021-07-27 17:37:45 +09:30
grossmj
010888e3ca Handle -no-kvm param deprecated in Qemu >= v5.2 2021-07-27 16:34:51 +09:30
grossmj
3226921536 Support for invisible links. Fixes #2461 2021-07-27 15:30:58 +09:30
grossmj
022e918301 Add kitty console application command line. Fixes #3203 2021-07-25 16:12:35 +09:30
grossmj
846b19a9e7 Add Windows Terminal profile as an option for Console Applications. Fixes #3193 2021-06-14 13:10:01 +09:30
grossmj
45f5c6e010 Development on 2.2.23dev1 2021-06-10 16:20:10 +09:30
grossmj
963bbb7b89 Release v2.2.22 2021-06-10 15:41:58 +09:30
grossmj
016ad7a775 Fix exception shown when GNS3 is started with empty config. Fixes #3188 2021-06-10 12:28:25 +09:30
grossmj
e8c82566c6 Add ZOC8 console terminal for macOS command line 2021-06-07 19:41:09 +09:30
grossmj
1ed6fceade Fix tests. Ref https://github.com/GNS3/gns3-gui/issues/2461 2021-06-07 14:26:20 +09:30
grossmj
d945fd8b7b Minor changes to style editor dialog. 2021-06-07 14:10:32 +09:30
grossmj
fd6c7eccd0 Link style support. Fixes https://github.com/GNS3/gns3-gui/issues/2461 2021-06-07 14:09:58 +09:30
grossmj
7a1afe2aec Upgrade dependencies 2021-06-07 13:46:06 +09:30
grossmj
6debe56d8e Fix charcoal theme. Ref #3137 2021-06-06 21:45:16 +09:30
grossmj
a4c7d41c26 Fix issue when showing menu to select port. Fixes #3169 2021-05-20 22:15:21 -07:00
grossmj
ea9243dcd9 Merge remote-tracking branch 'origin/2.2' into 2.2 2021-05-20 15:00:49 +09:30
grossmj
e9d8337bd6 Revert "Downgrade to PyQt5 5.12.1. Fixes https://github.com/GNS3/gns3-gui/issues/3169"
This reverts commit ece4d51213.
2021-05-20 14:59:44 +09:30
Jeremy Grossmann
3c92e463f8 Update setup.py
Fixes https://github.com/GNS3/gns3-server/issues/1897
2021-05-16 17:45:11 +09:30
grossmj
3d07db5c5f Development on 2.2.22dev1 2021-05-10 23:44:40 +09:30
grossmj
20cc309ac8 Release v2.2.21 2021-05-10 22:42:47 +09:30
grossmj
262a2839c5 Fix issue with empty project variable name. Fixes #3162 2021-05-10 17:55:06 +09:30
grossmj
ece4d51213 Downgrade to PyQt5 5.12.1. Fixes https://github.com/GNS3/gns3-gui/issues/3169 2021-05-10 17:03:22 +09:30
grossmj
0ef39ba129 Development on 2.2.21dev1 2021-04-09 13:50:21 +09:30
grossmj
f90267b4f0 Release v2.2.20 2021-04-09 12:14:38 +09:30
grossmj
8f16706a22 Merge branch 'master' into 2.2 2021-04-09 12:05:15 +09:30
grossmj
2d3ee3abf9 Fix project does not load anymore. Fixes #3140 2021-04-07 16:47:09 +09:30
grossmj
b8b209fa55 Fix errors while connecting to server 2021-04-07 15:51:52 +09:30
grossmj
18129e3d29 Do not connect to server while waiting for user to accept/reject SSL certificate. Fixes #3144 2021-04-07 12:09:38 +09:30
grossmj
7a2b9c024f Fix invalid server version check request. Fixes #3144 2021-04-07 12:03:37 +09:30
grossmj
4923a6dc17 Revert to PyQt5 v5.12.3 because of SSL not working
Probably the SSL DLLs weren't properly found and included by cx_Freeze
2021-04-06 23:01:07 +09:30
grossmj
73dfc047aa Set PyQt5 version to 5.15.2 on Windows 2021-04-06 22:12:34 +09:30
grossmj
fe0a70c4be Upgrade dependencies 2021-04-06 13:57:00 +09:30
Tomas Hrnciar
67014965be Explicitly require setuptools, utils/get_resource.py imports pkg_resources 2021-03-31 11:53:28 +02:00
Jeremy Grossmann
f14cb43404 Merge pull request #3153 from VidVidex/master
Add terminator as a predefined custom console option
2021-03-26 14:53:00 +10:30
Vid
f8517ee5ac Add terminator as a predefined custom console option 2021-03-24 20:28:19 +01:00
grossmj
7dc607b4c5 Development on 2.2.20dev1 2021-03-05 16:48:09 +10:30
grossmj
882fa76550 Release v2.2.19 2021-03-05 14:51:03 +10:30
grossmj
1490a1ad8f Development on 2.2.19dev1 2021-02-16 20:44:58 +10:30
grossmj
aab0c99cc6 Release v2.2.18 2021-02-16 19:09:46 +10:30
grossmj
a6a987d74c Fix bug with SSL connection on projet websocket stream. 2021-02-16 17:42:18 +10:30
grossmj
9c58b18c20 Merge remote-tracking branch 'origin/2.2' into 2.2 2021-02-16 16:42:45 +10:30
grossmj
8bc499c68f Bump version to 2.2.18dev2 2021-02-16 16:35:26 +10:30
Jeremy Grossmann
bd5eb288b7 Merge pull request #3130 from GNS3/ssl-support
SSL support.
2021-02-16 16:16:32 +10:30
grossmj
465a289568 SSL support. 2021-02-16 16:08:27 +10:30
grossmj
d240ba3056 Merge remote-tracking branch 'origin/2.2' into 2.2 2021-01-26 23:11:11 +10:30
grossmj
3cedfd3649 Remove the useless file "zoom-in (copy).svg". Fixes #3114 2021-01-26 23:10:34 +10:30
Jeremy Grossmann
276d7abdd9 Merge pull request #3104 from b-ehlers/QemuConfig
Add Qemu config disk
2020-12-14 14:23:09 +10:30
grossmj
927e38bd6d Development on 2.2.18dev1 2020-12-04 18:10:11 +10:30
grossmj
376cc29995 Release v2.2.17 2020-12-04 16:26:56 +10:30
grossmj
1f8ebeb084 Merge branch 'master' into 2.2 2020-12-04 16:21:42 +10:30
grossmj
0212755c78 Remove "-nographic" option by default for Qemu VM. Fixes #3094 2020-12-02 18:44:18 +10:30
Jeremy Grossmann
2f7d75eae9 Fix app cannot start on macOS Big Sur. Ref #3037 2020-11-30 20:02:52 +10:30
Jeremy Grossmann
fc1c060922 Merge pull request #3097 from SpikefishSolutions/master
Add yes/no prompts to gui for global project level buttons start/stop/reload/suspend to prevent bad day.
2020-11-21 18:32:45 +10:30
John
0ea72ce782 one more spacing update 2020-11-20 21:33:44 -05:00
John
3de2d2eda2 spacing updates 2020-11-20 21:32:26 -05:00
John
c08262f8af Correct stop/start/reload/suspend button names 2020-11-20 21:26:08 -05:00
John
9ae70bf2fe Add yes/no prompts to all major buttons 2020-11-20 21:11:15 -05:00
John
fa6d250602 oops.. need to build after commit. 2020-11-20 20:27:43 -05:00
John
0668840a2b i don't get it. 2020-11-20 20:26:19 -05:00
John
8b25d1b06c can't fix indent? 2020-11-20 20:25:06 -05:00
John
58c3ba0755 update indent 2020-11-20 20:23:46 -05:00
John
5a91c9aaf8 Create a message box for stopping all devives instead of blindly making someone's day terrible. 2020-11-20 18:28:30 -05:00
grossmj
0fc3f4ef16 Development on 2.2.17dev1 2020-11-05 16:59:58 +10:30
grossmj
f0e5cd2ba2 Release v2.2.16 2020-11-05 15:38:19 +10:30
grossmj
f59ef6378a Fix broken security link (replaced by email). Fixes #3085 2020-11-05 15:00:04 +10:30
grossmj
61ef08d1b7 Fix packets capture stops after some time. Fixes #3067 2020-11-05 14:21:22 +10:30
grossmj
e812c000fd Option to allocate or not the vCPUs and RAM settings for the GNS3 VM. Fixes https://github.com/GNS3/gns3-gui/issues/3069 2020-11-05 11:13:57 +10:30
Bernhard Ehlers
d3d9e1e8ae Use HDD disk image as startup QEMU config disk 2020-10-19 03:45:27 +02:00
Bernhard Ehlers
05f8df345a Fix HDD configuration layout
(cherry picked from commit 4f631669e5)
2020-10-16 10:22:32 +02:00
grossmj
4b0cc11cab Development on 2.2.16dev1 2020-10-07 16:30:03 +10:30
grossmj
b5285cd142 Release v2.2.15 2020-10-07 15:29:52 +10:30
grossmj
69482343ba Fix custom symbol not sent to remote controller when installing appliance 2020-10-07 15:09:08 +10:30
grossmj
d4639c2e61 Development on 2.2.15dev1 2020-09-15 06:49:11 +09:30
grossmj
b85ade9dd7 Release v2.2.14 2020-09-15 05:52:48 +09:30
grossmj
e191cb8aa3 Fix tests. Ref #3002 2020-09-14 00:10:11 +09:30
grossmj
e6bc75ce26 Improvements to add a new version of an appliance from wizard. Fixes #3002. 2020-09-14 00:04:58 +09:30
grossmj
bc1df346f2 Development on 2.2.14dev1 2020-09-05 04:26:16 +09:30
grossmj
27c35321f0 Release v2.2.13 2020-09-04 23:13:28 +09:30
Bernhard Ehlers
3e212fc629 Edit only text mode config files
(cherry picked from commit 880ac5e8c3)
2020-08-18 02:27:31 +02:00
Bernhard Ehlers
25e41dc0f1 Hide config import/export when configFiles attribute is empty
(cherry picked from commit fd7b915e96)
2020-08-17 13:09:59 +02:00
grossmj
c58c7774c4 Qemu disk interfaces must be set to "none" by default. Ref #3035
(cherry picked from commit 5fbb6cbf61)
2020-08-17 12:49:21 +09:30
grossmj
bd2bc8265c Do not allow image to be configured on Qemu VM secondary slave disk if create config disk option is enabled.
(cherry picked from commit 04f9a1cf8c)
2020-08-15 16:05:43 +09:30
grossmj
f2209a2780 Add explicit option to automatically create or not the config disk. Off by default.
(cherry picked from commit af79471afd)
2020-08-14 17:57:24 +09:30
grossmj
7b99ba325b Development on 2.2.13dev1 2020-08-07 21:12:46 +09:30
grossmj
74763287fb Release v2.2.12 2020-08-07 19:27:32 +09:30
grossmj
737ff42d64 Merge branch 'master' into 2.2 2020-08-07 19:04:08 +09:30
Jeremy Grossmann
5656bd2d48 Downgrade psutil to version 5.6.7 2020-07-29 17:36:14 +09:30
Jeremy Grossmann
058c069394 Fix log shows the GUI command line without spaces between its arguments. Fixes #3026 2020-07-27 18:27:23 +09:30
grossmj
926ec48d00 Upgrade to psutil version 5.7.2 2020-07-21 15:49:58 +09:30
grossmj
410e5353b2 Use server host is console host is equal to "0:0:0:0:0:0:0:0" 2020-07-17 21:13:27 +09:30
grossmj
bfb90406ed Remove VMware promotion. 2020-07-17 21:12:59 +09:30
grossmj
439cdce287 Development on 2.2.12dev1 2020-07-09 21:37:03 +09:30
grossmj
4e50c2a4b1 Release v2.2.11 2020-07-09 20:37:10 +09:30
grossmj
94c636ae61 Merge branch 'master' into 2.2 2020-07-09 20:23:31 +09:30
grossmj
f53b9a266e Try to fix "Recent project" selection not working. Ref #3007 2020-07-09 15:37:47 +09:30
grossmj
2476448032 Fix debug entries shown twice in console window and double error messages with remote GNS3VM. Fixes #3010 #3011
Note that the debug level is broken (has been for a long time apparently).
2020-07-07 21:06:56 +09:30
grossmj
a34cd742e3 Merge branch '2.2' 2020-07-06 22:20:05 +09:30
grossmj
39698196ac Fix deprecation warning. Ref #3009 2020-07-06 22:08:10 +09:30
grossmj
61432ced4f Fix tests on macOS. Ref #3009 2020-07-06 22:03:29 +09:30
grossmj
2ddd13c445 Add Snyk badges. 2020-06-27 18:27:04 +09:30
grossmj
af6c4c5b3e Merge branch 'master' into 2.2 2020-06-26 21:30:37 +09:30
grossmj
d4012294bf Run tests inside container 2020-06-26 20:50:48 +09:30
grossmj
4b04b0e855 Use xvfb to run tests 2020-06-26 20:41:08 +09:30
grossmj
1bec5019bf Install PyQt5 using pip 2020-06-26 19:42:42 +09:30
grossmj
ec6b876baa Explicitly install sip 2020-06-26 19:38:10 +09:30
grossmj
7cee0d01ab Install PyQt5 for tests and add GitHub Actions badge 2020-06-26 19:34:02 +09:30
Jeremy Grossmann
dd3314d06b Set up GitHub Actions for running tests 2020-06-26 19:27:22 +09:30
grossmj
9c58b26265 Remove tox, Travis CI and pep8.sh script
Update dependencies
2020-06-26 19:21:51 +09:30
Jeremy Grossmann
83c26f47da Merge pull request #3005 from GNS3/whitesource/configure
Configure WhiteSource for GitHub.com
2020-06-26 09:04:39 +08:00
whitesource-for-github-com[bot]
8ed2f55600 Add .whitesource configuration file 2020-06-26 01:01:54 +00:00
Jeremy Grossmann
b435317904 Merge pull request #3003 from GNS3/snyk-fix-8bf3e4840df4587cc42afb85b857d470
[Snyk] Security upgrade psutil from 5.6.6 to 5.6.7
2020-06-25 11:41:01 +08:00
snyk-bot
acb8aa8ca2 fix: requirements.txt to reduce vulnerabilities
The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-PSUTIL-483082
2020-06-24 13:10:33 +00:00
grossmj
c55d6b8a6f Fix sentry SDK is configured twice. 2020-06-24 12:40:06 +09:30
grossmj
a4039a254e Development on 2.2.11dev1 2020-06-18 19:06:00 +09:30
grossmj
85ed4b3026 Release v2.2.10 2020-06-18 12:29:33 +09:30
grossmj
5207a99692 New fix for multi-device selection/deselection not working as expected with right click. Fixes #2986 2020-06-09 13:50:31 +09:30
grossmj
d69527995d Revert "Fix Multi-device selection/deselection not working as expected with right click. Fixes #2986"
This reverts commit ddeb95cb0a.
2020-06-09 13:19:20 +09:30
grossmj
4b000ba2f7 Optimize snap-to-grid code for drawing items. Fixes #2997 2020-06-09 11:47:05 +09:30
grossmj
1b302b77a0 Move jsonschema 2.6.0 requirement in build repository.
https://github.com/GNS3/gns3-server/issues/1751
https://github.com/GNS3/gns3-gui/issues/2849

This is to avoid the following error:

```
ERROR: Double requirement given: jsonschema==2.6.0 (from -r gns3-gui\win-requirements.txt (line 4)) (already in jsonschema==3.2.0 (from -r gns3-gui\requirements.txt (line 1)), name='jsonschema')
```
2020-06-07 13:07:16 +09:30
grossmj
a5b5c404ec Only use jsonschema 2.6.0 on Windows and macOS.
https://github.com/GNS3/gns3-server/issues/1751
https://github.com/GNS3/gns3-gui/issues/2849
2020-06-07 12:55:22 +09:30
grossmj
6b97b0c6cd Disable default integrations for sentry sdk. 2020-06-06 15:37:17 +09:30
grossmj
115dd43eee Development on 2.2.10dev1 2020-06-04 21:06:30 +09:30
grossmj
2530bf97a8 Release v2.2.9 2020-06-04 18:39:27 +09:30
grossmj
9892fd0654 Fix issue editing README.txt on Windows. 2020-06-04 18:12:50 +09:30
grossmj
c71ee73da8 Merge branch 'master' into 2.2 2020-06-04 12:22:11 +09:30
Jeremy Grossmann
0643fd516d Merge pull request #2993 from GNS3/replicate-network-connection-state
Support to activate/deactive network connection state replication in Qemu
2020-06-04 10:49:41 +08:00
grossmj
a25680f2ce Fix GUI doesn't detect another GUI on macOS. Fixes #2994 2020-06-03 20:38:55 +09:30
grossmj
58bd5be920 Support to activate/deactive network connection state replication in Qemu. 2020-06-02 18:45:22 +09:30
Jeremy Grossmann
d95633ba2c Merge pull request #2989 from GNS3/reset-mac-addresses
Option to reset all MAC addresses when exporting or duplicating a project.
2020-05-27 10:53:22 +08:00
grossmj
dfea6d1723 Option to reset or not all MAC addresses when exporting or duplicating a project. 2020-05-27 12:14:47 +09:30
grossmj
ddeb95cb0a Fix Multi-device selection/deselection not working as expected with right click. Fixes #2986 2020-05-26 16:11:53 +09:30
grossmj
5f7ff0d70d Generate MainWindow Ui file. 2020-05-26 13:01:04 +09:30
Jeremy Grossmann
a00e039cec Merge pull request #2875 from fatoms/master
Proposed fix for "Edit readme" is missing in GNS3 GUI. #2854
2020-05-26 11:30:19 +08:00
Dominic
a24e9adef1 Merge branch 'Edit_Readme' 2020-05-21 20:03:03 +02:00
Dominic Harford
ee5f8e8edd Resolve conflict with GNS3 repo 2020-05-21 19:08:29 +02:00
grossmj
f5470130f5 Fix issues with crash reporting & bump version to 2.2.9dev2. Ref https://github.com/GNS3/gns3-server/issues/1758 2020-05-21 18:19:19 +09:30
grossmj
1ff405885e Merge branch 'master' into 2.2 2020-05-20 17:25:37 +09:30
Dominic
9fb42ead9f Revert "Updated GUI pyqt files from Tab Order 'fixes' in "Tab Order in Preferences and Project Dialog #2872""
This reverts commit 0d2f91709c.
2020-05-19 18:31:02 +02:00
grossmj
2ea1946c0f Replace Raven by Sentry SDK. Fixes https://github.com/GNS3/gns3-server/issues/1758 2020-05-19 15:48:53 +09:30
grossmj
963e054918 Fix online help menu URL. Fixes #2984 2020-05-08 12:42:06 +09:30
grossmj
0f5f6ab645 Require setuptools>=17.1 in setup.py. Ref https://github.com/GNS3/gns3-server/issues/1751
This is to support environmental markers.
https://github.com/pypa/setuptools/blob/master/CHANGES.rst#171
2020-05-08 12:34:58 +09:30
grossmj
8a905b5c39 Development on 2.2.9dev1 2020-05-07 23:10:20 +09:30
grossmj
e917193f06 Merge branch '2.2' 2020-05-07 23:09:04 +09:30
grossmj
16846ce49c Release v2.2.8 2020-05-07 18:10:57 +09:30
grossmj
624a670ae7 Make sure "port" is defined. 2020-05-07 17:51:32 +09:30
grossmj
406326ccd8 Merge remote-tracking branch 'origin/master' 2020-05-06 11:57:25 +09:30
grossmj
24bc15fb73 Default port set to 80 for server running in the GNS3 VM. Fixes #1737 2020-05-05 12:40:50 +09:30
grossmj
348d8b9438 Make the Web UI the default page. Ref https://github.com/GNS3/gns3-server/issues/1737 2020-04-30 17:27:06 +09:30
grossmj
6787982408 Fix "export portable project forgets contents of README". Fixes #1724 2020-04-30 16:43:00 +09:30
Jeremy Grossmann
c2384917fa Update README. Ref https://github.com/GNS3/gns3-server/issues/1719 2020-04-29 15:01:45 +09:30
grossmj
b80178d0cf Activate unified title and toolbar on MacOS. Fixes #2968 2020-04-29 13:08:51 +09:30
grossmj
e6084ed834 Confirmation dialog for "console connect to all nodes". Fixes #2971 2020-04-28 15:04:39 +09:30
grossmj
ba924cd0d9 Add "Resume all suspended links". Fixes #2858 2020-04-28 14:00:26 +09:30
grossmj
0c3d43346f Revert "Change default path for SecureCRT. Fixes #2896"
This reverts commit 0c4367d77e.
2020-04-28 13:19:38 +09:30
grossmj
fcf6ef3027 Remove @property from ConfigurationDialog(). Fixes #2819 #2965 2020-04-28 11:57:54 +09:30
grossmj
e0f87e573d Use Environmental Markers to force jsonschema version. Fixes https://github.com/GNS3/gns3-gui/issues/2849
Version 3.2.0 with Python >= 3.8
Version 2.6.0 with Python < 3.8
2020-04-27 12:54:17 +09:30
grossmj
3ec068f0cb Use Environmental Markers to force jsonschema version 2.6.0 on Windows/macOS. Ref https://github.com/GNS3/gns3-gui/issues/2849 2020-04-27 12:43:07 +09:30
grossmj
37f1fcf6f7 Remove preferences dialog geometry restoration. Fixes #2807 2020-04-27 11:55:01 +09:30
grossmj
c51dd1605d Merge branch '2.3'
# Conflicts:
#	gns3/version.py
2020-04-13 11:57:04 +09:30
grossmj
4ebf3b4e1c Development on 2.2.8dev1 2020-04-08 01:26:42 +09:30
grossmj
b1ec9d535c Release v2.2.7 2020-04-08 00:03:13 +09:30
grossmj
7fc9087cf0 Fix unable to configure custom adapters for Qemu VMs. Fixes #2961 2020-04-07 15:47:53 +09:30
Bernhard Ehlers
5dc2c77806 QEMU config disk - enable QEMU config import/export
(cherry picked from commit d01f15c4df)
2020-04-06 13:42:00 +02:00
grossmj
4972d460d2 Fix tests. 2020-04-06 21:09:47 +09:30
grossmj
c388836be7 Fix VNC console template doesn't extract %i (Project UUID). Fixes #2960 2020-04-06 18:34:37 +09:30
grossmj
18ae4a6ce9 Fix contextual menu issues. Ref #2955 2020-03-30 21:37:52 -07:00
grossmj
3020e1fc9f Downgrade to PyQt 5.12.3 Ref #2955 #2952 2020-03-29 18:18:53 +10:30
grossmj
fe2f8424db Downgrade to PyQt 5.13.2 Ref #2955 #2952 2020-03-29 14:46:34 +10:30
grossmj
a744f65199 Merge branch 'master' into 2.3
# Conflicts:
#	gns3/version.py
2020-03-28 13:44:08 +10:30
grossmj
d27578f0fc Release v2.2.6 2020-03-26 12:37:59 +10:30
grossmj
b01c11f19b Prevent locked drawings to be deleted. Fixes https://github.com/GNS3/gns3-gui/issues/2948 2020-03-16 16:30:09 +10:30
grossmj
fb269da4d3 Fix issues with empty project variables. Fixes https://github.com/GNS3/gns3-gui/issues/2941 2020-03-14 17:22:44 +10:30
grossmj
ab15f96bb5 Upgrade psutil to version 5.6.6 due to CVE-2019-18874
https://github.com/advisories/GHSA-qfc5-mcwq-26q8
2020-03-14 15:47:12 +10:30
grossmj
5bb8b8e8bd Use existing README.txt if existing when exporting portable project. Fixes https://github.com/GNS3/gns3-server/issues/1724 2020-03-10 17:32:13 +10:30
grossmj
3f9632fae0 Allow creation of a diskless Qemu VMs. Fixes #2939 2020-03-10 17:04:07 +10:30
grossmj
b5f8195abb Re-enable "create new version" in appliance wizard. Fixes #2837 2020-03-03 13:11:01 +08:00
grossmj
73a293bd17 Fix unable to load project from project library. Fixes #2932 2020-03-03 09:34:45 +08:00
grossmj
0a1dfb99e9 Merge remote-tracking branch 'origin/2.2' into 2.2 2020-02-19 14:13:16 +08:00
grossmj
d352919264 Fix some permission denied errors when loading remote project. Ref #2871 Fixes #2901 2020-02-19 14:13:03 +08:00
Jeremy Grossmann
65f2a1e461 Merge pull request #2931 from inthought/2.2
Add 'Royal TS V5' to predefined console list
2020-02-18 13:29:46 +10:30
Travis Abram
71f289721b Add 'Royal TS V5' to predefined console list 2020-02-16 20:46:40 -08:00
grossmj
c28089d400 Disallow invalid grid sized. Fixes #2908 2020-02-10 16:59:17 +08:00
grossmj
64f009bf71 Check if hostname is blank. Fixes #2924 2020-01-25 18:21:02 +08:00
Jeremy Grossmann
edb2fd7fd9 Merge pull request #2925 from GNS3/qemu-changes
GUI changes to support recent versions of Qemu
2020-01-25 16:04:54 +07:00
grossmj
62e7ad8c8a Add nvme disk interface and fix scsi disk interface for Qemu VMs. 2020-01-25 16:22:34 +08:00
grossmj
caeb5d71c3 Add latest Qemu nic models. 2020-01-24 19:05:46 +08:00
grossmj
cfe96b2311 Upgrade Qt version to 5.14.1. Ref #2778 #2903 2020-01-24 17:47:01 +08:00
grossmj
8955b9ee29 Upgrade to PyQt 5.14.1. Ref #2778 2020-01-22 17:53:04 +08:00
grossmj
e727abf27a Change version to 2.3.0dev1 on 2.3 branch 2020-01-16 18:06:51 +08:00
grossmj
f209bf7644 Development on 2.2.6dev1 2020-01-10 00:32:10 +08:00
grossmj
5860dedc32 Release v2.2.5 2020-01-09 23:52:40 +08:00
grossmj
9e2df17a4e Add gns3-gui.xml and update Linux icons paths & permissions. Ref #2919 2020-01-09 23:49:44 +08:00
grossmj
a95761437a Development on 2.2.5dev1 2020-01-09 05:17:01 +08:00
grossmj
626510865f Update paths to icons for Linux 2020-01-09 04:19:21 +08:00
grossmj
2e248aa340 Release v2.2.4 2020-01-09 00:45:09 +08:00
grossmj
e306f73f01 Fix "Console to all nodes" doesn't open cloud objects with console configured. Fixes #2902 2020-01-08 00:35:57 +08:00
grossmj
0c4367d77e Change default path for SecureCRT. Fixes #2896 2019-12-26 06:13:23 +08:00
grossmj
6dda0ff787 Add icons in setup.py Ref #2898 2019-12-26 06:04:40 +08:00
grossmj
d7d4b84309 Add remote viewer as a VNC console for Linux. Fixes #2913 2019-12-26 04:13:02 +08:00
grossmj
7b57983699 Development on 2.2.4dev1 2019-11-12 16:43:21 +08:00
grossmj
bb89fe2275 Release v2.2.3 2019-11-12 15:29:54 +08:00
grossmj
7eb2a923b2 Fix issue when binding on 0.0.0.0. Fixes #2892 2019-11-11 17:49:09 +08:00
grossmj
58052e3cce Allow double click on cloud with configured console to open session. Fixes #2894 2019-11-11 14:31:35 +08:00
grossmj
e431104f6b Officially support Python 3.8. Ref https://github.com/GNS3/gns3-gui/issues/2895 2019-11-11 12:56:11 +08:00
grossmj
a4e9d6b8ce Set psutil to version 5.6.3 in requirements.txt 2019-11-08 10:44:17 +08:00
grossmj
f58f5c7b95 Developement version on 2.2.3dev1 2019-11-04 19:45:18 +08:00
grossmj
37faa39309 Release v2.2.2 2019-11-04 18:33:29 +08:00
grossmj
4d64598ed2 Fix KeyError: 'spice+agent'. Fixes #2890 2019-11-03 15:19:18 +08:00
grossmj
5132c4e172 Fix wrong log.error() call when exporting file. 2019-11-02 23:19:04 +08:00
grossmj
3c3fdd9ffd Revert "Explicitly cleanup the cache directory."
This reverts commit 8095fef228.
2019-11-02 15:47:24 +08:00
grossmj
efa50571c6 Fix "UnboundLocalError: local variable 'pywintypes' referenced before assignment" 2019-11-02 15:45:16 +08:00
grossmj
ca9b10fcca Fix version string. 2019-11-02 15:27:28 +08:00
grossmj
8660161b10 Fix GUI uses only telnet console. Fixes #2885 2019-11-02 02:23:13 +08:00
grossmj
50ebfb9c06 Fix missing sys module in sudo.py Fixes #2886 2019-11-02 02:06:33 +08:00
grossmj
26df59d6b6 Development on 2.2.2dev1 2019-11-01 18:43:36 +08:00
grossmj
b903e2ad73 Release v2.2.1 2019-11-01 17:53:20 +08:00
grossmj
b2fe7eb643 Check if console_type is None. 2019-11-01 17:47:26 +08:00
grossmj
8095fef228 Explicitly cleanup the cache directory. 2019-11-01 17:46:53 +08:00
grossmj
b8da5440f5 Get Windows interface from registry if cannot load win32com module. 2019-11-01 17:44:47 +08:00
grossmj
6cea094e4e Ignore OSError returned by psutil when bringing console to front. 2019-11-01 17:44:06 +08:00
grossmj
9ac46c9d50 Catch error if NPF or NPCAP service cannot be detected. Ref https://github.com/GNS3/gns3-server/issues/1670 2019-10-30 17:59:19 +08:00
Dominic
c8a8663ff0 Restore editReadme attribute which was removed in Change 'New export project wizard' ( ID c2472bcb22 ) 2019-10-18 17:11:28 +02:00
Dominic
d27e5c1795 Revert "Remove unused edit readme action. Fixes #2816"
This reverts commit 7cd0187f33.
2019-10-18 16:46:48 +02:00
Dominic
0d2f91709c Updated GUI pyqt files from Tab Order 'fixes' in "Tab Order in Preferences and Project Dialog #2872" 2019-10-18 16:45:39 +02:00
grossmj
6dc44d5108 Better handling for reading synchronous JSON response from server. Ref #2874 2019-10-17 12:45:40 +08:00
grossmj
9c6be0341b Fix tests. 2019-10-17 12:34:34 +08:00
grossmj
011a49e998 Fix JSONDecodeError when getting server version. Fixes #2874 2019-10-17 12:31:15 +08:00
grossmj
e18c2df5f5 Fix FileNotFoundError exceptions when launching SPICE or VNC clients. 2019-10-17 12:19:55 +08:00
grossmj
1794b8389f Fix UnboundLocalError local variable 'win32serviceutil' referenced before assignment 2019-10-17 12:12:46 +08:00
grossmj
0379c370eb Merge remote-tracking branch 'remotes/origin/master' into 2.2 2019-10-15 23:36:49 +08:00
Jeremy Grossmann
e03550a89b Merge pull request #2872 from fatoms/Tab_Order
Tab Order in Preferences and Project Dialog
2019-10-15 22:35:53 +07:00
Dominic
c6ea775e81 'Fix' tab order in preferences dialog so it follows the layout 2019-10-12 22:06:30 +02:00
Dominic
38233ba5e9 'Fix' tab order in edit project dialog so it follows the layout 2019-10-12 22:05:52 +02:00
grossmj
89c1272bc1 Use compatible shlex_quote to handle case where Windows needs double quotes around file names, not single quotes. Ref https://github.com/GNS3/gns3-gui/issues/2866 2019-10-09 17:02:30 +08:00
grossmj
8bbb46c599 Use 0.0.0.0 by default for server host. Fixes https://github.com/GNS3/gns3-server/issues/1663 2019-10-09 16:35:42 +08:00
grossmj
74fca3d736 Set default host to "localhost". Fixes https://github.com/GNS3/gns3-server/issues/1663 2019-10-08 18:28:11 +08:00
grossmj
7aeed7aa59 Catch IndexError when configuring port names. Fixes #2865 2019-10-08 16:15:36 +08:00
grossmj
aa15ace887 Bump version to 2.2.1dev1 2019-10-08 16:05:37 +08:00
grossmj
2d0a7b5f58 Release v2.2.0 2019-09-30 16:24:26 +08:00
grossmj
20a09b56c1 Merge branch 'master' into 2.2
# Conflicts:
#	gns3/version.py
2019-09-24 14:07:38 +08:00
grossmj
1938cdabae Bump version to 2.2.0dev18 2019-09-24 14:02:36 +08:00
grossmj
8d1bff782c Release v2.2.0rc5 2019-09-09 15:06:14 +07:00
grossmj
4e3eee2383 Adjust size for setup dialog and remove question about running the wizard again. Ref #2846 2019-09-07 23:46:02 +07:00
grossmj
da8aa0d2fd Release v2.2.0rc4 2019-08-30 15:23:32 +07:00
grossmj
5b4481c43a Fix issue when asking to run the setup wizard again. Ref #2846 2019-08-29 15:59:40 +07:00
grossmj
593cb8c1fd Remove warning about VirtualBox not supporting nested virtualization. Ref https://github.com/GNS3/gns3-server/issues/1610 2019-08-27 17:28:44 +07:00
grossmj
210cf63fe2 Ask user if they want to see the wizard again. Ref #2846 2019-08-27 16:15:50 +07:00
grossmj
3b178013c0 Bump version to 2.2.0dev17 2019-08-23 18:20:44 +07:00
grossmj
6e44d6b919 Merge branch 'master' into 2.2
# Conflicts:
#	gns3/version.py
2019-08-20 17:35:13 +07:00
grossmj
6b520b8036 Bump version to 2.2.0dev16 2019-08-20 17:33:48 +07:00
grossmj
803782b9d8 Release v2.2.0rc3 2019-08-11 19:14:56 -07:00
grossmj
d3d6ca3f2e Revert to jsonschema 2.6.0 due to packaging problem. 2019-08-11 19:11:41 -07:00
grossmj
f545c793f8 Release v2.2.0rc2 2019-08-10 12:04:19 -05:00
grossmj
47d6a4fef6 Release v2.2.0rc1 2019-08-10 11:42:13 -05:00
grossmj
8862b608cf Bump jsonschema to version 3.0.2 2019-08-09 13:47:58 -05:00
grossmj
76832ab83f Fix "Unable to change Remote Main Server IP". Fixes #2823 2019-08-02 17:23:31 -02:30
grossmj
fed245fd34 Fix "AttributeError: 'QGraphicsTextItem' object has no attribute 'locked'". Fixes #2814 2019-07-30 15:50:40 -02:30
grossmj
3e0f1affd0 Merge branch '2.2' 2019-07-12 12:07:33 +02:00
grossmj
2110c2805e Development on 2.2.0dev15 2019-07-11 17:34:56 +02:00
grossmj
46cfdd8314 Release v2.2.0b4 2019-07-11 16:58:35 +02:00
grossmj
f8f648c2b6 Fix issue preventing to open the QFileDialog in the correct directory. 2019-07-11 16:50:59 +02:00
grossmj
7cd0187f33 Remove unused edit readme action. Fixes #2816 2019-07-10 12:10:17 +02:00
grossmj
4d8f362f11 Remove deprecated Qemu parameter to run legacy ASA VMs. Fixes #2827 2019-07-10 11:33:04 +02:00
grossmj
469eaa4737 Upload images on remote controller. Fixes #2828 2019-07-10 11:23:29 +02:00
grossmj
c921224b30 Preferences dialog: send API request only if connected to controller 2019-07-05 18:07:48 +02:00
grossmj
61487b2e2f Fix AttributeError: 'QGraphicsTextItem' object has no attribute 'locked'. Fixes #2814 2019-06-24 15:29:07 +02:00
grossmj
9affca495e Fix KeyError: 'chassis' when converting old IOS templates. Fixes #2813 2019-06-24 15:14:20 +02:00
grossmj
9d8886a640 Development on 2.2.0dev14 2019-06-15 16:38:06 +02:00
grossmj
98cfec1b77 Release v2.2.0b3 2019-06-15 15:39:32 +02:00
grossmj
aed174953e Merge 2.1 into 2.2 branch. 2019-06-15 15:26:20 +02:00
grossmj
f0feea8262 Fix template migration issues from GUI to controller. Fixes https://github.com/GNS3/gns3-gui/issues/2803 2019-06-15 12:52:50 +02:00
grossmj
e2aeaf0a78 Development on 2.1.22dev1 2019-06-14 19:42:18 +02:00
grossmj
b92bb94875 Release v2.1.21 2019-06-14 10:47:08 +02:00
grossmj
c56db59353 Increase timeout from 2 to 5 seconds for synchronous check. Ref #2805 2019-06-10 22:20:40 +02:00
grossmj
a87c4e21d7 %guest-cid% variable implementation for Qemu VMs. Fixes https://github.com/GNS3/gns3-gui/issues/2804 2019-06-04 18:00:44 +02:00
grossmj
ed99a989d7 Fix "General Preferences dialog displays misleading information". Fixes #2801 2019-06-04 17:05:01 +02:00
grossmj
f9a4c9399a Increase timeout from 2 to 5 seconds for synchronous check. Ref #2805 2019-05-31 09:17:34 +02:00
grossmj
efb5c8ca9a Development on 2.2.0dev13 2019-05-29 17:52:38 +07:00
grossmj
0946dff3a0 Release v2.2.0b2 2019-05-29 17:16:59 +07:00
grossmj
d7d96b10e5 Merging 2.1 into 2.2 branch 2019-05-29 16:50:36 +07:00
grossmj
0c0b2d5cb3 Development on 2.1.21dev1 2019-05-29 16:37:43 +07:00
grossmj
450fbc9af3 Release v2.1.20 2019-05-29 15:44:25 +07:00
grossmj
469ee8fab8 Fix KeyError: 'endpoint' issue. Fixes #2802 2019-05-28 23:17:55 +07:00
grossmj
6ccfcaf76e Development on 2.1.20dev1 2019-05-28 16:33:43 +07:00
grossmj
520e857874 Release v2.1.19 2019-05-28 15:23:35 +07:00
grossmj
012c7b4241 Fix wrong aligment of symbols in saved/exported projects. Fixes #2800 2019-05-27 16:33:51 +07:00
grossmj
1d71cd5bf0 Replace urllib.request by Qt implementation for local server synchronous check. Fixes #2793 2019-05-27 16:03:55 +07:00
grossmj
17d1a7f4ed Support snapshots for portable projects. Fixes https://github.com/GNS3/gns3-gui/issues/2792 2019-05-27 15:35:47 +07:00
grossmj
0cd5c08c6b Fix event notification problem for projects and how snapshots are restored. 2019-05-27 15:24:36 +07:00
grossmj
20ac503fe9 Do not close the nodes dock widget when creating project. 2019-05-26 15:20:53 +07:00
grossmj
5f737c2c7c Fix no scan for images on remote controller. Fixes #2799 2019-05-26 15:12:22 +07:00
grossmj
eb1a37be36 Remove problematic tests. 2019-05-25 17:49:33 +07:00
grossmj
07c64b5432 Use QNetworkAccessManager to download custom appliance symbols. 2019-05-25 16:25:02 +07:00
grossmj
ce981d1c49 Experimental auto upgrade should not be available for "frozen" app. Fixes #2797 2019-05-25 15:17:23 +07:00
grossmj
32a9f2556e Use QNetworkAccessManager for synchronous local server check. Ref #2793
Remove unused code.
2019-05-25 15:04:37 +07:00
grossmj
7f08675121 Merging 2.2 into master 2019-05-24 15:27:07 +07:00
grossmj
1dc3c13df2 Don't allow link labels to be moved for locked nodes. Fixes #2794 2019-05-23 15:10:40 +07:00
grossmj
6a6e86b325 Merge 2.1 into 2.2 branch 2019-05-23 14:51:53 +07:00
grossmj
d96277882a Set grid's minimum to 5. Fixes #2795 2019-05-23 14:41:53 +07:00
grossmj
ecec917752 Development on 2.1.19dev1 2019-05-23 14:37:37 +07:00
grossmj
ea9c1a8ee1 Release v2.1.18 2019-05-22 16:13:28 +07:00
grossmj
cfbb09fb57 Fix error in HTTPConnection.request for Python3.6. Fixes #2793 2019-05-22 16:05:34 +07:00
grossmj
dc8aa1fb92 Catch more OSError/PermissionError when checking md5 on remote images. Fixes #2582 2019-05-22 15:23:56 +07:00
grossmj
786cc8aa65 Fix exception when grid size is 0. Fixes #2790 2019-05-22 15:13:16 +07:00
grossmj
4a353e08e3 Catch PermissionError when scanning local image directories. Fixes #2791 2019-05-22 14:55:07 +07:00
grossmj
1371921586 Development on 2.2.0dev12 2019-05-21 19:16:19 +07:00
grossmj
cd8696a714 Release v2.2.0b1 2019-05-21 15:26:54 +07:00
grossmj
17799719d6 Merge branch '2.1' into 2.2 2019-05-21 15:16:19 +07:00
grossmj
2a59013604 Revert "Make sure the latest PyQt5 version 5.12.x is used on Windows." Ref #2778 2019-05-20 12:01:16 +07:00
grossmj
1c46299dd9 Change behavior when an IOU license is verified. Fixes https://github.com/GNS3/gns3-server/issues/1555 2019-05-20 10:51:25 +07:00
grossmj
628d7cb909 Fix cannot load new profile. Fixes #2784 2019-05-19 16:33:33 +07:00
grossmj
b23c92c0fb Fix Docker extra volumes support 2019-05-19 14:26:03 +07:00
Jeremy Grossmann
49ce5a9f38 Merge pull request #2775 from kazkansouh/2.2-docker-volumes
Custom persistent docker volumes
2019-05-18 20:17:20 +07:00
Jeremy Grossmann
4575ea9f6d Merge pull request #2789 from GNS3/update-dockerfile
Update Dockerfile to Ubuntu 18.04
2019-05-18 20:10:31 +07:00
grossmj
fd6a00df6a Update Dockerfile to Ubuntu 18.04 2019-05-18 20:03:04 +07:00
grossmj
58ab4b424a Fix remote packet capture when controller is also remote. Fixes #2785 2019-05-18 17:33:34 +07:00
grossmj
1ea1abf582 Set console type to "none" by default for Ethernet switches and add a warning if trying to use "telnet". Fixes https://github.com/GNS3/gns3-gui/issues/2776 2019-05-18 14:28:20 +07:00
grossmj
e8caab74f4 Bump version to 2.2.0dev11 2019-05-18 14:11:07 +07:00
grossmj
9fce393fd1 Add tooltip for symbol theme support in general preferences. Fixes #2770 2019-05-18 14:01:08 +07:00
grossmj
827c11ae97 Merge remote-tracking branch 'origin/2.2' into 2.2 2019-05-18 13:45:57 +07:00
grossmj
eb370d5672 Merge 2.1 branch into 2.2 2019-05-18 13:45:39 +07:00
grossmj
7732aaf9a5 Release v2.1.17 2019-05-17 15:10:28 +07:00
Karim Kanso
63161eb760 Minor ui tweak to align extra hosts text edit look and feel with extra volume text edit. 2019-04-22 13:03:23 +01:00
Karim Kanso
5dba814d1b Support for persistent docker volumes to be configured via ui (requires corresponding commit on gns3-server) 2019-04-22 11:09:28 +01:00
Jeremy Grossmann
aecdc71f3a Merge pull request #2772 from GNS3/pyup-update-pytest-4.4.0-to-4.4.1
Update pytest to 4.4.1
2019-04-16 20:04:42 +07:00
pyup-bot
3209c1d0e6 Update pytest from 4.4.0 to 4.4.1 2019-04-16 03:33:58 +02:00
grossmj
2b3fb53ef2 Release v2.2.0a5 2019-04-15 17:05:20 +07:00
grossmj
cbbbece0e5 Revert "Drop old Qemu support (Windows and macOS) and legacy ASA support." Ref https://github.com/GNS3/gns3-server/issues/1579
This reverts commit 3e47267e35.
2019-04-15 15:56:01 +07:00
grossmj
56d742b19f Merge 2.1 into 2.2 2019-04-15 15:54:08 +07:00
grossmj
1f566a31cf Development on 2.1.17dev1 2019-04-15 12:41:41 +07:00
grossmj
10d75e15da Release v2.1.16 2019-04-15 12:00:18 +07:00
grossmj
17def7e00a Do not make NPF or NPCAP service mandatory to start the local server on Windows. 2019-04-15 10:33:27 +07:00
grossmj
106afd0987 Do not try to upload a local image that is already installed on the local server. 2019-04-15 00:29:43 +07:00
grossmj
bba9c5e1d8 Back to the major.minor version for config files. Ref https://github.com/GNS3/gns3-gui/issues/2756 2019-04-14 21:31:41 +07:00
grossmj
ae8e8013d4 Some adjustments with compute WebSocket handling. Ref https://github.com/GNS3/gns3-server/issues/1564 2019-04-14 16:48:12 +07:00
grossmj
3a5f1d60f9 Fix AttributeError: 'GraphicsView' object has no attribute '_import_config_dir'. Fixes #2768 2019-04-13 18:45:16 +07:00
grossmj
3f6eb61382 Do not try to lock a SvgIconItem. Fixes #2766 2019-04-13 18:40:54 +07:00
grossmj
32bfff381d Merge 2.1 into 2.2 2019-04-13 18:11:41 +07:00
grossmj
f68a8ea829 Fix OverflowError error with progress dialog. Fixes #2767 2019-04-13 17:38:43 +07:00
grossmj
50066b2f12 More fixes for stuck progress window. Fixes #2765 2019-04-13 17:10:24 +07:00
grossmj
21a99d4376 Fix adding multiple devices - stuck progress window. Fixes #2765 2019-04-13 17:04:23 +07:00
grossmj
f97d3041b8 Make sure the latest PyQt5 version 5.12.x is used on Windows. 2019-04-13 15:43:23 +07:00
grossmj
31d6a065b0 Show a warning when a config export is not supported. Ref #2762 2019-04-11 15:32:22 +07:00
grossmj
20bf63dbbf Prevent locked nodes to be deleted. Fixes https://github.com/GNS3/gns3-gui/issues/2764 2019-04-10 15:43:52 +07:00
grossmj
1c3e0ef640 Fix default telnet console command. 2019-04-09 21:18:55 +07:00
grossmj
5b58d3ab6d Bump version to 2.2.0dev10 2019-04-09 19:20:21 +07:00
grossmj
554c9205f3 Add PuTTY 0.71 and mark GNS3 PuTTY as deprecated. Fixes #2758 2019-04-09 19:19:56 +07:00
grossmj
543a8e7c33 Fix bug with IOS platform detection. Fixes #2760 2019-04-09 16:24:07 +07:00
grossmj
69ef35c674 Development on 2.2.0dev9 2019-04-05 22:01:35 +08:00
grossmj
45102a07b6 Release v2.2.0a4 2019-04-05 19:10:04 +08:00
grossmj
f0b8b22e8a Use the full version number for path to config files. Ref https://github.com/GNS3/gns3-gui/issues/2756 2019-04-05 18:44:31 +08:00
grossmj
d94f5a2d8c Fix error message when shutting down GUI without a started server. 2019-04-01 21:08:17 +07:00
grossmj
a768661c05 Fix remote packet capture and make sure packet capture is stopped when deleting an NIO. Fixes https://github.com/GNS3/gns3-gui/issues/2753 2019-04-01 19:47:32 +07:00
grossmj
4657b005b6 Restore migrate old settings. 2019-04-01 16:20:26 +07:00
grossmj
e71da830b0 Merge remote-tracking branch 'origin/2.2' into 2.2 2019-04-01 15:53:59 +07:00
grossmj
ebf2563200 Store config files in version specific location 2019-04-01 15:53:39 +07:00
Jeremy Grossmann
e8eaa00244 Merge pull request #2755 from GNS3/pyup-update-pytest-4.3.1-to-4.4.0
Update pytest to 4.4.0
2019-04-01 12:00:43 +07:00
pyup-bot
d750e7a427 Update pytest from 4.3.1 to 4.4.0 2019-04-01 06:53:29 +02:00
grossmj
bfc8adc904 Fix error messages on closing GNS3 application. Fixes https://github.com/GNS3/gns3-gui/issues/2750 2019-03-30 17:20:15 +07:00
grossmj
4de38ea590 Fix bug when list of files for an appliance is not displayed. 2019-03-30 15:44:30 +07:00
ziajka
cc0c6d0a7a Update 'local' to 'bundled' in server & gui, Fixes: #1561 2019-03-27 11:56:32 +01:00
grossmj
d1d0810233 Development on 2.2.0dev8 2019-03-25 23:44:19 +08:00
grossmj
ee3c758bb7 Release v2.2.0a3 2019-03-25 19:35:22 +08:00
grossmj
8f077456b1 Development on 2.1.16dev1 2019-03-21 13:56:11 +08:00
grossmj
a29f3e35c0 Release v2.1.15 2019-03-21 11:41:44 +08:00
grossmj
b12cb5c939 Fix bug when changing symbol. Fixes #2740 2019-03-20 15:15:29 +08:00
grossmj
ba646f5efa Fix image upload tests, second try. 2019-03-18 17:34:26 +07:00
grossmj
edafc29cdc Fix image upload tests. 2019-03-18 17:19:23 +07:00
grossmj
5aa67d18c0 Fix issue when images are not uploaded from appliance wizard. Ref https://github.com/GNS3/gns3-gui/issues/2738 2019-03-18 15:33:37 +07:00
grossmj
8067aaadd4 Development on 2.2.0dev7 2019-03-14 23:27:11 +07:00
grossmj
4a012c4d88 Release v2.2.0a2 2019-03-14 17:09:53 +07:00
grossmj
7f234aa648 Try to handle stacked widget layout differently. Ref #2605 2019-03-13 15:46:41 +07:00
Jeremy Grossmann
dbbcdf0f73 Merge pull request #2735 from GNS3/pyup-update-pytest-4.3.0-to-4.3.1
Update pytest to 4.3.1
2019-03-13 11:43:19 +07:00
pyup-bot
a6c56a0963 Update pytest from 4.3.0 to 4.3.1 2019-03-13 00:37:53 +01:00
Jeremy Grossmann
466d427295 Merge pull request #2732 from GNS3/symbol-management-refactoring
Symbol management refactoring
2019-03-12 18:21:23 +07:00
grossmj
e5b8bdc106 Early support for symbol themes. 2019-03-12 18:13:33 +07:00
grossmj
25a6b6b3b1 Download custom appliance symbols from GitHub
Fix symbol cache issue. Ref https://github.com/GNS3/gns3-gui/issues/2671
Fix temporary directory for symbols was not deleted
Fix temporary appliance file was not deleted
2019-03-11 16:55:16 +07:00
Jeremy Grossmann
39723a2212 Merge pull request #2730 from GNS3/lock-unlock-items
Display available appliances in a hierarchical folder structure. Fixes #2702
2019-03-08 18:03:59 +07:00
grossmj
9cd0597879 Change the size of template list on the Preferences window to relative. Fixes #2605 2019-03-08 11:46:43 +07:00
grossmj
c2472bcb22 New export project wizard. 2019-03-07 17:38:27 +07:00
grossmj
b9caf7216a Update paths for binaries moved to the MacOS directory in GNS3.app 2019-03-04 16:07:04 +07:00
grossmj
6b23de94b0 Bump version to 2.2.0dev2 2019-03-04 14:48:57 +07:00
grossmj
ab1324ffba Prevent to change layer position for locked items. Ref #2679 2019-03-02 18:49:19 +07:00
grossmj
21bcfde8f3 Display available appliances in a hierarchical folder structure. Fixes #2702 2019-03-02 17:52:47 +07:00
Jeremy Grossmann
3616bd6c85 Merge pull request #2725 from GNS3/lock-unlock-items
Refactoring for locking/unlocking items
2019-03-02 16:44:22 +07:00
grossmj
740e9bab87 Handle locking/unlocking items independently from the layer position. 2019-03-02 16:26:41 +07:00
grossmj
198cf833e9 Stay with jsonschema 2.6.0 2019-03-01 17:26:23 +07:00
grossmj
21f5a64b07 Merge 2.1 into 2.2 2019-03-01 17:23:49 +07:00
grossmj
fc3781550a Development on 2.1.15dev1 2019-02-27 15:59:16 +07:00
Jeremy Grossmann
a9a2a541c0 Update gns3-feature-request.md 2019-02-27 15:46:57 +07:00
Jeremy Grossmann
8998c07e0e Update gns3-bug-report.md 2019-02-27 15:46:28 +07:00
Jeremy Grossmann
ba01a89af1 Update gns3-feature-request.md 2019-02-27 15:43:07 +07:00
Jeremy Grossmann
eae07d62ad Update gns3-bug-report.md 2019-02-27 15:42:21 +07:00
Jeremy Grossmann
23903cf0c9 Delete feature_request.md 2019-02-27 15:36:33 +07:00
Jeremy Grossmann
4d908fd855 Delete bug_report.md 2019-02-27 15:36:18 +07:00
Jeremy Grossmann
bb0e67be4f Update issue templates 2019-02-27 15:32:18 +07:00
grossmj
d285e62c04 Release v2.1.14 2019-02-27 14:58:52 +07:00
grossmj
44d70de687 Better description to why an appliance cannot be installed. 2019-02-27 14:51:12 +07:00
grossmj
752c516f82 Development on 2.1.14dev1 2019-02-26 18:09:56 +07:00
grossmj
e1ec6c5771 Merge remote-tracking branch 'origin/2.1' into 2.1 2019-02-26 16:43:27 +07:00
grossmj
e8308869d9 Release v2.1.13 2019-02-26 16:43:14 +07:00
Jeremy Grossmann
484c5abe9d Force jsonschema dependency to 2.6.0
This is to fix this issue when starting the (frozen) application on Windows:

```
  File "C:\Python36-x64\lib\site-packages\jsonschema\validators.py", line 505, in <module>
  File "C:\Python36-x64\lib\site-packages\jsonschema\_utils.py", line 57, in load_schema
  File "C:\Python36-x64\lib\pkgutil.py", line 634, in get_data
OSError: [Errno 34] Result too large: 'jsonschema\\schemas\\draft6.json'
```
2019-02-26 15:28:16 +07:00
grossmj
c85112978d Fix broken idle-pc support. Fixes #1515 2019-02-22 22:22:31 +07:00
grossmj
e57f6db9f0 Merge remote-tracking branch 'origin/2.2' into 2.2 2019-02-22 17:37:24 +07:00
grossmj
edee26c77c Merging 2.1 into 2.2 2019-02-22 17:36:59 +07:00
grossmj
fe222b873f Disable computer hibernation detection mechanism. Ref #2678 2019-02-22 17:04:12 +07:00
Jeremy Grossmann
1acf44de21 Merge pull request #2719 from GNS3/drop-old-qemu
Drop old Qemu support (Windows/macOS) and ASA legacy image support. Ref #1516
2019-02-20 17:48:29 +07:00
grossmj
f8bb6661dd Add some advice for request timeout message. Fixes #2652 2019-02-20 00:14:15 +07:00
grossmj
ac50dffabd Fix appliance to template tests. 2019-02-19 23:29:20 +07:00
grossmj
fbb28a4325 Remove -nographic Qemu option when importing appliance. 2019-02-19 23:20:21 +07:00
grossmj
3e47267e35 Drop old Qemu support (Windows and macOS) and legacy ASA support. 2019-02-19 23:14:19 +07:00
grossmj
0f9aab9230 Merge remote-tracking branch 'origin/2.1' into 2.1 2019-02-19 16:07:51 +07:00
grossmj
a5cf5e16b7 Show/Hide interface labels when status points are not shown. Fixes #2690 2019-02-19 16:07:39 +07:00
Jeremy Grossmann
7f8269bb44 Merge pull request #2717 from GNS3/pyup-update-pytest-4.1.1-to-4.3.0
Update pytest to 4.3.0
2019-02-19 15:56:28 +07:00
Jeremy Grossmann
097458d108 Merge pull request #2715 from GNS3/critical-messages-before-running
Show critical messages before the main window runs. Fixes #2710
2019-02-19 15:19:53 +07:00
pyup-bot
2e0ce6afe0 Update pytest from 4.1.1 to 4.3.0 2019-02-19 04:26:58 +01:00
grossmj
f4cafac9c7 Do not print critical message twice on stderr.
Replace QMessageBox calls with no parent by log.error()/log.warning().
2019-02-18 22:09:23 +08:00
grossmj
7f132fdc36 Show critical messages before the main window runs. 2019-02-18 11:22:13 +08:00
grossmj
6b7d629755 Avoid using PyQt5.Qt, which imports unneeded stuff. Fixes #2592 2019-02-16 15:05:42 +08:00
grossmj
b7ccc37ea5 Fix SIP import error with recent PyQt versions. Fixes #2709 2019-02-16 14:38:44 +08:00
Jeremy Grossmann
bbe2826c77 Upgrade to Qt 5.12. Fixes #2636 2019-02-12 11:55:09 +08:00
grossmj
dda0447839 Release v2.2.0a1 2019-01-29 14:39:42 +08:00
grossmj
9398dd0840 Resize some more dialogs. 2019-01-29 11:44:15 +08:00
grossmj
6e3c5c1bb8 Resize some dialogs. 2019-01-28 18:01:52 +08:00
grossmj
a83208178b Fix default NAT interface not restored on Windows. Fixes #2681 2019-01-28 15:39:35 +08:00
grossmj
f1b7c0e176 Fix tests. 2019-01-28 15:24:40 +08:00
grossmj
429c2ab650 Merge and improvements to the setup wizard. Fixes #2676. 2019-01-28 15:13:37 +08:00
grossmj
68e2a0ee39 Adjust the setup wizard (VMware image size, layouts). 2019-01-27 22:44:56 +08:00
Jeremy Grossmann
b27c024449 Merge pull request #2684 from GNS3/refactor-appliance-wizard
Additional improvements for the appliance wizard. Fixes #2224
2019-01-25 15:27:31 +08:00
grossmj
7bbd337801 Refactor appliance wizard. 2019-01-25 14:31:37 +08:00
grossmj
7c545e3860 Natural sorting support for custom adapters tree widget. 2019-01-24 16:14:20 +08:00
grossmj
5b6491a23f Add the word "template" to configuration dialog titles. 2019-01-24 15:56:50 +08:00
grossmj
12e4f8445d Reorder node contextual menu. 2019-01-24 14:57:01 +08:00
grossmj
52418ed94a Development on 2.1.13dev1 2019-01-23 15:25:48 +08:00
grossmj
a1496bffd4 Release 2.1.12 2019-01-23 15:22:26 +08:00
Jeremy Grossmann
911f6305fa Merge pull request #2677 from GNS3/svg-symbols-fixes
Resize SVG node symbols that are too big. Fixes #2674
2019-01-22 22:25:13 +07:00
grossmj
c6594d4845 Checkbox to activate/deactivate the size limit of node symbols. 2019-01-22 22:16:45 +07:00
grossmj
538adc4817 Option to limit the size of node symbols (activated by default). Ref #2674.
(cherry picked from commit 6b38b58633)
2019-01-22 00:28:06 +07:00
grossmj
961c5652ea Resize SVG node symbol only when height is above 80px. Ref #2674
Work on str instead of binary when resizing SVG symbol.

(cherry picked from commit 938e9129cd)
2019-01-22 00:24:30 +07:00
grossmj
c0ecf3ccc4 Automatically resize SVG symbols that are too big. Ref #2674.
(cherry picked from commit 8f381a4720)
2019-01-22 00:24:11 +07:00
grossmj
33bc644688 Resize some dialogs. 2019-01-21 18:19:04 +07:00
grossmj
6b38b58633 Option to limit the size of node symbols (activated by default). Ref #2674. 2019-01-21 18:11:26 +07:00
grossmj
938e9129cd Resize SVG node symbol only when height is above 80px. Ref #2674
Work on str instead of binary when resizing SVG symbol.
2019-01-21 17:22:03 +07:00
grossmj
8f381a4720 Automatically resize SVG symbols that are too big. Ref #2674. 2019-01-21 16:41:46 +07:00
grossmj
c1fd434f75 Bigger new template wizard. 2019-01-17 18:37:07 +07:00
grossmj
2440faf3f5 Fix DeprecationWarning: invalid escape sequence. Fixes https://github.com/GNS3/gns3-gui/issues/2670 2019-01-17 18:01:58 +07:00
grossmj
0bd480eabb Use theme icons in other contextual menus. Fixes #2669 2019-01-17 17:34:30 +07:00
grossmj
dc3d762799 Resize new template dialog. Ref #2671 2019-01-16 19:31:03 +07:00
Jeremy Grossmann
1d139cee4d Merge pull request #2668 from GNS3/new_appliance_installation
Template creation from appliance. Fixes #2642
2019-01-14 17:25:17 +07:00
grossmj
d033268cd9 Change some text regarding appliance installation. 2019-01-14 17:19:37 +07:00
grossmj
82fdeb3a49 Handle errors when creating template from appliance. 2019-01-14 16:45:58 +07:00
grossmj
3462109ef2 Template creation from an appliance. 2019-01-14 16:14:31 +07:00
grossmj
b6e5a588bf Basic support to create new template from appliance. 2019-01-13 15:23:14 +07:00
Jeremy Grossmann
4e2a80e379 Merge pull request #2667 from GNS3/pyup-update-pytest-4.0.2-to-4.1.1
Update pytest to 4.1.1
2019-01-13 12:54:08 +07:00
pyup-bot
fc61079132 Update pytest from 4.0.2 to 4.1.1 2019-01-12 22:56:48 +01:00
grossmj
f48f4eacd2 Fix race condition when trying to automatically open a console and the project is already running. Fixes #1493. 2019-01-12 16:08:21 +07:00
grossmj
92e2920212 Fix issue with IOS c7200 templates and usage variable. 2019-01-12 12:30:20 +07:00
grossmj
ebb2d8bb73 Add usage instructions to node tooltip. Ref #2662. 2019-01-10 15:02:41 +08:00
grossmj
ade748c3b1 Smaller node info dialog. 2018-12-30 21:51:51 +07:00
grossmj
ec334508a6 New node information dialog to display general, usage and command line information.
Ref https://github.com/GNS3/gns3-gui/issues/2662 https://github.com/GNS3/gns3-gui/issues/2656
2018-12-30 19:35:25 +07:00
grossmj
ed88eaa620 Support "usage" field for Dynamips, IOU, VirtualBox and VMware. Fixes https://github.com/GNS3/gns3-gui/issues/2657 2018-12-21 16:54:13 +08:00
grossmj
524f911293 Add "new template" entry to File menu. Fixes #2658 2018-12-21 16:07:06 +08:00
grossmj
fa9fc0ff8d Merge 2.1 into 2.2 branch. 2018-12-21 15:24:34 +08:00
grossmj
cf73db25b4 Update VMware banners and links. 2018-12-21 13:18:29 +08:00
grossmj
dd79939140 Allow users to refresh the template list in the nodes view panel. 2018-12-18 17:52:50 -06:00
grossmj
6d0afd39d7 Merge remote-tracking branch 'origin/2.2' into 2.2 2018-12-14 21:00:15 -06:00
grossmj
1d7a6611bd Fix bug with filter in add template. Fixes #2651. 2018-12-14 21:00:02 -06:00
Jeremy Grossmann
15aa4c6001 Merge pull request #2654 from GNS3/pyup-update-pytest-4.0.1-to-4.0.2
Update pytest to 4.0.2
2018-12-14 11:30:25 -06:00
pyup-bot
6f42208323 Update pytest from 4.0.1 to 4.0.2 2018-12-14 18:20:51 +01:00
grossmj
45b3c17c97 Remove typo. Ref #2648. 2018-12-13 22:37:00 -06:00
grossmj
1ddf3e6388 Fix Dynamips decompress doesn't work with relative images. Fixes #2648. 2018-12-13 22:32:06 -06:00
grossmj
d4f0f76e57 Merge branch '2.1' into 2.2 2018-11-30 12:37:25 +08:00
grossmj
e0c06ecd78 Fix missing method '_newApplianceActionSlot'. Fixes #2643. 2018-11-29 15:00:11 +07:00
Jeremy Grossmann
f839bbf877 Merge pull request #2641 from GNS3/naming-consistency
Review and apply consistent naming
2018-11-28 16:32:34 +07:00
grossmj
52c06f4730 Use "template" to name what we use to create new nodes. 2018-11-28 16:12:58 +07:00
grossmj
a8593bb39e Use project instead of topology where appropriate. 2018-11-27 18:30:16 +07:00
grossmj
396e871b3b Make sure nothing is named "compute server". 2018-11-27 18:14:51 +07:00
Jeremy Grossmann
ba9298735a Merge pull request #2640 from GNS3/kazkansouh-2.2-grid-new-project
Improved grid support
2018-11-27 16:34:03 +07:00
grossmj
f4bae20592 Use "node" instead of "appliance" for grid support. 2018-11-27 16:13:22 +07:00
Karim Kanso
189852862e Support for differing grid sizes for appliances and drawings. Requires corresponding commit on gns3-server. 2018-11-26 15:59:34 +00:00
Karim Kanso
ba59d69536 New projects can be created with show grid/snap to grid. 2018-11-26 15:13:39 +00:00
Jeremy Grossmann
26de22f105 Merge pull request #2597 from GNS3/pyup-update-pytest-pythonpath-0.7.2-to-0.7.3
Update pytest-pythonpath to 0.7.3
2018-11-24 16:11:43 +07:00
Jeremy Grossmann
d47b5040cf Merge branch '2.2' into pyup-update-pytest-pythonpath-0.7.2-to-0.7.3 2018-11-24 16:11:33 +07:00
Jeremy Grossmann
dcf133b297 Merge pull request #2634 from GNS3/pyup-update-pytest-4.0.0-to-4.0.1
Update pytest to 4.0.1
2018-11-24 15:24:49 +07:00
pyup-bot
b50fe81d86 Update pytest from 4.0.0 to 4.0.1 2018-11-24 09:20:07 +01:00
Jeremy Grossmann
1c8e166393 Update download URL for "Check For Update". 2018-11-23 16:28:59 +07:00
grossmj
6afdb18bdb Disallow changing layer of a locked object. Ref #2513. 2018-11-20 14:55:30 +07:00
grossmj
a454283357 Bump version to 2.2.0dev5 2018-11-20 14:37:38 +07:00
Jeremy Grossmann
9369ad9645 Merge pull request #2625 from GNS3/pyup-update-pytest-3.8.1-to-4.0.0
Update pytest to 4.0.0
2018-11-19 17:46:28 +07:00
Jeremy Grossmann
be997d4d25 Merge pull request #2627 from GNS3/pyup-update-pytest-timeout-1.3.1-to-1.3.3
Update pytest-timeout to 1.3.3
2018-11-19 17:46:09 +07:00
grossmj
d1b9185764 Cosmetic changes regarding appliances. 2018-11-19 14:37:33 +07:00
grossmj
2b98e48420 Fix issue when duplicating an appliance on GUI side. 2018-11-19 01:21:03 +07:00
grossmj
ec21134920 Fix issue to access configuration pages for Ethernet switch and hub appliances. 2018-11-18 00:00:17 +07:00
grossmj
9b73d652d3 Fix small bugs when using the new appliance management API. 2018-11-17 22:16:18 +07:00
grossmj
3c67b70ff3 Fix bug with custom adapters and categories for Docker VM. Fixes https://github.com/GNS3/gns3-gui/issues/2613 2018-11-17 21:50:00 +07:00
grossmj
60f58064b3 Fix bug with categories with Docker appliances. 2018-11-17 20:10:22 +07:00
pyup-bot
ca305cefa4 Update pytest-timeout from 1.3.1 to 1.3.3 2018-11-16 13:10:50 +01:00
Jeremy Grossmann
8ce928aec2 Merge pull request #2626 from GNS3/appliance-api
New appliance management API. Fixes #1427
2018-11-15 22:52:28 +07:00
grossmj
9ff8816273 Schema validation for appliance API. Ref #1427. 2018-11-15 17:28:17 +07:00
pyup-bot
42d5d4b542 Update pytest from 3.8.1 to 4.0.0 2018-11-15 00:56:49 +01:00
grossmj
2cf64a99de Remove generic controller settings API endpoint. 2018-11-14 16:24:30 +08:00
grossmj
7e942a7753 Fix tests. 2018-11-13 15:40:18 +08:00
grossmj
23d467f688 Working dedicated appliance management API. Ref https://github.com/GNS3/gns3-server/issues/1427 2018-11-13 14:59:18 +08:00
grossmj
fede614716 Base for dedicated appliance management API. Ref https://github.com/GNS3/gns3-server/issues/1427 2018-11-11 20:13:58 +08:00
grossmj
c31b5dd7a9 Bump version to 2.2.0dev4 2018-10-15 17:06:10 +07:00
grossmj
3ba811e675 Fix tests. 2018-10-15 14:33:23 +07:00
grossmj
f6a738fe3e Fix conflict between the two websocket streams (project & controller). 2018-10-15 14:19:46 +07:00
grossmj
4b577e96dd Fix platform.linux_distribution() is deprecated. Fixes https://github.com/GNS3/gns3-gui/issues/2578 2018-10-04 16:32:50 +02:00
grossmj
c6ed354629 Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/appliance_manager.py
#	gns3/dialogs/appliance_wizard.py
#	gns3/nodes_view.py
#	gns3/version.py
2018-10-04 15:50:00 +02:00
grossmj
ec324f9b01 Development on 2.1.12dev1 2018-09-28 20:44:52 +02:00
grossmj
cbfd59498e Release v2.1.11 2018-09-28 20:40:58 +02:00
grossmj
0216bc8b4d Handle deleted SIP objects. 2018-09-28 15:01:22 +02:00
grossmj
a8477597ab Update paths for UltraVNC and VirtViewer. 2018-09-27 22:22:36 +02:00
pyup-bot
4c7965d70f Update pytest-pythonpath from 0.7.2 to 0.7.3 2018-09-27 21:46:54 +02:00
Jeremy Grossmann
28acb2911f Merge pull request #2594 from GNS3/pyup-update-pytest-3.7.0-to-3.8.1
Update pytest to 3.8.1
2018-09-27 21:45:48 +02:00
grossmj
e240dbad6b Indicate if Solar-PuTTY is included or not. Fixes #2595 2018-09-27 21:08:51 +02:00
pyup-bot
fac27d9df9 Update pytest from 3.7.0 to 3.8.1 2018-09-23 03:52:10 +02:00
grossmj
8d183a3283 Fix bad link to installation instructions in README.rst. Fixes #2590 2018-09-20 14:58:41 +02:00
grossmj
3af5046d0f Downgrade to Qt 5.9. Fixes #2592. 2018-09-20 14:30:57 +02:00
grossmj
c8397a1ef7 Development on 2.1.11dev1 2018-09-15 11:13:39 +02:00
grossmj
b419891950 Release v2.1.10 2018-09-15 11:11:24 +02:00
grossmj
2c1ba697bd Fix small errors like unhandled exceptions etc. 2018-09-11 15:06:01 +02:00
grossmj
3000a9aa7f Fix when appliance version is not available for Dynamips/IOU/Qemu. Fixes #2585. 2018-09-05 15:32:38 +08:00
grossmj
2f8541c543 Fix issue when installing appliance with no version selected. Fixes #2585. 2018-09-05 14:53:47 +08:00
grossmj
5c3d4b2ab6 Check for existing appliance name across all emulator types. Fixes #2584. 2018-09-05 14:08:05 +08:00
grossmj
f44ac8cba5 Improve the invalid port format detection. Fixes https://github.com/GNS3/gns3-gui/issues/2580 2018-09-05 13:35:42 +08:00
grossmj
7ef49fbca7 Catch OSError/PermissionError when checking md5 on remote image. Fixes #2582. 2018-09-05 13:24:01 +08:00
grossmj
5ccf5778a2 Fix UnicodeDecodeError in file editor. Fixes #2581. 2018-09-04 21:52:35 +08:00
grossmj
6030d5e019 Catch import error for win32serviceutil. Fixes #2583. 2018-09-04 21:18:03 +08:00
grossmj
6de8880937 Fix bug with empty project ID when creating a new node. Fixes #2366
..
2018-09-04 20:51:30 +08:00
grossmj
08c89c4fac Fix various small errors, mostly about non-existing C/C++ objects. 2018-09-03 16:48:23 +07:00
grossmj
e411d497c4 Send extra controller and compute information in crash reports. 2018-09-02 21:47:33 +07:00
grossmj
e037835769 Update setup.py and fix minor issues. 2018-09-02 15:32:34 +07:00
grossmj
a5f4ec0135 Set the default delay console all value to 1500ms if using Solar-PuTTY. 2018-08-29 21:15:40 +07:00
grossmj
3ee68b22bd Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/compute.py
#	gns3/nodes_view.py
#	gns3/version.py
2018-08-29 15:35:31 +07:00
grossmj
154f10a686 Make Solar-Putty the default if installed. Ref #2519. 2018-08-27 16:24:38 +07:00
grossmj
e5320c318f Fix tests. 2018-08-22 20:37:55 +07:00
grossmj
07ea6207c1 Fix issue with custom appliance. Fixes https://github.com/GNS3/gns3-registry/issues/361 2018-08-22 20:18:35 +07:00
grossmj
12398881f8 Forbid controller and compute servers to be different versions.
Report last compute server error to clients and display in the server summary.
2018-08-22 16:54:43 +07:00
grossmj
27a8e3c7f8 Fix issue with appliance categories. Fixes https://github.com/GNS3/gns3-registry/issues/361 2018-08-22 15:52:32 +07:00
grossmj
d92ff1abe3 Add compute information to crash reports. 2018-08-21 20:40:01 +07:00
grossmj
e97b3b6a42 Add controller version in Sentry bug reports. 2018-08-21 19:16:49 +07:00
grossmj
5ee3f73213 Backport: Fix "Network session error" issues. Fixes #2560. 2018-08-21 18:29:57 +07:00
grossmj
a30aa2f5f1 Add SolarPutty command line. Fixes #2519. 2018-08-21 18:16:51 +07:00
grossmj
98bb6590aa Add missing Qemu boot priority values. Fixes https://github.com/GNS3/gns3-server/issues/1385 2018-08-21 17:49:58 +07:00
grossmj
4250e961a3 Merge remote-tracking branch 'origin/2.1' into 2.1 2018-08-21 17:32:24 +07:00
grossmj
3c46a3a72d Update PyQt5 from version 5.8 to version 5.10. Fixes #2564. 2018-08-21 17:32:09 +07:00
grossmj
c82d262975 Allow multiple appliances to be installed. Ref #2490 2018-08-21 17:06:03 +07:00
grossmj
aa84d100b1 Add more information about appliance templates. 2018-08-20 16:50:47 +07:00
grossmj
e51477d989 New appliance wizard to install an appliance from different sources. Ref #2490 2018-08-19 16:51:48 +07:00
grossmj
e4a29f30e3 Fix tests. 2018-08-16 22:01:24 +07:00
grossmj
3d8bd16536 Redesign appliance handling part 1. Ref #2490
- Removed appliance templates from device dock
 - Use new controller notification stream
 - Fixed device update and remove from device dock
2018-08-16 21:47:52 +07:00
ziajka
c55442a517 Development on 2.1.10dev1 2018-08-13 13:50:31 +02:00
ziajka
45e0080726 Release v2.1.9 2018-08-13 13:14:20 +02:00
grossmj
bb013804d4 Merge branch '2.1' into 2.2 2018-08-13 16:10:06 +07:00
grossmj
95558ec2e6 Fix incorrect short port names in topology summary. Fixes https://github.com/GNS3/gns3-gui/issues/2562 2018-08-13 15:10:21 +07:00
grossmj
f1cd31baa6 Fix "Network session error" issues. Fixes #2560. 2018-08-12 21:06:00 +07:00
grossmj
cf7176559d Set default layer for newly created nodes to 1 and 2 for all other drawings. Ref #2513. 2018-08-08 14:34:58 +07:00
grossmj
2504085db2 Deactivate TraceNG module 2018-08-08 14:02:23 +07:00
grossmj
75d3b61783 Merge remote-tracking branch 'origin/2.2' into 2.2 2018-08-07 21:02:40 +07:00
grossmj
5da8e77d01 Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/dialogs/appliance_wizard.py
#	gns3/node.py
#	gns3/version.py
2018-08-07 21:02:10 +07:00
grossmj
5b56d54030 Add compute version in server summary tooltip. 2018-08-07 15:32:16 +07:00
Jeremy Grossmann
3de38d2ccb Merge pull request #2552 from GNS3/pyup-update-pytest-3.6.1-to-3.7.0
Update pytest to 3.7.0
2018-07-31 21:10:18 -05:00
pyup-bot
76553ff102 Update pytest from 3.6.1 to 3.7.0 2018-07-31 08:03:53 +02:00
Jeremy Grossmann
67b2d145da Merge pull request #2543 from GNS3/pyup-update-pytest-timeout-1.2.1-to-1.3.1
Update pytest-timeout to 1.3.1
2018-07-30 11:30:58 -05:00
Jeremy Grossmann
d5ee1ea5d2 Merge pull request #2538 from ehlers/osx_telnet_utf8_path
Support PATH with UTF-8 characters in OSX telnet console, fixes #2537
2018-07-30 10:13:52 -05:00
grossmj
69b8c07c0a Fix test for Qemu boot priority. Fixes #2548. 2018-07-30 09:48:38 -05:00
grossmj
dbe73eb8d7 Fix boot priority missing when installing an appliance. Fixes #2548. 2018-07-30 09:29:51 -05:00
pyup-bot
ba0559bf08 Update pytest-timeout from 1.2.1 to 1.3.1 2018-07-23 22:51:41 +02:00
Bernhard Ehlers
706f89debb Support PATH with UTF-8 characters in OSX telnet console, fixes #2537 2018-07-14 12:38:53 +02:00
grossmj
ec0be9e22b Allow users to accept different MD5 hashes for preconfigured appliances. Fixes #2526. 2018-07-10 16:02:44 +08:00
grossmj
0e6fa597ec Do not try to update drawing if it is being deleted. Ref #2483. 2018-07-10 15:39:35 +08:00
grossmj
f81450c65a Merge remote-tracking branch 'origin/2.1' into 2.1 2018-07-10 11:54:26 +08:00
grossmj
38cbe70aaa Catch exception when loading invalid appliance file. 2018-07-10 11:54:11 +08:00
ziajka
9fd07b6379 Merge pull request #2528 from GNS3/local-web-ui
Main menu actions to WebUI and Light Web Interface
2018-06-26 12:05:17 +02:00
ziajka
c84b262303 Main menu actions to WebUI and Light Web Interface 2018-06-26 12:04:02 +02:00
Jeremy Grossmann
0150515338 Enable TraceNG module 2018-06-18 23:54:13 +07:00
ziajka
47d335f4c9 Release v2.1.8 2018-06-14 15:16:54 +02:00
grossmj
ffc08361ce Add Solar-Putty command line. Ref #2519. 2018-06-14 17:04:44 +08:00
grossmj
ab90f5f458 Fix merging issue from 2.1 to 2.2 for DockerVMConfigurationPage. Fixes #2516. 2018-06-14 12:03:07 +08:00
grossmj
a0d6a43b51 Fix issues when locking/unlocking items. Ref #2513. 2018-06-13 17:31:27 +08:00
grossmj
20d4f73f56 Add error information when cannot access/read IOS/IOU config file. Ref #2501 2018-06-13 16:27:43 +08:00
grossmj
5204184029 Fallback when using process name to bring console to front. 2018-06-12 17:55:09 +08:00
grossmj
9915beeb8e Use process name to bring console to front. Fixes #2514. 2018-06-12 17:45:54 +08:00
ziajka
1ea383fce2 Development on v2.1.8dev1 2018-06-12 11:15:26 +02:00
ziajka
2744e669b4 Release v2.1.7 2018-06-12 11:12:49 +02:00
grossmj
8fd9ec5319 Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/node.py
2018-06-12 15:22:46 +08:00
grossmj
a5f3164feb Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/node.py
2018-06-10 21:24:57 +07:00
grossmj
3d949df14c Fix tests for default note font/color. 2018-06-10 17:53:00 +07:00
grossmj
6a5764fda9 Console support for clouds (to connect to external devices or services). Fixes #2500. 2018-06-10 17:45:34 +07:00
grossmj
f312d57165 Fix LabelItem tests. 2018-06-09 19:19:16 +07:00
grossmj
973793e6b6 Separate appliance font from note font. Fixes #2477. 2018-06-09 19:13:36 +07:00
grossmj
2a7ce661da Do not include spaces in link description (%d replacement) for packet analyzer command. Ref #2485. 2018-06-09 18:25:09 +07:00
grossmj
a85f99185a Fix error when trying to open project. Fixes #2508 2018-06-09 18:20:03 +07:00
grossmj
d511d0f5f8 Launch packet capture analyzer command without creating pipe. 2018-06-09 18:08:42 +07:00
Jeremy Grossmann
b92a589762 Merge pull request #2510 from GNS3/pyup-update-pytest-3.4.2-to-3.6.1
Update pytest to 3.6.1
2018-06-07 21:56:13 +07:00
grossmj
6ab2d63bdc Do not try to update link if it is being deleted. Fixes #2483. 2018-06-06 21:00:08 +07:00
grossmj
0de6bfe7e1 Fix can't add SVG image to project. Fixes #2502 2018-06-06 18:26:37 +07:00
pyup-bot
b024eb63e9 Update pytest from 3.4.2 to 3.6.1 2018-06-05 19:44:09 +02:00
grossmj
f144103bca Remove unwanted trailing characters and other white spaces when reading .md5sum files. Fixes #2498. 2018-06-04 23:59:53 +07:00
grossmj
7c1af696b9 Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/modules/docker/pages/docker_vm_preferences_page.py
#	gns3/modules/docker/ui/docker_vm_configuration_page.ui
#	gns3/modules/docker/ui/docker_vm_configuration_page_ui.py
#	gns3/modules/qemu/pages/qemu_vm_configuration_page.py
#	gns3/modules/virtualbox/pages/virtualbox_vm_configuration_page.py
#	gns3/modules/vmware/pages/vmware_vm_configuration_page.py
#	gns3/version.py
2018-06-04 22:45:24 +07:00
grossmj
c0b26aff48 Update interface sequence number check. Fixes #2491. 2018-06-04 22:31:19 +07:00
ziajka
9601e4e6f2 Logo should not have context menu, Fixes: #2507 2018-05-24 13:21:13 +02:00
ziajka
88708c2a8d Update logo position only when changes, Fixes: #2506 2018-05-24 13:15:32 +02:00
ziajka
8eff12194d Development on v2.1.7dev1 2018-05-22 14:14:46 +02:00
ziajka
b0520b2bd4 Release v2.1.6 2018-05-22 14:11:59 +02:00
ziajka
17d2c023bf Fix redraw logo on Windows 2018-05-22 13:16:48 +02:00
ziajka
ce9fdea0a0 Merge pull request #2492 from GNS3/extra-hosts
Extra hosts for Docker, global variables for project and supplier logo support, Fixes: #2482
2018-05-15 09:23:42 +02:00
ziajka
24d7dacb4e Variables fix on ProjectWelcomeDialog 2018-05-10 10:46:57 +02:00
ziajka
bb36765407 Remove project_created_signal 2018-05-09 15:24:41 +02:00
ziajka
250db92ce0 Ask for global variables when project is loaded 2018-05-09 11:54:13 +02:00
ziajka
d59ec39505 Add/Edit global variables of project 2018-05-08 18:31:26 +02:00
ziajka
5e9ae04dc1 Rename tabs at Edit Project 2018-05-08 17:05:25 +02:00
ziajka
ddb0fccda3 Global variables tab on Edit project 2018-05-08 17:03:04 +02:00
ziajka
9b22a52f14 Support of supplier logo and url 2018-05-08 16:22:01 +02:00
grossmj
948878bfdd Add missing crowdfunder name in About dialog. 2018-05-08 21:52:37 +08:00
ziajka
7340abbaa9 Project variables and supplier 2018-05-08 13:00:32 +02:00
grossmj
1c1ea50adc Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/node.py
#	gns3/version.py
2018-04-28 19:44:49 +07:00
grossmj
4ea0528bf2 No timeout when duplicating a project. 2018-04-28 17:09:08 +07:00
grossmj
49005e6add No timeout when restoring snapshot. 2018-04-28 16:41:54 +07:00
ziajka
5484c039b5 Fix tests 2018-04-27 14:47:09 +02:00
ziajka
daaf71b6d2 Add advanced settings for docker and param, Ref. #2482 2018-04-27 14:28:14 +02:00
grossmj
450f0e006b Merge remote-tracking branch 'origin/2.1' into 2.1 2018-04-23 15:40:18 +07:00
grossmj
a6a967fbde Replace "not supported" by "none" in topology summary view. 2018-04-23 15:39:58 +07:00
ziajka
1a6293709e Development on v2.1.6 2018-04-18 11:41:43 +02:00
ziajka
2ed53225e0 Release v2.1.5 2018-04-18 11:28:52 +02:00
grossmj
b8798fbda5 Disable TraceNG for version 2.1.5 2018-04-18 17:19:44 +08:00
grossmj
c2ac68be49 Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/modules/traceng/traceng_node.py
2018-04-18 17:10:50 +08:00
grossmj
368de32faa Fix Qemu binary list locks when a version is deleted. Fixes #2474. 2018-04-18 15:44:33 +08:00
grossmj
98d01cbfa0 Fix invalid answer from the PyPi server. Fixes #2473. 2018-04-18 15:10:31 +08:00
grossmj
ad62bb7832 Fix wrong wizard page name. 2018-04-16 17:16:20 +08:00
grossmj
637061663a Add default destination setting for traceng + some checks. Ref #2450. 2018-04-16 15:03:02 +08:00
grossmj
c137198985 Grid size support for projects. Fixes #2469. 2018-04-13 16:56:37 +08:00
grossmj
946efb61de Remove 'include INSTALL' from MANIFEST. Fixes #2470. 2018-04-13 14:17:03 +08:00
grossmj
cb74a8e12f Cleanup more code. 2018-04-11 16:56:18 +07:00
grossmj
c42fecaea3 Cleanup node code. 2018-04-10 20:48:00 +07:00
grossmj
088b020ac0 More spring cleaning. 2018-04-09 16:50:33 +07:00
grossmj
af507e7668 Some spring cleanup. 2018-04-08 16:44:12 +07:00
grossmj
204ff1f8fd Streamline appliance wizard. Fixes #2224. 2018-04-08 16:42:07 +07:00
grossmj
8c7e8e412a Fix "Node list view not updated when renaming or deleting appliance template". Fixes #2356. 2018-04-06 16:57:07 +07:00
grossmj
030169dc10 Automatically resize the Custom adapters configuration dialog. Fixes #2467. 2018-04-06 16:24:50 +07:00
grossmj
e877adca35 Change size of custom adapters configuration dialog. Ref #2467. 2018-04-06 14:42:30 +07:00
grossmj
18dc8fab14 Fix tests. 2018-04-06 14:35:39 +07:00
grossmj
60018612b1 Improve node tooltips. Fixes #2462. 2018-04-06 13:25:23 +07:00
Jeremy Grossmann
0410c446fc Merge pull request #2466 from dhalperi/fix-typo
Fix a minor typo in the setup wizard
2018-04-05 13:19:38 +07:00
Daniel Halperin
18486e4772 Fix a minor typo in the setup wizard
Eveything -> Everything
2018-04-04 22:53:09 -07:00
grossmj
3c9787effb Do not activate "console auto start" by default. Ref #1910. 2018-04-05 11:08:40 +07:00
grossmj
664da8ee3d Remove unused code. 2018-04-04 21:52:29 +07:00
grossmj
b4da9b7bae Support for console auto start. Fixes #1910 2018-04-04 21:32:08 +07:00
grossmj
5ef612815b Bump version to 2.2.0dev2 2018-04-03 12:51:09 +07:00
grossmj
06d7ed783f Add custom_adapters setting support for appliance files. Ref #2361. 2018-04-02 23:13:45 +07:00
grossmj
cc5b55a7ce Fix tests. 2018-04-02 22:59:47 +07:00
grossmj
c8e1602a26 Possibility to customize port names and adapter types for Qemu, VirtualBox, VMware and Docker. Fixes #2361.
MAC addresses can customized for Qemu as well.
2018-04-02 22:27:12 +07:00
grossmj
43688cb9bd Allow to have the projects with the same name in different locations. Fixes #2380. 2018-03-30 23:18:07 +07:00
grossmj
eb34715178 Save state feature for VirtualBox and VMware. New "On close" setting to
select the action to execute when closing/stopping a Qemu/VirtualBox/VMware VM.
2018-03-30 21:18:44 +07:00
grossmj
b7d78b92fc Support for suspend to disk / resume (Qemu). Ref #725. 2018-03-30 19:27:46 +07:00
grossmj
ab7930d3d9 Fix bug with 'none' console type for Ethernet switch.
Fix some tests related to traceng.
2018-03-30 13:00:52 +07:00
grossmj
c684e63be2 Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/ui/resources_rc.py
2018-03-30 12:16:31 +07:00
grossmj
4c610acfa4 Fix traceng tests. 2018-03-30 12:10:57 +07:00
grossmj
37f74824f1 Merge branch 'traceng' into 2.1 2018-03-29 15:19:29 +07:00
grossmj
5ccf8c414d Sync 2018-03-29 15:19:18 +07:00
grossmj
913f0d5e4a Check for valid IP address and prevent to run on non-Windows platforms. 2018-03-29 13:26:43 +07:00
grossmj
061bac0cc6 Support for source and destination for traceNG. 2018-03-27 16:58:49 +07:00
grossmj
20ff8a19f6 Allow to resize a Qemu VM disk (extend only). Ref #2382. 2018-03-26 18:05:20 +07:00
grossmj
53ba302515 Allow to select the default NAT interface in preferences for local server. 2018-03-26 14:23:01 +07:00
grossmj
4b43dfb77c Fix missing lock and unlock icons in resources. 2018-03-25 18:50:52 +07:00
grossmj
f8555f4008 Consistent icon styles for contextual menu. Fixes #1272. 2018-03-25 18:40:10 +07:00
grossmj
75c3092724 Spice with agent support for Qemu VMs. Fixes #2355. 2018-03-25 14:35:25 +07:00
grossmj
89e274d040 Fix zoom-in zoom-out step values. Ref #2457. 2018-03-25 13:05:50 +07:00
grossmj
f9619d79ae Support for console type "none" for all VMs. Fixes #2452. 2018-03-24 18:12:06 +07:00
grossmj
7fd9f39c36 Allow to copy Dynamips, IOU, Qemu and Docker templates in preferences. Fixes #2451. 2018-03-23 21:11:20 +07:00
grossmj
bb732bc202 Support for none console type (Qemu & Docker only) 2018-03-23 15:41:56 +07:00
grossmj
481e6c3450 Fix some issues with hardware acceleration support for Qemu. 2018-03-22 15:45:41 +07:00
grossmj
7ad663cc2a Support Qemu with HAXM acceleration. 2018-03-21 16:41:47 +07:00
ziajka
ec59cd87bd Back to development on v2.1.5dev1 2018-03-15 08:46:06 +01:00
grossmj
d4a0b21206 Some spring cleaning. 2018-03-15 14:17:40 +07:00
ziajka
05d9ee8499 Re-release v2.1.4 due to travis issue 2018-03-14 15:28:15 +01:00
grossmj
3e0242ada7 Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/version.py
2018-03-14 18:39:08 +07:00
grossmj
a72ece5c18 Custom icons and small fixes for TraceNG integration. 2018-03-14 16:56:39 +07:00
grossmj
63baa2eff0 Base support for TraceNG. 2018-03-12 17:57:13 +07:00
ziajka
b91fd4a0c2 Development on v2.1.5dev1 2018-03-12 09:25:41 +01:00
ziajka
718217e332 Release v2.1.4 2018-03-12 09:17:16 +01:00
grossmj
ba71e560f9 Merge remote-tracking branch 'origin/2.2' into 2.2 2018-03-12 13:34:31 +07:00
grossmj
1989ec3a40 Merge branch '2.1' into 2.2 2018-03-12 13:30:46 +07:00
ziajka
c202c5e4be Move connect to update settings into one place 2018-03-09 13:31:55 +01:00
ziajka
71830dd69f Merge pull request #2449 from GNS3/update-nodes
Update node on server on any change, Fixes: #2429
2018-03-09 12:55:48 +01:00
ziajka
37a7fdfa68 Update node on server on any change, Fixes: #2429 2018-03-09 12:54:29 +01:00
ziajka
cb074be0a1 Merge pull request #2446 from GNS3/pyup-update-pytest-3.4.1-to-3.4.2
Update pytest to 3.4.2
2018-03-06 09:24:50 +01:00
pyup-bot
08784158c1 Update pytest from 3.4.1 to 3.4.2 2018-03-06 04:56:24 +01:00
grossmj
0efe006cad Mark IOU layer 1 keepalive messages feature as non-functional. Fixes #2431. 2018-03-05 16:44:42 +07:00
ziajka
4a663a5910 Fix typo 2018-02-27 16:08:33 +01:00
ziajka
a559bd4ae4 Images refresh when added via settings, Fixes:#2423 2018-02-27 16:07:06 +01:00
ziajka
2539abd445 Merge pull request #2436 from GNS3/pyup-update-pytest-timeout-1.2.0-to-1.2.1
Update pytest-timeout to 1.2.1
2018-02-22 09:23:16 +01:00
ziajka
e76f1ca5cc Merge pull request #2437 from GNS3/pyqt-update
PyQt 5.10 with AV builds, Ref. #2434
2018-02-21 16:18:36 +01:00
pyup-bot
bc338b6232 Update pytest-timeout from 1.2.0 to 1.2.1 2018-02-21 16:15:38 +01:00
ziajka
ddb581623a Use PyQt 5.10 and change AV build to use MSVS2017 2018-02-21 16:11:53 +01:00
ziajka
486faf6718 Merge branch '2.2' into pyqt-update 2018-02-21 12:59:52 +01:00
ziajka
a081dcddb8 Merge branch '2.1' into 2.2 2018-02-21 12:04:56 +01:00
ziajka
c4160ec942 Test with PyQt5.9 2018-02-21 12:04:02 +01:00
ziajka
f38d9ef525 Back to PyQt5.8 2018-02-21 12:02:48 +01:00
ziajka
6639108354 Merge pull request #2435 from GNS3/pyup-update-pytest-3.1.0-to-3.4.1
Update pytest to 3.4.1
2018-02-21 10:05:37 +01:00
ziajka
a63a097341 Merge branch '2.2' into pyup-update-pytest-3.1.0-to-3.4.1 2018-02-21 10:05:27 +01:00
ziajka
94bad69198 Merge pull request #2412 from GNS3/pyup-update-pytest-pythonpath-0.7.1-to-0.7.2
Update pytest-pythonpath to 0.7.2
2018-02-21 10:04:19 +01:00
ziajka
e9057e75a0 PyQt5.10 support, Ref. #2434 2018-02-21 10:01:20 +01:00
pyup-bot
b80b86d365 Update pytest from 3.1.0 to 3.4.1 2018-02-21 03:02:35 +01:00
ziajka
5ebb3011d3 Merge pull request #2433 from GNS3/show-if-labels-on-new-project
Show labels on the new project, Fixes: #2308
2018-02-19 13:05:22 +01:00
ziajka
81300fd40e Adjust tests 2018-02-19 12:55:52 +01:00
ziajka
d4dda2a285 Emit project_loaded_signal after project creation 2018-02-19 12:54:36 +01:00
ziajka
5a4342d4b8 Add option Show interface labels on new project, Ref. #2308 2018-02-16 14:32:07 +01:00
ziajka
94fc5e6c4f Improve finding pyuic3.exe on Windows 2018-02-16 14:30:49 +01:00
grossmj
a3e81fbf2e Use debug for error downloading file messages. Fixes #2398. 2018-02-07 16:12:50 +08:00
grossmj
514eb97eac Merge remote-tracking branch 'origin/2.1' into 2.1 2018-02-06 15:38:38 +08:00
grossmj
7637039cb2 Refresh buttons in the cloud node to query the server for available interfaces. Fixes #2416. 2018-02-06 15:36:27 +08:00
pyup-bot
e46c92e92f Update pytest-pythonpath from 0.7.1 to 0.7.2 2018-02-03 04:13:02 +01:00
Jeremy Grossmann
ac989b191b Merge pull request #2410 from GNS3/new-appliance-symbol-from-controller
Appliance import looks for symbols on server, Fixes. #2405
2018-02-02 10:24:32 +01:00
Dominik Ziajka
c971cef31b Handle Certifacte Error, Ref. gns3-server#1262 2018-02-02 10:02:18 +01:00
Dominik Ziajka
c1af2df780 Backward compatibility for tests, Ref. #2405? 2018-02-02 08:47:56 +01:00
grossmj
eaaa141be9 Use UTF-8 for IOURC file migration. 2018-02-02 15:41:42 +08:00
ziajka
226169cdc6 Look for symbols on controller, Ref. #2405 2018-02-01 17:42:02 +01:00
grossmj
42a4c89f20 Display an error message if Telnet console program cannot be executed. 2018-01-29 18:59:28 +07:00
Jeremy Grossmann
38ade919df Merge pull request #2404 from GNS3/allow-different-md5
Allow to accept a different md5 hash than the one in the appliance file.
2018-01-26 16:13:10 +07:00
grossmj
6458f88d1c Remove leftover debug message. 2018-01-26 15:26:27 +07:00
ziajka
1e936da469 Allow to accept a different md5 hash than the one in the appliance file. Ref. server#1246 2018-01-25 11:55:33 +01:00
ziajka
f90ec81fca Critical information during upload file with different md5, Ref. #1246 2018-01-24 11:43:32 +01:00
grossmj
141578a1e1 Restore locked item state. 2018-01-23 17:39:35 +07:00
grossmj
e1d2bcca20 Merge branch '2.1' into 2.2
# Conflicts:
#	gns3/ui/main_window_ui.py
#	gns3/ui/resources_rc.py
#	gns3/version.py
#	resources/resources.qrc
2018-01-23 12:44:02 +07:00
grossmj
a5435280d7 Bump to version 2.2.0dev1 & refresh resources/ui files. 2018-01-23 11:36:58 +07:00
grossmj
1482b0e804 Back to development on v2.1.4dev1 2018-01-21 15:57:41 +07:00
grossmj
8ebe3435c4 Re-release v2.1.3 to fix idna packaging issue. 2018-01-21 15:16:25 +07:00
ziajka
a1cd34d7c4 Back to development on v2.1.4dev1 2018-01-19 08:18:19 +01:00
ziajka
1e4a44135c Re-release v2.1.3 2018-01-19 08:11:46 +01:00
ziajka
a407f1ec90 Update to python3.6 in tests - running xvfb 2018-01-19 08:05:07 +01:00
ziajka
faab113384 Update to python3.6 in tests 2018-01-19 08:01:11 +01:00
ziajka
c158b7fc46 Use Ubuntu 17.10 for TCI tests 2018-01-19 07:55:13 +01:00
ziajka
16de9e830f Use Ubuntu 16.04 for TCI tests 2018-01-19 07:44:37 +01:00
ziajka
25c625c0bb Development on v2.1.4dev1 2018-01-19 07:17:22 +01:00
ziajka
bf42d1a355 Release v2.1.3 2018-01-19 07:15:24 +01:00
grossmj
1c0f3493ee Fix more client/server version tests. 2018-01-18 16:14:09 +08:00
grossmj
c3c1f87c5e Change messages when there are different client and server versions. Fixes #2391. 2018-01-18 15:58:21 +08:00
grossmj
6b80914385 Bump version number to 2.1.3dev1 2018-01-18 15:32:06 +08:00
grossmj
a114d9ace7 Fix "Transport selection via DSN is deprecated" message. Sync is configured with HTTPTransport. 2018-01-15 16:56:16 +07:00
grossmj
4dca4d057a Refresh CPU/RAM info every 1 second. Ref #2262. 2018-01-15 14:42:01 +07:00
grossmj
17af21e29a Only check for AVG on Windows 2018-01-14 13:40:31 +07:00
grossmj
7fbce0266d Improve the search for VBoxManage. 2018-01-11 16:33:15 +07:00
grossmj
d5cdbdbf90 Allow telnet console to node with name containing double quotes. Fixes #2371. 2018-01-10 22:16:35 +07:00
ziajka
e5a790f4b2 Development v2.1.3dev1 2018-01-08 14:21:28 +01:00
ziajka
f3769df0d6 Add to CHANGELOG changes 2018-01-08 14:09:21 +01:00
ziajka
a21db74941 Release v2.1.2 2018-01-08 14:08:12 +01:00
grossmj
d1e1f6dfb6 Update VMware promotion in setup wizard. 2018-01-08 18:41:40 +07:00
grossmj
cc45c9631a Confirm exit. Fixes #2359. 2018-01-08 18:00:59 +07:00
ziajka
d16a52e389 Development on v2.1.2dev1 2017-12-22 13:28:39 +01:00
ziajka
ee2bea7cdd Release v2.1.1 2017-12-22 13:26:55 +01:00
grossmj
7cbc25cbbf Bump version to 2.1.1dev2 2017-12-20 11:20:07 +01:00
ziajka
7237cf1b88 Merge pull request #2373 from GNS3/fix-2363
Fix dragging appliance into topology from nodes window, fixes: #2363
2017-12-20 09:54:05 +01:00
ziajka
965923900b Fix dragging appliance into topology from nodes window, fixes: #2363 2017-12-20 09:53:19 +01:00
ziajka
a5a3a4e8cc Merge pull request #2372 from GNS3/fix-2362-2
Fix Appliances in Docked mode, fixes: #2362
2017-12-20 09:29:21 +01:00
ziajka
d898b30d84 Fix Appliances in Docked mode, fixes: #2362 2017-12-20 09:28:33 +01:00
ziajka
e86ced750e Merge pull request #2370 from GNS3/fix-2366
Create local variable in order to debug issue in the next occurrence,…
2017-12-19 14:48:44 +01:00
ziajka
e15b717cb0 Create local variable in order to debug issue in the next occurrence, #2366 2017-12-19 14:46:24 +01:00
ziajka
d8bd33f0e7 Merge pull request #2369 from GNS3/fix-2364
Fix ParseError: not well-formed (invalid token), #2364
2017-12-19 12:52:25 +01:00
ziajka
bc2fbe33ef Fix ParseError: not well-formed (invalid token), #2364 2017-12-19 12:51:20 +01:00
ziajka
b99b26f463 Merge pull request #2368 from GNS3/fix-2365
Fix local variable 'vm' referenced before assignment #2365
2017-12-19 11:41:30 +01:00
ziajka
5b7606793f Fix local variable 'vm' referenced before assignment #2365 2017-12-19 11:40:24 +01:00
ziajka
b8b5e8739e Merge pull request #2367 from GNS3/fix-2362
Fix: 'NodesDockWidget' object has no attribute 'uiNodesView', #2362
2017-12-19 11:38:11 +01:00
ziajka
0126c30887 Fix: 'NodesDockWidget' object has no attribute 'uiNodesView', #2362 2017-12-18 14:30:26 +01:00
grossmj
a89086ff60 Fix test. 2017-12-07 14:31:41 -06:00
grossmj
9ca35c56de Tentative fix for packet capture not working correctly when remote main server is configured. Ref #2111. 2017-12-07 13:59:02 -06:00
grossmj
3ddccf40a8 Log Qt messages with log.debug() instead of log.info(). 2017-12-05 14:24:24 -06:00
grossmj
d51c96f105 Merge remote-tracking branch 'remotes/origin/2.1' into 2.2 2017-11-27 14:21:31 +07:00
grossmj
a47b839cc2 Merge remote-tracking branch 'remotes/origin/2.1' into 2.2
# Conflicts:
#	gns3/ui/main_window_ui.py
#	gns3/ui/resources_rc.py
2017-11-27 14:19:29 +07:00
Jeremy Grossmann
1398ef323a Merge pull request #2345 from GNS3/no-timeout-snapshots
Snapshoting project without timeout but with Cancel button. Ref. #2314
2017-11-24 18:19:26 +07:00
grossmj
d52c4d839d Fix auto idle-pc from preferences. Fixes #2344. 2017-11-23 23:01:01 +07:00
ziajka
6989ee2c8b Snapshot creation, busy all the time as we cannot calculate progress. 2017-11-23 15:06:44 +01:00
ziajka
5c182e95ca Snapshoting project without timeout but with button. Ref. #2314 2017-11-23 14:13:56 +01:00
grossmj
bcb7a8e57b Improve validation for idle-pc. 2017-11-23 10:41:30 +07:00
grossmj
dba75e844e Activate faulthandler. 2017-11-21 13:44:29 +07:00
Jeremy Grossmann
6733739fa5 Merge pull request #2340 from ehlers/fix-osx-telnet
Fix OS X Telnet
2017-11-20 11:44:02 +07:00
Bernhard Ehlers
f5de62aa05 Add PATH to OS X console commands 2017-11-19 15:40:54 +01:00
Bernhard Ehlers
4087d35f6a Use raw triple quotes in large console settings
This eliminates one level of quoting
2017-11-19 15:31:26 +01:00
grossmj
f6a1af46a0 Fix issue in node summary when console is not supported by a node. 2017-11-19 20:30:58 +07:00
Bernhard Ehlers
6cef2fed5a Revert "Add preferred path to use Telnet console in DMG package. Ref #2274." 2017-11-19 12:37:21 +01:00
Bernhard Ehlers
e16c8db311 Revert "Force to use the telnet client embedded in DMG. Ref #2274." 2017-11-19 12:36:33 +01:00
Bernhard Ehlers
61c95a93ca Revert "Add debug when using Telnet path on OSX. Ref #2274." 2017-11-19 12:35:55 +01:00
Bernhard Ehlers
0df36dab30 Revert "Fix bug when replacing Telnet path on OSX. Ref #2274." 2017-11-19 12:33:54 +01:00
Bernhard Ehlers
9a5da633e0 Revert "Fix problem when embedded telnet client path contains a space on macOS. Ref #2328." 2017-11-19 12:32:29 +01:00
Bernhard Ehlers
02fed964f2 Revert "Support Telnet path containing spaces. Ref #2328." 2017-11-19 12:30:15 +01:00
grossmj
84ba56ae74 Remove unused symbols. Fixes #2320. 2017-11-19 14:50:12 +07:00
grossmj
e8c4758cb7 Show console information in Topology Summary Dock. Fixes #2258. 2017-11-19 13:56:54 +07:00
grossmj
d8dc31965f New option: require KVM. If false, Qemu VMs will not be prevented to run without KVM. 2017-11-19 12:39:37 +07:00
grossmj
9af48ba9a3 Implement variable replacement for Qemu VM options. 2017-11-18 17:36:11 +07:00
grossmj
67d8e317e0 Show on what server a node is installed in the servers summary pane. Fixes #2279. 2017-11-18 16:02:31 +07:00
grossmj
64392780c5 Add more info when cannot remove capture file after stopping packet capture in a remote project. Ref #1223. 2017-11-17 18:32:18 +07:00
grossmj
81bb159d45 Do not overwrites the disk images when copied to default directory. Fixes #2326. 2017-11-17 15:42:33 +07:00
ziajka
85352af9bd Update pyup config to use 2.2 branch 2017-11-15 13:21:14 +01:00
grossmj
65cfdf6b33 Revert "Only replace quoted telnet for macOS Telnet commands. Ref #2328." 2017-11-15 10:39:24 +07:00
grossmj
5d45dbebf6 Only replace quoted telnet for macOS Telnet commands. Ref #2328. 2017-11-14 18:42:17 +07:00
grossmj
0a7b6d81d8 Support Telnet path containing spaces. Ref #2328. 2017-11-14 18:34:06 +07:00
grossmj
588dcadd3a Fix problem when embedded telnet client path contains a space on macOS. Ref #2328. 2017-11-14 17:22:44 +07:00
grossmj
f24c93a55f Do not launch console for builtin nodes when using the "Console to all nodes" button. Fixes #2309. 2017-11-12 17:02:00 +08:00
grossmj
26e5c80406 Merge remote-tracking branch 'remotes/origin/master' into 2.1 2017-11-12 14:22:13 +08:00
ziajka
eb502232a2 Development on 2.1.1dev1 2017-11-09 10:50:12 +01:00
ziajka
25e17d718c Release 2.1.0 2017-11-09 07:29:33 +01:00
ziajka
89108070df Development on v2.1.0dev10 2017-11-07 10:19:46 +01:00
ziajka
f4df3ff9c0 Release v2.1.0rc4 2017-11-07 08:48:00 +01:00
Jeremy Grossmann
90f80b9804 Merge pull request #2322 from GNS3/upload-dialogs-progress
Accurate upload progress dialogs for large files
2017-11-06 20:50:59 +08:00
ziajka
3e86044132 Fix tests 2017-11-06 09:31:39 +01:00
ziajka
78d805cebc Disable showProgress during obtaining endpoint 2017-11-06 09:28:07 +01:00
ziajka
289f754108 Accurate upload progress dialogs for large files 2017-11-03 11:38:04 +01:00
Jeremy Grossmann
1a0c1f826b Merge pull request #2313 from GNS3/disable-direct-file-upload
Disable direct file upload on default
2017-10-30 17:18:36 +07:00
ziajka
9837d661a5 Disable direct file upload on default 2017-10-26 13:41:27 +02:00
grossmj
ff60776769 Merge remote-tracking branch 'origin/2.1' into 2.1 2017-10-26 15:47:02 +07:00
grossmj
7ac442631a Add registry version 5 2017-10-26 15:46:39 +07:00
Jeremy Grossmann
8da2ff3a97 Merge pull request #2310 from GNS3/image-upload-manager
Safe approach to send files to computes and dialogs fixes, Fixes: #2307, Ref: #2188
2017-10-26 13:01:14 +07:00
Jeremy Grossmann
a04d9784f2 Merge branch '2.1' into image-upload-manager 2017-10-26 12:24:17 +07:00
ziajka
623aa4a2de Code style and tests 2017-10-25 16:10:24 +02:00
ziajka
ef3c2afab9 Direct file upload enabled on default 2017-10-25 15:22:39 +02:00
ziajka
73e59d92ca Progress Dialog: don't count finished queries done in background 2017-10-25 13:50:35 +02:00
ziajka
8f3d5bf038 Add debug messages to file upload 2017-10-25 10:27:17 +02:00
ziajka
d638c6e0d7 Image Upload Manager for uploading 2017-10-24 17:20:30 +02:00
grossmj
c5688cacf9 Restore timer for refreshing the progress dialog status. 2017-10-24 20:12:01 +07:00
Jeremy Grossmann
b34bcd6369 Merge pull request #2305 from GNS3/race-nodes-view
Fix race condition on NodesDockWidget, fixes: #2304
2017-10-23 16:10:40 +07:00
ziajka
5e0fc3675f Fix race condition on NodesDockWidget, fixes: #2304 2017-10-23 11:08:33 +02:00
grossmj
e75a21e2ed Do not write an error message when importing non existing config from a directory. Fixes #2296. 2017-10-21 12:30:08 +07:00
grossmj
aeee44e597 Fix bug when replacing Telnet path on OSX. Ref #2274. 2017-10-19 16:32:16 +07:00
ziajka
3cebee64ad Back to development on 2.1.0rc3 2017-10-19 09:56:56 +02:00
ziajka
fd1619cfd3 Fix Travis deploy - urlib3 2017-10-19 09:51:05 +02:00
ziajka
4573d2aed8 Fix Travis deploy - urlib3 2017-10-19 09:47:22 +02:00
ziajka
7f29c497cc Fix Travis deploy 2017-10-19 09:21:57 +02:00
ziajka
6da42b5013 Development on 2.1.0dev9 2017-10-19 08:58:15 +02:00
ziajka
430366947f Release 2.1.0 rc3 2017-10-19 08:56:10 +02:00
grossmj
3870f8ecdc Add debug when using Telnet path on OSX. Ref #2274. 2017-10-18 18:47:24 +07:00
grossmj
f68626e4cc Force to use the telnet client embedded in DMG. Ref #2274. 2017-10-18 17:26:44 +07:00
Jeremy Grossmann
6b4126b688 Merge pull request #2297 from GNS3/direct-file-upload
Direct file upload, Fixes #2264
2017-10-18 00:36:28 +07:00
ziajka
2ef9890dc1 Upload directly to compute 2017-10-17 12:32:38 +02:00
ziajka
100e3dbf27 Load endpoing and execute post image 2017-10-16 09:44:16 +02:00
Jeremy Grossmann
b85db6e24f Merge pull request #2294 from ddragic/qxcb-log-filter
Filter additional QXcbConnection log messages
2017-10-14 15:38:52 +02:00
Dušan Dragić
05d2077b16 Filter additional QXcbConnection log messages 2017-10-14 13:21:55 +02:00
grossmj
80f3dab152 Rebuild resources file. 2017-10-13 18:21:48 +08:00
grossmj
eef4d6e9fd Merge 2.1 to 2.2 2017-10-13 18:11:27 +08:00
ziajka
357d039434 Preparation to load endpoint before usage 2017-10-13 12:05:31 +02:00
ziajka
0288384c85 Direct file upload settings 2017-10-13 11:22:32 +02:00
grossmj
84347848e9 Do not add missing file extension for screenshot file names on Mac. Fixes #2287. 2017-10-11 04:58:59 +08:00
grossmj
24e5ef885c Add preferred path to use Telnet console in DMG package. Ref #2274. 2017-10-10 23:57:34 +08:00
grossmj
0d8255ecaf Merge remote-tracking branch 'origin/2.1' into 2.1 2017-10-10 22:32:18 +08:00
grossmj
679548e4ad Log Qt messages as info instead of error. Ref #2281. 2017-10-10 22:13:22 +08:00
ziajka
e5384af45d Fix Travis bug with missing twine library. Fixes: #2283 2017-10-06 09:55:43 +02:00
ziajka
ae68d4d84b Development on 2.1.0dev8 2017-10-04 11:40:14 +02:00
ziajka
2ab81816ef Release 2.1.0 rc2 2017-10-04 11:36:51 +02:00
grossmj
4c4241183a Only show "can't get settings from controller" message in debug mode. 2017-10-04 16:24:29 +08:00
grossmj
46406d1e7b Remove explicit Telnet path on OS X. Ref #2274 2017-10-03 04:31:08 +08:00
Jeremy Grossmann
a92573394f Merge pull request #2280 from GNS3/fix-pyqt-version-check
Disable WebSocket notification for lower PyQT version than 5.6. Fixes…
2017-10-02 18:03:31 +02:00
ziajka
6baf628997 Disable WebSocket notification for lower PyQT version than 5.6. Fixes #2272 2017-10-02 10:44:28 +02:00
grossmj
8f9190e094 Increase timeout to 5 minutes when creating and restoring a snapshot. 2017-10-02 05:02:26 +08:00
grossmj
7e14e734b2 Bump version to 2.1.0dev7 2017-10-02 04:04:38 +08:00
grossmj
76fc2f07ce Add more information when a request timeouts. Ref #2277. 2017-10-02 00:46:23 +08:00
grossmj
eee066d5f3 Do not show the progress dialog when moving a node. Ref #2275. 2017-10-02 00:44:58 +08:00
grossmj
9dead47a37 Increase timer before showing a progress dialog from 250ms to 500ms. Ref #2275. 2017-10-01 23:56:28 +08:00
grossmj
a22bd8e9be Use embedded Telnet client on OS X. Ref #2274. 2017-10-01 23:33:12 +08:00
grossmj
a4b897d458 Fix small bug when adding an appliance template and the name already exists. 2017-09-19 16:32:19 +07:00
grossmj
e784f21c0f Use RAW sockets by default on Linux for VMware VM connections. 2017-09-19 12:47:30 +07:00
grossmj
3a000cdc60 Increase timeout to get compute servers from controller. Ref #2269. 2017-09-15 19:40:42 +07:00
grossmj
405f3b3382 Fix "Node doesn't exist" after deletion, but still on the canvas. Fixes #2266. 2017-09-15 17:23:15 +07:00
grossmj
7397f76566 Remove debug test. 2017-09-15 16:24:57 +07:00
grossmj
178cb35d6a Make sure the warning button icon appears in cloud properties dialog on Windows. Fixes #2245. 2017-09-15 16:21:05 +07:00
grossmj
012e5d331d Fix bug when cancelling the importation of a configuration file. Fixes #2260. 2017-09-15 15:52:36 +07:00
ziajka
bd81d36635 Development on v2.1.0dev6 2017-09-13 09:30:56 +02:00
ziajka
234eab57c8 Release 2.1.0rc1 2017-09-13 09:28:55 +02:00
grossmj
e4b19714f4 Fix missing spice console option in appliance template schema. Fixes #2255. 2017-09-13 13:55:30 +07:00
ziajka
7bfba1015b Back to development at 2.1.0dev5 2017-09-05 11:24:08 +02:00
ziajka
498ba2d2b1 Re-release 2.1.0b2 2017-09-05 11:16:02 +02:00
ziajka
f3756b8401 Fix unicode error during appliance tests 2017-09-05 09:56:56 +02:00
ziajka
68f6d37aab Fix link tests 2017-09-05 09:43:33 +02:00
ziajka
6ce35fa5b5 Development on 2.1.0dev5 2017-09-05 08:41:08 +02:00
ziajka
e376753859 Release 2.1.0 beta 2 2017-09-05 08:37:42 +02:00
Jeremy Grossmann
7b03c3eae7 Merge pull request #2250 from GNS3/dont-move-under-layer-0
Disabled possibility of moving items under zero layer (Fixes #2220)
2017-09-01 16:20:04 +07:00
ziajka
902ba42be1 Merge pull request #2252 from GNS3/fix-resources
Fix resources dependencies for cloud configuration page (Fixes: #2251)
2017-09-01 11:06:58 +02:00
ziajka
73fe898eda Fix resources dependencies for cloud configuration page (Fixes: #2251) 2017-09-01 11:05:53 +02:00
ziajka
1ff488d39a Disabled possibility of moving items under zero layer (Fixes #2220) 2017-09-01 10:13:19 +02:00
Jeremy Grossmann
1622a79383 Merge pull request #2248 from GNS3/dialog-warning-fallback
dialog-warning.svg fallback for themed icon (Ref. #2245)
2017-09-01 12:51:38 +07:00
Jeremy Grossmann
1564c63a42 Merge pull request #2247 from GNS3/wide-packet-filters-dialog
Change width of packet filters dialog (Fixes #2244)
2017-09-01 12:50:24 +07:00
ziajka
29f651aaea dialog-warning.svg fallback for themed icon (Ref. #2245) 2017-08-31 11:37:32 +02:00
ziajka
9ee0222339 Change width of packet filters dialog (Fixes #2244) 2017-08-31 09:46:08 +02:00
grossmj
6e1384c985 Fix high CPU usage when using packet filters. Fixes #2240. 2017-08-28 11:40:50 +07:00
Jeremy Grossmann
20190c5816 Merge pull request #2232 from GNS3/toggle-node-menu-item
Toggle Node menu item (Fixes #2227)
2017-08-25 16:32:49 +08:00
ziajka
cab3412ddc Toggle Node menu item (Fixes #2227) 2017-08-22 13:01:50 +02:00
grossmj
78e7b78315 Have the contextual menu use icons from the active style. Ref #1272. 2017-08-15 19:38:23 +08:00
grossmj
b3f8170e01 Individually lock or unlock an item on the scene. Fixes #1228. 2017-08-11 17:35:24 +08:00
grossmj
18321f5347 Improve lock and unlock all items so some actions can still be performed on objects. Fixes #1134. 2017-08-11 15:03:33 +08:00
grossmj
734fcdfe9e Lock or unlock all items button. Fixes #1134. 2017-08-11 14:37:45 +08:00
Jeremy Grossmann
6d74ce4070 Merge pull request #2215 from GNS3/fix-qemu-edit-symbol
Fixes loading symbols for QEMU at Edit Page (#2214)
2017-08-10 21:41:58 +08:00
Jeremy Grossmann
159d21af9a Merge pull request #2217 from GNS3/fixes-lineitem
Fixes multiselection styles change crash on LineItem (#2216)
2017-08-10 21:39:42 +08:00
ziajka
713feff11f Fixes multiselection styles change crash on LineItem (#2216) 2017-08-10 09:38:22 +02:00
ziajka
64c5ca712e Fixes loading symbols for QEMU at Edit Page (#2214) 2017-08-10 09:09:07 +02:00
Jeremy Grossmann
1572a6f67f Merge pull request #2212 from GNS3/2211
Fixes exception when right click on Dynamips router in the device dock
2017-08-08 22:16:53 +08:00
ziajka
fcee5c6916 Fixes exception when right click on Dynamips router in the device dock (#2211) 2017-08-08 13:59:47 +02:00
grossmj
378d454e1e Move console to all devices icon after the separation bar. Ref #1272 2017-08-08 15:56:22 +08:00
grossmj
eb90950be1 Lock icons. Ref #1134. 2017-08-08 15:46:52 +08:00
Jeremy Grossmann
3d21f9a997 Merge pull request #2210 from CapnCheapo/patch-1
Update frame_relay_switch_configuration_page_ui.py
2017-08-08 11:14:19 +08:00
Jeremy Grossmann
d93ad5e9d5 Merge pull request #2209 from CapnCheapo/2.1
Update frame_relay_switch_configuration_page.ui
2017-08-08 11:14:08 +08:00
Stephen C. Moore
13739281da Update frame_relay_switch_configuration_page_ui.py
Fixes #2205
2017-08-07 14:04:44 -05:00
Stephen C. Moore
1f281a807b Update frame_relay_switch_configuration_page.ui
Fixes #2205
2017-08-07 14:03:00 -05:00
ziajka
2ca250d2c2 Development on 2.1.0dev4 2017-08-04 11:36:47 +02:00
ziajka
b82b031168 Release 2.1.0 beta 1 2017-08-04 11:35:21 +02:00
Julien Duponchelle
c48048f013 Info added to the Nat node
Ref #2197
2017-08-02 13:19:24 +02:00
Julien Duponchelle
9aaca9955a Add missing popup information in cloud and docker node
Fix #2197
2017-08-02 12:14:30 +02:00
Julien Duponchelle
a0e6a82ea2 Handle invalid json in websockets
Fix #2192
2017-08-01 16:32:52 +02:00
Julien Duponchelle
9a3e320e95 Avoid invalid bad request error when receiving partial answer
Fix #2194
2017-08-01 16:29:31 +02:00
Julien Duponchelle
c3fce51493 Catch parse error for broken SVG
Fix #2193
2017-08-01 16:14:08 +02:00
Julien Duponchelle
116cf55758 Filter QXcbConnection log messages
It's Qt noise on Linux we can't do nothing to avoid it.

Fix #2191
2017-08-01 16:14:08 +02:00
Julien Duponchelle
269c6bd0cd Catch class 'PyQt5.QtNetwork.QNetworkReply'> returned a result with an error set
Fix #2195
2017-08-01 16:14:08 +02:00
Julien Duponchelle
31aa612a62 Fix KeyError: 'overlay_notifications'
Fix #2196
2017-08-01 16:14:07 +02:00
ziajka
55f396694f Development on 2.1.0dev3 2017-07-31 11:35:40 +02:00
ziajka
b51fd9c92f Release 2.1.0 alpha 2 2017-07-31 11:31:42 +02:00
Julien Duponchelle
5857d3709b Fix permission error when importing a project on a remote server
Fix #2082
2017-07-27 10:20:28 +02:00
Julien Duponchelle
0c00e1309c Fix RecursionError
Fix #2185
2017-07-26 15:46:40 +02:00
Julien Duponchelle
06dbf9f7d8 Fix 'NodesDockWidget' object has no attribute 'loadPath'
Fix #2182
2017-07-26 14:59:13 +02:00
Julien Duponchelle
ef651d9e9a Fix 'MainWindow' object has no attribute '_settings
Fix #2183
2017-07-26 14:55:13 +02:00
Julien Duponchelle
65dd3a23c6 Fix object has no attribute 'warning_signal'
Fix #2184
2017-07-26 14:53:25 +02:00
Julien Duponchelle
85f697d47b Fix timeout issues when using an appliance 2017-07-26 11:08:39 +02:00
Jeremy Grossmann
0988fdca09 Merge pull request #2180 from GNS3/ubridge_dir
Make sure ubridge path is not a directory
2017-07-25 06:40:36 -07:00
Julien Duponchelle
eba3d5751e Make sure ubridge path is not a directory
Ref https://twitter.com/andreppires/status/889594139800719360
2017-07-25 09:03:57 +02:00
Julien Duponchelle
93e140ae05 2.1.0dev2 2017-07-24 16:19:52 +02:00
Julien Duponchelle
b81a531a7b 2.0.1a1 2017-07-24 16:19:16 +02:00
Jeremy Grossmann
089b4108cc Merge pull request #2179 from GNS3/duplicate
Allow to duplicate a node
2017-07-24 01:39:32 -07:00
grossmj
b89f70370a Updating text for duplicating node/project. 2017-07-24 15:38:54 +07:00
Jeremy Grossmann
81b4ded30a Merge pull request #2174 from GNS3/fix_segfault
Try to fix segfault at exit
2017-07-21 08:44:06 -07:00
Julien Duponchelle
b658eea427 Poll local server return code when waiting for server stop 2017-07-21 13:36:03 +02:00
Julien Duponchelle
da225ffdf9 Try to avoid websocket garbage collection 2017-07-21 13:25:02 +02:00
Jeremy Grossmann
b7fb6e6b13 Merge pull request #2171 from GNS3/fix_wifi_off
Fix issues when Wifi is turned off
2017-07-21 02:50:08 -07:00
Julien Duponchelle
078cef064b Allow to duplicate a node
Ref #1065
2017-07-20 18:05:46 +02:00
Julien Duponchelle
bec1c41f75 Handle recent version of Chicken of VNC
Fix #2146
2017-07-20 16:15:35 +02:00
Julien Duponchelle
64f3516153 Catch unknown protocol errors
The server should use a different port automaticaly.

Fix #2120, #2131
2017-07-20 15:31:02 +02:00
Julien Duponchelle
558e8ad8ce Set main window as parent of LocalServer class 2017-07-20 11:51:05 +02:00
Julien Duponchelle
5f7408809e Fix a race condition when we got a project error 2017-07-20 11:09:38 +02:00
Julien Duponchelle
8359da3c76 Increase timeout before quitting GNS3 because server could be slow to stop 2017-07-20 11:07:11 +02:00
Julien Duponchelle
c613e20971 Try to avoid multiple error dialog in case of network issues 2017-07-20 11:03:39 +02:00
Julien Duponchelle
34ab6c2e1b Try to fix segfault at exit
Fix #2166
2017-07-20 10:46:34 +02:00
Julien Duponchelle
5382a8a397 Fix image permissions
Fix #2169
2017-07-20 09:35:05 +02:00
grossmj
507f104ae5 os.geteuid() doesn't exist on Windows. 2017-07-20 12:15:00 +07:00
Jeremy Grossmann
ada2f647a0 Merge pull request #2170 from GNS3/appliances_dir
Add an appliance templates directory
2017-07-19 22:10:03 -07:00
grossmj
347b76d39e Update text for "My custom appliances" 2017-07-20 12:08:58 +07:00
Jeremy Grossmann
3749819016 Merge pull request #2172 from GNS3/suspend_link
Suspend link
2017-07-20 11:15:28 +07:00
grossmj
4d4871d165 Improve link suspend support. 2017-07-20 11:13:17 +07:00
Julien Duponchelle
59f6a22e81 Suspend link
Fix https://github.com/GNS3/gns3-gui/issues/1295
2017-07-19 17:23:19 +02:00
Julien Duponchelle
0982338e2c Fix tests suite for 2.1 GUI 2017-07-19 15:55:07 +02:00
Julien Duponchelle
20efde749c Turn off timeout for node creation
The timeout is an issue if you use a local GNS3 server and
a remote over a slow link.

Fix https://github.com/GNS3/gns3-server/issues/1126
2017-07-19 15:26:51 +02:00
Julien Duponchelle
23c3576256 Fix docker test env 2017-07-19 15:11:31 +02:00
Julien Duponchelle
1dbf30c6cb Fix issues when Wifi is turned off
Fix #2104
2017-07-19 14:50:40 +02:00
Julien Duponchelle
2081689c12 Change text for my appliances 2017-07-19 13:47:02 +02:00
Julien Duponchelle
983c55928e Add an appliance templates directory
* Settings in general preferences to configure it
* When you import a gns3a the file is copy to this directory
* A filter my appliances is available

Fix https://github.com/GNS3/gns3-gui/issues/2133
2017-07-19 11:55:46 +02:00
Julien Duponchelle
de625d6cfc Allow duplicate name in nodes view if emulator are different
Fix #2158
2017-07-19 09:49:03 +02:00
Jeremy Grossmann
523d791cac Merge pull request #2164 from GNS3/tabs-filters
Tabs in packet filters dialog. Fixes #2159
2017-07-17 21:35:43 +07:00
grossmj
270518f294 Add reset button and tab icons to indicate filter status. 2017-07-17 21:33:55 +07:00
Julien Duponchelle
7ab8d679f7 Fix a rare crash 2017-07-17 12:06:27 +02:00
ziajka
f518464eb2 Tabs in packet filters dialog. Fixes #2159 2017-07-17 10:44:15 +02:00
grossmj
321685acb8 Fixes tests. 2017-07-17 13:25:41 +07:00
grossmj
747ca36a5a Fixes uncaught exception in select server. Fixes #2106. 2017-07-17 12:59:17 +07:00
grossmj
485844f8de Fixes missing "style" in label data. Fixes #2110. 2017-07-17 12:40:14 +07:00
grossmj
b7c0a8c368 Fixes bug when no server selected. Fixes #2163. 2017-07-17 12:25:06 +07:00
grossmj
678c42f941 Fixes uBridge check. Fixes #2143. 2017-07-16 16:56:41 +07:00
Jeremy Grossmann
1eaf6c97e0 Merge pull request #2160 from GNS3/run-as-root
Fixes #2048. Inform the user about running as root, disallow change o…
2017-07-16 12:27:28 +07:00
grossmj
f92282f823 Update message to prevent to run as a user. 2017-07-16 12:26:45 +07:00
ziajka
9ef90210d8 Better os handling and message improvement, fixes #2160 2017-07-14 13:11:41 +02:00
Jeremy Grossmann
f280ea4c68 Merge pull request #2161 from GNS3/fix_2157
Fix Wireshark is restarted when updating packet filters
2017-07-12 22:09:42 +07:00
Julien Duponchelle
0067634990 Fix Wireshark is restarted when updating packet filters
Fix #2157
2017-07-12 16:40:52 +02:00
ziajka
4799fc7c93 Fixes #2048. Inform the user about running as root, disallow change of user and disable crash reports in this case 2017-07-12 14:07:49 +02:00
Jeremy Grossmann
829154fb1c Merge pull request #2156 from GNS3/bpf_filter
BPF filter support
2017-07-12 16:23:48 +07:00
grossmj
7e0caba4b0 Small changes for packet filters Ui. 2017-07-12 16:23:29 +07:00
grossmj
3c3890ff21 Fix typo. 2017-07-12 14:12:48 +07:00
Julien Duponchelle
65411d1742 Merge branch 'master' into 2.1 2017-07-11 17:59:12 +02:00
Julien Duponchelle
146a6a5af2 BPF filter support
Fix #765
2017-07-11 17:28:38 +02:00
grossmj
fc72140402 Bring to front complete (Windows only). Fixes #847. 2017-07-11 21:22:22 +07:00
grossmj
1b13d83e38 New icon for bring to front. Ref #847. 2017-07-11 20:02:43 +07:00
grossmj
e3f073d74b Generic best effort bring console to front for all nodes. Ref #847. 2017-07-11 16:31:18 +07:00
grossmj
8f6e84f8a9 Support bring to front for VMware VMs. Ref #847. 2017-07-11 15:31:42 +07:00
grossmj
c594c3d8a7 Fixes bring to front for VirtualBox VMs. Ref #847. 2017-07-11 14:30:26 +07:00
Jeremy Grossmann
a550527e6d Merge pull request #2153 from GNS3/idlepc_apicall
Idlepc apicall
2017-07-10 11:33:26 +07:00
Jeremy Grossmann
0ce377f321 Merge pull request #2145 from GNS3/preserve-file-permissions
Preserve permissions while copying files. Fixes #2125.
2017-07-08 21:56:50 +07:00
grossmj
ab37a6237c Fix small bug when not capturing/filtering on a link. 2017-07-08 21:47:30 +07:00
Jeremy Grossmann
ecc57133c6 Merge pull request #2139 from GNS3/filters
Filter packet interface
2017-07-08 18:51:50 +07:00
grossmj
fc6c2c0304 Filter icons and bug fixes for topology summary view. 2017-07-08 18:46:31 +07:00
Julien Duponchelle
92c731a9c9 Merge pull request #2151 from GNS3/improve-tpl-error
Fixes #2122. Warning dialog on Win and Mac when user has not choice.
2017-07-07 16:58:42 +02:00
Julien Duponchelle
bc433e5281 Merge pull request #2152 from GNS3/bugfix-2121
New appliance - case without versions in file. Fixes #2121
2017-07-07 16:58:04 +02:00
Julien Duponchelle
21eb0b0f03 Call the new api for getting IDLE PC values
Ref #2103
2017-07-07 16:41:17 +02:00
ziajka
3f70d0238f New appliance - case without versions in file. Fixes #2121 2017-07-07 12:59:41 +02:00
ziajka
8fd3f67378 Fixes #2122. Warning dialog on Win and Mac when user has not choice. 2017-07-07 11:54:27 +02:00
Julien Duponchelle
4e9cb90468 Remove dead code 2017-07-07 11:10:40 +02:00
Julien Duponchelle
d38e62fa38 Renable auth
Fix #2148
2017-07-07 11:09:39 +02:00
Julien Duponchelle
4b7df545aa Test if auth is enabled
Ref #2148
2017-07-07 10:20:22 +02:00
grossmj
6af5f5f3fb Stop all packet filters from the topology summary view. 2017-07-07 14:12:36 +07:00
Julien Duponchelle
b9318dfe6a Merge pull request #2140 from GNS3/bugfix-2137
Fixes #2137
2017-07-07 09:01:32 +02:00
Julien Duponchelle
6ffc2c807b Merge pull request #2144 from GNS3/bugfix-2129
Bugfix 2129 - ValueError: stat: path too long for Windows
2017-07-07 09:00:51 +02:00
grossmj
d177ea44bd Change the way the help is displayed for filter dialog. 2017-07-06 20:40:55 +07:00
ziajka
39f3b22817 Removed initial checks in tests due to Windows 2017-07-06 14:53:44 +02:00
ziajka
d157295550 Preserve permissions while copying files. Fixes #2125. 2017-07-06 14:47:08 +02:00
ziajka
d7b9465850 Typo. Fixes #2129 2017-07-06 13:30:59 +02:00
ziajka
0766dac62b Handle ValueError on Windows during checking path with SVG data. Fixes #2129 2017-07-06 13:29:34 +02:00
ziajka
4f81dde2fd Checking if new project dialog is already open, #2140 2017-07-06 11:47:58 +02:00
Julien Duponchelle
4a716000ff Do not crash if zoom is None 2017-07-06 09:58:13 +02:00
Jeremy Grossmann
d8b0e9234e Merge pull request #2134 from GNS3/use_websocket_for_notification
Use websocket for notifications
2017-07-05 15:42:50 +07:00
Julien Duponchelle
bf0af2a929 Cleanup double include of QtWebsockets 2017-07-05 10:33:48 +02:00
Jeremy Grossmann
a05e47a4d2 Merge pull request #2135 from GNS3/bugfix-725
Bugfix 725 (IPV6)
2017-07-05 14:47:56 +07:00
grossmj
996c5c927c Fix call to protocol() and add :: IPv6 address. 2017-07-05 14:47:07 +07:00
Julien Duponchelle
dab7569575 Fix compatibility with Qt version before 5.6 2017-07-04 18:24:50 +02:00
Julien Duponchelle
2a0e8a3b4f Merge pull request #2138 from GNS3/bugfix-1095
Bugfix 1095
2017-07-04 15:20:42 +02:00
ziajka
872e7199e4 Fixes #2137 2017-07-04 15:14:15 +02:00
Julien Duponchelle
67b57a8d78 Filter packet interface
Ref #765
2017-07-04 15:05:41 +02:00
ziajka
ba3c1e6969 Added protocol filtering on available server bind addresses 2017-07-04 14:00:33 +02:00
ziajka
1879172505 Persistent zoom level - refactor 2017-07-04 09:33:25 +02:00
ziajka
22fe51fe5a Show interface labels - persistance 2017-07-04 08:36:37 +02:00
ziajka
b5ac40896f Snap to grid persistance 2017-07-04 08:27:54 +02:00
ziajka
2d6b53245b Show the grid - save the state 2017-07-04 08:14:19 +02:00
ziajka
eee377c4fc Show layers persistent state 2017-07-03 15:09:12 +02:00
ziajka
c34b82c255 State of the zoom settings 2017-07-03 10:40:23 +02:00
grossmj
c750ce8d80 Add QtWebsockets dependency. 2017-06-30 17:49:30 +08:00
ziajka
2d2e682540 Add warning when user tries to run vncviewer on IPv6 host 2017-06-30 10:19:07 +02:00
Julien Duponchelle
e06cf5b9a1 Use websocket for notifications
Fix #2127
2017-06-29 10:58:06 +02:00
ziajka
d25258c47f IPV6 support for spice client 2017-06-28 15:50:25 +02:00
grossmj
1e40a36a48 Delete duplicated code. 2017-06-28 17:20:25 +08:00
Jeremy Grossmann
d5059d22fc Merge pull request #2119 from GNS3/drop_trusty
Drop support for Qt before 5.5 (ubuntu trusty)
2017-06-24 13:54:29 +02:00
grossmj
bae61bdcaa Allow IOU 64-bit images. 2017-06-23 12:00:33 +02:00
Julien Duponchelle
eb44226ee4 Drop support for Qt before 5.5 (ubuntu trusty)
Fix #2080
2017-06-22 14:32:53 +02:00
Jeremy Grossmann
8ee251cbb2 Merge pull request #2087 from GNS3/ethernet_switch_console
Console for ethernet switch
2017-06-21 23:53:07 +02:00
Julien Duponchelle
a84e081a75 Merge pull request #2116 from GNS3/spice-feature
Spice support
2017-06-21 11:56:15 +02:00
ziajka
d92db4e99d Spice support
* SPICE console type for QEMU settings pages
* SPICE settings tab at General Preferences
* Executing SPICE console type
* Preconfigured SPICE client for Windows
* SPICE commands for Win and Mac
2017-06-21 11:21:33 +02:00
Julien Duponchelle
873e04ed9d Merge branch 'master' into 2.1 2017-06-21 10:39:10 +02:00
Julien Duponchelle
c0c41b99eb Merge pull request #2114 from GNS3/revert-2112-spice-feature
Revert "Spice feature"
2017-06-21 10:31:21 +02:00
Julien Duponchelle
12b694047a Revert "Spice feature" 2017-06-21 10:30:49 +02:00
Julien Duponchelle
59651a3fe5 Merge pull request #2112 from GNS3/spice-feature
Spice feature
2017-06-21 10:29:58 +02:00
ziajka
02ad5d2f3a SPICE commands for Win and Mac 2017-06-20 12:37:44 +02:00
ziajka
a31b98f781 Preconfigured SPICE client for Windows 2017-06-20 10:18:25 +02:00
ziajka
e9a674c4e9 Executing SPICE console type 2017-06-16 14:16:54 +02:00
ziajka
4b383e2b06 SPICE settings tab at General Preferences 2017-06-16 11:11:40 +02:00
ziajka
6d2ca353a3 SPICE console type for QEMU settings pages 2017-06-16 10:57:00 +02:00
ziajka
d8b5caf679 Ignore env directory inside the project 2017-06-16 10:27:24 +02:00
Bernhard Ehlers
d61088e3a7 Sync appliance.json with gns3-registry repository
Fix #2107

Signed-off-by: Julien Duponchelle <julien@gns3.net>
2017-06-15 15:39:08 +02:00
Julien Duponchelle
a3f0569663 2.0.4dev1 2017-06-13 10:34:20 +02:00
Julien Duponchelle
31e82bb410 2.0.3 2017-06-13 10:33:13 +02:00
Julien Duponchelle
cab3baf2c6 Cleanup 2017-06-12 16:04:11 +02:00
grossmj
55b80cc9cb Merge remote-tracking branch 'origin/2.1' into 2.1 2017-06-09 22:37:29 +02:00
grossmj
aec6c37016 Do not enable authentication by default. 2017-06-09 22:37:10 +02:00
Julien Duponchelle
574da9c80a Display error when we can't export files
Fix #2097, #2098
2017-06-09 15:06:33 +02:00
Julien Duponchelle
117f6ec3b1 Merge branch '2.1' into ethernet_switch_console 2017-06-09 14:30:39 +02:00
Julien Duponchelle
574d6b3792 Merge branch 'master' into 2.1 2017-06-09 14:16:17 +02:00
Julien Duponchelle
8321883199 Fix auth header not sent is some conditions
Fix #2099
2017-06-09 14:12:38 +02:00
Julien Duponchelle
9608614aa9 Merge branch 'master' into 2.1 2017-06-09 11:39:24 +02:00
Julien Duponchelle
98e4aefa65 If we have auth issue at server startup continue to get better error 2017-06-09 11:37:54 +02:00
Julien Duponchelle
67d816baa3 Do not override IOU configuration file when you change the image
Fix #2091
2017-06-08 16:20:04 +02:00
Julien Duponchelle
13a8bd4500 Fix some PNG loading issues on Windows
Fix #2085
2017-06-08 14:59:47 +02:00
Julien Duponchelle
802b80b764 Handle label with missing elements
Fix #2096
2017-06-07 19:02:38 +02:00
Julien Duponchelle
fe5f80382a Merge branch '2.1' into ethernet_switch_console 2017-06-07 18:30:42 +02:00
Julien Duponchelle
a4ed59200d Merge branch 'master' into 2.1 2017-06-07 18:28:54 +02:00
Julien Duponchelle
59292ff6cb Support floating value for font size
Fix #2092
2017-06-07 16:34:05 +02:00
Julien Duponchelle
7810d19f4d Handle partial json in a response
Fix #2093
2017-06-07 14:49:31 +02:00
ziajka
0788ce569f Extended 'Thanks to' section - tab selection on first element 2017-06-06 16:14:53 +02:00
ziajka
4b0379892d Extended section 2017-06-06 15:55:15 +02:00
Julien Duponchelle
3ca05c7427 Console for ethernet switch
Ref https://github.com/GNS3/gns3-server/issues/454
2017-05-31 13:23:37 +02:00
Julien Duponchelle
6a16bcedc0 Reduce debug noise 2017-05-31 12:05:48 +02:00
Julien Duponchelle
8f8994e7df 2.0.3dev1 2017-05-30 09:10:54 +02:00
Julien Duponchelle
4e172fc7e3 2.0.2 2017-05-30 09:02:02 +02:00
Julien Duponchelle
56ebfc7fd0 Drop SSL support
Fix #1022
2017-05-26 15:52:09 +02:00
Julien Duponchelle
8ed8a2c115 Show a default symbol in case of corrupted file
Fix https://github.com/GNS3/gns3-server/issues/1043
2017-05-24 12:26:18 +02:00
Julien Duponchelle
073665a75d When another gui is already running exit instead of proper close to avoid any issue
Fix #2059
2017-05-23 18:00:02 +02:00
Julien Duponchelle
4ccc67aa46 Fix duplicate on remote server use wrong location
Fix https://github.com/GNS3/gns3-server/issues/1040
2017-05-23 17:25:29 +02:00
Julien Duponchelle
6e2632e91f Display the location of settings when we disallow opening due to old release 2017-05-23 15:54:35 +02:00
Julien Duponchelle
38ddcde902 Improve search for dynamips in development on OSX 2017-05-23 14:24:54 +02:00
Julien Duponchelle
436563afcb Merge pull request #2079 from GNS3/pyup-update-pytest-3.0.7-to-3.1.0
Update pytest to 3.1.0
2017-05-23 08:29:55 +02:00
pyup-bot
7eaab3e38b Update pytest from 3.0.7 to 3.1.0 2017-05-23 02:25:48 +02:00
Julien Duponchelle
0927a2a8c9 Fix error display when loading a .png custom symbol 2017-05-22 13:38:04 +02:00
Julien Duponchelle
87e6159ff6 Fix a crash in the progress dialog
Fix #2064
2017-05-22 09:56:31 +02:00
Julien Duponchelle
effdcf5e24 Fix a race condition when exporting a closed project
Fix #2078
2017-05-22 09:54:17 +02:00
Julien Duponchelle
021cdd2e65 Fix RuntimeError: wrapped C/C++ object of type NodeItem has been deleted
Fix #2070
2017-05-19 17:39:34 +02:00
Julien Duponchelle
9b559d43be Fix duplicate node in node view
Fix #2004
2017-05-19 17:22:29 +02:00
grossmj
ad7d06ef21 Fixes typo. 2017-05-19 00:06:50 +02:00
Julien Duponchelle
b88bf71be9 Clean IOU code
Ref https://github.com/GNS3/gns3-gui/issues/2065
2017-05-18 17:13:11 +02:00
Julien Duponchelle
3b019edc82 Avoid an error when downloading symbols not available 2017-05-16 11:22:06 +02:00
grossmj
f3504809ed Bring VirtualBox and VMware VM window to front on Windows. Ref #847. 2017-05-16 11:14:53 +02:00
Julien Duponchelle
23735f35ad Rename linked_base to linked_clone
Ref https://github.com/GNS3/gns3-server/issues/1034
2017-05-16 10:28:11 +02:00
Julien Duponchelle
3adc46fbe2 Merge branch '2.0' into 2.1 2017-05-16 09:31:28 +02:00
Julien Duponchelle
363c4a9966 2.0.2dev1 2017-05-16 09:15:18 +02:00
Julien Duponchelle
7082c75511 2.0.1 2017-05-16 08:48:56 +02:00
Julien Duponchelle
8a303e4563 Merge branch '2.0' into 2.1 2017-05-16 08:38:43 +02:00
Julien Duponchelle
842ad8ae26 Merge branch '2.0' into 2.1 2017-05-15 16:07:32 +02:00
grossmj
16c4a837d7 Improve inline help. Fixes #1999.
Add a warning about wifi interfaces in the cloud. Fixes #1902.
2017-05-14 22:18:35 +02:00
grossmj
fd42ac410c Copy remote directory path into clipboard in "Show in FileManager". Fixes #1966. 2017-05-12 16:49:26 +08:00
Jeremy Grossmann
6efc177804 Merge pull request #2054 from GNS3/export_thread
Do not run import / export of project in seperate thread
2017-05-12 10:23:25 +08:00
Julien Duponchelle
6f9e6c9b92 Fix display of error in progress dialog when we don't have thread 2017-05-11 17:48:38 +02:00
Jeremy Grossmann
0411c68150 Merge pull request #2057 from GNS3/lost_slot_and_port
Fix lost slot and port in dynamips settings
2017-05-11 23:37:39 +08:00
Julien Duponchelle
4246e731e5 Fix lost slot and port in dynamips settings
When you reopen a project you no longer have the
wic and slot, until you move the node and retrieve an
update. The settings is just lost in the GUI but is fine
on server.

Fix #2053
2017-05-11 09:49:47 +02:00
Julien Duponchelle
50cca71279 Do not run import / export of project in seperate thread
This trigger warning because you need to do the HTTP request
to the API from the main thread.

Fix #2008
2017-05-10 18:13:45 +02:00
Julien Duponchelle
c78ef8f348 Assert when running an HTTP query outside the main thread
Ref #2008
2017-05-10 17:57:02 +02:00
Julien Duponchelle
c03a5a9e0a Proper error when you try to load the pid file as config file
Fix #2044
2017-05-09 17:27:38 +02:00
Julien Duponchelle
c93b7836d8 Log malformed svg text item
Fix #2045
2017-05-09 17:14:02 +02:00
Julien Duponchelle
690b22cc24 Fix a race condition when right click and delete a node at the same time
Fix #2043
2017-05-09 17:03:23 +02:00
Julien Duponchelle
3560251816 Fix a race condition when snapshoting a closed project
Fix #2046
2017-05-09 16:37:42 +02:00
Jeremy Grossmann
90e861289f Merge pull request #2016 from GNS3/missing_xattr
Catch missing function listxattr on some linux host
2017-05-08 21:04:47 +07:00
Jeremy Grossmann
6e144d6122 Update doctor_dialog.py 2017-05-08 21:04:01 +07:00
grossmj
2f168193d1 Catch remaining missing function listxattr on some Linux host. 2017-05-08 21:01:27 +07:00
Jeremy Grossmann
0fe5559564 Merge pull request #2007 from GNS3/fix_project_close
Fix project closing when we have multiple client connected
2017-05-08 20:42:35 +07:00
Julien Duponchelle
37f0744d7c Fix a race condition when creating node and closing project
Fix #2018
2017-05-05 19:04:06 +02:00
Julien Duponchelle
000f4a4790 Fix Bug with python before 3.4.3
Fix #2035
2017-05-05 18:58:40 +02:00
Julien Duponchelle
a09b7d6738 Fix error if you put a path in a .gns3a file for qemu
Fix #2038
2017-05-05 18:31:13 +02:00
Julien Duponchelle
a1fa8f9ec2 Fix AttributeError: 'NoneType' object has no attribute '_refreshVisibleWidgets'
Fix #2034
2017-05-05 18:29:36 +02:00
Jeremy Grossmann
cd6b0b793e Merge pull request #2009 from GNS3/dissalow_gns3_on_remote
Disallow opening a .gns3 on a remote server
2017-05-05 20:53:29 +07:00
Jeremy Grossmann
6453932421 Update main_window.py 2017-05-05 20:52:03 +07:00
Julien Duponchelle
37a23d9682 Do not crash if the logging code raise an exception
Fix #2017
2017-05-04 12:18:26 +02:00
Julien Duponchelle
e18e10c701 Fix some crash in dynamips device preference page
Fix #2029
2017-05-04 12:02:49 +02:00
Julien Duponchelle
a9240e2e46 Fix warning when loading IOU images on Windows
Fix #2012
2017-05-04 10:43:13 +02:00
Julien Duponchelle
4df0c33013 Do not crash if you don't have configure a packet capture program on Windows
Fix #2026
2017-05-04 10:38:35 +02:00
Julien Duponchelle
4096316ceb Ignore error when we can't kill the packet capture
The user probalby manually kill it.

Fix #2013
2017-05-04 10:30:41 +02:00
Julien Duponchelle
e09292c647 Fix AttributeError: 'NoneType' object has no attribute 'wasCanceled'
Fix #2023
2017-05-04 10:27:45 +02:00
Julien Duponchelle
31c37161fa Fix RuntimeError: wrapped C/C++ object of type QComboBox has been deleted
Fix #2027
2017-05-04 10:25:46 +02:00
Julien Duponchelle
a047cd7f4c Fix RuntimeError: wrapped C/C++ object of type QTreeWidgetItem has been deleted
Fix #2028
2017-05-04 10:13:33 +02:00
Julien Duponchelle
87cde665a8 Fix detection of https when use for the local server
Ref #995
2017-05-03 17:23:03 +02:00
Julien Duponchelle
6361c94bbe Silent the _COMPIZ_TOOLKIT_ACTION warning
This a Qt bug.

Fix #2020
2017-05-03 15:54:55 +02:00
Julien Duponchelle
8a0aeff0bb Cacth TypeError: native Qt signal is not callable
Fix #2011
2017-05-03 10:58:38 +02:00
Julien Duponchelle
508f8b3ad5 Fix AttributeError: 'C7200' object has no attribute 'warning_signal'
Fix #2014
2017-05-03 10:51:12 +02:00
Julien Duponchelle
bfe942c029 Catch missing function listxattr on some linux host
Fix #2010
2017-05-03 10:47:22 +02:00
Julien Duponchelle
b3a86594ff 2.0.1dev1 2017-05-03 10:19:25 +02:00
Julien Duponchelle
debe88bd37 2.0.0 2017-05-02 10:14:01 +02:00
Julien Duponchelle
a948fd07b1 Disallow opening a .gns3 on a remote server
This prevent opening a local .gns3 on a remote server.
Because this is not working you need to import the
project on the server using portable project.

Fix https://github.com/GNS3/gns3-server/issues/984
2017-05-02 09:27:40 +02:00
Julien Duponchelle
072f714e21 Fix project closing when we have multiple client connected
In all case when we close the main window we let the server
manage if he need to close or not the project.

Fix https://github.com/GNS3/gns3-server/issues/991
2017-05-02 09:07:14 +02:00
Julien Duponchelle
466c349642 Remove log noise 2017-04-28 12:51:26 +02:00
Julien Duponchelle
1356fd9c69 Reduce log info noise 2017-04-27 15:46:39 +02:00
Julien Duponchelle
2d1c9444c5 Delete noise 2017-04-27 15:13:56 +02:00
Julien Duponchelle
22d7815d8e Fix can't drag VPCS to topology
Fix #2001
2017-04-27 14:28:58 +02:00
Julien Duponchelle
53487d5937 Merge branch '2.0' into 2.1 2017-04-27 10:56:41 +02:00
Julien Duponchelle
a2059d3e7c Clarify that we don't override vmware custom adapters 2017-04-27 10:06:52 +02:00
Julien Duponchelle
ab729d8f67 Close the program if you close the profile select dialog
Fix #1922
2017-04-26 17:05:16 +02:00
Julien Duponchelle
eb5c10de3d Support node uuid is telnet console parameter
Fix #1918
2017-04-26 16:19:59 +02:00
Julien Duponchelle
c4cc819d50 Strip space from path at project creation
Fix #1997
2017-04-21 14:49:52 +02:00
Julien Duponchelle
0796d9aae5 2.0.0dev13 2017-04-20 10:57:28 +02:00
Julien Duponchelle
c8148c1877 2.0.0rc4 2017-04-20 10:56:55 +02:00
Julien Duponchelle
1b6d534b8e Merge branch '2.0' into 2.1 2017-04-20 10:30:58 +02:00
Julien Duponchelle
d6021afa0f Catch all error during the generation of log messages.
This prevent error loop is something goes wrong.

Fix #1993
2017-04-20 09:26:57 +02:00
Julien Duponchelle
9018bdac07 Remove no longer working capturelog plugin for pytest 2017-04-19 09:41:56 +02:00
Julien Duponchelle
a48b898d92 Catch a rare node creation error
Fix #1991
2017-04-19 09:39:32 +02:00
Julien Duponchelle
949c1bbe37 Fix missing menu text at application startup
Fix #1990
2017-04-19 09:35:31 +02:00
Julien Duponchelle
0089edecc0 Run test on windows also 2017-04-18 16:48:45 +02:00
Julien Duponchelle
91da1d492b Fix a race condition in the drawing item
Fix #1987
2017-04-18 11:32:33 +02:00
Julien Duponchelle
0242f53c17 Catch system error when connecting to local server
Fix #1988
2017-04-18 11:29:42 +02:00
Julien Duponchelle
bab7a1016f Catch a rare error when killing the capture
Fix #1985
2017-04-14 10:39:43 +02:00
Julien Duponchelle
2ec91e1ef7 Improve pcap streaming speed
Fix #1982
2017-04-14 10:30:49 +02:00
Julien Duponchelle
38af30ec15 Merge branch 'master' into 2.0 2017-04-14 09:04:17 +02:00
Julien Duponchelle
3f8a0cb527 Merge master 2017-04-14 09:03:08 +02:00
Julien Duponchelle
fd1a86df03 1.5.5dev1 2017-04-14 09:00:57 +02:00
Julien Duponchelle
c954a16ead 1.5.4 2017-04-13 17:27:37 +02:00
Julien Duponchelle
9418b997eb Mac Qt wheel is not working in our build envirronement 2017-04-13 16:07:52 +02:00
Julien Duponchelle
9682cad4f4 Add security issues section 2017-04-13 12:37:34 +02:00
Julien Duponchelle
60ee9e1374 Limit ubridge permission to the admin group on OSX 2017-04-13 10:04:08 +02:00
Julien Duponchelle
dbd5b9366a Upgrade to 5.7.1 2017-04-13 10:01:40 +02:00
Julien Duponchelle
f63314d4d0 Fix version number 2017-04-13 09:56:17 +02:00
Julien Duponchelle
a9b5b9eda2 Merge pull request #1906 from GNS3/appliances_api
Move appliances management to the server
2017-04-12 14:36:10 +02:00
Julien Duponchelle
96eaec0100 Recent projects list bug
Fix #1976
2017-04-10 17:59:17 +02:00
Julien Duponchelle
5d554976e2 Fix a race condition in the preferences dialog
Fix #1981
2017-04-10 11:42:13 +02:00
Julien Duponchelle
d1d8390b73 Try to fix some windows Z issues
Fix #1955
2017-04-07 11:06:51 +02:00
Julien Duponchelle
5f3f6462c2 Catch a garbage collection issue in the right click on a link 2017-04-03 16:33:14 +02:00
Julien Duponchelle
821809bf6f Fix a compatibility issue with Python 3.4
Fix #1973
2017-03-31 19:30:32 +02:00
Julien Duponchelle
a712fab7a4 2.0.0dev12 2017-03-31 09:44:27 +02:00
Julien Duponchelle
4ab21ea9f9 2.0.0rc3 2017-03-31 09:41:48 +02:00
Julien Duponchelle
ce12eb86e8 Merge branch '2.0' into 2.1 2017-03-30 10:07:55 +02:00
Julien Duponchelle
1a4902279b Check hibernation only if it's a remote main server
Fix #1971
2017-03-29 17:19:00 +02:00
Julien Duponchelle
35412171b9 Improve timeout handling
Ref #1959
2017-03-29 12:34:10 +02:00
Julien Duponchelle
73939847b9 Improve logging when we display a qt message box
Ref #1959
2017-03-29 12:12:22 +02:00
Julien Duponchelle
5acfc5bc56 Fix a problem with settings not pushed to the server 2017-03-28 16:22:17 +02:00
Julien Duponchelle
d67d0d146f Try to detect computer hibernation
I'm not really happy with the patch but it the most simple way
I found. If between two request we have more than 120 seconds
of differences we disconnect.

Fix #1968
2017-03-28 14:41:43 +02:00
Julien Duponchelle
23da6a4c31 Fix crash when we send some errors to the user console 2017-03-27 18:16:11 +02:00
Julien Duponchelle
fd5f999756 Use QtFile for managing file capture
This prevent application freeze when we run a capture.

Fix #1959
2017-03-27 14:19:07 +02:00
Julien Duponchelle
c05304b86f Allow to delete a profile from the profile select dialog
Fix #1961
2017-03-27 10:26:29 +02:00
Julien Duponchelle
6361980591 Filter hidden folder in the profil directory
Fix #1960
2017-03-23 12:02:32 +01:00
Julien Duponchelle
d5ea98ba2a Prevent user putting port in the remote host name
Fix #1948
2017-03-22 11:56:27 +01:00
Julien Duponchelle
3ca01384c9 Fix RuntimeError: wrapped C/C++ object of type EllipseItem has been deleted
Fix #1957
2017-03-21 18:19:47 +01:00
Julien Duponchelle
f35bb6a281 Fix a rare error in LinkItem
Fix #1950
2017-03-21 16:56:23 +01:00
Julien Duponchelle
0c4a7693e6 Fix Image field in nodes list is stale after changing an image
Fix #1956
2017-03-21 16:54:10 +01:00
Julien Duponchelle
20506525c5 Fix RuntimeError: Set changed size during iteration
Fix #1951
2017-03-21 15:13:49 +01:00
Julien Duponchelle
bb00a9f64c Better detection of remote server changes
Fix #1949
2017-03-21 14:38:20 +01:00
Julien Duponchelle
ef36792379 Add a notice about the fact you need to apply server settings
Fix #1952
2017-03-21 11:35:03 +01:00
Julien Duponchelle
873fd409bd Check python version only for setup.py install 2017-03-21 10:10:14 +01:00
Julien Duponchelle
03221e8ab7 Fix refresh issue with link in topology summary
Fix #1938
2017-03-20 18:24:16 +01:00
Julien Duponchelle
55f9836dc9 Remove duplicate code 2017-03-20 17:34:17 +01:00
Julien Duponchelle
3ab5144fe2 Catch appliance error when creating an appliance new version
Fix #1941
2017-03-20 17:10:49 +01:00
Julien Duponchelle
c91a22c9f8 If a node can't be deleted do not remove it
Fix #1933
2017-03-16 19:42:38 +01:00
Julien Duponchelle
a8ba909568 If something is wrong during packet capture do not disconnect us from the server
Fix #1520
2017-03-16 18:14:55 +01:00
Julien Duponchelle
d33e9ed833 If something is wrong during packet capture do not disconnect us from the server
Fix #1520
2017-03-16 14:37:32 +01:00
Julien Duponchelle
aa31af1dca Fix saving dynamips
Fix #1939
2017-03-16 14:33:16 +01:00
Julien Duponchelle
4d07a7391f Try to fix the hang dialog on some computers
Ref #1915
2017-03-16 12:19:09 +01:00
Julien Duponchelle
417395718d Fix a rare crash in progress dialog 2017-03-15 16:36:13 +01:00
Julien Duponchelle
212048c4d1 If we pass --profile skip the profile select dialog
Fix #1934
2017-03-15 16:09:35 +01:00
Julien Duponchelle
11c27063b4 Raise an error if the progress dialog is not created from the main thread
Ref #1915
2017-03-15 15:14:12 +01:00
Julien Duponchelle
b8696fa54e Log qt log to python log 2017-03-15 14:50:19 +01:00
Julien Duponchelle
ba9785f83f Revert "Rollback to Qt 5.7.1"
This reverts commit 5038a72610.
2017-03-15 14:46:57 +01:00
Julien Duponchelle
4ae742529c Fix image are not uploaded to remote main server
Fix #1926, #1927, #1925
2017-03-15 14:33:25 +01:00
Julien Duponchelle
92cc335708 Fix race condition when editing a project
Fix #1932
2017-03-15 14:30:00 +01:00
Julien Duponchelle
2099a4ae9a Poll settings each 5 seconds
Fix #1923, #1924
2017-03-15 12:55:14 +01:00
Julien Duponchelle
5038a72610 Rollback to Qt 5.7.1
Ref #1915
2017-03-15 11:51:22 +01:00
Julien Duponchelle
b9e320996b Merge pull request #1935 from GNS3/pyup-update-pytest-3.0.6-to-3.0.7
Update pytest to 3.0.7
2017-03-15 10:20:50 +01:00
pyup-bot
9c86cd71c8 Update pytest from 3.0.6 to 3.0.7 2017-03-14 23:53:42 +01:00
Julien Duponchelle
7fdf42b442 Avoid progress dialog not disapear
Fix #1915
2017-03-14 15:40:04 +01:00
Julien Duponchelle
61d86e919e Remove wrong mention about the fact super putty is include 2017-03-14 12:02:02 +01:00
Julien Duponchelle
bc71985ee3 Avoid a crash when an ios router don't have a chassis
Fix #1920
2017-03-13 17:25:58 +01:00
Julien Duponchelle
6bebf2d14d Fix a potentatial crash in the progress dialog
Fix #1919
2017-03-13 17:16:34 +01:00
Julien Duponchelle
490021aa47 Fix appliance file 2017-03-13 15:48:59 +01:00
Julien Duponchelle
c8db5e7e49 2.0.0 dev 11 2017-03-13 15:42:06 +01:00
Julien Duponchelle
8efaacbc3d Support official docker images in appliances 2017-03-13 15:41:14 +01:00
Julien Duponchelle
c5da24b954 2.0.0rc2 2017-03-10 20:40:10 +01:00
Julien Duponchelle
4456cfd68e Merge branch 'master' into 2.0 2017-03-10 20:39:03 +01:00
Julien Duponchelle
3468909db1 Deploy on pypi when we tag 2017-03-10 20:37:57 +01:00
Julien Duponchelle
212728eb94 Fix rare crash in GNS3 VM preference page
Fix #1912
2017-03-09 10:51:38 +01:00
Julien Duponchelle
cf4f73a7e1 Fix an error on Windows when loading SVG files
Fix #1913
2017-03-09 10:25:18 +01:00
Julien Duponchelle
d4ffbd9f97 Fix an error on Windows when loading SVG files
Fix #1913
2017-03-09 10:10:06 +01:00
Julien Duponchelle
4c01a465ac Merge branch '2.0' into 2.1 2017-03-08 18:14:32 +01:00
Julien Duponchelle
5948e5c4cb Prevent a potential crash 2017-03-08 18:12:46 +01:00
Julien Duponchelle
791aa27158 Workaround a rare crash when sending analytics
It seem PyQT is confuse between the signal and error function.

Fix #1861
2017-03-08 14:52:47 +01:00
Julien Duponchelle
0b8ab56ffc Catch error when you try to create a node a not existing server
Fix #1905
2017-03-08 14:44:30 +01:00
Julien Duponchelle
12dcfda756 Fix an error when your local server crash and computer return non unicode
Fix #1904
2017-03-08 14:40:29 +01:00
Julien Duponchelle
ef44beac41 Fix KeyError: 'slot1'
Fix #1907
2017-03-08 09:54:17 +01:00
Julien Duponchelle
97a71904f7 Fix a rare crash in import appliance
Fix #1908
2017-03-08 09:53:27 +01:00
Julien Duponchelle
012bc1e406 Display the appliances in the application
Ref #1045
2017-03-07 18:10:15 +01:00
Julien Duponchelle
94f4059d67 Rollback to PyQT 5.8 because 5.8.1 seem to have trouble at install 2017-03-07 15:49:26 +01:00
Julien Duponchelle
14ed2546bc Merge pull request #1903 from GNS3/pyup-update-pyqt5-5.8-to-5.8.1
Update pyqt5 to 5.8.1
2017-03-07 13:25:40 +01:00
pyup-bot
908258c163 Update pyqt5 from 5.8 to 5.8.1 2017-03-07 12:09:10 +01:00
Julien Duponchelle
05ba772715 Remove log noise 2017-03-07 10:30:59 +01:00
Jeremy Grossmann
9ea57f511b Merge pull request #1830 from GNS3/applicance_in_nodes
Display the appliances in the application
2017-03-06 19:49:48 -07:00
grossmj
5aaa2d7280 Some tweaks for appliance wizard. 2017-03-07 08:40:56 +08:00
Julien Duponchelle
704191ba25 2.0.0 dev 10 2017-03-06 19:42:25 +01:00
Julien Duponchelle
be7fc9abe2 2.0.0rc1 2017-03-06 19:39:46 +01:00
Julien Duponchelle
e0daf1dbb1 Fix syntax error 2017-03-01 09:04:05 +01:00
Julien Duponchelle
a8877d4f8a UltraVNC support 2017-02-28 18:08:48 +01:00
Julien Duponchelle
497eb19369 Fix a resize notifications dialog for the first notification 2017-02-28 17:42:23 +01:00
Julien Duponchelle
70049aa877 Merge branch '2.1' into applicance_in_nodes 2017-02-28 15:59:52 +01:00
Julien Duponchelle
ece7930cb1 Merge branch '2.0' into 2.1 2017-02-28 15:59:29 +01:00
Julien Duponchelle
2db850a3f3 Fix tests 2017-02-28 15:58:25 +01:00
Julien Duponchelle
c7df589857 Fix noisy dialog and an error with right click 2017-02-28 15:37:15 +01:00
Julien Duponchelle
8bcc92f319 Merge branch '2.1' into applicance_in_nodes 2017-02-28 15:03:28 +01:00
Julien Duponchelle
dedde63b60 Merge branch '2.0' into 2.1 2017-02-28 14:10:07 +01:00
Julien Duponchelle
ec7cdedb86 Display less noisy dialog when we can't connect to the remote server
Fix #1887
2017-02-28 14:06:52 +01:00
Julien Duponchelle
606fa15a55 Prevent the usage of gns3vm as a remote server name 2017-02-28 13:50:31 +01:00
Jeremy Grossmann
3eca9b0e54 Merge pull request #1881 from GNS3/catch_local_process_errors
Monitor and display local server stderr
2017-02-28 02:46:27 +08:00
Julien Duponchelle
3abaf74580 Fix the VMware wizard for not using a remote server by default
Fix #1893
2017-02-27 19:00:02 +01:00
Julien Duponchelle
9713748633 Prevent the GNS3 VM to appear in remote compute in the VM wizard
Fix #1894
2017-02-27 18:08:34 +01:00
Julien Duponchelle
405e86aff4 Remove iouyap settings
Fix #1892
2017-02-27 15:26:05 +01:00
Julien Duponchelle
4da824dc2b Fix missing permission error management
Fix #1888
2017-02-24 09:49:10 +01:00
Julien Duponchelle
0ec177c644 Avoid a crash when create a new dynamips version in the appliance wizard
Fix #1884
2017-02-23 15:13:00 +01:00
Julien Duponchelle
9ef4f86050 Disallow user to add the same server as a remote server and as local server
Fix #1883
2017-02-23 11:13:14 +01:00
Julien Duponchelle
96b830817e Fix 'module' object has no attribute 'run'
Fix #1878
2017-02-23 09:11:31 +01:00
Julien Duponchelle
0db8b00fb9 Monitor and display local server stderr
It's the best solution I found. Streaming in real time
the log will require to start an aditionnal thread

Fix #1880
2017-02-22 17:51:23 +01:00
Julien Duponchelle
005dde6c2b Fix some import errors 2017-02-22 17:23:58 +01:00
Julien Duponchelle
260f9b352e Remove placeholder string from appliance wizard 2017-02-22 11:02:25 +01:00
Julien Duponchelle
852b0bc498 Avoiding calling multiple time /computes at the same time. And reduce timeout
Fix #1848
2017-02-22 10:29:41 +01:00
Julien Duponchelle
3a503a5fc0 Support for appliance v4 2017-02-22 09:04:22 +01:00
Jeremy Grossmann
88b408695a Merge pull request #1875 from GNS3/hdpi_enable
Disable HDPI by default on Linux and allow to configure it
2017-02-20 20:39:19 -08:00
grossmj
776b45363b Some tweaks for enabling/disabling HDPI mode. 2017-02-21 12:33:09 +08:00
Julien Duponchelle
adb270b64c Do not display error at first step of the setup wizard
Fix #1827
2017-02-20 20:04:43 +01:00
Julien Duponchelle
5329b8fd72 Disable HDPI by default on Linux and allow to configure it
Fix #1870
2017-02-20 19:21:02 +01:00
Julien Duponchelle
d6379e4bb9 Fix an issue when you edit a VPCS node from the node view
Fix https://github.com/GNS3/gns3-gui/issues/1874
2017-02-20 18:09:48 +01:00
Julien Duponchelle
6ca18d5b29 Catch a race condition in managing error static assets download
Fix #1872
2017-02-20 15:11:44 +01:00
Julien Duponchelle
50c008ddec Handle error if you try to import an appliance without having the images
Fix #1871
2017-02-20 12:29:37 +01:00
Julien Duponchelle
4f56f100fa Improve crash proof code of the progress dialog
Fix #1873
2017-02-20 12:16:32 +01:00
Jeremy Grossmann
a81d1443f9 Merge pull request #1835 from GNS3/base_config_server_side
Manage base configuration on server
2017-02-19 22:59:27 -08:00
Jeremy Grossmann
e69089f4cf Merge pull request #1865 from GNS3/status_bar_error
Display a count of errors at the bottom of the screen
2017-02-18 05:53:27 -08:00
Julien Duponchelle
0c052542b3 Display a count of errors at the bottom of the screen
You can test it by typing in the console:
log error test
log warning test

Click on the count hide / show the console and reset the counters.

Also now status bar is a dedicated class we can easyly extend it.

Ref #1864
2017-02-17 16:24:58 +01:00
Julien Duponchelle
00e402f28c Merge pull request #1814 from GNS3/show_error
Display an overlay popup with log messages
2017-02-17 11:20:37 +01:00
Julien Duponchelle
0742b282a3 Change some log level to avoid notifications noises 2017-02-17 11:09:18 +01:00
Jeremy Grossmann
2b588aa0bf Merge pull request #1820 from GNS3/line
Allow drawing lines
2017-02-17 02:08:36 -08:00
Julien Duponchelle
92fb8418ab Add a checkbox to display or not notification in app 2017-02-17 11:08:31 +01:00
Julien Duponchelle
9c7dbc864e Display an overlay popup with log messages
Ref #1334
2017-02-17 11:08:31 +01:00
Julien Duponchelle
25aebaa46c Better support for Vertical Line 2017-02-17 11:01:57 +01:00
Jeremy Grossmann
0e30b3cf5f Merge pull request #1842 from GNS3/qemu_more_adapters
Allow up to 275 adapters for qemu
2017-02-17 01:41:24 -08:00
Julien Duponchelle
755667c4d5 Spawn line at correct position 2017-02-17 10:37:27 +01:00
grossmj
16dbdf70d9 Add line icons 2017-02-17 17:17:05 +08:00
Jeremy Grossmann
806c7479ee Merge pull request #1831 from GNS3/scale_percent
Display zoom percentage when changing scale.
2017-02-17 00:25:04 -08:00
Jeremy Grossmann
cc8b84725a Update graphics_view.py 2017-02-17 16:24:46 +08:00
Julien Duponchelle
e01701614e Remember last appliance filter 2017-02-16 17:21:42 +01:00
Julien Duponchelle
efaffac801 Merge branch '2.0' into 2.1 2017-02-16 16:28:21 +01:00
Julien Duponchelle
0c16a5b0d1 2.0.0dev9 2017-02-16 11:27:49 +01:00
Julien Duponchelle
8f33ad3c70 2.0.0b4 2017-02-16 11:26:32 +01:00
Julien Duponchelle
7dca1b404c Fix a rare crash 2017-02-15 19:28:38 +01:00
Julien Duponchelle
99ff98ff47 Merge pull request #1858 from GNS3/pyup-update-pyqt5-5.7.1-to-5.8
Update pyqt5 to 5.8
2017-02-15 18:55:09 +01:00
pyup-bot
083d6e1298 Update pyqt5 from 5.7.1 to 5.8 2017-02-15 18:44:11 +01:00
Julien Duponchelle
71716c451e Drop from console view the show command not supported by 2.0
Fix #1855
2017-02-15 18:15:09 +01:00
Julien Duponchelle
3c4a244b75 Try to avoid segfault in some PyQT version
Fix #1856
2017-02-15 16:19:13 +01:00
Julien Duponchelle
85892a3bd6 Display git commit version in version number 2017-02-15 12:52:17 +01:00
Julien Duponchelle
1d3d721cf3 Support for strike and underline
Fix #1851
2017-02-14 17:45:48 +01:00
Julien Duponchelle
37a72af75f Do not use native font selector on mac it could crash 2017-02-14 17:01:21 +01:00
Julien Duponchelle
c93713b9e7 Use a dedicated QNetwork manager for notification
I hope this will solve issue for some users where the connection
return random error when they change the project.

Ref #1848
2017-02-14 15:15:29 +01:00
Julien Duponchelle
77b3118cbc Try to workaround unknow error on some user computers
Ref #1848
2017-02-14 12:27:34 +01:00
Julien Duponchelle
bc0cbfd040 Fix a display error in console error message 2017-02-14 11:37:20 +01:00
Julien Duponchelle
0cfc66b4d4 Use signal for writting on console to avoid some potential segfault 2017-02-14 11:23:41 +01:00
Julien Duponchelle
1b9b1cbe3c Fix tests about HTTP errors 2017-02-14 10:19:34 +01:00
Julien Duponchelle
407187c826 Fix a rare warning
Fix https://github.com/GNS3/gns3-server/issues/901
2017-02-14 09:53:12 +01:00
Julien Duponchelle
a6eb1e65ac Add more debug when we have an http error
Ref #1848
2017-02-13 19:15:19 +01:00
Julien Duponchelle
efbb19a862 Disable timeout on project open
Ref #1848
2017-02-13 17:39:13 +01:00
Julien Duponchelle
2a94816b58 Support for gvncviewer
Fix #1845
2017-02-13 15:26:12 +01:00
Julien Duponchelle
aab307a519 Fix a rare crash in the file editor dialog
Fix #1849
2017-02-13 15:22:03 +01:00
Julien Duponchelle
1279e16484 Fix a race condition when we display the error
Ref #1848
2017-02-13 13:08:38 +01:00
Julien Duponchelle
c2e20f9bd6 Fix an issue with invalid hostname detected as an IPV6 2017-02-10 18:13:48 +01:00
Julien Duponchelle
c58366e9cb When an appliance template is added we hide it 2017-02-10 15:55:48 +01:00
Julien Duponchelle
068ebcdea0 "/appliances" => "/appliances/templates" 2017-02-10 15:55:47 +01:00
Julien Duponchelle
51f2b4bfa8 Display the appliances in the application
Ref #1045
2017-02-10 15:55:47 +01:00
Julien Duponchelle
168e4ab86e Merge branch '2.0' into 2.1 2017-02-10 15:55:17 +01:00
Julien Duponchelle
4acdaf6b5a When you update a a node from the node view send settings to controller 2017-02-10 15:51:54 +01:00
Julien Duponchelle
25313cbcde Fix error when permission on the loaded image is broken
Fix #1843
2017-02-08 11:19:41 +01:00
Julien Duponchelle
7ae18ff82a Allow up to 275 adapters for qemu
See https://github.com/GNS3/gns3-server/pull/895 for server part
2017-02-07 17:37:10 +01:00
Julien Duponchelle
c694173f9d Merge branch '2.0' into 2.1 2017-02-07 17:36:45 +01:00
Julien Duponchelle
0de0eb12eb Fix tests 2017-02-07 17:36:21 +01:00
Julien Duponchelle
b58b92c9f0 Merge branch '2.0' into 2.1 2017-02-07 15:03:44 +01:00
Julien Duponchelle
7d0fe52600 Fix crash with invalid image file in appliance wizard
Fix #1837
2017-02-06 17:27:30 +01:00
Julien Duponchelle
ba1d3b2423 Fix error when loading an handmade appliance file
Fix #1839
2017-02-06 17:10:30 +01:00
Julien Duponchelle
cae6afe85d Fix no error if your VNC client is not configured
Fix #1838
2017-02-06 16:59:06 +01:00
Julien Duponchelle
5865ac267b Avoid high cpu usage when connection is lost
Fix #1840
2017-02-06 11:27:36 +01:00
Julien Duponchelle
162993839c Support {name} in cloud template
Fix #1833
2017-02-03 15:15:47 +01:00
Julien Duponchelle
4359b490cc Fix text of the export dialog
Fix #1834
2017-02-03 14:47:07 +01:00
Julien Duponchelle
e4a8e67229 Fix error message when a project is already open
Fix #1832
2017-02-03 14:45:44 +01:00
Julien Duponchelle
3ddb2e70d4 Manage base configuration on server
Fix #786
2017-02-03 13:18:04 +01:00
Julien Duponchelle
05966a9119 Display zoom percentage when changing scale.
It's like other messages display during 2 seconds.

Fix #1263
2017-02-01 14:51:58 +01:00
Julien Duponchelle
8ea24e9920 Remove unused variables 2017-02-01 14:32:05 +01:00
Julien Duponchelle
6605270e64 Fix missing info in tooltip of ethernet switch
Fix  https://github.com/GNS3/gns3-gui/issues/1828
2017-01-31 19:28:03 +01:00
Julien Duponchelle
09e2bfeed0 The server manage the vmname when we update the linked virtual box VM
Ref https://github.com/GNS3/gns3-gui/issues/1821
2017-01-31 18:50:52 +01:00
Julien Duponchelle
47f34fd5af Merge branch '2.0' into 2.1 2017-01-31 17:00:40 +01:00
Julien Duponchelle
b24733466d Fix z value for text
Fix #1822
2017-01-30 16:00:43 +01:00
Julien Duponchelle
c31be48f20 Avoid a segfault when display an error 2017-01-30 10:51:31 +01:00
Julien Duponchelle
a9ed27f42c Add sata options in the appliance schema
Fix #1817
2017-01-27 11:01:11 +01:00
Julien Duponchelle
89321a6cad Allow drawing lines
Ref #997
2017-01-27 10:15:05 +01:00
Julien Duponchelle
1440caa532 Fix a rare crash when exporting IOU configurations
Fix #1800
2017-01-25 13:55:19 +01:00
Julien Duponchelle
513eb21940 Allow additionnal properties in registry files 2017-01-25 12:14:36 +01:00
Julien Duponchelle
de348d39da Fix a potential crash when a symbol is not found 2017-01-25 12:04:40 +01:00
Julien Duponchelle
0a3697962b Strip unused code for OVA support in the registry 2017-01-24 12:14:25 +01:00
Julien Duponchelle
e0edcf3d23 Increase the timeout for killing local server
Fix #1813
2017-01-24 11:20:50 +01:00
Julien Duponchelle
6690ba7108 2.1.0dev1 2017-01-24 10:38:13 +01:00
Julien Duponchelle
57dbff6a8e Merge pull request #1804 from GNS3/pyup-update-pytest-3.0.5-to-3.0.6
Update pytest to 3.0.6
2017-01-24 09:57:13 +01:00
Julien Duponchelle
0149bc90f2 Fix error when changing the layer of a drawing item
Fix #1810
2017-01-23 17:30:55 +01:00
Julien Duponchelle
f7292deb0f Fix double click for open file on OSX
Fix #1808
2017-01-23 17:22:17 +01:00
Julien Duponchelle
be01448c36 Add debug to see the arguments use to start the application
Ref #1808
2017-01-23 13:58:19 +01:00
Julien Duponchelle
484617ce25 Put the selected engine in the first position of the listbox
This avoid trigerring unexpected signals

Fix #1803
2017-01-23 11:31:55 +01:00
Julien Duponchelle
8ec53a6004 Fix rare crash with dynamips
Fix #1806
2017-01-23 10:15:29 +01:00
Julien Duponchelle
cfd1bbd9d1 Fix rare crash in the progress dialog
Fix #1802
2017-01-23 10:13:43 +01:00
Julien Duponchelle
25ae214b6b Fix a rare crash in console view
Fix #1807
2017-01-23 10:11:36 +01:00
Julien Duponchelle
456160beb1 Fix rare crash
Fix #1805
2017-01-23 10:09:49 +01:00
Julien Duponchelle
9affe2d9f4 Fix crash when you drag a file inside GNS3
Fix #1798
2017-01-23 10:08:03 +01:00
pyup-bot
3ed2f89b3b Update pytest from 3.0.5 to 3.0.6 2017-01-22 23:58:47 +01:00
Julien Duponchelle
9bb353fdbd 2.0.0dev8 2017-01-19 11:23:19 +01:00
Julien Duponchelle
c414ea28e4 2.0.0b3 2017-01-19 11:20:31 +01:00
Julien Duponchelle
cb0253f7cb Fix error if you already have an image with a different name on remote server
Fix #1794
2017-01-18 17:13:00 +01:00
Julien Duponchelle
f28663c626 Ask pyup to not monitor pywin32 2017-01-18 09:32:39 +01:00
Julien Duponchelle
3ef018f90e Allow any pywin32 version 2017-01-17 10:59:25 +01:00
Julien Duponchelle
e5ae7f77fa Drop gns3 converter from requirements 2017-01-17 10:58:36 +01:00
Julien Duponchelle
b6bac0cd3b Show correct server name in tooltip
Fix #1783
2017-01-16 20:46:49 +01:00
Julien Duponchelle
6a8e435210 Menu item to open controller webpage
Fix #1784
2017-01-16 17:43:06 +01:00
grossmj
442318af49 Fixes potential exception when adding network module to an IOS router. Fixes #1774. 2017-01-16 13:53:25 +08:00
Julien Duponchelle
ad93b46c94 Merge pull request #1776 from GNS3/pyup-update-pypiwin32-219-to-220
Update pypiwin32 to 220
2017-01-13 09:13:40 +01:00
pyup-bot
f7a9cc09ea Update pypiwin32 from 219 to 220 2017-01-12 18:47:41 +01:00
Julien Duponchelle
0d5507cf3d Merge branch '2.0' of github.com:GNS3/gns3-gui into 2.0 2017-01-12 08:55:17 +01:00
Julien Duponchelle
f885e33cbd Merge branch 'master' into 2.0 2017-01-12 08:53:57 +01:00
Julien Duponchelle
4813a8681f 1.5.4dev1 2017-01-12 08:51:46 +01:00
Julien Duponchelle
829f750c76 1.5.3 2017-01-12 08:14:42 +01:00
Julien Duponchelle
08b9f4a6d2 Merge pull request #1772 from GNS3/sata-qemu
Sata disk interface support for Qemu VMs.
2017-01-11 16:53:58 +01:00
Julien Duponchelle
7fdf022b36 Do not export a file config file if empty 2017-01-10 15:56:17 +01:00
Julien Duponchelle
f12935076e Allow to set console type in qemu wizard
/bin/bash: q: command not found
2017-01-09 13:02:12 +01:00
Julien Duponchelle
7a472d1574 Fix overwrite of projects
Fix #1743
2017-01-09 12:35:36 +01:00
Julien Duponchelle
4a82dc8705 Fix creation of new appliance version when filename is different
Fix #1755
2017-01-09 12:08:09 +01:00
Julien Duponchelle
52acaadfce Fix you can't configure port 0 on ethernet switch
Fix #1765
2017-01-09 10:23:06 +01:00
Julien Duponchelle
ef1967ff00 Fix a race condition when saving as a project and closing it
Fix #1770
2017-01-09 10:17:03 +01:00
Julien Duponchelle
6584f3b2d4 Reorder multi link when you delete one
Fix #1750
2017-01-06 11:42:26 +01:00
Julien Duponchelle
8ad55290b1 Ensure we can't connect to occupy port
Fix https://github.com/GNS3/gns3-gui/issues/1759
2017-01-06 10:30:24 +01:00
Julien Duponchelle
8ff34d63c0 Fix AttributeError: 'QImageSvgRenderer' object has no attribute '_svg'
Fix #1760
2017-01-06 09:12:13 +01:00
Julien Duponchelle
da88947028 Fix Unsaved preferences in GNS3 VM warning 2017-01-05 17:40:05 +01:00
Julien Duponchelle
854dc5db71 Fix Unsaved preferences in GNS3 VM warning
Fix #1740
2017-01-05 15:50:41 +01:00
Julien Duponchelle
e8ac144011 Merge pull request #1753 from GNS3/pyup-update-pyqt5-5.7-to-5.7.1
Update pyqt5 to 5.7.1
2017-01-05 08:22:10 +01:00
grossmj
8b20f4d568 Force margins in configuration tabs. 2017-01-05 14:52:39 +08:00
grossmj
cb88a4f6d9 Sata disk interface support for Qemu VMs. 2017-01-05 11:24:49 +08:00
grossmj
270f12dc1e Remove "sata" disk interface. Does not exist in Qemu. Ref #1749 2017-01-02 15:02:19 +08:00
grossmj
46ff586055 Add SATA and none disk interfaces on Qemu VM configuration page. Fixes #1749. 2017-01-01 23:25:31 +08:00
pyup-bot
78b999be57 Update pyqt5 from 5.7 to 5.7.1 2016-12-29 12:06:02 +01:00
Julien Duponchelle
4f702d9339 Fix TypeError: argument of type 'NoneType' is not iterable
Fix #1733
2016-12-21 14:34:58 +01:00
Julien Duponchelle
6f210c0e91 2.0.0 dev7 2016-12-21 09:38:50 +01:00
Julien Duponchelle
a677cff0a2 Fix an error when you edit readme and no projet is opened
Fix #1732
2016-12-21 09:37:23 +01:00
Julien Duponchelle
5929e3b56d 2.0.0 beta 2 2016-12-20 12:01:10 +01:00
Julien Duponchelle
5b1050e427 1.5.3 dev2 2016-12-20 11:48:07 +01:00
Julien Duponchelle
271e987972 Upgrade Qt 5.7 2016-12-20 11:40:32 +01:00
grossmj
80402185a5 AUX console button text change in MainWindow. 2016-12-20 18:31:46 +08:00
Julien Duponchelle
1df34148b2 1.5.3 rc1 2016-12-20 09:32:38 +01:00
Julien Duponchelle
dc2070b24e Remove debug 2016-12-20 08:56:08 +01:00
grossmj
7dcbb14b75 Remove forgotten code comments. Ref #1713. 2016-12-20 12:27:41 +11:00
Julien Duponchelle
36c90e0d96 Fix GNS3 Client not connecting to remote controller
Fix #1726
2016-12-19 18:58:05 +01:00
Julien Duponchelle
53b0bef527 Delete from project list deleted projects
Fix #1724
2016-12-19 18:52:31 +01:00
Julien Duponchelle
8227cf1aba Keep a shared list of projects internally
Ref #1724
2016-12-19 18:29:48 +01:00
Julien Duponchelle
7e09d9042b Fix recent files in new project dialog 2016-12-19 17:45:16 +01:00
Julien Duponchelle
49688d6c0e Move recent projects to the file menu
Fix #1713
2016-12-19 17:40:20 +01:00
Julien Duponchelle
962ce3e3d8 Fix Tail process for wireshark trace not killed when we change project
Fix #1725
2016-12-19 14:57:55 +01:00
grossmj
8cbae911e9 Move project menu items. Ref #1713. 2016-12-19 23:23:26 +11:00
Julien Duponchelle
10c94baab7 Fix AttributeError: 'NoneType' object has no attribute 'project_updated_signal'
Fix #1728
2016-12-19 09:11:39 +01:00
Julien Duponchelle
2f2c0ba3ba Display recent files for local controller, recent project for remote controller
Ref #1713
2016-12-16 11:43:01 +01:00
Julien Duponchelle
879647de5e Do not display the remote server if the server is use as a GNS3 VM
Fix #1718
2016-12-15 18:07:00 +01:00
Julien Duponchelle
cd2c9d6b0c If the notification stream is stopped by something we auto reconnect 2016-12-14 19:58:09 +01:00
Julien Duponchelle
95c443e127 Ignore system proxy to avoid trouble with "Security Suites"
Fix #1721
2016-12-13 18:04:19 +01:00
Julien Duponchelle
d403b26b44 Avoid close and delete a project at the same time
Ref #1714
2016-12-12 22:08:49 +01:00
Julien Duponchelle
0f4d4e2071 Alpha sort of servers summaries 2016-12-12 21:29:16 +01:00
Julien Duponchelle
b51e772664 Fix new remote server doesn't show up in compute summary
Fix #1703
2016-12-12 21:25:33 +01:00
Julien Duponchelle
83c7be0f60 Fix interface number for Switch & Hub templates
Fix #1711, #1712
2016-12-12 16:30:33 +01:00
Julien Duponchelle
0063f7d97f Fix sync of node alignements with the server
Fix #1710
2016-12-12 12:50:02 +01:00
Julien Duponchelle
0a65eeeee2 Fix rare condition when you close a project and add a node
Fix #1716
2016-12-12 09:57:49 +01:00
Julien Duponchelle
a7e69e7260 Fix 'LocalServer' object has no attribute '_server_started_by_me'
Fix #1715
2016-12-12 09:13:05 +01:00
Julien Duponchelle
cea15dab4c Options -q for quiet startup
Fix #1708
2016-12-12 09:11:13 +01:00
Julien Duponchelle
7646b59078 Fix an error when apply permission on OSX 2016-12-08 18:52:48 +01:00
Julien Duponchelle
a3c996a3d8 Fix test suites 2016-12-08 17:49:06 +01:00
Julien Duponchelle
e6017ea102 Support Qemu cpus in GNS3A
Fix https://github.com/GNS3/gns3-server/issues/811
2016-12-08 17:34:48 +01:00
Julien Duponchelle
e7db81c277 Support for BIOS images
Fix https://github.com/GNS3/gns3-gui/issues/1700
2016-12-08 16:21:30 +01:00
Julien Duponchelle
a182f5e4b6 Fix IdlePC can't be found during setup wizard
Fix #1693
2016-12-08 12:41:16 +01:00
Julien Duponchelle
da73357763 2.0.0 dev 6 2016-12-08 10:31:34 +01:00
Julien Duponchelle
09e37725f7 2.0.0b1 2016-12-07 19:46:33 +01:00
Julien Duponchelle
5ab9f95379 Use osascript on OSX for asking admin permission
Fix #1699
2016-12-07 16:45:01 +01:00
Julien Duponchelle
6731909971 Change the method for creating the tmpdir for symbols cache
Fix #1701
2016-12-07 16:09:05 +01:00
Julien Duponchelle
284948e377 Fix a connection error at the end of the setup wizard
Fix #1698
2016-12-07 15:59:54 +01:00
Julien Duponchelle
1e55c974eb Merge pull request #1702 from GNS3/CapnCheapo-remove_use_local
Remove use local
2016-12-07 15:33:03 +01:00
grossmj
b186dee326 Change some more preferences tab names. 2016-12-07 22:04:28 +11:00
grossmj
3ae0abc19e Change how some tabs are organized or named. 2016-12-07 21:42:09 +11:00
Julien Duponchelle
dde660ae15 General settings => local settings 2016-12-06 19:40:33 +01:00
Julien Duponchelle
d9fbd04552 Drop more reference to use local server 2016-12-06 19:36:24 +01:00
pyup.io bot
a20c15cbac Update pytest from 3.0.4 to 3.0.5 (#1697) 2016-12-05 17:29:42 +01:00
Stephen Moore
5a54b9f5ca Remove local server checkbox from preferences 2016-12-04 22:14:19 -06:00
Julien Duponchelle
3528d85501 Make sure to not start local server during setup wizard remote server
Fix #1674
2016-12-01 18:18:59 +01:00
Julien Duponchelle
b773599c56 Merge branch 'master' into 2.0 2016-12-01 13:43:22 +01:00
Julien Duponchelle
73346c8de7 Fix Error when editing IOS image created using .gns3a file
Fix #1684
2016-12-01 13:42:42 +01:00
Julien Duponchelle
d33b21fdc1 Fix Error when editing IOS image created using .gns3a file
Fix #1684
2016-12-01 13:41:33 +01:00
Julien Duponchelle
8139010796 Fix test suites around sip deleted 2016-12-01 13:30:00 +01:00
Julien Duponchelle
f0bc1a4abb Do not auto start the local server in setup wizard
Until you quit setup wizard or choose local server the server
don't start.

Fix #1687
2016-12-01 12:33:00 +01:00
Julien Duponchelle
9d0d5da3fc On OSX execute all sudo in a single operation
Fix #1687
2016-12-01 12:10:46 +01:00
Julien Duponchelle
26d188f228 Catch key Compute is missing during conversion error
Fix #1690
2016-12-01 11:12:21 +01:00
Julien Duponchelle
c7af6c2ae2 Fix rare crash in gns3.dialogs.appliance_wizard in validateCurrentPage
Fix #1691
2016-12-01 10:52:28 +01:00
Julien Duponchelle
8707113db8 Fix AttributeError: 'Nat' object has no attribute 'configPage'
Fix #1685
2016-12-01 10:10:19 +01:00
Julien Duponchelle
e88b4814e7 Catch one more RuntimeError: wrapped C/C++
Fix #1692
2016-12-01 09:56:19 +01:00
Julien Duponchelle
97926fe6d5 Fix a rare crash in port
Fix #1688
2016-12-01 09:46:14 +01:00
Julien Duponchelle
4fb9d46953 Fix a rare crash when set symbol
Fix #1689
2016-12-01 09:44:57 +01:00
Julien Duponchelle
c066f7f3df Fix a potential crash 2016-11-29 08:51:33 +01:00
Julien Duponchelle
5117ef8a58 Fix a potential crash at exit 2016-11-28 20:00:03 +01:00
Julien Duponchelle
35ebb39e22 Fix crashes 2016-11-28 14:41:54 +01:00
Julien Duponchelle
66f8c19478 Remove unused settings from general preferences
Fix #1681
2016-11-28 14:17:01 +01:00
Julien Duponchelle
e07ea40b24 Catch error when you try to import a IOU bin as a licence
Fix #1679
2016-11-28 11:08:34 +01:00
Julien Duponchelle
149bc38b2b Fix rare crash when exiting
Fix #1676
2016-11-28 11:06:45 +01:00
Julien Duponchelle
23ca81ccc4 Fix crash when freeing some ressources
Fix #1678, #1677
2016-11-28 11:05:01 +01:00
Julien Duponchelle
b4ab559b00 Fix timeout when exporting large project
Fix https://github.com/GNS3/gns3-server/issues/797
2016-11-25 17:32:09 +01:00
Julien Duponchelle
ad88735e63 Avoid a rare crash when we free a port
Fix #1672
2016-11-25 17:20:16 +01:00
Julien Duponchelle
66ec4f9de5 Fix you can't download symbols after you got an error
Fix #1673
2016-11-25 17:15:41 +01:00
Julien Duponchelle
35d6b424e6 2.0.0dev5 2016-11-24 12:52:54 +01:00
Julien Duponchelle
eb6b099fa1 2.0.0a4 2016-11-24 12:09:33 +01:00
grossmj
b8c1a7a4c9 Some cosmetic for the setup wizard. 2016-11-23 23:06:36 +11:00
Julien Duponchelle
bc07bdaf74 Fix project open (merge error) 2016-11-22 18:41:20 +01:00
Jeremy Grossmann
3109befe73 Merge pull request #1491 from GNS3/dissallow_unknow
Dissallow unknown extensions
2016-11-22 19:02:27 +10:30
Julien Duponchelle
044683de21 Mark preferences changes when you change a QPlainTextEdit 2016-11-21 18:16:02 +01:00
Julien Duponchelle
e607663575 Force the VPCS config initial file
Ref #1655
2016-11-21 17:11:22 +01:00
Julien Duponchelle
abcff7192b Replace the IOU licence path by an input text
Ref #1662
2016-11-21 15:29:53 +01:00
Julien Duponchelle
bc43c43c53 Fix 403 when loading a remote project
Fix #782
2016-11-18 17:59:30 +01:00
Julien Duponchelle
dbc7c4675f Fix some possible PID issues
Fix #1658
2016-11-18 16:45:55 +01:00
Julien Duponchelle
3f0e23f34d Hide the connection refused dialog when we success to reconnect
Fix #1665
2016-11-18 12:36:59 +01:00
Julien Duponchelle
ef7bd7c77c Avoid a rare crash when changing topology 2016-11-18 09:43:43 +01:00
Julien Duponchelle
77950c8a2c When loading another project disconnect from current project
Ref #1646
2016-11-17 12:09:21 +01:00
Julien Duponchelle
a801b5b21f Do not crash if we can't list remote list of GNS3 VM engines 2016-11-16 12:02:18 +01:00
Julien Duponchelle
d637a6dcac Init the VPCS base config
Fix #1655
2016-11-16 10:33:36 +01:00
Julien Duponchelle
8370a22966 Fix invalid ressource path on OSX 2016-11-15 11:41:06 +01:00
Julien Duponchelle
7ea8c8b8f1 Disable the usage of the wheel for Qt 5.7 2016-11-15 11:37:57 +01:00
Julien Duponchelle
11ab87245b Crash fix 2016-11-15 11:33:06 +01:00
Julien Duponchelle
cf63b49b82 Fix segfault when deleting a node
Ref #1654
2016-11-14 19:05:01 +01:00
Julien Duponchelle
030384c990 Do not download multiple time the same symbol
Fix #1661
2016-11-14 16:04:19 +01:00
Julien Duponchelle
49c734b52c Kill tail process when capture stop
Fix #772
2016-11-14 10:41:09 +01:00
pyup.io bot
2a7b6144d6 Update pytest from 3.0.3 to 3.0.4 (#1657) 2016-11-14 09:45:47 +01:00
Julien Duponchelle
f1ecc0cc15 Fix Topology summary contain non existing links
Fix #1640
2016-11-11 11:18:29 +01:00
Julien Duponchelle
adb7663d03 Fix a rare crash when deleting a link
Fix #1653
2016-11-11 09:59:54 +01:00
pyup.io bot
118b0a85d2 Update pytest-timeout from 1.0.0 to 1.2.0 (#1652) 2016-11-10 22:54:29 +01:00
Julien Duponchelle
5fcf1e156d Fix export of debug informations when not connected to the controller
Fix #1650
2016-11-10 13:29:30 +01:00
Julien Duponchelle
5272befb60 Fix AttributeError: 'DockerVM' object has no attribute 'server'
Fix #1647
2016-11-06 21:49:17 +01:00
Julien Duponchelle
b10a524496 Fix error message if you double click on builtin switch
Fix #1642
2016-11-04 13:34:43 +01:00
Julien Duponchelle
de7417787b Fix a rare crash in packet capture
Fix #1643
2016-11-04 13:28:16 +01:00
Julien Duponchelle
a00b80529b Restrict ubridge to admin users on OSX 2016-11-04 09:50:14 +01:00
Julien Duponchelle
b1fa44d176 Natural sort of Nodes in topology summary
Fix #1634
2016-11-03 19:53:36 +01:00
Julien Duponchelle
8251b460ad Drop serial console type
Fix https://github.com/GNS3/gns3-server/issues/748
2016-11-03 18:56:39 +01:00
Julien Duponchelle
4403044584 Fix syntax error 2016-11-03 18:45:42 +01:00
Julien Duponchelle
39c7a56041 Display an error if you try to open a 0.8.x file
Fix #1639
2016-11-03 15:15:03 +01:00
Julien Duponchelle
383dbb5fca Fix tab order when editing a compute 2016-11-02 13:35:04 +01:00
Julien Duponchelle
fc94e784cc Fix a crash in ethernet switch settings
Fix #1635
2016-11-02 11:58:24 +01:00
Julien Duponchelle
37937b0096 2.0.0dev4 2016-10-28 19:38:32 +02:00
Julien Duponchelle
3e9d303ec4 Update changelog 2016-10-28 19:25:26 +02:00
Julien Duponchelle
68908e17d3 2.0.0 alpha 3 2016-10-28 19:23:51 +02:00
Julien Duponchelle
026f482b1b Merge branch 'master' into 2.0 2016-10-28 10:29:28 +02:00
Julien Duponchelle
879784cd67 Fix error when opening a project from the cli with a gns3 installed via setup.py
Fix #1581
2016-10-28 10:27:07 +02:00
Julien Duponchelle
8b8cbb4d74 Fix a rare crash in snapshot dialog
Fix #1627
2016-10-28 09:54:20 +02:00
Julien Duponchelle
40783eba15 Fix crash when importing project on a remote server
Fix #1628
2016-10-28 09:52:52 +02:00
Julien Duponchelle
e63d20ce48 Fix crash in appliance wizard
Fix #1624
2016-10-27 21:01:11 +02:00
Julien Duponchelle
f6ecc4d0bb Fix crash when local server is not available 2016-10-27 20:14:36 +02:00
Julien Duponchelle
64339e6846 Disallow to overwrite a running project
Fix https://github.com/GNS3/gns3-server/issues/745
2016-10-27 16:02:08 +02:00
Julien Duponchelle
2fe73056f0 Fix a rare crash when deleting a link
Fix #1623
2016-10-27 15:29:03 +02:00
Julien Duponchelle
95051035a9 Merge branch 'master' into 2.0 2016-10-27 12:30:27 +02:00
Julien Duponchelle
af6294fe7e Fix appliance with wrong file name after import 2016-10-27 12:29:32 +02:00
Julien Duponchelle
2fd53be083 Fix a crash at startup on Mac when coming from old GNS3 version
Fix #1622
2016-10-26 17:51:07 +02:00
Julien Duponchelle
93199e3695 Fix a crash 2016-10-26 17:04:54 +02:00
Julien Duponchelle
d0a3051656 Fix key error in settings if a compute no longer exists
Fix #1612
2016-10-26 16:16:55 +02:00
Julien Duponchelle
516e84d328 All check for vmware linked base are already made server side
Fix #1609
2016-10-26 15:50:13 +02:00
Julien Duponchelle
a06e4cb7ba Fix Save as is not switching to the saved project
Fix #1620
2016-10-26 15:37:13 +02:00
Julien Duponchelle
a1dd5fee9f Auto reopen a project if connection is lost
Fix #1619
2016-10-26 15:28:25 +02:00
Julien Duponchelle
7e00ac4e50 Empty the list of computes nodes when connection is lost
Ref #1619
2016-10-26 15:01:17 +02:00
Julien Duponchelle
59201e8af6 Try to fix duplicate nodes after snapshot restore on some user computer
Fix #1571
2016-10-26 11:28:35 +02:00
Julien Duponchelle
fbde9e0746 Allow only IPV4 in setup wizard
Fix #1608
2016-10-26 10:55:51 +02:00
Julien Duponchelle
f714add057 Catch error if user tmp directory is read only
Fix #1614
2016-10-26 10:25:59 +02:00
Julien Duponchelle
ce2724a892 Raise a proper error if packet capture program is invalid
Fix #1597
2016-10-26 10:23:20 +02:00
Julien Duponchelle
aff475cd5b Fix AttributeError: 'NoneType' object has no attribute 'upper'
Fix #1615
2016-10-26 10:20:55 +02:00
Julien Duponchelle
b18d7c7cc5 Fix rare crash when killing wireshark
Fix #1616
2016-10-26 10:19:00 +02:00
Julien Duponchelle
687088cbd7 Export debug informations also from the controller
Ref #1562, https://github.com/GNS3/gns3-server/issues/740
2016-10-25 11:41:49 +02:00
Julien Duponchelle
31fc18b150 Fix a crash in vm wizard
Fix #1610
2016-10-25 10:41:09 +02:00
Julien Duponchelle
dd960d5556 Fix an invalid test 2016-10-25 10:39:25 +02:00
Julien Duponchelle
004d9f90e3 Fix error when uploading an images from preferences
Fix #1594
2016-10-25 10:27:56 +02:00
Julien Duponchelle
f8f7ee686e Fix snap to grid when initialy drop a node in the topology 2016-10-24 21:58:47 +02:00
Bernhard Ehlers
c695e565ea Optimize snap-to-grid code
Signed-off-by: Julien Duponchelle <julien@gns3.net>

Fix #1599
2016-10-24 21:45:01 +02:00
Julien Duponchelle
d32c3ebebe Fix a crash with linked clone 2016-10-24 19:20:41 +02:00
Julien Duponchelle
b863bae4e7 Move prevent using twice the same VM when linked clone is not enable
Ref #1593
2016-10-24 18:14:01 +02:00
Julien Duponchelle
8f033e8bd3 Fix If you show interface label and delete the link ghost interface label will appear
Fix #1607
2016-10-24 17:40:51 +02:00
Julien Duponchelle
c8776486c5 Display short interface label instead of long version
Fix #1606
2016-10-24 17:30:34 +02:00
Julien Duponchelle
679e9ad4bf Fix error AttributeError: 'NoneType' object has no attribute 'capabilities'
Fix #1595
2016-10-24 17:15:17 +02:00
Julien Duponchelle
877b255f23 Fix PermissionError when killing local server
Fix #1601
2016-10-24 17:03:18 +02:00
Julien Duponchelle
e404716f88 Handle empty color
Fix #1602
2016-10-24 17:01:35 +02:00
Julien Duponchelle
4e58df60ea Fix rare crash in save as
Fix #1592
2016-10-24 16:58:56 +02:00
Julien Duponchelle
e7f761c8d6 Fix crash in restore default server settings
Fix #1603
2016-10-24 16:51:52 +02:00
Julien Duponchelle
50ca85b7ce Fix an error during import of some 0.8x projects
Fix #1578
2016-10-21 10:55:26 +02:00
Julien Duponchelle
9659c29dd0 2.0.0dev3 2016-10-20 22:12:39 +02:00
Julien Duponchelle
535f3193db 2.0.0a2 2016-10-20 21:33:01 +02:00
Julien Duponchelle
7fae1eac48 Support pure remote server for importing appliance
Fix #1590
2016-10-20 21:24:38 +02:00
Julien Duponchelle
4cc2975e97 Dissallow bindingi GNS3 server to an IPV6 (not supported by some emulators)
Ref https://github.com/GNS3/gns3-server/issues/725
2016-10-20 09:51:17 +02:00
Julien Duponchelle
149d1ad590 Drop vmware host type choice in client
Fix https://github.com/GNS3/gns3-gui/issues/1579
2016-10-19 12:05:21 +02:00
Julien Duponchelle
abc900a764 Merge branch 'master' into 2.0 2016-10-19 10:51:12 +02:00
Julien Duponchelle
14084192da Ask for restart after installing vmrun
Fix https://github.com/GNS3/gns3-server/issues/724
2016-10-19 10:50:07 +02:00
Julien Duponchelle
2f6603070b Ask user to restart GNS3 after VMware installation
Ref https://github.com/GNS3/gns3-server/issues/724
2016-10-19 10:29:11 +02:00
Julien Duponchelle
c3aac9f0a6 Improve duplicate prevention in topology summary
Fix #1571
2016-10-19 09:01:23 +02:00
Julien Duponchelle
afde80dab5 Add a duplicate button in the project library dialog
Fix #1585
2016-10-18 16:55:49 +02:00
pyup.io bot
b7f68afbf1 Update dependencies from pyup
* Pin pep8 to latest version 1.7.0
* Pin pypiwin32 to latest version 219
* Pin pytest to latest version 3.0.3
* Pin pytest-capturelog to latest version 0.7
* Pin pytest-pythonpath to latest version 0.7.1

* Pin pytest-timeout to latest version 1.0.0
2016-10-18 15:21:44 +02:00
Julien Duponchelle
08634f330c Fix error introduce in previous commits 2016-10-18 12:04:55 +02:00
Julien Duponchelle
83e35e6aa0 Fix duplicates in recent project list
Fix #1584
2016-10-18 11:28:40 +02:00
Julien Duponchelle
dc3bfef038 Fix a project override error 2016-10-18 11:26:18 +02:00
Julien Duponchelle
c13bb77b08 Fix Duplicated node in node summary when restoring a snapshot
Fix #1571
2016-10-18 10:12:36 +02:00
Julien Duponchelle
fab621bb40 Try pyup.io 2016-10-18 09:41:27 +02:00
Julien Duponchelle
bb760cd861 Fix a crash in the VMware / VirtualBox wizard 2016-10-17 18:44:00 +02:00
Julien Duponchelle
59e7b3fd93 If console host is 0.0.0.0 use controller address 2016-10-17 18:30:44 +02:00
Julien Duponchelle
315870aa09 Fix save issue when importing an appliance
Fix #1564
2016-10-17 14:26:01 +02:00
Julien Duponchelle
5ed17acd6b Strip HTML in console view logs and log files
Fix #1576
2016-10-17 10:01:55 +02:00
Julien Duponchelle
d0dde822dd Fix TypeError: _expandAllSlot() takes 1 positional argument but 2 were given
Fix #1577
2016-10-14 23:02:22 +02:00
Julien Duponchelle
e3023532ed Fix Cannot open created project by using Recents projects
Fix #1544
2016-10-14 22:57:19 +02:00
grossmj
2a4c229c9d Update edit project Ui. 2016-10-08 14:51:00 -06:00
Julien Duponchelle
7b77627db7 Update crash report key 2016-10-07 10:31:36 +02:00
Julien Duponchelle
fd5f32bcc4 Fix a crash when exporting debug without project open 2016-10-05 16:29:30 +02:00
Julien Duponchelle
7e7eecfa3e Fix a crash 2016-10-05 16:28:33 +02:00
Julien Duponchelle
8325339b58 Fix a crash in rare condition when logging informations to the console 2016-10-05 11:35:47 +02:00
Julien Duponchelle
b39185ceb3 Fix a crash in compute summary view 2016-10-05 11:01:55 +02:00
Julien Duponchelle
d93100f3c3 Add a text about how to change the topology size in 2.0 in general preferences
Fix #1561
2016-10-05 10:36:11 +02:00
Julien Duponchelle
1691558989 Merge branch 'master' into 2.0 2016-10-05 09:36:11 +02:00
Julien Duponchelle
17cabba48f Improve warning when connection issue to GNS3 VM 2016-10-05 09:32:31 +02:00
Julien Duponchelle
c9a2cc05ea Fix crash in setup wizard 2016-10-04 21:11:18 +02:00
Julien Duponchelle
f9ac5302ca Fix the wizard for creating appliance template doesn't support remote main server
Fix #1550
2016-10-04 20:44:32 +02:00
Julien Duponchelle
7c8c8dfc20 Appliance wizard support remote controller
Ref #1550
2016-10-04 19:22:47 +02:00
Julien Duponchelle
6622bc7560 Fix Browse button is not working in the local server page in the setup wizard
Fix #1559
2016-10-04 17:14:21 +02:00
Julien Duponchelle
3df7bd99eb Fix test 2016-10-04 17:11:40 +02:00
Julien Duponchelle
da1636af60 Check if local server is running in the setup wizard
Fix #1560
2016-10-04 16:45:36 +02:00
Julien Duponchelle
2378d7ff78 Hide setup wizard after first successful run 2016-10-04 16:00:59 +02:00
Julien Duponchelle
c2f357cc0e Import appliance and New project are display at the same time
Fix #1558
2016-10-04 15:58:33 +02:00
Julien Duponchelle
f2bd85d803 Support remote controller in the setup wizard
Fix #1549
2016-10-04 15:44:56 +02:00
Julien Duponchelle
ec3a856c59 Fix When importing a gns3a the correct qemu binary is not selected
Fix #1556
2016-10-03 22:56:13 +02:00
Julien Duponchelle
1a55487e7b Increase creation timeout for docker container 2016-10-03 22:30:54 +02:00
Julien Duponchelle
0f0ac33345 Make WaitForLambdaWorker more crash proof 2016-10-03 18:41:36 +02:00
Julien Duponchelle
d0b4e5045b Fix a crash when importing appliance
Fix #705
2016-10-03 18:30:36 +02:00
Julien Duponchelle
393cff0343 Fix error in import appliances 2016-10-03 17:24:15 +02:00
Julien Duponchelle
8e56b59bb8 Try to fix the a segfault when importing appliance
Fix https://github.com/GNS3/gns3-server/issues/705
2016-10-03 15:38:56 +02:00
Julien Duponchelle
a939dfe37f Fix crash in upload images 2016-10-03 12:34:51 +02:00
Julien Duponchelle
9b7e06bd54 Trust the server for link creation error (avoid sync issue)
Fix #1553
2016-10-03 12:31:53 +02:00
Julien Duponchelle
cc2f7920b8 Try to fix crash when import appliances
Fix #705
2016-10-03 10:44:37 +02:00
Julien Duponchelle
66a69dd22d Fix an Error in server preference page
Fix #1551
2016-10-03 10:36:58 +02:00
Julien Duponchelle
d3f7eaee1c Fix compatibility with remote server of 1.X
Fix https://github.com/GNS3/gns3-server/issues/696
2016-09-30 16:04:00 +02:00
Julien Duponchelle
3200f4cd28 New appliance dialog should not be display if you cancel the setup wizard
Fix #1545
2016-09-30 10:56:01 +02:00
Julien Duponchelle
fc04b30b7e 2.0.0dev2 2016-09-29 20:41:50 +02:00
Julien Duponchelle
b81a02fbb4 Update crash report key 2016-09-22 10:47:02 +02:00
Julien Duponchelle
c36695c59a Dissallow unknown extensions
Fix #1490
2016-09-15 17:12:09 +02:00
749 changed files with 148143 additions and 153333 deletions

View File

@@ -0,0 +1,34 @@
---
name: GNS3 bug report
about: Create a report to help us fix a bug
title: 'Short description of the bug'
labels: Bug
assignees: ''
---
**Before you start**
Please open an issue only if you suspect there is a bug or any problem with GNS3. Go to https://gns3.com/community for any other questions or for requesting help with GNS3.
You may also post this issue directly on the GNS3 server repository if you know the bug comes from the server: https://github.com/GNS3/gns3-server/issues/new
**Describe the bug**
Please provide a clear and detailed description of what the bug is.
**GNS3 version and operating system (please complete the following information):**
- OS: [e.g. Windows, Linux or macOS]
- GNS3 version [e.g. 2.1.14]
- Any use of the GNS3 VM or remote server (ESXi, bare metal etc.)
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Screenshots or videos**
If applicable, add screenshots (e.g. of the topology and/or error message) or links to videos to help explain the problem. This will help us a lot to quickly find the bug and fix it.
**Additional context**
Add any other context about the problem here.

View File

@@ -0,0 +1,10 @@
---
name: GNS3 development
about: Any question or discussion regarding GNS3 development
title: ''
labels: ''
assignees: ''
---

View File

@@ -0,0 +1,25 @@
---
name: GNS3 feature request
about: Suggest an idea for GNS3
title: 'Short description of the feature request'
labels: Enhancement
assignees: ''
---
**Before you start**
Please check if a similar feature request has already been submitted.
You may also post this issue directly on the GNS3 server repository if you know the feature request only applies to the server: https://github.com/GNS3/gns3-server/issues/new
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen. If applicable, please provide screenshots
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -0,0 +1,16 @@
name: Add new issues to GNS3 project
on:
issues:
types:
- opened
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v1.0.1
with:
project-url: https://github.com/orgs/GNS3/projects/3
github-token: ${{ secrets.ADD_NEW_ISSUES_TO_PROJECT }}

93
.github/workflows/codeql.yml vendored Normal file
View File

@@ -0,0 +1,93 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '17 22 * * 6'
jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write
# required to fetch internal or private CodeQL packs
packages: read
# only required for workflows in private repositories
actions: read
contents: read
strategy:
fail-fast: false
matrix:
include:
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"

19
.github/workflows/testing.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: testing
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Build and run Docker image
run: |
docker build -t gns3-gui-test .
docker run gns3-gui-test

4
.gitignore vendored
View File

@@ -60,3 +60,7 @@ keys
updates
.cache
__pycache__
# Virtualenv
env
venv

View File

@@ -1,19 +0,0 @@
sudo: required
services:
- docker
notifications:
email: false
#email:
# - julien@gns3.net
#irc:
# channels:
# - "chat.freenode.net#gns3"
# on_success: change
# on_failure: always
script:
- docker build -t gns3-gui-test .
- docker run gns3-gui-test

14
.whitesource Normal file
View File

@@ -0,0 +1,14 @@
{
"scanSettings": {
"configMode": "AUTO",
"configExternalURL": "",
"projectToken" : "",
"baseBranches": ["master", "2.2", "3.0"]
},
"checkRunSettings": {
"vulnerableCheckRunConclusionLevel": "failure"
},
"issueSettings": {
"minSeverityLevel": "LOW"
}
}

1431
CHANGELOG

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +1,16 @@
# Run tests inside a container
FROM ubuntu:vivid
FROM ubuntu:latest
MAINTAINER GNS3 Team
#ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -y --force-yes python3.4 python3-pyqt5 python3-pip python3-pyqt5.qtsvg python3.4-dev xvfb
RUN apt-get install -y --force-yes python3 python3-pyqt6 python3-pip python3-pyqt6.qtsvg python3-pyqt6.qtwebsockets python3-dev xvfb
RUN apt-get clean
ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt
RUN pip3 install -r /dev-requirements.txt
RUN python3 -m pip install --break-system-packages --no-cache-dir -r /dev-requirements.txt
ADD . /src
WORKDIR /src
CMD xvfb-run python3.4 -m pytest -vv
CMD xvfb-run python3 -m pytest -vv

View File

@@ -1,10 +1,8 @@
include README.rst
include README.md
include AUTHORS
include INSTALL
include LICENSE
include MANIFEST.in
include requirements.txt
include tox.ini
recursive-include tests *
recursive-include gns3 *
recursive-include resources *

62
README.md Normal file
View File

@@ -0,0 +1,62 @@
GNS3-gui
========
[![image](https://github.com/GNS3/gns3-gui/workflows/testing/badge.svg)](https://github.com/GNS3/gns3-gui/actions?query=workflow%3Atesting)
[![image](https://img.shields.io/pypi/v/gns3-gui.svg)](https://pypi.python.org/pypi/gns3-gui)
[![image](https://snyk.io/test/github/GNS3/gns3-gui/badge.svg)](https://snyk.io/test/github/GNS3/gns3-gui)
GNS3 GUI repository.
Installation
------------
Please see <https://docs.gns3.com/>
Software dependencies
---------------------
PyQt6 which is either part of the Linux distribution or installable from
PyPi. The other Python dependencies are automatically installed during
the GNS3 GUI installation and are listed
[here](https://github.com/GNS3/gns3-gui/blob/master/requirements.txt)
For connecting to nodes using Telnet, a Telnet client is required. On
Linux that's a terminal emulator like xterm, gnome-terminal, konsole
plus the telnet program. For connecting to nodes with a GUI, a VNC
client is required, optionally a SPICE client can be used for Qemu
nodes.
For using packet captures within GNS3, Wireshark should be installed.
It's recommended, but if you don't need that functionality you can go
without it.
Development
-----------
If you want to update the interface, modify the .ui files using QT
tools. And:
``` {.bash}
cd scripts
python build_pyqt.py
```
### Debug
If you want to see the full logs in the internal shell you can type:
``` {.bash}
debug 2
```
Or start the app with --debug flag.
Due to the fact PyQT intercept you can use a web debugger for inspecting
stuff: <https://github.com/Kozea/wdb>
Security issues
---------------
Please contact us at <security@gns3.net>

View File

@@ -1,42 +0,0 @@
GNS3-gui
========
.. image:: https://travis-ci.org/GNS3/gns3-gui.svg?branch=master
:target: https://travis-ci.org/GNS3/gns3-gui
.. image:: https://img.shields.io/pypi/v/gns3-gui.svg
:target: https://pypi.python.org/pypi/gns3-gui
GNS3 GUI repository.
Installation
------------
https://gns3.com/support/docs
Development
-------------
If you want to update the interface, modify the .ui files using QT tools. And:
.. code:: bash
cd scripts
python build_pyqt.py
Debug
"""""
If you want to see the full logs in the internal shell you can type:
.. code:: bash
debug 2
Or start the app with --debug flag.
Due to the fact PyQT intercept you can use a web debugger for inspecting stuff:
https://github.com/Kozea/wdb

5
SECURITY.md Normal file
View File

@@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
Please use GitHub's report a vulnerability feature. More information can be found in https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability

View File

@@ -1,7 +1,5 @@
-rrequirements.txt
pep8
pytest
pytest-pythonpath # useful for running tests outside tox
pytest-timeout
pytest-capturelog
pytest==8.4.2; python_version == '3.9' # version 8.4.2 is the last one supporting Python 3.9
pytest==9.0.2; python_version >= '3.10'
pytest-timeout==2.4.0

93
gns3/appliance_manager.py Normal file
View File

@@ -0,0 +1,93 @@
#!/usr/bin/env python
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .qt import QtCore
from .controller import Controller
from .local_config import LocalConfig
from .settings import GENERAL_SETTINGS
import logging
log = logging.getLogger(__name__)
class ApplianceManager(QtCore.QObject):
"""
Manager for appliances.
"""
appliances_changed_signal = QtCore.Signal()
def __init__(self):
super().__init__()
self._appliances = []
self._controller = Controller.instance()
self._controller.connected_signal.connect(self.refresh)
self._controller.disconnected_signal.connect(self._controllerDisconnectedSlot)
def refresh(self, update=False):
"""
Gets the appliances from the controller.
"""
if self._controller.connected():
settings = LocalConfig.instance().loadSectionSettings("MainWindow", GENERAL_SETTINGS)
symbol_theme = settings["symbol_theme"]
if update is True:
self._controller.get("/appliances?update=yes&symbol_theme={}".format(symbol_theme), self._listAppliancesCallback, progressText="Downloading appliances from online registry...")
else:
self._controller.get("/appliances?symbol_theme={}".format(symbol_theme), self._listAppliancesCallback)
def _controllerDisconnectedSlot(self):
"""
Called when the controller has been disconnected.
"""
self._appliances = []
self.appliances_changed_signal.emit()
def appliances(self):
"""
Returns the appliances.
:returns: array of appliances
"""
return self._appliances
def _listAppliancesCallback(self, result, error=False, **kwargs):
"""
Callback to get the appliances.
"""
if error is True:
log.error("Error while getting appliances list: {}".format(result.get("message", "unknown")))
return
self._appliances = result
self.appliances_changed_signal.emit()
@staticmethod
def instance():
"""
Singleton to return only on instance of ApplianceManager.
:returns: instance of ApplianceManager
"""
if not hasattr(ApplianceManager, '_instance') or ApplianceManager._instance is None:
ApplianceManager._instance = ApplianceManager()
return ApplianceManager._instance

View File

@@ -27,19 +27,16 @@ log = logging.getLogger(__name__)
class Application(QtWidgets.QApplication):
file_open_signal = QtCore.pyqtSignal(str)
file_open_signal = QtCore.Signal(str)
def __init__(self, argv):
self.setStyle(QtWidgets.QStyleFactory.create("Fusion"))
# both Qt and PyQt must be version >= 5.6 in order to enable high DPI scaling
if parse_version(QtCore.QT_VERSION_STR) >= parse_version("5.6") and parse_version(QtCore.PYQT_VERSION_STR) >= parse_version("5.6"):
# only available starting Qt version 5.6
self.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
self.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
super().__init__(argv)
# this is tell Wayland what is the name of the desktop file (gns3.desktop)
self.setDesktopFileName("gns3")
# this info is necessary for QSettings
self.setOrganizationName("GNS3")
self.setOrganizationDomain("gns3.net")
@@ -51,7 +48,7 @@ class Application(QtWidgets.QApplication):
self.open_file_at_startup = None
def event(self, event):
# When you double click file you receive an event
# When you double click on a file, you receive an event
# and not the file as command line parameter
if sys.platform.startswith("darwin"):
if isinstance(event, QtGui.QFileOpenEvent):

View File

@@ -22,13 +22,11 @@ Base class for node classes.
from .qt import QtCore
from .ports.port import Port
import logging
log = logging.getLogger(__name__)
class BaseNode(QtCore.QObject):
"""
BaseNode implementation.
@@ -46,11 +44,9 @@ class BaseNode(QtCore.QObject):
loaded_signal = QtCore.Signal()
deleted_signal = QtCore.Signal()
error_signal = QtCore.Signal(int, str)
warning_signal = QtCore.Signal(int, str)
server_error_signal = QtCore.Signal(int, str)
_instance_count = 1
_allocated_names = set()
# node statuses
stopped = 0
@@ -58,14 +54,15 @@ class BaseNode(QtCore.QObject):
suspended = 2
# node categories
routers = 0
switches = 1
end_devices = 2
security_devices = 3
routers = "router"
switches = "switch"
end_devices = "guest"
security_devices = "firewall"
def __init__(self, module, compute, project):
super().__init__()
# create an unique ID
self._id = BaseNode._instance_count
BaseNode._instance_count += 1
@@ -82,15 +79,47 @@ class BaseNode(QtCore.QObject):
def links(self):
"""
Links connected to the node
Links connected to this node
"""
return self._links
def addLink(self, link):
"""
Add a link connected to this node
:param link: link object
"""
self._links.add(link)
def deleteLink(self, link):
self._links.remove(link)
"""
Delete a link connected to this node
:param link: link object
"""
try:
self._links.remove(link)
except KeyError:
pass
def state(self):
"""
Returns a human readable status of this node.
:returns: string
"""
status = self.status()
if status == self.started:
return "started"
elif status == self.stopped:
return "stopped"
elif status == self.suspended:
return "suspended"
return "unknown"
@classmethod
def reset(cls):
@@ -174,19 +203,16 @@ class BaseNode(QtCore.QObject):
# set ports as started
port.setStatus(Port.started)
self.started_signal.emit()
log.info("{} has started".format(self.name()))
elif status == self.stopped:
for port in self._ports:
# set ports as stopped
port.setStatus(Port.stopped)
self.stopped_signal.emit()
log.info("{} has stopped".format(self.name()))
elif status == self.suspended:
for port in self._ports:
# set ports as suspended
port.setStatus(Port.suspended)
self.suspended_signal.emit()
log.info("{} has suspended".format(self.name()))
def initialized(self):
"""
@@ -225,6 +251,53 @@ class BaseNode(QtCore.QObject):
return self._ports
def controllerHttpPost(self, path, callback, body=None, context=None, **kwargs):
"""
POST on current server / project
:param path: Remote path
:param callback: callback method to call when the server replies
:param body: params to send (dictionary)
:param context: Pass a context to the response callback
"""
self._project.post(path, callback, body=body, context=context, **kwargs)
def controllerHttpPut(self, path, callback, body=None, context=None, **kwargs):
"""
PUT on current server / project
:param path: Remote path
:param callback: callback method to call when the server replies
:param body: params to send (dictionary)
:param context: Pass a context to the response callback
"""
self._project.put(path, callback, body=body, context=context, **kwargs)
def controllerHttpGet(self, path, callback, context=None, **kwargs):
"""
Get on current server / project
:param path: Remote path
:param callback: callback method to call when the server replies
:param body: params to send (dictionary)
:param context: Pass a context to the response callback
"""
self._project.get(path, callback, context=context, **kwargs)
def controllerHttpDelete(self, path, callback, context=None, **kwargs):
"""
Delete on current server / project
:param path: Remote path
:param callback: callback method to call when the server replies
:param context: Pass a context to the response callback
"""
self._project.delete(path, callback, context=context, **kwargs)
@staticmethod
def defaultCategories():
"""
@@ -251,16 +324,6 @@ class BaseNode(QtCore.QObject):
raise NotImplementedError()
@staticmethod
def symbolName():
"""
Returns the symbol name (for the nodes view).
:returns: name (string)
"""
raise NotImplementedError()
@staticmethod
def categories(self):
"""
@@ -276,52 +339,4 @@ class BaseNode(QtCore.QObject):
Must be overloaded.
"""
raise NotImplementedError()
def controllerHttpPost(self, path, callback, body={}, context={}, **kwargs):
"""
POST on current server / project
:param path: Remote path
:param callback: callback method to call when the server replies
:param body: params to send (dictionary)
:param context: Pass a context to the response callback
"""
self._project.post(path, callback, body=body, context=context, **kwargs)
def controllerHttpPut(self, path, callback, body={}, context={}, **kwargs):
"""
PUT on current server / project
:param path: Remote path
:param callback: callback method to call when the server replies
:param body: params to send (dictionary)
:param context: Pass a context to the response callback
"""
self._project.put(path, callback, body=body, context=context, **kwargs)
def controllerHttpGet(self, path, callback, context={}, **kwargs):
"""
Get on current server / project
:param path: Remote path
:param callback: callback method to call when the server replies
:param body: params to send (dictionary)
:param context: Pass a context to the response callback
"""
self._project.get(path, callback, context=context, **kwargs)
def controllerHttpDelete(self, path, callback, context={}, **kwargs):
"""
Delete on current server / project
:param path: Remote path
:param callback: callback method to call when the server replies
:param context: Pass a context to the response callback
"""
self._project.delete(path, callback, context=context, **kwargs)
raise NotImplementedError()

View File

@@ -20,100 +20,228 @@ import uuid
class Compute:
"""
A compute node on the remote server
An instance of a compute.
"""
def __init__(self, compute_id=None):
if compute_id is None:
compute_id = str(uuid.uuid4())
self._compute_id = compute_id
self._name = compute_id
self._connected = False
self._protocol = None
self._protocol = "http"
self._host = None
self._port = None
self._port = 3080
self._user = None
self._password = None
self._cpu_usage_percent = None
self._memory_usage_percent = None
self._capabilities = {
"node_types": []
}
self._capabilities = {"node_types": []}
self._last_error = None
def id(self):
"""
Returns the compute ID.
:returns: compute identifier
"""
return self._compute_id
def name(self):
"""
Returns the compute name.
:returns: compute name
"""
return self._name
def setName(self, name):
"""
Sets the compute name.
:param name: compute name
"""
self._name = name
def connected(self):
"""
Returns whether or not there is a connection to the compute.
:returns: boolean
"""
return self._connected
def setConnected(self, value):
"""
Sets whether or not there is a connection to the compute.
:param value: boolean
"""
self._connected = value
def port(self):
return self._port
def setPort(self, port):
self._port = port
def user(self):
return self._user
def setUser(self, user):
self._user = user
def setPassword(self, password):
self._password = password
def protocol(self):
return self._protocol
def setProtocol(self, protocol):
self._protocol = protocol
def host(self):
"""
Returns the compute host.
:returns: host (string)
"""
return self._host
def setHost(self, host):
"""
Sets the compute host.
:param host: host (string)
"""
self._host = host
def setCpuUsagePercent(self, usage):
self._cpu_usage_percent = usage
def port(self):
"""
Returns the compute port number.
:returns: port number (integer)
"""
return self._port
def setPort(self, port):
"""
Sets the compute port number.
:param port: port number (integer)
"""
self._port = port
def user(self):
"""
Returns the compute user for HTTP authentication.
:returns: user (string)
"""
return self._user
def setUser(self, user):
"""
Sets the compute user for HTTP authentication.
:param user: user (string)
"""
self._user = user
def setPassword(self, password):
"""
Returns the compute password for HTTP authentication.
:returns: password (string)
"""
self._password = password
def protocol(self):
"""
Returns the compute protocol.
:returns: protocol (string)
"""
return self._protocol
def setProtocol(self, protocol):
"""
Sets the compute protocol.
:param protocol: protocol (string)
"""
self._protocol = protocol
def cpuUsagePercent(self):
"""
Returns the compute CPU usage.
:returns: CPU usage (integer)
"""
return self._cpu_usage_percent
def setCpuUsagePercent(self, usage):
"""
Sets the compute CPU usage.
:param usage: CPU usage (integer)
"""
self._cpu_usage_percent = usage
def setMemoryUsagePercent(self, usage):
"""
Returns the compute memory usage.
:returns: memory usage (integer)
"""
self._memory_usage_percent = usage
def memoryUsagePercent(self):
"""
Sets the compute memory usage.
:param usage: memory usage (integer)
"""
return self._memory_usage_percent
def capabilities(self):
"""
Returns the compute capabilities
:returns: capabilities (dictionary)
"""
return self._capabilities
def setCapabilities(self, val):
self._capabilities = val
def setCapabilities(self, value):
"""
Sets the compute capabilities
:param value: capabilities (dictionary)
"""
self._capabilities = value
def setLastError(self, last_error):
self._last_error = last_error
def lastError(self):
return self._last_error
def __str__(self):
return self._compute_id
def __json__(self):
return {
"host": self._host,
"port": self._port,
"protocol": self._protocol,
"user": self._user,
"password": self._password,
"name": self._name,
"compute_id": self._compute_id
}
return {"host": self._host,
"port": self._port,
"protocol": self._protocol,
"user": self._user,
"password": self._password,
"name": self._name,
"compute_id": self._compute_id}
def __eq__(self, v):
if isinstance(v, Compute):
return self.__json__() == v.__json__()
return False

View File

@@ -16,46 +16,82 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .qt import QtCore
from .compute import Compute
from .controller import Controller
import sys
import copy
import logging
import urllib
import datetime
import logging
log = logging.getLogger(__name__)
class ComputeManager(QtCore.QObject):
"""
Manager for computes.
"""
created_signal = QtCore.Signal(str)
updated_signal = QtCore.Signal(str)
deleted_signal = QtCore.Signal(str)
def __init__(self):
super().__init__()
self._computes = {}
self._controller = Controller.instance()
self._controller.connected_signal.connect(self._controllerConnectedSlot)
self._controller.disconnected_signal.connect(self._controllerDisconnectedSlot)
self._controllerConnectedSlot()
# If we receive fresh data from the notification feed no need to refresh via an API call
# No need to refresh via an API call if we received fresh data from the notification feed
self._last_computes_refresh = datetime.datetime.now().timestamp()
self._timer = QtCore.QTimer()
self._timer.setInterval(1000)
self._refreshingComputes = False
self._timer.timeout.connect(self._refreshComputesSlot)
self._timer.start()
def _refreshComputesSlot(self):
if self._controller.connected() and datetime.datetime.now().timestamp() - self._last_computes_refresh > 5:
"""
Called when computes are refreshed.
"""
if self._refreshingComputes:
return
if self._controller.connected() and datetime.datetime.now().timestamp() - self._last_computes_refresh > 1:
self._last_computes_refresh = datetime.datetime.now().timestamp()
self._controller.get("/computes", self._listComputesCallback, showProgress=True)
self._refreshingComputes = True
self._controller.get("/computes", self._listComputesCallback, showProgress=False, timeout=30)
def _controllerConnectedSlot(self):
"""
Called when connected to a compute.
"""
if self._controller.connected():
self._controller.get("/computes", self._listComputesCallback)
self._refreshingComputes = True
self._controller.get("/computes", self._listComputesCallback, showProgress=False, timeout=30)
def _controllerDisconnectedSlot(self):
"""
Called when disconnected from a compute.
"""
for compute_id in list(self._computes):
del self._computes[compute_id]
self.deleted_signal.emit(compute_id)
def _listComputesCallback(self, result, error=False, **kwargs):
"""
Callback to list computes.
"""
self._refreshingComputes = False
if error is True:
log.error("Error while getting compute list: {}".format(result["message"]))
return
@@ -65,9 +101,9 @@ class ComputeManager(QtCore.QObject):
def computeDataReceivedCallback(self, compute):
"""
Called when we received data from a compute
node.
Called when we received data from a compute node.
"""
self._last_computes_refresh = datetime.datetime.now().timestamp()
new_node = False
@@ -85,22 +121,40 @@ class ComputeManager(QtCore.QObject):
self._computes[compute_id].setCpuUsagePercent(compute["cpu_usage_percent"])
self._computes[compute_id].setMemoryUsagePercent(compute["memory_usage_percent"])
self._computes[compute_id].setCapabilities(compute["capabilities"])
self._computes[compute_id].setLastError(compute.get("last_error"))
if new_node:
self.created_signal.emit(compute_id)
else:
self.updated_signal.emit(compute_id)
def computeIsTheRemoteGNS3VM(self, compute):
"""
:returns: boolean True if the remote server is the remote GNS3 VM
"""
if compute.id() != "local" and compute.id() != "vm":
if self.vmCompute() and "GNS3 VM ({})".format(compute.name()) == self.vmCompute().name():
return True
return False
def computes(self):
"""
:returns: List of computes nodes
"""
return list(self._computes.values())
computes = []
for compute in self._computes.values():
# We filter the remote GNS3 VM compute from the computes list
if not self.computeIsTheRemoteGNS3VM(compute):
computes.append(compute)
return computes
def vmCompute(self):
"""
:returns: The GNS3 VM compute node or None
"""
try:
return self._computes["vm"]
except KeyError:
@@ -110,34 +164,67 @@ class ComputeManager(QtCore.QObject):
"""
:returns: The local compute node or None
"""
try:
return self._computes["local"]
except KeyError:
return None
def localPlatform(self):
"""
Return the platform of the local compute.
With a remote controller it could be different of our local platform
"""
c = self.localCompute()
if c is None:
return sys.platform
return c.capabilities().get("platform", sys.platform)
def remoteComputes(self):
"""
:returns: List of non local and non VM computes
"""
return [c for c in self._computes.values() if c.id() != "local" and c.id() != "vm"]
def getCompute(self, compute_id):
"""
Gets a compute by ID
:param compute_id: compute identifier
:returns: compute
"""
if compute_id.startswith("http:") or compute_id.startswith("https:"):
u = urllib.parse.urlsplit(compute_id)
for compute in self._computes.values():
if "{}:{}".format(compute.host(), compute.port()) == u.netloc:
return compute
raise KeyError("Compute ID {} is missing.".format(compute_id))
if compute_id not in self._computes:
self._computes[compute_id] = Compute(compute_id)
self.created_signal.emit(compute_id)
return self._computes[compute_id]
def deleteCompute(self, compute_id):
"""
Deletes a compute by ID
:param compute_id: compute identifier
"""
if compute_id in self._computes:
compute = self._computes[compute_id]
del self._computes[compute_id]
self._controller.delete("/computes/" + compute_id, None)
self.deleted_signal.emit(compute_id)
self._controller.delete("/computes/{compute_id}".format(compute_id=compute_id), None)
self.deleted_signal.emit(compute_id)
def updateList(self, computes):
"""
Sync an array of compute server with remote
Sync an array of compute with remote
"""
for compute_id in copy.copy(self._computes):
# Delete compute on controller not in the new computes
if compute_id in ["local", "vm"]:
@@ -153,12 +240,14 @@ class ComputeManager(QtCore.QObject):
log.debug("Update compute %s", compute_id)
self._controller.put("/computes/" + compute_id, None, body=c.__json__())
self._computes[compute_id] = c
self.updated_signal.emit(compute_id)
# Create the new nodes
for compute in computes:
if compute.id() not in self._computes:
log.debug("Create compute %s", compute.id())
self._controller.post("/computes", None, body=compute.__json__())
self._computes[compute.id()] = compute
self.created_signal.emit(compute.id())
@staticmethod
def reset():

View File

@@ -19,17 +19,16 @@
Compute summary view that list all the compute, their status.
"""
import sip
from .qt import QtGui, QtCore, QtWidgets
from .compute_manager import ComputeManager
from .topology import Topology
from .node import Node
import logging
log = logging.getLogger(__name__)
class ComputeItem(QtWidgets.QTreeWidgetItem):
"""
Custom item for the QTreeWidget instance
(topology summary view).
@@ -62,24 +61,47 @@ class ComputeItem(QtWidgets.QTreeWidgetItem):
text = "{} CPU {}%, RAM {}%".format(text, self._compute.cpuUsagePercent(), self._compute.memoryUsagePercent())
self.setText(0, text)
self.setToolTip(0, text)
if self._compute.connected():
self._status = "connected"
self.setToolTip(0, "Server {} version {} running on {}".format(self._compute.name(),
self._compute.capabilities().get("version", "n/a"),
self._compute.capabilities().get("platform", "")))
if usage is None or (self._compute.cpuUsagePercent() < 90 and self._compute.memoryUsagePercent() < 90):
self.setIcon(0, QtGui.QIcon(':/icons/led_green.svg'))
else:
self.setIcon(0, QtGui.QIcon(':/icons/led_yellow.svg'))
else:
if self._status == "unknown":
last_error = self._compute.lastError()
if last_error:
self.setToolTip(0, "Failed to connect to {}: {}".format(self._compute.name(), last_error))
self.setIcon(0, QtGui.QIcon(':/icons/led_red.svg'))
elif self._status == "unknown":
self.setToolTip(0, "Discovering or connecting to {}...".format(self._compute.name()))
self.setIcon(0, QtGui.QIcon(':/icons/led_gray.svg'))
else:
self._status = "stopped"
self.setToolTip(0, "{} is stopped or cannot be reached".format(self._compute.name()))
self.setIcon(0, QtGui.QIcon(':/icons/led_red.svg'))
self._parent.sortItems(0, QtCore.Qt.SortOrder.AscendingOrder)
# add nodes belonging to this compute
self.takeChildren()
nodes = Topology.instance().nodes()
for node in nodes:
if node.compute().id() == self._compute.id():
item = QtWidgets.QTreeWidgetItem()
item.setText(0, node.name())
if node.status() == Node.started:
item.setIcon(0, QtGui.QIcon(':/icons/led_green.svg'))
elif node.status() == Node.suspended:
item.setIcon(0, QtGui.QIcon(':/icons/led_yellow.svg'))
else:
item.setIcon(0, QtGui.QIcon(':/icons/led_red.svg'))
self.addChild(item)
self.sortChildren(0, QtCore.Qt.SortOrder.AscendingOrder)
class ComputeSummaryView(QtWidgets.QTreeWidget):
"""
Compute summary view implementation.
@@ -89,9 +111,7 @@ class ComputeSummaryView(QtWidgets.QTreeWidget):
def __init__(self, parent):
super().__init__(parent)
self._computes = {}
ComputeManager.instance().created_signal.connect(self._computeAddedSlot)
ComputeManager.instance().updated_signal.connect(self._computeUpdatedSlot)
ComputeManager.instance().deleted_signal.connect(self._computeRemovedSlot)
@@ -106,17 +126,26 @@ class ComputeSummaryView(QtWidgets.QTreeWidget):
"""
compute = ComputeManager.instance().getCompute(compute_id)
if ComputeManager.instance().computeIsTheRemoteGNS3VM(compute):
return
self._computes[compute_id] = ComputeItem(self, compute)
def _computeUpdatedSlot(self, compute_id):
"""
Called when a compute is removed to the list of computes
Called when a compute is updated
:params url: URL of the compute
"""
if compute_id in self._computes:
self._computes[compute_id]._refreshStatusSlot()
compute = ComputeManager.instance().getCompute(compute_id)
# We hide the remote GNS3 VM
if ComputeManager.instance().computeIsTheRemoteGNS3VM(compute):
self._computeRemovedSlot(compute_id)
else:
self._computes[compute_id]._refreshStatusSlot()
else:
self._computeAddedSlot(compute_id)
def _computeRemovedSlot(self, compute_id):
"""

View File

@@ -1,26 +0,0 @@
!
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname %h
!
ip cef
no ip domain-lookup
no ip icmp rate-limit unreachable
ip tcp synwait 5
no cdp log mismatch duplex
!
line con 0
exec-timeout 0 0
logging synchronous
privilege level 15
no login
line aux 0
exec-timeout 0 0
logging synchronous
privilege level 15
no login
!
!
end

View File

@@ -1,181 +0,0 @@
!
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
no service dhcp
!
hostname %h
!
ip cef
no ip routing
no ip domain-lookup
no ip icmp rate-limit unreachable
ip tcp synwait 5
no cdp log mismatch duplex
vtp file nvram:vlan.dat
!
!
interface FastEthernet0/0
description *** Unused for Layer2 EtherSwitch ***
no ip address
shutdown
!
interface FastEthernet0/1
description *** Unused for Layer2 EtherSwitch ***
no ip address
shutdown
!
interface FastEthernet1/0
no shutdown
duplex full
speed 100
!
interface FastEthernet1/1
no shutdown
duplex full
speed 100
!
interface FastEthernet1/2
no shutdown
duplex full
speed 100
!
interface FastEthernet1/3
no shutdown
duplex full
speed 100
!
interface FastEthernet1/4
no shutdown
duplex full
speed 100
!
interface FastEthernet1/5
no shutdown
duplex full
speed 100
!
interface FastEthernet1/6
no shutdown
duplex full
speed 100
!
interface FastEthernet1/7
no shutdown
duplex full
speed 100
!
interface FastEthernet1/8
no shutdown
duplex full
speed 100
!
interface FastEthernet1/9
no shutdown
duplex full
speed 100
!
interface FastEthernet1/10
no shutdown
duplex full
speed 100
!
interface FastEthernet1/11
no shutdown
duplex full
speed 100
!
interface FastEthernet1/12
no shutdown
duplex full
speed 100
!
interface FastEthernet1/13
no shutdown
duplex full
speed 100
!
interface FastEthernet1/14
no shutdown
duplex full
speed 100
!
interface FastEthernet1/15
no shutdown
duplex full
speed 100
!
interface Vlan1
no ip address
shutdown
!
!
line con 0
exec-timeout 0 0
logging synchronous
privilege level 15
no login
line aux 0
exec-timeout 0 0
logging synchronous
privilege level 15
no login
!
!
banner exec $
***************************************************************
This is a normal Router with a SW module inside (NM-16ESW)
It has been preconfigured with hard coded speed and duplex
To create vlans use the command "vlan database" from exec mode
After creating all desired vlans use "exit" to apply the config
To view existing vlans use the command "show vlan-switch brief"
Warning: You are using an old IOS image for this router.
Please update the IOS to enable the "macro" command!
***************************************************************
$
!
!Warning: If the IOS is old and doesn't support macro, it will stop the configuration loading from this point!
!
macro name add_vlan
end
vlan database
vlan $v
exit
@
macro name del_vlan
end
vlan database
no vlan $v
exit
@
!
!
banner exec $
***************************************************************
This is a normal Router with a Switch module inside (NM-16ESW)
It has been pre-configured with hard-coded speed and duplex
To create vlans use the command "vlan database" in exec mode
After creating all desired vlans use "exit" to apply the config
To view existing vlans use the command "show vlan-switch brief"
Alias(exec) : vl - "show vlan-switch brief" command
Alias(configure): va X - macro to add vlan X
Alias(configure): vd X - macro to delete vlan X
***************************************************************
$
!
alias configure va macro global trace add_vlan $v
alias configure vd macro global trace del_vlan $v
alias exec vl show vlan-switch brief
!
!
end

View File

@@ -1,132 +0,0 @@
!
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname %h
!
!
!
logging discriminator EXCESS severity drops 6 msg-body drops EXCESSCOLL
logging buffered 50000
logging console discriminator EXCESS
!
no ip icmp rate-limit unreachable
!
ip cef
no ip domain-lookup
!
!
!
!
!
!
ip tcp synwait-time 5
!
!
!
!
!
!
interface Ethernet0/0
no ip address
no shutdown
duplex auto
!
interface Ethernet0/1
no ip address
no shutdown
duplex auto
!
interface Ethernet0/2
no ip address
no shutdown
duplex auto
!
interface Ethernet0/3
no ip address
no shutdown
duplex auto
!
interface Ethernet1/0
no ip address
no shutdown
duplex auto
!
interface Ethernet1/1
no ip address
no shutdown
duplex auto
!
interface Ethernet1/2
no ip address
no shutdown
duplex auto
!
interface Ethernet1/3
no ip address
no shutdown
duplex auto
!
interface Ethernet2/0
no ip address
no shutdown
duplex auto
!
interface Ethernet2/1
no ip address
no shutdown
duplex auto
!
interface Ethernet2/2
no ip address
no shutdown
duplex auto
!
interface Ethernet2/3
no ip address
no shutdown
duplex auto
!
interface Ethernet3/0
no ip address
no shutdown
duplex auto
!
interface Ethernet3/1
no ip address
no shutdown
duplex auto
!
interface Ethernet3/2
no ip address
no shutdown
duplex auto
!
interface Ethernet3/3
no ip address
no shutdown
duplex auto
!
interface Vlan1
no ip address
shutdown
!
!
!
!
!
!
!
!
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
!
end

View File

@@ -1,108 +0,0 @@
!
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname %h
!
!
!
no ip icmp rate-limit unreachable
!
!
!
!
ip cef
no ip domain-lookup
!
!
ip tcp synwait-time 5
!
!
!
!
interface Ethernet0/0
no ip address
shutdown
!
interface Ethernet0/1
no ip address
shutdown
!
interface Ethernet0/2
no ip address
shutdown
!
interface Ethernet0/3
no ip address
shutdown
!
interface Ethernet1/0
no ip address
shutdown
!
interface Ethernet1/1
no ip address
shutdown
!
interface Ethernet1/2
no ip address
shutdown
!
interface Ethernet1/3
no ip address
shutdown
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial2/3
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/0
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/1
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/2
no ip address
shutdown
serial restart-delay 0
!
interface Serial3/3
no ip address
shutdown
serial restart-delay 0
!
!
no cdp log mismatch duplex
!
line con 0
exec-timeout 0 0
privilege level 15
logging synchronous
line aux 0
exec-timeout 0 0
privilege level 15
logging synchronous
!
end

View File

@@ -1 +0,0 @@
set pcname %h

View File

@@ -19,20 +19,30 @@
Handles commands typed in the GNS3 console.
"""
import os
import sys
import cmd
import logging
import struct
import sip
import json
from .qt import sip
from .node import Node
from .qt import QtCore
from .version import __version__
import logging
log = logging.getLogger(__name__)
class ConsoleCmd(cmd.Cmd):
def do_env(self, args):
"""
Show the environment variables used by GNS3.
"""
for key, val in os.environ.items():
print("{}={}".format(key, val))
def do_version(self, args):
"""
Show the version of GNS3 and its dependencies.
@@ -177,6 +187,24 @@ class ConsoleCmd(cmd.Cmd):
print("Cannot console to {}".format(device))
break
def do_log(self, args):
"""
Log a message
log level message
"""
args = args.split()
if len(args) == 0:
return
level = args.pop(0)
if level == "info":
log.info(" ".join(args))
elif level == "warning":
log.warning(" ".join(args))
else:
log.error(" ".join(args))
def _start_console(self, node):
"""
Starts a console application for a specific node.
@@ -204,17 +232,10 @@ class ConsoleCmd(cmd.Cmd):
level = int(args[0])
if level == 0:
print("Deactivating debugging")
for handler in root.handlers:
if isinstance(handler, logging.StreamHandler):
root.removeHandler(handler)
root.setLevel(logging.INFO)
else:
root.addHandler(logging.StreamHandler(sys.stdout))
if level == 1:
print("Activating debugging")
else:
print("Activating full debugging")
root.setLevel(logging.DEBUG)
print("Activating debugging")
root.setLevel(logging.DEBUG)
from .main_window import MainWindow
MainWindow.instance().setSettings({"debug_level": level})
else:
@@ -249,44 +270,6 @@ class ConsoleCmd(cmd.Cmd):
print("{}: no such device".format(node_name))
continue
def _show_run(self, params):
"""
Handles the 'show run' command.
:param params: list of parameters
"""
if self._topology.project is None:
print("Sorry, the project hasn't been saved yet")
return
topology = self._topology.dump()
if len(params) == 1:
# print out whole topology
print(json.dumps(topology, sort_keys=True, indent=4))
elif len(params) >= 2:
# this is a 'show run <device_name>'
params.pop(0)
for param in params:
node_name = param
base_node_id = None
# get the node ID
for node in self._topology.nodes():
if node.name() == node_name:
base_node_id = node.id()
break
if base_node_id is None:
print("{}: no such device".format(node_name))
continue
if "nodes" in topology["topology"]:
for node in topology["topology"]["nodes"]:
if node["id"] == base_node_id:
print(json.dumps(node, sort_keys=True, indent=4))
break
def do_show(self, args):
"""
Show detail information about every device in current lab:
@@ -294,15 +277,6 @@ class ConsoleCmd(cmd.Cmd):
Show detail information about a device:
show device <device_name>
Show the whole topology:
show run
Show topology info of a device:
show run <device_name>
Show the GNS3 VM status
show gns3vm
"""
if '?' in args or args.strip() == "":
@@ -312,10 +286,6 @@ class ConsoleCmd(cmd.Cmd):
params = args.split()
if params[0] == "device":
self._show_device(params)
elif params[0] == "run":
self._show_run(params)
elif params[0] == "gns3vm":
self._show_gnsvm(params)
else:
print(self.do_show.__doc__)

View File

@@ -15,13 +15,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import platform
import sys
from .qt import sip
import struct
import inspect
import datetime
import platform
from .qt import QtCore, Qt
from .qt import QtCore, QtGui
from .topology import Topology
from .version import __version__
from .console_cmd import ConsoleCmd
@@ -37,24 +38,31 @@ class ConsoleLogHandler(logging.StreamHandler):
"""
Display log event to the console
"""
def emit(self, record):
if sip.isdeleted(self._console_view):
return
message = self.format(record)
level_no = record.levelno
if level_no >= logging.ERROR:
self._console_view.write("{}\n".format(message), error=True)
self._console_view.write_message_signal.emit("{}\n".format(message), "error")
elif level_no >= logging.WARNING:
self._console_view.write("{}\n".format(message), warning=True)
self._console_view.write_message_signal.emit("{}\n".format(message), "warning")
elif level_no >= logging.INFO:
# To avoid noise on console we display all event only if log level is debug
# or if we force the display in the log record
if "show" in record.__dict__ or logging.getLogger().getEffectiveLevel() == logging.DEBUG:
self._console_view.write("{}\n".format(message))
self._console_view.write_message_signal.emit("{}\n".format(message), "debug")
elif level_no >= logging.DEBUG:
self._console_view.write("{}\n".format(message))
self._console_view.write_message_signal.emit("{}\n".format(message), "debug")
class ConsoleView(PyCutExt, ConsoleCmd):
# Emit this signal to write a message on console
write_message_signal = QtCore.Signal(str, str)
def __init__(self, parent):
# Set the prompt PyCutExt
@@ -67,7 +75,7 @@ class ConsoleView(PyCutExt, ConsoleCmd):
self.intro = "GNS3 management console.\nRunning GNS3 version {} on {} ({}-bit) with Python {} Qt {} and PyQt {}.\n" \
"Copyright (c) 2006-{} GNS3 Technologies.\n" \
"Use Help -> GNS3 Doctor to detect common issues." \
"".format(__version__, platform.system(), bitness, platform.python_version(), QtCore.QT_VERSION_STR, Qt.PYQT_VERSION_STR, current_year)
"".format(__version__, platform.system(), bitness, platform.python_version(), QtCore.QT_VERSION_STR, QtCore.PYQT_VERSION_STR, current_year)
# Parent class initialization
try:
@@ -89,16 +97,51 @@ class ConsoleView(PyCutExt, ConsoleCmd):
self._handleLogs()
if LocalConfig.instance().experimental():
log.warning("WARNING: Experimental features enable. You can use some unfinished features and lost data.")
log.warning("WARNING: Experimental features enable. You can use some unfinished features and lost data.")
for module in MODULES:
instance = module.instance()
instance.notification_signal.connect(self.writeNotification)
self.write_message_signal.connect(self._writeMessageSlot)
# required for Cmd module (do_help etc.)
self.stdout = sys.stdout
self._topology = Topology.instance()
def contextMenuEvent(self, event):
"""
Handles all context menu events.
:param event: QContextMenuEvent instance
"""
menu = self.createStandardContextMenu()
delete_all_action = QtGui.QAction("Delete All", menu)
delete_all_action.triggered.connect(self._deleteAllActionSlot)
menu.addAction(delete_all_action)
menu.exec(event.globalPos())
def _deleteAllActionSlot(self):
"""
Delete all action slot
"""
self.clear()
self.write(self.prompt)
self.lines = []
self._clearLine()
def _writeMessageSlot(self, message, level):
"""
Write a message in the console.
"""
if level == "error":
self.write(message, error=True)
elif level == "warning":
self.write(message, warning=True)
else:
self.write(message)
def _handleLogs(self):
"""
@@ -174,11 +217,9 @@ class ConsoleView(PyCutExt, ConsoleCmd):
"""
text = "Server notification: {}".format(message)
self.write(text, error=True)
self.write("\n")
if details:
self.write(details)
self.write("\n")
text += "\n" + details
self.write_message_signal.emit(text, "info")
def writeError(self, base_node_id, message):
"""
@@ -195,8 +236,7 @@ class ConsoleView(PyCutExt, ConsoleCmd):
text = "Error:{name} {message}".format(name=name,
message=message)
self.write(text, error=True)
self.write("\n")
self.write_message_signal.emit(text, "error")
def writeWarning(self, base_node_id, message):
"""
@@ -213,8 +253,7 @@ class ConsoleView(PyCutExt, ConsoleCmd):
text = "Warning:{name} {message}".format(name=name,
message=message)
self.write(text, warning=True)
self.write("\n")
self.write_message_signal.emit(text, "warning")
def writeServerError(self, base_node_id, message):
"""
@@ -235,8 +274,7 @@ class ConsoleView(PyCutExt, ConsoleCmd):
text = "Server error {server}:{name} {message}".format(server=server,
name=name,
message=message)
self.write(text.strip(), error=True)
self.write("\n")
self.write_message_signal.emit(text.strip(), "error")
def _run(self):
"""

View File

@@ -18,99 +18,241 @@
import os
import hashlib
import tempfile
import json
import pathlib
from .qt import QtCore, QtGui, QtWidgets, qpartial
from .qt import QtCore, QtNetwork, QtGui, QtWidgets, QtWebSockets, qpartial, qslot
from .symbol import Symbol
from .local_server_config import LocalServerConfig
from .settings import LOCAL_SERVER_SETTINGS
from gns3.local_config import LocalConfig
from gns3.utils import parse_version
import logging
log = logging.getLogger(__name__)
class Controller(QtCore.QObject):
"""
An instance of the GNS3 server controller
An instance of the server controller.
"""
connected_signal = QtCore.Signal()
def __init__(self, parent=None):
connected_signal = QtCore.Signal()
disconnected_signal = QtCore.Signal()
connection_failed_signal = QtCore.Signal()
project_list_updated_signal = QtCore.Signal()
def __init__(self):
super().__init__()
self._connected = False
self._cache_directory = tempfile.TemporaryDirectory()
self._connecting = False
self._notification_stream = None
self._version = None
self._cache_directory = tempfile.TemporaryDirectory(suffix="-gns3")
self._http_client = None
# If it's the first error we display an alert box to the user
self._first_error = True
self._error_dialog = None
self._display_error = True
self._projects = []
self._websocket = QtWebSockets.QWebSocket()
# If we do multiple call in order to download the same symbol we queue them
self._static_asset_download_queue = {}
def host(self):
return self._http_client.host()
def version(self):
return self._version
def isRemote(self):
"""
:returns Boolean: True if the controller is remote
"""
settings = LocalServerConfig.instance().loadSettings("Server", LOCAL_SERVER_SETTINGS)
return not settings["auto_start"]
def connecting(self):
"""
:returns: True if connection is in progress
"""
return self._connecting
def connected(self):
"""
Is the controller connected
"""
return self._connected
def httpClient(self):
"""
:returns: HTTP client for connected to the controller
:returns: HTTP client to connect to the controller
"""
return self._http_client
def setHttpClient(self, http_client):
"""
:param http_client: Instance of HTTP client to communicate with the server
"""
self._http_client = http_client
if self._http_client:
if self.isRemote():
self._http_client.setMaxTimeDifferenceBetweenQueries(120)
self._http_client.connection_connected_signal.connect(self._httpClientConnectedSlot)
self._http_client.connection_disconnected_signal.connect(self._httpClientDisconnectedSlot)
self._connectingToServer()
def getHttpClient(self):
"""
:return: Instance of HTTP client to communicate with the server
"""
return self._http_client
def setDisplayError(self, val):
"""
Allow error to be visible or not
"""
self._display_error = val
self._first_error = True
def _connectingToServer(self):
"""
Connection process as started
"""
self._connected = False
self._connecting = True
status, json_data = self.httpClient().getSynchronous('GET', '/version', timeout=60)
self._versionGetSlot(json_data, status is None or status >= 300)
def _httpClientDisconnectedSlot(self):
if self._connected:
self._connected = False
self.get('/version', self._versionGetSlot)
self.disconnected_signal.emit()
self._connectingToServer()
self.stopListenNotifications()
def _versionGetSlot(self, result, error=False, **kwargs):
"""
Called after the inital version get
Called after the initial version get
"""
if error:
if "message" in result and self._first_error:
QtWidgets.QMessageBox.critical(self.parent(), "Connection", result["message"])
# Try to connect again in 1 seconds
QtCore.QTimer.singleShot(1000, qpartial(self.get, '/version', self._versionGetSlot, showProgress=self._first_error))
if self._first_error:
self._connecting = False
self.connection_failed_signal.emit()
if self._display_error:
self._error_dialog = QtWidgets.QMessageBox(self.parent())
self._error_dialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal)
self._error_dialog.setWindowTitle("Connection to server")
if result and "message" in result:
self._error_dialog.setText("Error when connecting to the GNS3 server:\n{}".format(result["message"]))
else:
self._error_dialog.setText("Cannot connect to the GNS3 server")
self._error_dialog.setIcon(QtWidgets.QMessageBox.Icon.Critical)
self._error_dialog.show()
# Try to connect again in 5 seconds
QtCore.QTimer.singleShot(5000, qpartial(self.get, '/version', self._versionGetSlot, showProgress=self._first_error))
self._first_error = False
else:
self._first_error = True
if self._error_dialog:
self._error_dialog.reject()
self._error_dialog = None
self._version = result.get("version")
self._http_client.connection_connected_signal.emit()
def _httpClientConnectedSlot(self):
if not self._connected:
self._connected = True
self._connecting = False
self.connected_signal.emit()
def get(self, *args, **kwargs):
return self.createHTTPQuery("GET", *args, **kwargs)
self.refreshProjectList()
self._startListenNotifications()
def post(self, *args, **kwargs):
return self.createHTTPQuery("POST", *args, **kwargs)
def get(self, *args, **kwargs):
return self.createHTTPQuery("GET", *args, **kwargs)
def put(self, *args, **kwargs):
return self.createHTTPQuery("PUT", *args, **kwargs)
def delete(self, *args, **kwargs):
return self.createHTTPQuery("DELETE", *args, **kwargs)
def getCompute(self, path, compute_id, *args, **kwargs):
"""
API get on a specific compute
"""
compute_id = self.__fix_compute_id(compute_id)
path = "/computes/{}{}".format(compute_id, path)
return self.get(path, *args, **kwargs)
def postCompute(self, path, compute_id, *args, **kwargs):
"""
API post on a specific compute
"""
compute_id = self.__fix_compute_id(compute_id)
path = "/computes/{}{}".format(compute_id, path)
return self.post(path, *args, **kwargs)
def __fix_compute_id(self, compute_id):
"""
Support for remote server <= 1.5
This fix should be not require after the 2.1
when all the templates will be managed on server
"""
#FIXME: remove this?
if compute_id.startswith("http:") or compute_id.startswith("https:"):
from .compute_manager import ComputeManager
try:
return ComputeManager.instance().getCompute(compute_id).id()
except KeyError:
return compute_id
return compute_id
def getEndpoint(self, path, compute_id, *args, **kwargs):
"""
API post on a specific compute
"""
compute_id = self.__fix_compute_id(compute_id)
path = "/computes/endpoint/{}{}".format(compute_id, path)
return self.get(path, *args, **kwargs)
def putCompute(self, path, compute_id, *args, **kwargs):
"""
API put on a specific compute
"""
compute_id = self.__fix_compute_id(compute_id)
path = "/computes/{}{}".format(compute_id, path)
return self.put(path, *args, **kwargs)
def createHTTPQuery(self, method, path, *args, **kwargs):
"""
Forward the query to the HTTP client or controller depending of the path
Forward the query to the HTTP client or controller depending on the path
"""
if self._http_client:
return self._http_client.createHTTPQuery(method, path, *args, **kwargs)
def getSynchronous(self, endpoint, timeout=2):
return self._http_client.getSynchronous(endpoint, timeout)
@staticmethod
def instance():
"""
@@ -122,17 +264,59 @@ class Controller(QtCore.QObject):
Controller._instance = Controller()
return Controller._instance
def getStatic(self, url, callback):
def getStatic(self, url, callback, fallback=None):
"""
Get a URL from the /static on controller and cache it on disk
:param url: URL without the protocol and host part
:param callback: Callback to call when file is ready
:param fallback: Fallback url in case of error
"""
if not self._http_client:
return
path = self.getStaticCachedPath(url)
if os.path.exists(path):
callback(path)
elif path in self._static_asset_download_queue:
self._static_asset_download_queue[path].append((callback, fallback, ))
else:
self._static_asset_download_queue[path] = [(callback, fallback, )]
self._http_client.createHTTPQuery("GET", url, qpartial(self._getStaticCallback, url, path))
def _getStaticCallback(self, url, path, result, error=False, raw_body=None, **kwargs):
if path not in self._static_asset_download_queue:
return
if error:
fallback_used = False
for callback, fallback in self._static_asset_download_queue[path]:
if fallback:
self.getStatic(fallback, callback)
fallback_used = True
if fallback_used:
log.debug("Error while downloading file: {}".format(url))
del self._static_asset_download_queue[path]
return
try:
with open(path, "wb+") as f:
f.write(raw_body)
except OSError as e:
log.error("Can't write to {}: {}".format(path, str(e)))
return
log.debug("File stored {} for {}".format(path, url))
for callback, fallback in self._static_asset_download_queue[path]:
callback(path)
del self._static_asset_download_queue[path]
def getStaticCachedPath(self, url):
"""
Returns static cached (hashed) path
:param url:
"""
m = hashlib.md5()
m.update(url.encode())
if ".svg" in url:
@@ -140,30 +324,185 @@ class Controller(QtCore.QObject):
else:
extension = ".png"
path = os.path.join(self._cache_directory.name, m.hexdigest() + extension)
if os.path.exists(path):
callback(path)
else:
self._http_client.createHTTPQuery("GET", url, qpartial(self._getStaticCallback, callback, url, path))
return path
def _getStaticCallback(self, callback, url, path, result, error=False, raw_body=None, **kwargs):
if error:
log.error("Error while downloading file: {}".format(url))
return
with open(path, "wb+") as f:
f.write(raw_body)
log.debug("File stored {} for {}".format(path, url))
callback(path)
def clearStaticCache(self):
"""
Clear the cache directory.
"""
def getSymbolIcon(self, symbol_id, callback):
for filename in os.listdir(self._cache_directory.name):
if filename.endswith(".svg") or filename.endswith(".png"):
try:
os.remove(os.path.join(self._cache_directory.name, filename))
except OSError as e:
log.debug("Error deleting cached symbol '{}':{}".format(filename, e))
continue
def getSymbolIcon(self, symbol_id, callback, fallback=None):
"""
Get a QIcon for a symbol from the controller
:param url: URL without the protocol and host part
:param symbol_id: Symbol id
:param callback: Callback to call when file is ready
:param fallback: Fallback symbol if not found
"""
self.getStatic(Symbol(symbol_id).url(), qpartial(self._getIconCallback, callback))
if symbol_id is None:
self.getStatic(Symbol(fallback).url(), qpartial(self._getIconCallback, callback))
else:
if fallback:
fallback = Symbol(fallback).url()
self.getStatic(Symbol(symbol_id).url(), qpartial(self._getIconCallback, callback), fallback=fallback)
def _getIconCallback(self, callback, path):
pixmap = QtGui.QPixmap(path)
if pixmap.isNull():
log.debug("Invalid symbol {}".format(path))
path = ":/icons/cancel.svg"
icon = QtGui.QIcon()
icon.addFile(path)
callback(icon)
def uploadSymbol(self, symbol_id, path):
self.post("/symbols/" + symbol_id + "/raw",
qpartial(self._finishSymbolUpload, path),
body=pathlib.Path(path), progressText="Uploading {}".format(symbol_id), timeout=None)
def _finishSymbolUpload(self, path, result, error=False, **kwargs):
if error:
log.error("Error while uploading symbol: {}: {}".format(path, result.get("message", "unknown")))
return
# Refresh the templates list
from .template_manager import TemplateManager
TemplateManager.instance().templates_changed_signal.emit()
def getSymbols(self, callback):
self.get('/symbols', callback=callback)
def deleteProject(self, project_id, callback=None):
Controller.instance().delete("/projects/{}".format(project_id), qpartial(self._deleteProjectCallback, callback=callback, project_id=project_id))
def _deleteProjectCallback(self, result, error=False, project_id=None, callback=None, **kwargs):
if error:
log.error("Error while deleting project: {}".format(result["message"]))
else:
self.refreshProjectList()
self._projects = [p for p in self._projects if p["project_id"] != project_id]
if callback:
callback(result, error=error, **kwargs)
@qslot
def refreshProjectList(self, *args):
self.get("/projects", self._projectListCallback)
def _projectListCallback(self, result, error=False, **kwargs):
if not error:
self._projects = result
self.project_list_updated_signal.emit()
def projects(self):
return self._projects
def _startListenNotifications(self):
if not self.connected():
return
# Due to bug in Qt on some version we need a dedicated network manager
self._notification_network_manager = QtNetwork.QNetworkAccessManager()
self._notification_stream = None
# Qt websocket before Qt 5.6 doesn't support auth
if parse_version(QtCore.QT_VERSION_STR) < parse_version("5.6.0") or parse_version(QtCore.PYQT_VERSION_STR) < parse_version("5.6.0") or LocalConfig.instance().experimental():
self._notification_stream = Controller.instance().createHTTPQuery("GET", "/notifications", self._endListenNotificationCallback,
downloadProgressCallback=self._event_received,
networkManager=self._notification_network_manager,
timeout=None,
showProgress=False,
ignoreErrors=True)
url = self._http_client.url() + '/notifications'
log.info("Listening for controller notifications on '{}'".format(url))
else:
self._notification_stream = self._http_client.connectWebSocket(self._websocket, "/notifications/ws")
self._notification_stream.textMessageReceived.connect(self._websocket_event_received)
if parse_version(QtCore.QT_VERSION_STR) < parse_version("6.5.0"):
self._notification_stream.error.connect(self._websocket_error)
else:
self._notification_stream.errorOccurred.connect(self._websocket_error)
self._notification_stream.sslErrors.connect(self._sslErrorsSlot)
log.info("Listening for controller notifications on '{}'".format(self._notification_stream.requestUrl().toString()))
def stopListenNotifications(self):
if self._notification_stream:
log.debug("Stop listening for notifications from controller")
stream = self._notification_stream
self._notification_stream = None
stream.abort()
self._notification_network_manager = None
def _endListenNotificationCallback(self, result, error=False, **kwargs):
"""
If notification stream disconnect we reconnect to it
"""
if self._notification_stream:
self._notification_stream = None
self._startListenNotifications()
@qslot
def _websocket_error(self, error):
if self._notification_stream:
log.error("Websocket controller notification stream error: {}".format(self._notification_stream.errorString()))
self._notification_stream = None
self._startListenNotifications()
@qslot
def _sslErrorsSlot(self, ssl_errors):
self._http_client.handleSslError(self._notification_stream, ssl_errors)
@qslot
def _websocket_event_received(self, event):
try:
self._event_received(json.loads(event))
except ValueError as e:
log.error("Invalid event received: {}".format(e))
def _event_received(self, result, *args, **kwargs):
# Log only relevant events
if result["action"] not in ("ping", "compute.updated"):
log.debug("Event received from controller stream: {}".format(result))
if result["action"] == "template.created" or result["action"] == "template.updated":
from gns3.template_manager import TemplateManager
TemplateManager.instance().templateDataReceivedCallback(result["event"])
elif result["action"] == "template.deleted":
from gns3.template_manager import TemplateManager
TemplateManager.instance().deleteTemplateCallback(result["event"])
elif result["action"] == "compute.created" or result["action"] == "compute.updated":
from .compute_manager import ComputeManager
ComputeManager.instance().computeDataReceivedCallback(result["event"])
elif result["action"] == "project.closed":
from .topology import Topology
project = Topology.instance().project()
if project and project.id() == result["event"]["project_id"]:
Topology.instance().setProject(None)
elif result["action"] == "project.updated":
from .topology import Topology
project = Topology.instance().project()
if project and project.id() == result["event"]["project_id"]:
project.projectUpdatedCallback(result["event"])
elif result["action"] == "log.error" and result["event"].get("message"):
log.error(result["event"].get("message"))
elif result["action"] == "log.warning" and result["event"].get("message"):
log.warning(result["event"].get("message"))
elif result["action"] == "log.info" and result["event"].get("message"):
log.info(result["event"].get("message"), extra={"show": True})
elif result["action"] == "ping":
pass

View File

@@ -15,21 +15,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
try:
import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration
SENTRY_SDK_AVAILABLE = True
except ImportError:
# Sentry SDK is not installed with deb package in order to simplify packaging
SENTRY_SDK_AVAILABLE = False
import sys
import psutil
import os
import platform
import struct
import distro
try:
import raven
from raven.transport.http import HTTPTransport
RAVEN_AVAILABLE = True
except ImportError:
# raven is not installed with deb package in order to simplify packaging
RAVEN_AVAILABLE = False
from .utils.get_resource import get_resource
from .version import __version__, __version_info__
import logging
@@ -41,7 +40,7 @@ if __version_info__[3] != 0:
import faulthandler
# Display a traceback in case of segfault crash. Usefull when frozen
# Not enabled by default for security reason
log.info("Enable catching segfault")
log.debug("Enable catching segfault")
faulthandler.enable()
@@ -51,45 +50,46 @@ class CrashReport:
Report crash to a third party service
"""
DSN = "https://468f899afc3c46d99bad2eb474516d2c:415662f2e4c240829d5eaf8f09ca99b4@app.getsentry.com/38506"
if hasattr(sys, "frozen"):
cacert = get_resource("cacert.pem")
if cacert is not None and os.path.isfile(cacert):
DSN += "?ca_certs={}".format(cacert)
else:
log.warning("The SSL certificate bundle file '{}' could not be found".format(cacert))
DSN = "https://dd662ce99d7e4a04714a89939ec523c9@o19455.ingest.us.sentry.io/38506"
_instance = None
def __init__(self):
# We don't want sentry making noise if an error is catched when you don't have internet
# We don't want sentry making noise if an error is caught when we don't have internet
sentry_errors = logging.getLogger('sentry.errors')
sentry_errors.disabled = True
sentry_uncaught = logging.getLogger('sentry.errors.uncaught')
sentry_uncaught.disabled = True
self._sentry_initialized = False
def captureException(self, exception, value, tb):
from .local_server import LocalServer
local_server = LocalServer.instance().localServerSettings()
if local_server["report_errors"]:
if not RAVEN_AVAILABLE:
return
if os.path.exists(".git"):
log.warning("A .git directory exist crash report is turn off for developers. Instant exit")
sys.exit(1)
if SENTRY_SDK_AVAILABLE:
# Don't send log records as events.
sentry_logging = LoggingIntegration(level=logging.INFO, event_level=None)
try:
sentry_sdk.init(dsn=CrashReport.DSN,
release=__version__,
default_integrations=False,
integrations=[sentry_logging])
except Exception as e:
log.error("Crash report could not be sent: {}".format(e))
return
if hasattr(exception, "fingerprint"):
client = raven.Client(CrashReport.DSN, release=__version__, fingerprint=['{{ default }}', exception.fingerprint], transport=HTTPTransport)
else:
client = raven.Client(CrashReport.DSN, release=__version__, transport=HTTPTransport)
context = {
tags = {
"os:name": platform.system(),
"os:release": platform.release(),
"os:win_32": " ".join(platform.win32_ver()),
"os:mac": "{} {}".format(platform.mac_ver()[0], platform.mac_ver()[2]),
"os:linux": " ".join(platform.linux_distribution()),
"os:linux": distro.name(pretty=True),
}
self._add_qt_information(tags)
with sentry_sdk.configure_scope() as scope:
for key, value in tags.items():
scope.set_tag(key, value)
extra_context = {
"python:version": "{}.{}.{}".format(sys.version_info[0],
sys.version_info[1],
sys.version_info[2]),
@@ -97,26 +97,64 @@ class CrashReport:
"python:encoding": sys.getdefaultencoding(),
"python:frozen": "{}".format(hasattr(sys, "frozen"))
}
context = self._add_qt_information(context)
client.tags_context(context)
try:
report = client.captureException((exception, value, tb))
except Exception as e:
log.error("Can't send crash report to Sentry: {}".format(e))
return
log.info("Crash report sent with event ID: {}".format(client.get_ident(report)))
def _add_qt_information(self, context):
# extra controller and compute information
from .controller import Controller
from .compute_manager import ComputeManager
extra_context["controller:version"] = Controller.instance().version()
extra_context["controller:host"] = Controller.instance().host()
extra_context["controller:connected"] = Controller.instance().connected()
for index, compute in enumerate(ComputeManager.instance().computes()):
extra_context["compute{}:id".format(index)] = compute.id()
extra_context["compute{}:name".format(index)] = compute.name(),
extra_context["compute{}:host".format(index)] = compute.host(),
extra_context["compute{}:connected".format(index)] = compute.connected()
extra_context["compute{}:platform".format(index)] = compute.capabilities().get("platform")
extra_context["compute{}:version".format(index)] = compute.capabilities().get("version")
with sentry_sdk.configure_scope() as scope:
for key, value in extra_context.items():
scope.set_extra(key, value)
def captureException(self, exception, value, tb):
from .local_server import LocalServer
from .local_config import LocalConfig
local_server = LocalServer.instance().localServerSettings()
if local_server["report_errors"]:
if not SENTRY_SDK_AVAILABLE:
log.warning("Cannot capture exception: Sentry SDK is not available")
return
if os.path.exists(LocalConfig.instance().runAsRootPath()):
log.warning("User is running application as root. Crash reports disabled.")
return
if not hasattr(sys, "frozen") and os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", ".git")):
log.warning(".git directory detected, crash reporting is turned off for developers.")
return
try:
error = (exception, value, tb)
sentry_sdk.capture_exception(error=error)
log.info("Crash report sent with event ID: {}".format(sentry_sdk.last_event_id()))
except Exception as e:
log.warning("Can't send crash report to Sentry: {}".format(e))
def _add_qt_information(self, tags):
try:
from .qt import QtCore
import sip
from .qt import sip
except ImportError:
return context
context["psutil:version"] = psutil.__version__
context["pyqt:version"] = QtCore.PYQT_VERSION_STR
context["qt:version"] = QtCore.QT_VERSION_STR
context["sip:version"] = sip.SIP_VERSION_STR
return context
return tags
tags["pyqt:version"] = QtCore.PYQT_VERSION_STR
tags["qt:version"] = QtCore.QT_VERSION_STR
tags["sip:version"] = sip.SIP_VERSION_STR
return tags
@classmethod
def instance(cls):

File diff suppressed because it is too large Load Diff

View File

@@ -24,15 +24,15 @@ log = logging.getLogger(__name__)
class CaptureDialog(QtWidgets.QDialog, Ui_CaptureDialog):
"""
This dialog allow configure the packet capture
This dialog allow to configure the packet capture
"""
def __init__(self, parent, file_name, auto_start, ethernet_link=True):
super().__init__(parent)
self.setupUi(self)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Ok).clicked.connect(self._okButtonClickedSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Cancel).clicked.connect(self.reject)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).clicked.connect(self._okButtonClickedSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Cancel).clicked.connect(self.reject)
if ethernet_link:
self.uiDataLinkTypeComboBox.addItem("Ethernet", "DLT_EN10MB")
@@ -70,6 +70,6 @@ if __name__ == '__main__':
main = QtWidgets.QMainWindow()
dialog = CaptureDialog(main, "test.pcap")
dialog.show()
exit_code = app.exec_()
exit_code = app.exec()
print(dialog.dataLink())
print(dialog.fileName())

View File

@@ -49,6 +49,9 @@ class ConfigurationDialog(QtWidgets.QDialog, Ui_configurationDialog):
self._settings = settings
self._configuration_page = configuration_page
def settings(self):
return self._settings
def on_uiButtonBox_clicked(self, button):
"""
Slot called when a button of the uiButtonBox is clicked.
@@ -56,7 +59,7 @@ class ConfigurationDialog(QtWidgets.QDialog, Ui_configurationDialog):
:param button: button that was clicked (QAbstractButton)
"""
if button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Cancel):
if button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Cancel):
QtWidgets.QDialog.reject(self)
else:
try:

View File

@@ -22,8 +22,8 @@ from gns3.qt import QtWidgets
from gns3.local_config import LocalConfig
from gns3.ui.console_command_dialog_ui import Ui_uiConsoleCommandDialog
from gns3.settings import PRECONFIGURED_TELNET_CONSOLE_COMMANDS, \
PRECONFIGURED_SERIAL_CONSOLE_COMMANDS, \
PRECONFIGURED_VNC_CONSOLE_COMMANDS, \
PRECONFIGURED_SPICE_CONSOLE_COMMANDS, \
CUSTOM_CONSOLE_COMMANDS_SETTINGS
@@ -39,11 +39,14 @@ class ConsoleCommandDialog(QtWidgets.QDialog, Ui_uiConsoleCommandDialog):
def __init__(self, parent, console_type="telnet", current=None):
"""
:params console_type: telnet, serial or vnc
:params console_type: telnet, serial, vnc or spice
:params current: Current console command
"""
super().__init__(parent)
self.setupUi(self)
if console_type == "spice+agent":
# special case for spice+agent, use the spice console type
console_type = "spice"
self._console_type = console_type
self._current = current
@@ -63,8 +66,8 @@ class ConsoleCommandDialog(QtWidgets.QDialog, Ui_uiConsoleCommandDialog):
elif self._console_type == "vnc":
self._consoles = copy.copy(PRECONFIGURED_VNC_CONSOLE_COMMANDS)
self._consoles.update(self._settings[self._console_type])
else:
self._consoles = copy.copy(PRECONFIGURED_SERIAL_CONSOLE_COMMANDS)
elif self._console_type == "spice":
self._consoles = copy.copy(PRECONFIGURED_SPICE_CONSOLE_COMMANDS)
self._consoles.update(self._settings[self._console_type])
self.uiCommandComboBox.clear()
@@ -90,7 +93,7 @@ class ConsoleCommandDialog(QtWidgets.QDialog, Ui_uiConsoleCommandDialog):
"""
Save a custom command to the list
"""
name, ok = QtWidgets.QInputDialog.getText(self, "Add a command", "Command name:", QtWidgets.QLineEdit.Normal)
name, ok = QtWidgets.QInputDialog.getText(self, "Add a command", "Command name:", QtWidgets.QLineEdit.EchoMode.Normal)
command = self.uiCommandPlainTextEdit.toPlainText().strip()
if ok and len(command) > 0:
if command not in self._consoles.values():
@@ -120,9 +123,9 @@ class ConsoleCommandDialog(QtWidgets.QDialog, Ui_uiConsoleCommandDialog):
def getCommand(parent, console_type="telnet", current=None):
dialog = ConsoleCommandDialog(parent, console_type=console_type, current=current)
dialog.show()
if dialog.exec_():
return (True, dialog.uiCommandPlainTextEdit.toPlainText().replace("\n", " "))
return (False, None)
if dialog.exec():
return True, dialog.uiCommandPlainTextEdit.toPlainText().replace("\n", " ")
return False, None
if __name__ == '__main__':

View File

@@ -0,0 +1,205 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Custom adapters configuration.
"""
import textwrap
import re
from ..qt import QtCore, QtWidgets
from ..ui.custom_adapters_configuration_dialog_ui import Ui_CustomAdaptersConfigurationDialog
class NoEditDelegate(QtWidgets.QStyledItemDelegate):
def __init__(self, parent=None):
QtWidgets.QStyledItemDelegate.__init__(self, parent=parent)
def createEditor(self, parent, option, index):
return None
class TreeWidgetItem(QtWidgets.QTreeWidgetItem):
def __lt__(self, other):
column = self.treeWidget().sortColumn()
key1 = self.text(column)
key2 = other.text(column)
return self.natural_sort_key(key1) < self.natural_sort_key(key2)
@staticmethod
def natural_sort_key(key):
regex = r'(\d*\.\d+|\d+)'
parts = re.split(regex, key)
return tuple((e if i % 2 == 0 else float(e)) for i, e in enumerate(parts))
class CustomAdaptersConfigurationDialog(QtWidgets.QDialog, Ui_CustomAdaptersConfigurationDialog):
"""
Custom adapters configuration dialog.
:param parent: parent widget
"""
def __init__(self, ports, custom_adapters, default_adapter_type=None, adapter_types=None, base_mac_address=None, parent=None):
super().__init__(parent)
self.setupUi(self)
self._ports = ports
self._default_adapter_type = default_adapter_type
self._adapter_types = adapter_types
self._custom_adapters = custom_adapters
self._base_mac_address = base_mac_address
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Reset).clicked.connect(self._resetSlot)
if self._default_adapter_type and self._adapter_types:
self.uiAdaptersTreeWidget.setColumnCount(3)
self.uiAdaptersTreeWidget.headerItem().setText(2, "Adapter type")
if self._base_mac_address:
self.uiAdaptersTreeWidget.setColumnCount(4)
self.uiAdaptersTreeWidget.headerItem().setText(3, "MAC address")
self._populateWidgets()
# resize to fit the tree widget
width = 0
for column in range(self.uiAdaptersTreeWidget.columnCount()):
width += 20 + self.uiAdaptersTreeWidget.columnWidth(column)
self.resize(QtCore.QSize(width, self.height()))
def _getCustomAdapterSettings(self, adapter_number):
for custom_adapter in self._custom_adapters:
if custom_adapter["adapter_number"] == adapter_number:
return custom_adapter
return {}
def _MacToInteger(self, mac_address):
"""
Convert a macaddress with the format 00:0c:29:11:b0:0a to a int
:param mac_address: The mac address
:returns: Integer
"""
return int(mac_address.replace(":", ""), 16)
def _IntegerToMac(self, integer):
"""
Convert an integer to a mac address
"""
return ":".join(textwrap.wrap("%012x" % (integer), width=2))
def _populateWidgets(self):
adapter_number = 0
for port_name in self._ports:
item = TreeWidgetItem(self.uiAdaptersTreeWidget)
item.setFlags(item.flags() | QtCore.Qt.ItemFlag.ItemIsEditable)
item.setText(0, "Adapter {}".format(adapter_number))
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, adapter_number)
item.setData(1, QtCore.Qt.ItemDataRole.UserRole, port_name)
custom_adapter = self._getCustomAdapterSettings(adapter_number)
item.setText(1, custom_adapter.get("port_name", port_name))
if self._default_adapter_type and self._adapter_types:
combobox = QtWidgets.QComboBox(self)
if type(self._adapter_types) == list:
for adapter_type in self._adapter_types:
combobox.addItem("{}".format(adapter_type))
else:
index = 0
for adapter_type, adapter_description in self._adapter_types.items():
combobox.addItem("{}".format(adapter_type))
combobox.setItemData(index, adapter_description, QtCore.Qt.ItemDataRole.ToolTipRole)
index += 1
adapter_type_index = combobox.findText(custom_adapter.get("adapter_type", self._default_adapter_type))
combobox.setCurrentIndex(adapter_type_index)
self.uiAdaptersTreeWidget.setItemWidget(item, 2, combobox)
if self._base_mac_address:
self.uiAdaptersTreeWidget.addTopLevelItem(item)
line_edit = QtWidgets.QLineEdit(self)
line_edit.setInputMask("HH:HH:HH:HH:HH:HH;_")
mac_address = self._IntegerToMac(self._MacToInteger(self._base_mac_address) + adapter_number)
line_edit.setText(custom_adapter.get("mac_address", mac_address))
self.uiAdaptersTreeWidget.setItemWidget(item, 3, line_edit)
adapter_number += 1
self.uiAdaptersTreeWidget.setItemDelegateForColumn(0, NoEditDelegate(self))
self.uiAdaptersTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
self.uiAdaptersTreeWidget.setSortingEnabled(True)
for column in range(self.uiAdaptersTreeWidget.columnCount()):
self.uiAdaptersTreeWidget.resizeColumnToContents(column)
def _resetSlot(self):
self.uiAdaptersTreeWidget.clear()
self._custom_adapters.clear()
self._populateWidgets()
def _updateCustomAdapters(self):
self._custom_adapters.clear()
for row in range(self.uiAdaptersTreeWidget.topLevelItemCount()):
custom_adapter_settings = {}
item = self.uiAdaptersTreeWidget.topLevelItem(row)
port_name = item.text(1)
adapter_number = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
custom_adapter_settings["adapter_number"] = adapter_number
original_port_name = item.data(1, QtCore.Qt.ItemDataRole.UserRole)
if not port_name:
QtWidgets.QMessageBox.critical(self, "Port name", "Port name cannot be empty for adapter {}".format(adapter_number))
return False
if original_port_name != port_name:
custom_adapter_settings["port_name"] = port_name
if self._default_adapter_type and self._adapter_types:
adapter_type = self.uiAdaptersTreeWidget.itemWidget(item, 2).currentText()
if self._default_adapter_type != adapter_type:
custom_adapter_settings["adapter_type"] = adapter_type
if self._base_mac_address:
mac_address = self.uiAdaptersTreeWidget.itemWidget(item, 3).text()
if mac_address and mac_address != ":::::":
if not re.search(r"""^([0-9a-fA-F]{2}[:]){5}[0-9a-fA-F]{2}$""", mac_address):
QtWidgets.QMessageBox.critical(self, "MAC address", "Invalid MAC address (format required: hh:hh:hh:hh:hh:hh)")
return False
default_mac_address = self._IntegerToMac(self._MacToInteger(self._base_mac_address) + adapter_number)
if mac_address != default_mac_address:
custom_adapter_settings["mac_address"] = mac_address
if len(custom_adapter_settings) > 1:
# only save if there is more than the adapter_number key
self._custom_adapters.append(custom_adapter_settings.copy())
return True
def done(self, result):
"""
Called when the dialog is closed.
:param result: boolean (accepted or rejected)
"""
if result:
if not self._updateCustomAdapters():
return
super().done(result)

View File

@@ -95,13 +95,14 @@ class DoctorDialog(QtWidgets.QDialog, Ui_DoctorDialog):
def checkAVGInstalled(self):
"""Checking if AVG software is not installed"""
for proc in psutil.process_iter():
try:
psinfo = proc.as_dict(["exe"])
if psinfo["exe"] and "AVG\\" in psinfo["exe"]:
return (2, "AVG has known issues with GNS3, even after you disable it. You must whitelist dynamips.exe in the AVG preferences.")
except psutil.NoSuchProcess:
pass
if sys.platform.startswith("win32"):
for proc in psutil.process_iter():
try:
psinfo = proc.as_dict(["exe"])
if psinfo["exe"] and "AVG\\" in psinfo["exe"]:
return (2, "AVG has known issues with GNS3, even after you disable it. You must whitelist dynamips.exe in the AVG preferences.")
except psutil.NoSuchProcess:
pass
return (0, None)
def checkFreeRam(self):
@@ -136,20 +137,17 @@ class DoctorDialog(QtWidgets.QDialog, Ui_DoctorDialog):
if not os.path.exists(path):
return (2, "Ubridge path {path} doesn't exists".format(path=path))
request_setuid = False
if sys.platform.startswith("linux"):
if "security.capability" in os.listxattr(path):
caps = os.getxattr(path, "security.capability")
# test the 2nd byte and check if the 13th bit (CAP_NET_RAW) is set
if not struct.unpack("<IIIII", caps)[1] & 1 << 13:
return(2, "Ubridge require CAP_NET_RAW. Run sudo setcap cap_net_admin,cap_net_raw=ep {path}".format(path=path))
else:
# capabilities not supported
request_setuid = True
try:
if "security.capability" not in os.listxattr(path) or not struct.unpack("<IIIII", os.getxattr(path, "security.capability"))[1] & 1 << 13:
return (2, "Ubridge requires CAP_NET_RAW. Run sudo setcap cap_net_admin,cap_net_raw=ep {path}".format(path=path))
except (OSError, AttributeError) as e:
# Due to a Python bug, os.listxattr could be missing: https://github.com/GNS3/gns3-gui/issues/2010
return (1, "Could not determine if CAP_NET_RAW capability is set for uBridge: {}".format(e))
if sys.platform.startswith("darwin") or request_setuid:
if os.stat(path).st_uid != 0 or not os.stat(path).st_mode & stat.S_ISUID:
return (2, "Ubridge should be setuid. Run sudo chown root {path} and sudo chmod 4755 {path}".format(path=path))
if sys.platform.startswith("darwin"):
if os.stat(path).st_uid != 0 or not os.stat(path).st_mode & stat.S_ISUID:
return (2, "Ubridge should be setuid. Run sudo chown root:admin {path} and sudo chmod 4750 {path}".format(path=path))
return (0, None)
def checkDynamipsPermission(self):
@@ -164,11 +162,15 @@ class DoctorDialog(QtWidgets.QDialog, Ui_DoctorDialog):
if not os.path.exists(path):
return (2, "Dynamips path {path} doesn't exists".format(path=path))
if sys.platform.startswith("linux") and "security.capability" in os.listxattr(path):
caps = os.getxattr(path, "security.capability")
# test the 2nd byte and check if the 13th bit (CAP_NET_RAW) is set
if not struct.unpack("<IIIII", caps)[1] & 1 << 13:
return (2, "Dynamips require CAP_NET_RAW. Run sudo setcap cap_net_raw,cap_net_admin+eip {path}".format(path=path))
try:
if sys.platform.startswith("linux") and "security.capability" in os.listxattr(path):
caps = os.getxattr(path, "security.capability")
# test the 2nd byte and check if the 13th bit (CAP_NET_RAW) is set
if not struct.unpack("<IIIII", caps)[1] & 1 << 13:
return (2, "Dynamips requires CAP_NET_RAW. Run sudo setcap cap_net_raw,cap_net_admin+eip {path}".format(path=path))
except AttributeError:
# Due to a Python bug, os.listxattr could be missing: https://github.com/GNS3/gns3-gui/issues/2010
return (1, "Could not determine if CAP_NET_RAW capability is set for Dynamips (Python bug)".format(path=path))
return (0, None)
def checkGNS3InstalledTwice(self):
@@ -220,5 +222,5 @@ if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
main = QtWidgets.QMainWindow()
dialog = DoctorDialog(main, console=True)
#dialog.show()
#exit_code = app.exec_()
# dialog.show()
#exit_code = app.exec()

View File

@@ -89,6 +89,9 @@ class EditComputeDialog(QtWidgets.QDialog, Ui_EditComputeDialog):
if not re.match(r"^[a-zA-Z0-9\.{}-]+$".format("\u0370-\u1CDF\u2C00-\u30FF\u4E00-\u9FBF"), host):
QtWidgets.QMessageBox.critical(self, "Remote compute", "Invalid remote server hostname {}".format(host))
return
if name == "gns3vm":
QtWidgets.QMessageBox.critical(self, "Remote compute", "{} is a reserved name".format(name))
return
if len(name) == 0:
QtWidgets.QMessageBox.critical(self, "Remote compute", "Invalid remote server name {}".format(name))
return
@@ -118,4 +121,4 @@ if __name__ == '__main__':
main = QtWidgets.QMainWindow()
dialog = EditComputeDialog(main)
dialog.show()
exit_code = app.exec_()
exit_code = app.exec()

View File

@@ -15,10 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import re
from ..qt import QtWidgets
from ..qt import QtWidgets, QtCore, qslot, qpartial
from ..topology import Topology
from ..ui.edit_project_dialog_ui import Ui_EditProjectDialog
@@ -39,6 +36,61 @@ class EditProjectDialog(QtWidgets.QDialog, Ui_EditProjectDialog):
self.uiProjectAutoStartCheckBox.setChecked(self._project.autoStart())
self.uiSceneWidthSpinBox.setValue(self._project.sceneWidth())
self.uiSceneHeightSpinBox.setValue(self._project.sceneHeight())
self.uiNodeGridSizeSpinBox.setValue(self._project.nodeGridSize())
self.uiDrawingGridSizeSpinBox.setValue(self._project.drawingGridSize())
self.uiGlobalVariablesGrid.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
self.uiNewVarButton = QtWidgets.QPushButton('Add new variable', self)
self.uiNewVarButton.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
self.uiNewVarButton.clicked.connect(self.onAddNewVariable)
self.uiGlobalVariablesGrid.addWidget(self.uiNewVarButton, 0, 3, QtCore.Qt.AlignmentFlag.AlignRight)
self._variables = self._project.variables()
if not self._variables:
self._variables = [{"name": "", "value": ""}]
self.updateGlobalVariables()
def updateGlobalVariables(self):
while True:
item = self.uiGlobalVariablesGrid.takeAt(1)
if item is None:
break
elif item.widget():
item.widget().deleteLater()
for i, variable in enumerate(self._variables, start=1):
nameLabel = QtWidgets.QLabel()
nameLabel.setText("Name:")
self.uiGlobalVariablesGrid.addWidget(nameLabel, i, 0)
nameEdit = QtWidgets.QLineEdit()
nameEdit.setText(variable.get("name", ""))
nameEdit.textChanged.connect(qpartial(self.onNameChange, variable))
self.uiGlobalVariablesGrid.addWidget(nameEdit, i, 1)
valueLabel = QtWidgets.QLabel()
valueLabel.setText("Value:")
self.uiGlobalVariablesGrid.addWidget(valueLabel, i, 2)
valueEdit = QtWidgets.QLineEdit()
valueEdit.setText(variable.get("value", ""))
valueEdit.textChanged.connect(qpartial(self.onValueChange, variable))
self.uiGlobalVariablesGrid.addWidget(valueEdit, i, 3)
@qslot
def onAddNewVariable(self, event):
self._variables += [{"name": "", "value": ""}]
self.updateGlobalVariables()
def onNameChange(self, variable, text):
variable["name"] = text
def onValueChange(self, variable, text):
variable["value"] = text
def _cleanVariables(self):
return [v for v in self._variables if v.get("name").strip() != ""]
def done(self, result):
"""
@@ -48,11 +100,19 @@ class EditProjectDialog(QtWidgets.QDialog, Ui_EditProjectDialog):
"""
if result:
self._project.setName(self.uiProjectNameLineEdit.text())
self._project.setAutoOpen(self.uiProjectAutoOpenCheckBox.isChecked())
self._project.setAutoClose(not self.uiProjectAutoCloseCheckBox.isChecked())
self._project.setAutoStart(self.uiProjectAutoStartCheckBox.isChecked())
self._project.setSceneHeight(self.uiSceneHeightSpinBox.value())
self._project.setSceneWidth(self.uiSceneWidthSpinBox.value())
self._project.update()
node_grid_size = self.uiNodeGridSizeSpinBox.value()
drawing_grid_size = self.uiDrawingGridSizeSpinBox.value()
if node_grid_size % drawing_grid_size != 0:
QtWidgets.QMessageBox.critical(self, "Grid sizes", "Invalid grid sizes which will create overlapping lines")
else:
self._project.setNodeGridSize(node_grid_size)
self._project.setDrawingGridSize(drawing_grid_size)
self._project.setName(self.uiProjectNameLineEdit.text())
self._project.setAutoOpen(self.uiProjectAutoOpenCheckBox.isChecked())
self._project.setAutoClose(not self.uiProjectAutoCloseCheckBox.isChecked())
self._project.setAutoStart(self.uiProjectAutoStartCheckBox.isChecked())
self._project.setSceneHeight(self.uiSceneHeightSpinBox.value())
self._project.setSceneWidth(self.uiSceneWidthSpinBox.value())
self._project.setVariables(self._cleanVariables())
self._project.update()
super().done(result)

View File

@@ -25,6 +25,7 @@ from gns3.version import __version__
from gns3.qt import QtWidgets, QtCore
from gns3.ui.export_debug_dialog_ui import Ui_ExportDebugDialog
from gns3.local_config import LocalConfig
from gns3.controller import Controller
import logging
log = logging.getLogger(__name__)
@@ -44,16 +45,27 @@ class ExportDebugDialog(QtWidgets.QDialog, Ui_ExportDebugDialog):
self.uiOkButton.clicked.connect(self._okButtonClickedSlot)
def _okButtonClickedSlot(self):
path, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Export debug file", None, "Zip file (*.zip)", "Zip file (*.zip)")
if len(path) == 0:
if Controller.instance().isRemote():
QtWidgets.QMessageBox.critical(self, "Debug", "Export debug information from a remote server is not supported")
self.reject()
return
log.info("Export debug information to %s", path)
self._path, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Export debug file", None, "Zip file (*.zip)", "Zip file (*.zip)")
if len(self._path) == 0:
self.reject()
return
if Controller.instance().connected():
Controller.instance().post("/debug", self._exportDebugCallback)
else:
self._exportDebugCallback({}, error=True)
def _exportDebugCallback(self, result, error=False, **kwargs):
log.debug("Export debug information to %s", self._path)
try:
with ZipFile(path, 'w') as zip:
with ZipFile(self._path, 'w') as zip:
zip.writestr("debug.txt", self._getDebugData())
dir = LocalConfig.instance().configDirectory()
for filename in os.listdir(dir):
@@ -61,12 +73,20 @@ class ExportDebugDialog(QtWidgets.QDialog, Ui_ExportDebugDialog):
if os.path.isfile(path):
zip.write(path, filename)
dir = self._project.filesDir()
if dir:
dir = os.path.join(LocalConfig.instance().configDirectory(), "debug")
if os.path.exists(dir):
for filename in os.listdir(dir):
path = os.path.join(dir, filename)
if os.path.isfile(path):
zip.write(path, filename)
if self._project:
dir = self._project.filesDir()
if dir:
for filename in os.listdir(dir):
path = os.path.join(dir, filename)
if os.path.isfile(path):
zip.write(path, filename)
except OSError as e:
QtWidgets.QMessageBox.critical(self, "Debug", "Can't export debug information: {}".format(str(e)))
self.accept()

View File

@@ -48,8 +48,8 @@ class FileEditorDialog(QtWidgets.QDialog, Ui_FileEditorDialog):
self.setWindowTitle(target.name() + " " + os.path.basename(path))
self.uiRefreshButton.pressed.connect(self._refreshSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Save).clicked.connect(self._okButtonClickedSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Cancel).clicked.connect(self.reject)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Save).clicked.connect(self._okButtonClickedSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Cancel).clicked.connect(self.reject)
self._refreshSlot()
@@ -66,7 +66,7 @@ class FileEditorDialog(QtWidgets.QDialog, Ui_FileEditorDialog):
def _getCallback(self, result, error=False, raw_body=None, **kwargs):
if not error:
self.uiFileTextEdit.setText(raw_body.decode("utf-8"))
elif result["status"] == 404:
self.uiFileTextEdit.setText(raw_body.decode("utf-8", errors="ignore"))
elif result.get("status") == 404:
if self._default:
self.uiFileTextEdit.setText(self._default)

View File

@@ -0,0 +1,178 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from ..qt import QtGui, QtWidgets, qslot
from ..ui.filter_dialog_ui import Ui_FilterDialog
import logging
log = logging.getLogger(__name__)
class FilterDialog(QtWidgets.QDialog, Ui_FilterDialog):
"""
Filter dialog.
"""
def __init__(self, parent, link):
super().__init__(parent)
self.setupUi(self)
self._link = link
self._filters = {}
self._link.updated_link_signal.connect(self._updateUiSlot)
self._link.listAvailableFilters(self._listAvailableFiltersCallback)
self._initialized = False
self._filter_items = {}
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).clicked.connect(self._applyPreferencesSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help).clicked.connect(self._helpSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Reset).clicked.connect(self._resetSlot)
def _listAvailableFiltersCallback(self, result, error=False, *args, **kwargs):
if error:
log.warning("Error while listing information about the link: {}".format(result["message"]))
return
self._filters = result
self._initialized = True
self._updateUiSlot()
@qslot
def _updateUiSlot(self, *args):
# Empty the main layout
while True:
item = self.uiVerticalLayout.takeAt(0)
if item is None:
break
elif item.widget():
item.widget().deleteLater()
if len(self._filters) == 0:
QtWidgets.QMessageBox.critical(self, "Link", "No filter available for this link. Try with a different node type.")
self.reject()
self._tabWidget = QtWidgets.QTabWidget(self)
for i, filter in enumerate(self._filters):
tab = QtWidgets.QWidget()
self._tabWidget.addTab(tab, filter['name'])
self._tabWidget.setTabToolTip(i, filter['description'])
self._tabWidget.setTabIcon(i, QtGui.QIcon(':/icons/led_red.svg'))
vlayout = QtWidgets.QVBoxLayout()
gridLayout = QtWidgets.QGridLayout()
line = 0
filter["spinBoxes"] = []
filter["textEdits"] = []
nb_spin = 0
for param in filter["parameters"]:
label = QtWidgets.QLabel()
label.setText(param["name"] + ":")
gridLayout.addWidget(label, line, 0, 1, 1)
if param["type"] == "int":
spinBox = QtWidgets.QSpinBox()
filter["spinBoxes"].append(spinBox)
spinBox.setMinimum(param["minimum"])
spinBox.setMaximum(param["maximum"])
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(spinBox.sizePolicy().hasHeightForWidth())
spinBox.setSizePolicy(sizePolicy)
try:
value = self._link.filters()[filter["type"]][nb_spin]
spinBox.setValue(value)
if value != 0:
self._tabWidget.setTabIcon(i, QtGui.QIcon(':/icons/led_green.svg'))
except(KeyError, IndexError):
pass
nb_spin += 1
gridLayout.addWidget(spinBox, line, 1, 1, 1)
unit = QtWidgets.QLabel()
unit.setText(param["unit"])
gridLayout.addWidget(unit, line, 2, 1, 1)
elif param["type"] == "text":
textEdit = QtWidgets.QTextEdit()
textEdit.setAcceptRichText(False)
filter["textEdits"].append(textEdit)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
textEdit.setMinimumWidth(300)
textEdit.setSizePolicy(sizePolicy)
try:
text = self._link.filters()[filter["type"]][0]
textEdit.setPlainText(text)
if text:
self._tabWidget.setTabIcon(i, QtGui.QIcon(':/icons/led_green.svg'))
except(KeyError, IndexError):
pass
gridLayout.addWidget(textEdit, line, 1, 1, 1)
line += 1
spacerItem = QtWidgets.QSpacerItem(1, 1, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
gridLayout.addItem(spacerItem, line, 0, 1, 1)
vlayout.addLayout(gridLayout)
tab.setLayout(vlayout)
self.uiVerticalLayout.addWidget(self._tabWidget)
@qslot
def _applyPreferencesSlot(self, *args):
new_filters = {}
for filter in self._filters:
new_filters[filter["type"]] = []
for spinBox in filter["spinBoxes"]:
new_filters[filter["type"]].append(spinBox.value())
for spinBox in filter["textEdits"]:
new_filters[filter["type"]].append(spinBox.toPlainText())
self._link.setFilters(new_filters)
self._link.update()
@qslot
def _helpSlot(self, *args):
help_text = "Filters are applied to packets in both direction.\n\n"
filter_nb = 0
for filter in self._filters:
help_text += "{}: {}".format(filter["name"], filter["description"])
filter_nb += 1
if len(self._filters) != filter_nb:
help_text += "\n\n"
QtWidgets.QMessageBox.information(self, "Help for filters", help_text)
@qslot
def _resetSlot(self, *args):
filters = {}
self._link.setFilters(filters)
self._link.update()
def done(self, result):
"""
Called when the dialog is closed.
:param result: boolean (accepted or rejected)
"""
if result and self._initialized:
self._applyPreferencesSlot()
super().done(result)

View File

@@ -33,14 +33,15 @@ class IdlePCDialog(QtWidgets.QDialog, Ui_IdlePCDialog):
super().__init__(parent)
self.setupUi(self)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applySlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self._helpSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).clicked.connect(self._applySlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help).clicked.connect(self._helpSlot)
self._router = router
self._idlepcs = idlepcs
for value in self._idlepcs:
match = re.search(r"^(0x[0-9a-f]+)\s+\[(\d+)\]$", value)
# validate idle-pc format, e.g. 0x60c09aa0
match = re.search(r"^(0x[0-9a-f]{8})\s+\[(\d+)\]$", value)
if match:
idlepc = match.group(1)
count = int(match.group(2))
@@ -61,7 +62,7 @@ Select each value that appears in the list and click Apply, and note the CPU usa
"""
QtWidgets.QMessageBox.information(self, "Hints for Idle-PC", help_text)
def _applySlot(self):
def _applySlot(self, update_template=False):
"""
Applies an Idle-PC value.
"""
@@ -77,8 +78,9 @@ Select each value that appears in the list and click Apply, and note the CPU usa
if hasattr(node, "idlepc") and node.settings()["image"] == ios_image:
node.setIdlepc(idlepc)
# apply the idle-pc to templates with the same IOS image
self._router.module().updateImageIdlepc(ios_image, idlepc)
if update_template:
# apply the idle-pc to templates with the same IOS image
self._router.module().updateImageIdlepc(ios_image, idlepc)
def done(self, result):
"""
@@ -88,5 +90,5 @@ Select each value that appears in the list and click Apply, and note the CPU usa
"""
if result:
self._applySlot()
self._applySlot(update_template=True)
super().done(result)

View File

@@ -1,121 +0,0 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from gns3.qt import QtWidgets, QtCore
from gns3.ui.new_appliance_dialog_ui import Ui_NewApplianceDialog
from gns3.dialogs.preferences_dialog import PreferencesDialog
import logging
log = logging.getLogger(__name__)
class NewApplianceDialog(QtWidgets.QDialog, Ui_NewApplianceDialog):
"""
This dialog allow user to create a new appliance by opening
the correct creation dialog
"""
def __init__(self, parent):
super().__init__(parent)
self.setupUi(self)
self.uiImportApplianceTemplatePushButton.clicked.connect(self._importApplianceTemplatePushButtonClickedSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Ok).clicked.connect(self._okButtonClickedSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Cancel).clicked.connect(self.reject)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self._helpButtonClickedSlot)
def _importApplianceTemplatePushButtonClickedSlot(self):
self.accept()
from gns3.main_window import MainWindow
MainWindow.instance().openApplianceActionSlot()
def _okButtonClickedSlot(self):
self.accept()
dialog = PreferencesDialog(self.parent())
if self.uiAddIOSRouterRadioButton.isChecked():
self._setPreferencesPane(dialog, "Dynamips").uiNewIOSRouterPushButton.clicked.emit(False)
elif self.uiAddIOUDeviceRadioButton.isChecked():
self._setPreferencesPane(dialog, "IOS on UNIX").uiNewIOUDevicePushButton.clicked.emit(False)
elif self.uiAddQemuVMRadioButton.isChecked():
self._setPreferencesPane(dialog, "QEMU").uiNewQemuVMPushButton.clicked.emit(False)
elif self.uiAddVirtualBoxVMRadioButton.isChecked():
self._setPreferencesPane(dialog, "VirtualBox").uiNewVirtualBoxVMPushButton.clicked.emit(False)
elif self.uiAddVMwareVMRadioButton.isChecked():
self._setPreferencesPane(dialog, "VMware").uiNewVMwareVMPushButton.clicked.emit(False)
elif self.uiAddDockerVMRadioButton.isChecked():
self._setPreferencesPane(dialog, "Docker").uiNewDockerVMPushButton.clicked.emit(False)
elif self.uiAddVPCSRadioButton.isChecked():
self._setPreferencesPane(dialog, "VPCS").uiNewVPCSPushButton.clicked.emit(False)
elif self.uiAddCloudRadioButton.isChecked():
self._setPreferencesPane(dialog, "Cloud nodes").uiNewCloudNodePushButton.clicked.emit(False)
elif self.uiAddEthernetHubRadioButton.isChecked():
self._setPreferencesPane(dialog, "Ethernet hubs").uiNewEthernetHubPushButton.clicked.emit(False)
elif self.uiAddEthernetSwitchRadioButton.isChecked():
self._setPreferencesPane(dialog, "Ethernet switches").uiNewEthernetSwitchPushButton.clicked.emit(False)
else:
return
dialog.exec_()
def _helpButtonClickedSlot(self):
help_text = """<html><p>This dialog helps you to add an appliance template in GNS3. In all cases you must provide your own images.</p>
<p>You can download appliance template files (.gns3appliance) from <a href="https://gns3.com/marketplace/appliances">the GNS3 website</a></p>
<p>A template file provides community tested settings to run a specific appliance in GNS3.</p></html>
"""
QtWidgets.QMessageBox.information(self, "Help for adding a new appliance template", help_text)
def _setPreferencesPane(self, dialog, name):
"""
Finds the first child of the QTreeWidgetItem name.
:param dialog: PreferencesDialog instance
:param name: QTreeWidgetItem name
:returns: current QWidget
"""
panes = dialog.uiTreeWidget.findItems(name, QtCore.Qt.MatchFixedString)
if len(panes) > 0:
child_pane = panes[0].child(0)
dialog.uiTreeWidget.setCurrentItem(child_pane)
else:
i = 0
root = dialog.uiTreeWidget.invisibleRootItem()
while i < root.childCount():
root_item = root.child(i)
x = 0
while x < root_item.childCount():
item = root_item.child(x)
x += 1
if item.text(0) == name:
dialog.uiTreeWidget.setCurrentItem(item)
i += 1
dialog.addModifiedPage(dialog.uiStackedWidget.currentWidget())
return dialog.uiStackedWidget.currentWidget()
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
main = QtWidgets.QMainWindow()
dialog = NewApplianceDialog(main)
dialog._setPreferencesPane(PreferencesDialog(main), "Ethernet hubs").uiNewEthernetHubPushButton.clicked.emit(False)
dialog.show()
exit_code = app.exec_()

View File

@@ -0,0 +1,288 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import tempfile
import json
import os
from ..qt import sip
from gns3.qt import QtCore, QtWidgets, qpartial
from gns3.controller import Controller
from gns3.appliance_manager import ApplianceManager
from ..ui.new_template_wizard_ui import Ui_NewTemplateWizard
import logging
log = logging.getLogger(__name__)
class NewTemplateWizard(QtWidgets.QWizard, Ui_NewTemplateWizard):
"""
New template wizard.
"""
def __init__(self, parent):
super().__init__(parent)
self.setupUi(self)
self.setWizardStyle(QtWidgets.QWizard.WizardStyle.ModernStyle)
if sys.platform.startswith("darwin"):
# we want to see the cancel button on OSX
self.setOptions(QtWidgets.QWizard.WizardOption.NoDefaultButton)
# add a custom button to show appliance information
self.setButtonText(QtWidgets.QWizard.WizardButton.CustomButton1, "&Update from online registry")
self.setOption(QtWidgets.QWizard.WizardOption.HaveCustomButton1, True)
self.customButtonClicked.connect(self._downloadAppliancesSlot)
self.button(QtWidgets.QWizard.WizardButton.CustomButton1).hide()
self.uiFilterLineEdit.textChanged.connect(self._filterTextChangedSlot)
ApplianceManager.instance().appliances_changed_signal.connect(self._appliancesChangedSlot)
def _downloadAppliancesSlot(self):
"""
Request server to update appliances from online registry.
"""
ApplianceManager.instance().refresh(update=True)
Controller.instance().clearStaticCache()
def _appliancesChangedSlot(self):
"""
Called when the appliances have been updated.
"""
self._get_appliances_from_server()
QtWidgets.QMessageBox.information(self, "Appliances", "Appliances are up-to-date!")
def _filterTextChangedSlot(self, text):
self._get_appliances_from_server(appliance_filter=text)
def _setItemIcon(self, item, icon):
if item is None or sip.isdeleted(item):
return
item.setIcon(0, icon)
def _get_tooltip_text(self, appliance):
"""
Gets the appliance information to be displayed in the tooltip.
"""
info = (("Product", "product_name"),
("Vendor", "vendor_name"),
("Availability", "availability"),
("Status", "status"),
("Maintainer", "maintainer"))
if "qemu" in appliance:
qemu_info = (("vCPUs", "qemu/cpus"),
("RAM", "qemu/ram"),
("Adapters", "qemu/adapters"),
("Adapter type", "qemu/adapter_type"),
("Console type", "qemu/console_type"),
("Architecture", "qemu/arch"),
("Console type", "qemu/console_type"),
("KVM", "qemu/kvm"))
info = info + qemu_info
elif "docker" in appliance:
docker_info = (("Image", "docker/image"),
("Adapters", "docker/adapters"),
("Console type", "docker/console_type"))
info = info + docker_info
elif "iou" in appliance:
iou_info = (("RAM", "iou/ram"),
("NVRAM", "iou/nvram"),
("Ethernet adapters", "iou/ethernet_adapters"),
("Serial adapters", "iou/serial_adapters"))
info = info + iou_info
elif "dynamips" in appliance:
dynamips_info = (("Platform", "dynamips/platform"),
("Chassis", "dynamips/chassis"),
("Midplane", "dynamips/midplane"),
("NPE", "dynamips/npe"),
("RAM", "dynamips/ram"),
("NVRAM", "dynamips/nvram"),
("slot0", "dynamips/slot0"),
("slot1", "dynamips/slot1"),
("slot2", "dynamips/slot2"),
("slot3", "dynamips/slot3"),
("slot4", "dynamips/slot4"),
("slot5", "dynamips/slot5"),
("slot6", "dynamips/slot6"),
("wic0", "dynamips/wic0"),
("wic1", "dynamips/wic1"),
("wic2", "dynamips/wic2"))
info = info + dynamips_info
text_info = ""
for (name, key) in info:
if "/" in key:
key, subkey = key.split("/")
value = appliance.get(key, {}).get(subkey, None)
else:
value = appliance.get(key, None)
if value is None:
continue
text_info += "<span style='font-weight:bold;'>{}</span>: {}<br>".format(name, value)
return text_info
def _get_appliances_from_server(self, appliance_filter=None):
"""
Gets the appliances from the server and display them.
"""
self.uiAppliancesTreeWidget.clear()
parent_routers = QtWidgets.QTreeWidgetItem(self.uiAppliancesTreeWidget)
parent_routers.setText(0, "Routers")
parent_routers.setFlags(parent_routers.flags() & ~QtCore.Qt.ItemFlag.ItemIsSelectable)
parent_switches = QtWidgets.QTreeWidgetItem(self.uiAppliancesTreeWidget)
parent_switches.setText(0, "Switches")
parent_switches.setFlags(parent_switches.flags() & ~QtCore.Qt.ItemFlag.ItemIsSelectable)
parent_guests = QtWidgets.QTreeWidgetItem(self.uiAppliancesTreeWidget)
parent_guests.setText(0, "Guests")
parent_guests.setFlags(parent_guests.flags() & ~QtCore.Qt.ItemFlag.ItemIsSelectable)
parent_firewalls = QtWidgets.QTreeWidgetItem(self.uiAppliancesTreeWidget)
parent_firewalls.setText(0, "Firewalls")
parent_firewalls.setFlags(parent_firewalls.flags() & ~QtCore.Qt.ItemFlag.ItemIsSelectable)
self.uiAppliancesTreeWidget.expandAll()
for appliance in ApplianceManager.instance().appliances():
if appliance_filter is None:
appliance_filter = self.uiFilterLineEdit.text().strip()
if appliance_filter and appliance_filter.lower() not in appliance["name"].lower():
continue
if appliance["category"] == "router":
item = QtWidgets.QTreeWidgetItem(parent_routers)
elif appliance["category"].endswith("switch"):
item = QtWidgets.QTreeWidgetItem(parent_switches)
elif appliance["category"] == "firewall":
item = QtWidgets.QTreeWidgetItem(parent_firewalls)
elif appliance["category"] == "guest":
item = QtWidgets.QTreeWidgetItem(parent_guests)
if appliance["builtin"]:
appliance_name = appliance["name"]
else:
appliance_name = "{} (custom)".format(appliance["name"])
item.setText(0, appliance_name)
#item.setText(1, appliance["category"].capitalize().replace("_", " "))
if "qemu" in appliance:
item.setText(1, "Qemu")
elif "iou" in appliance:
item.setText(1, "IOU")
elif "dynamips" in appliance:
item.setText(1, "Dynamips")
elif "docker" in appliance:
item.setText(1, "Docker")
else:
item.setText(1, "N/A")
item.setText(2, appliance["vendor_name"])
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, appliance)
#item.setSizeHint(0, QtCore.QSize(32, 32))
item.setToolTip(0, self._get_tooltip_text(appliance))
Controller.instance().getSymbolIcon(appliance.get("symbol"), qpartial(self._setItemIcon, item),
fallback=":/symbols/" + appliance["category"] + ".svg")
self.uiAppliancesTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
self.uiAppliancesTreeWidget.resizeColumnToContents(0)
if not appliance_filter:
self.uiAppliancesTreeWidget.collapseAll()
def initializePage(self, page_id):
"""
Initialize Wizard pages.
:param page_id: page identifier
"""
super().initializePage(page_id)
if self.page(page_id) == self.uiApplianceFromServerWizardPage:
self.button(QtWidgets.QWizard.WizardButton.CustomButton1).show()
self.setButtonText(QtWidgets.QWizard.WizardButton.FinishButton, "&Install")
self._get_appliances_from_server()
else:
self.button(QtWidgets.QWizard.WizardButton.CustomButton1).hide()
def cleanupPage(self, page_id):
"""
Restore button default settings on the first page.
"""
self.button(QtWidgets.QWizard.WizardButton.CustomButton1).hide()
self.setButtonText(QtWidgets.QWizard.WizardButton.FinishButton, "&Finish")
super().cleanupPage(page_id)
def validateCurrentPage(self):
"""
Validates if an appliance can be installed.
"""
if self.currentPage() == self.uiSelectTemplateSourceWizardPage and not Controller.instance().connected():
QtWidgets.QMessageBox.critical(self, "New template", "There is no connection to the server")
return False
elif self.currentPage() == self.uiApplianceFromServerWizardPage:
if not self.uiAppliancesTreeWidget.selectedItems():
QtWidgets.QMessageBox.critical(self, "New template", "Please select an appliance to install!")
return False
return True
def nextId(self):
"""
Wizard rules!
"""
current_id = self.currentId()
if self.page(current_id) == self.uiSelectTemplateSourceWizardPage and \
(self.uiImportApplianceFromFileRadioButton.isChecked() or self.uiCreateTemplateManuallyRadioButton.isChecked()):
self.done(True)
return super().nextId()
def done(self, result):
"""
This dialog is closed.
"""
super().done(result)
if result:
#ApplianceManager.instance().appliances_changed_signal.disconnect(self._appliancesChangedSlot)
from gns3.main_window import MainWindow
if self.currentPage() == self.uiApplianceFromServerWizardPage:
items = self.uiAppliancesTreeWidget.selectedItems()
for item in items:
f = tempfile.NamedTemporaryFile(mode="w+", suffix=".builtin.gns3a", delete=False)
json.dump(item.data(0, QtCore.Qt.ItemDataRole.UserRole), f)
f.close()
MainWindow.instance().loadPath(f.name)
try:
os.remove(f.name)
except OSError:
pass
elif self.uiCreateTemplateManuallyRadioButton.isChecked():
MainWindow.instance().preferencesActionSlot()
elif self.uiImportApplianceFromFileRadioButton.isChecked():
from gns3.main_window import MainWindow
MainWindow.instance().openApplianceActionSlot()

View File

@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Dialog to show node information.
"""
from ..qt import QtWidgets
from ..ui.node_info_dialog_ui import Ui_NodeInfoDialog
class NodeInfoDialog(QtWidgets.QDialog, Ui_NodeInfoDialog):
"""
Node information dialog.
:param parent: parent widget
"""
def __init__(self, node, parent):
super().__init__(parent)
self.setupUi(self)
general_info = node.info()
usage_info = node.usage()
command_line_info = node.commandLine()
self.setWindowTitle(node.name())
# General tab
self.uiGeneralTextBrowser.setPlainText(general_info)
# Usage tab
if not usage_info:
usage_info = "No usage information has been provided for this node."
self.uiUsageTextBrowser.setPlainText(usage_info)
# Command line tab
if command_line_info is None:
command_line_info = "Command line information is not supported for this type of node."
elif len(command_line_info) == 0:
command_line_info = "Please start the node in order to get the command line information."
self.uiCommandLineTextBrowser.setPlainText(command_line_info)

View File

@@ -40,8 +40,8 @@ class NodePropertiesDialog(QtWidgets.QDialog, Ui_NodePropertiesDialog):
self._node_items = node_items
self._parent_items = {}
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).setEnabled(False)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset).setEnabled(False)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).setEnabled(False)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Reset).setEnabled(False)
self.previousItem = None
self.previousPage = None
@@ -84,7 +84,7 @@ class NodePropertiesDialog(QtWidgets.QDialog, Ui_NodePropertiesDialog):
ConfigurationPageItem(self._parent_items[parent], node_item)
# sort the tree
self.uiNodesTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
self.uiNodesTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
if len(self._node_items) == 1:
parent = " {} group".format(str(node_item.node()))
@@ -135,11 +135,19 @@ class NodePropertiesDialog(QtWidgets.QDialog, Ui_NodePropertiesDialog):
self.uiConfigStackedWidget.setCurrentWidget(page)
if page != self.uiEmptyPageWidget:
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).setEnabled(True)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset).setEnabled(True)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).setEnabled(True)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Reset).setEnabled(True)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help).setEnabled(True)
else:
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).setEnabled(False)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset).setEnabled(False)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).setEnabled(False)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Reset).setEnabled(False)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help).setEnabled(False)
# hide the contextual help button if there is no help text
if page.whatsThis():
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help).show()
else:
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help).hide()
def on_uiButtonBox_clicked(self, button):
"""
@@ -149,11 +157,13 @@ class NodePropertiesDialog(QtWidgets.QDialog, Ui_NodePropertiesDialog):
"""
try:
if button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply):
if button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply):
self.applySettings()
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset):
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Reset):
self.resetSettings()
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Cancel):
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help):
self.showHelp()
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Cancel):
QtWidgets.QDialog.reject(self)
else:
self.applySettings()
@@ -215,6 +225,14 @@ class NodePropertiesDialog(QtWidgets.QDialog, Ui_NodePropertiesDialog):
child = item.child(index)
child.setSettings(child.node().settings().copy())
def showHelp(self):
"""
Show contextual help for the current page.
"""
page = self.uiConfigStackedWidget.currentWidget()
if page != self.uiEmptyPageWidget and page.whatsThis():
QtWidgets.QMessageBox.information(self, "{} help".format(page.windowTitle()), page.whatsThis().strip())
class ConfigurationPageItem(QtWidgets.QTreeWidgetItem):

View File

@@ -0,0 +1,190 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Display error to the user in an overlay popup
"""
import time
from gns3.qt import QtWidgets, QtCore, qslot
import logging
log = logging.getLogger(__name__)
MAX_ELEMENTS = 3
DISPLAY_DURATION = {
"CRITICAL": 120,
"ERROR": 120,
"WARNING": 20,
"INFO": 5
}
class NotifDialogHandler(logging.StreamHandler):
def __init__(self, dialog):
super().__init__()
self._dialog = dialog
self.setLevel(logging.INFO)
self._dialog.show()
def emit(self, record):
self._dialog.addNotif(record.levelname, record.getMessage())
class NotifDialog(QtWidgets.QWidget):
def __init__(self, parent):
super().__init__(parent)
self._notifs = []
self.setWindowFlags(QtCore.Qt.WindowType.FramelessWindowHint |
QtCore.Qt.WindowType.WindowDoesNotAcceptFocus |
QtCore.Qt.WindowType.SubWindow)
# QtCore.Qt.WindowType.Tool)
# QtCore.Qt.WindowType.WindowStaysOnTopHint)
self.setAttribute(QtCore.Qt.WidgetAttribute.WA_ShowWithoutActivating) # | QtCore.Qt.WidgetAttribute.WA_TranslucentBackground)
self._layout = QtWidgets.QVBoxLayout()
self._timer = QtCore.QTimer()
self._timer.setInterval(1000)
self._timer.timeout.connect(self._refreshSlot)
self._timer.start()
for i in range(0, MAX_ELEMENTS):
l = QtWidgets.QLabel()
l.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
l.setWordWrap(True)
l.hide()
self._layout.addWidget(l)
self.setLayout(self._layout)
@qslot
def addNotif(self, level, message):
if not self.parent().settings().get("overlay_notifications", True):
return
# This unicode char prevent the wordwrap at /
message = message.replace("/", "\u2060/\u2060")
if len(self._notifs) == MAX_ELEMENTS:
self._notifs.pop(0)
self._notifs.append((level, message, time.time()))
self.update()
@qslot
def _refreshSlot(self):
"""
Hide the notifs after some delay
"""
notifs = []
for (i, (level, message, when)) in enumerate(self._notifs):
if when + DISPLAY_DURATION[level] > time.time():
notifs.append((level, message, when))
if notifs != self._notifs:
self._notifs = notifs
self.update()
elif len(notifs) > 0:
self.resize()
def update(self):
if len(self._notifs) == 0:
self.hide()
else:
for (i, (level, message, when)) in enumerate(self._notifs):
w = self._layout.itemAt(i).widget()
w.setText(message)
if level == "ERROR" or level == "CRITICAL":
w.setStyleSheet("""
color: black;
padding-left: 12px;
background-color: rgb(247, 205, 198);
border-left: 10px solid red;
""")
elif level == "WARNING":
w.setStyleSheet("""
color: black;
padding-left: 12px;
background-color: #f4f2b5;
border-left: 10px solid orange;
""")
elif level == "INFO":
w.setStyleSheet("""
color: black;
padding-left: 12px;
background-color: #cfffc9;
border-left: 10px solid green;
""")
w.show()
for i in range(i + 1, MAX_ELEMENTS):
w = self._layout.itemAt(i).widget()
w.hide()
self.resize()
self.show()
def resize(self):
x = self.parent().width() - self.width() - 10
y = 10
self.setGeometry(x, y, self.sizeHint().width(), self.sizeHint().height())
@qslot
def mousePressEvent(self, event):
self._notifs.clear()
self.update()
if __name__ == '__main__':
"""
A demo main for testing the features
"""
import sys
app = QtWidgets.QApplication(sys.argv)
logging.basicConfig(level=logging.INFO)
class MainWindow(QtWidgets.QWidget):
def __init__(self):
super().__init__()
l1 = QtWidgets.QLabel()
l1.setText("Hello World")
vbox = QtWidgets.QVBoxLayout()
vbox.addWidget(l1)
self.setLayout(vbox)
self.setStyleSheet("background-color:blue;")
self._dialog = NotifDialog(self)
log.addHandler(NotifDialogHandler(self._dialog))
log.info("test")
def moveEvent(self, event):
log.error("An error")
log.info("An info with an url http://test")
log.warning("A warning with a long long long longlong longlong longlong longlong longlong longlong longlong long message")
self._dialog.update()
def resizeEvent(self, event):
self._dialog.update()
main = MainWindow()
main.setMinimumWidth(600)
main.setMinimumHeight(600)
main.show()
exit_code = app.exec()

View File

@@ -19,7 +19,7 @@
Dialog to load module and built-in preference pages.
"""
from ..qt import QtCore, QtWidgets
from ..qt import QtGui, QtCore, QtWidgets
from ..ui.preferences_dialog_ui import Ui_PreferencesDialog
from ..pages.server_preferences_page import ServerPreferencesPage
from ..pages.general_preferences_page import GeneralPreferencesPage
@@ -27,6 +27,9 @@ from ..pages.packet_capture_preferences_page import PacketCapturePreferencesPage
from ..pages.gns3_vm_preferences_page import GNS3VMPreferencesPage
from ..modules import MODULES
import logging
log = logging.getLogger(__name__)
class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
@@ -41,12 +44,14 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
super().__init__(parent)
self.setupUi(self)
self._modified_pages = set()
# We adapt the max size to the screen resolution
# We need to manually do that otherwise on small screen the windows
# could be bigger than the screen instead of displaying scrollbars
height = QtWidgets.QDesktopWidget().screenGeometry().height() - 100
width = QtWidgets.QDesktopWidget().screenGeometry().width() - 100
geometry = QtGui.QGuiApplication.primaryScreen().geometry()
height = geometry.height() - 100
width = geometry.width() - 100
# 980 is the default width
if self.width() > width:
@@ -56,7 +61,7 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
self.resize(self.width(), height)
self.uiTreeWidget.currentItemChanged.connect(self._showPreferencesPageSlot)
self._applyButton = self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply)
self._applyButton = self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply)
self._applyButton.clicked.connect(self._applyPreferences)
self._applyButton.setEnabled(False)
self._applyButton.setStyleSheet("QPushButton:disabled {color: gray}")
@@ -69,7 +74,7 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
# set the maximum width based on the content of column 0
self.uiTreeWidget.setMaximumWidth(self.uiTreeWidget.sizeHintForColumn(0) + 10)
# Something has change?
# Something has changed?
self._modified_pages = set()
def _loadPreferencePages(self):
@@ -91,7 +96,7 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
name = preferences_page.windowTitle()
item = QtWidgets.QTreeWidgetItem(self.uiTreeWidget)
item.setText(0, name)
item.setData(0, QtCore.Qt.UserRole, preferences_page)
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, preferences_page)
self.uiStackedWidget.addWidget(preferences_page)
self._items.append(item)
self._watchForChanges(preferences_page)
@@ -102,11 +107,12 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
parent = self.uiTreeWidget
for cls in preference_pages:
preferences_page = cls()
preferences_page.setParent(self)
preferences_page.loadPreferences()
name = preferences_page.windowTitle()
item = QtWidgets.QTreeWidgetItem(parent)
item.setText(0, name)
item.setData(0, QtCore.Qt.UserRole, preferences_page)
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, preferences_page)
self.uiStackedWidget.addWidget(preferences_page)
self._items.append(item)
if cls is preference_pages[0]:
@@ -124,7 +130,9 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
# Class name, changed signal
widget_to_watch = {
QtWidgets.QLineEdit: "textChanged",
QtWidgets.QPlainTextEdit: "textChanged",
# QtWidgets.QTreeWidget: "itemChanged",
QtWidgets.QTreeWidget: "itemDoubleClicked",
QtWidgets.QComboBox: "currentIndexChanged",
QtWidgets.QSpinBox: "valueChanged",
QtWidgets.QAbstractButton: "pressed"
@@ -140,17 +148,23 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
"""
# Found the page with the change
widget = self.sender()
widget = sender = self.sender()
while widget.parent() != self.uiStackedWidget:
widget = widget.parent()
self.addModifiedPage(widget)
if self.addModifiedPage(widget):
log.debug("%s value has changed", sender.objectName())
def addModifiedPage(self, widget):
"""
:returns: True is the page is initialized and element added
"""
# The widget can trigger signal before the end of init due to async api call
if not hasattr(widget, 'pageInitialized') or widget.pageInitialized():
self._applyButton.setEnabled(True)
self._modified_pages.add(widget)
return True
return False
def _showPreferencesPageSlot(self, current, previous):
"""
@@ -163,7 +177,7 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
if current is None:
current = previous
preferences_page = current.data(0, QtCore.Qt.UserRole)
preferences_page = current.data(0, QtCore.Qt.ItemDataRole.UserRole)
accessible_name = preferences_page.accessibleName()
if accessible_name:
self.uiTitleLabel.setText(accessible_name)
@@ -172,17 +186,24 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
self.uiTitleLabel.setText("{} preferences".format(name))
index = self.uiStackedWidget.indexOf(preferences_page)
widget = self.uiStackedWidget.widget(index)
# self.uiStackedWidget.setMinimumSize(widget.size())
self.uiStackedWidget.resize(widget.size())
#self.uiStackedWidget.setMinimumSize(widget.size()) # FIXME: this seems to not work on Windows and OSX
#self.uiStackedWidget.resize(widget.size())
self.uiStackedWidget.setCurrentIndex(index)
for index in range(0, self.uiStackedWidget.count()):
page = self.uiStackedWidget.widget(index)
if self.uiStackedWidget.currentIndex() == index:
page.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
else:
page.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Ignored)
def _applyPreferences(self):
"""
Saves all the preferences.
"""
success = True
for preferences_page in self._modified_pages:
for preferences_page in list(self._modified_pages):
ok = preferences_page.savePreferences()
# if page.savePreferences() returns None, assume success
if ok is not None and not ok:
@@ -203,9 +224,9 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
reply = QtWidgets.QMessageBox.warning(self,
"Preferences",
"You have unsaved preferences in {}.\n\nContinue without saving?".format(pages_title),
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No)
if reply == QtWidgets.QMessageBox.No:
QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.No)
if reply == QtWidgets.QMessageBox.StandardButton.No:
return
QtWidgets.QDialog.reject(self)
@@ -214,11 +235,5 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
Saves the preferences and closes this dialog.
"""
# close the nodes dock to refresh the node list
from ..main_window import MainWindow
main_window = MainWindow.instance()
main_window.uiNodesDockWidget.setVisible(False)
main_window.uiNodesDockWidget.setWindowTitle("")
if self._applyPreferences():
QtWidgets.QDialog.accept(self)

View File

@@ -17,10 +17,12 @@
import os
import sys
import shutil
from gns3.qt import QtWidgets
from gns3.qt import QtWidgets, QtGui
from gns3.local_config import LocalConfig
from gns3.ui.profile_select_dialog_ui import Ui_ProfileSelectDialog
from gns3.version import __version_info__
import logging
log = logging.getLogger(__name__)
@@ -38,29 +40,42 @@ class ProfileSelectDialog(QtWidgets.QDialog, Ui_ProfileSelectDialog):
self._main.hide()
parent = self._main
super().__init__(parent)
self.setupUi(self)
self.setupUi(self)
self.uiNewPushButton.clicked.connect(self._newPushButtonSlot)
self.uiDeletePushButton.clicked.connect(self._deletePushButtonSlot)
# Center on screen
screen = QtWidgets.QApplication.desktop().screenGeometry()
screen = QtGui.QGuiApplication.primaryScreen().geometry()
self.move(screen.center() - self.rect().center())
version = "{}.{}".format(__version_info__[0], __version_info__[1])
if sys.platform.startswith("win"):
appdata = os.path.expandvars("%APPDATA%")
path = os.path.join(appdata, "GNS3")
path = os.path.join(appdata, "GNS3", version)
else:
home = os.path.expanduser("~")
path = os.path.join(home, ".config", "GNS3")
profiles_path = os.path.join(path, "profiles")
xgd_config_var = "$XDG_CONFIG_HOME"
xdg_config_res = os.path.expandvars(xgd_config_var)
if xdg_config_res != xgd_config_var:
path = os.path.join(xdg_config_res, "GNS3", version)
else:
home = os.path.expanduser("~")
path = os.path.join(home, ".config", "GNS3", version)
self.profiles_path = os.path.join(path, "profiles")
self.uiShowAtStartupCheckBox.setChecked(LocalConfig.instance().multiProfiles())
self._refresh()
def _refresh(self):
self.uiProfileSelectComboBox.clear()
self.uiProfileSelectComboBox.addItem("default")
try:
if os.path.exists(profiles_path):
for profil in sorted(os.listdir(os.path.join(path, "profiles"))):
self.uiProfileSelectComboBox.addItem(profil)
if os.path.exists(self.profiles_path):
for profile in sorted(os.listdir(self.profiles_path)):
if not profile.startswith("."):
self.uiProfileSelectComboBox.addItem(profile)
except OSError:
pass
@@ -72,15 +87,26 @@ class ProfileSelectDialog(QtWidgets.QDialog, Ui_ProfileSelectDialog):
super().accept()
def _newPushButtonSlot(self):
profile, ok = QtWidgets.QInputDialog.getText(self.parent(), "New profile", "Profile name:")
profile, ok = QtWidgets.QInputDialog.getText(self, "New profile", "Profile name:")
if ok:
self.uiProfileSelectComboBox.addItem(profile)
self.uiProfileSelectComboBox.setCurrentText(profile)
self.accept()
def _deletePushButtonSlot(self):
profile = self.uiProfileSelectComboBox.currentText()
if profile == "default":
QtWidgets.QMessageBox.critical(self, "Delete profile", "The default profile cannot be deleted")
else:
try:
shutil.rmtree(os.path.join(self.profiles_path, profile))
self._refresh()
except (OSError, PermissionError) as e:
QtWidgets.QMessageBox.critical(self, "Cannot delete profile", str(e))
if __name__ == '__main__':
import sys
app = QtWidgets.QApplication(sys.argv)
dialog = ProfileSelectDialog()
dialog.show()
exit_code = app.exec_()
exit_code = app.exec()

View File

@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from ..qt import QtCore, QtGui, QtWidgets
from ..qt import QtCore, QtGui, QtWidgets, qslot, sip_is_deleted
from ..ui.project_dialog_ui import Ui_ProjectDialog
from ..controller import Controller
from ..topology import Topology
@@ -43,7 +43,6 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
self.setupUi(self)
self._main_window = parent
self._projects = []
self._project_settings = {}
self.uiNameLineEdit.setText(default_project_name)
self.uiLocationLineEdit.setText(os.path.join(Topology.instance().projectsDirPath(), default_project_name))
@@ -54,7 +53,7 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
if show_open_options:
self.uiOpenProjectPushButton.clicked.connect(self._openProjectActionSlot)
self.uiRecentProjectsPushButton.clicked.connect(self._showRecentProjectsSlot)
self._addRecentFilesMenu()
else:
self.uiOpenProjectGroupBox.hide()
self.uiProjectTabWidget.removeTab(1)
@@ -65,15 +64,14 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
self.uiLocationLineEdit.setVisible(False)
self.uiLocationBrowserToolButton.setVisible(False)
self.uiOpenProjectPushButton.setVisible(False)
Controller.instance().connected_signal.connect(self._refreshProjects)
self.uiProjectsTreeWidget.itemDoubleClicked.connect(self._projectsTreeWidgetDoubleClickedSlot)
self.uiDeleteProjectButton.clicked.connect(self._deleteProjectSlot)
self.uiRefreshProjectsPushButton.clicked.connect(self._refreshProjects)
self._refreshProjects()
def _refreshProjects(self):
Controller.instance().get("/projects", self._projectListCallback)
self.uiDuplicateProjectPushButton.clicked.connect(self._duplicateProjectSlot)
self.uiRefreshProjectsPushButton.clicked.connect(Controller.instance().refreshProjectList)
Controller.instance().project_list_updated_signal.connect(self._updateProjectListSlot)
self._updateProjectListSlot()
Controller.instance().refreshProjectList()
def _settingsClickedSlot(self):
"""
@@ -85,66 +83,112 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
def _projectsTreeWidgetDoubleClickedSlot(self, item, column):
self.done(True)
def _deleteProjectSlot(self):
current = self.uiProjectsTreeWidget.currentItem()
if current is None:
@qslot
def _deleteProjectSlot(self, *args):
if len(self.uiProjectsTreeWidget.selectedItems()) == 0:
QtWidgets.QMessageBox.critical(self, "Delete project", "No project selected")
return
projects_to_delete = set()
for project in self.uiProjectsTreeWidget.selectedItems():
project_id = project.data(0, QtCore.Qt.UserRole)
project_name = project.data(1, QtCore.Qt.UserRole)
if sip_is_deleted(project):
continue
project_id = project.data(0, QtCore.Qt.ItemDataRole.UserRole)
project_name = project.data(1, QtCore.Qt.ItemDataRole.UserRole)
reply = QtWidgets.QMessageBox.warning(self,
"Delete project",
'Delete project "{}"?\nThis cannot be reverted.'.format(project_name),
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No)
if reply == QtWidgets.QMessageBox.Yes:
QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.No)
if reply == QtWidgets.QMessageBox.StandardButton.Yes:
projects_to_delete.add(project_id)
for project_id in projects_to_delete:
Controller.instance().delete("/projects/{}".format(project_id), self._deleteProjectCallback)
Controller.instance().deleteProject(project_id)
def _deleteProjectCallback(self, result, error=False, **kwargs):
if error:
log.error("Error while deleting project: {}".format(result["message"]))
def _duplicateProjectSlot(self):
if len(self.uiProjectsTreeWidget.selectedItems()) == 0:
QtWidgets.QMessageBox.critical(self, "Duplicate project", "No project selected")
return
Controller.instance().get("/projects", self._projectListCallback)
def _projectListCallback(self, result, error=False, **kwargs):
if len(self.uiProjectsTreeWidget.selectedItems()) > 1:
QtWidgets.QMessageBox.critical(self, "Duplicate project", "Please select only one project to duplicate")
return
for project in self.uiProjectsTreeWidget.selectedItems():
project_id = project.data(0, QtCore.Qt.ItemDataRole.UserRole)
project_name = project.data(1, QtCore.Qt.ItemDataRole.UserRole)
new_project_name = project_name + "-1"
existing_project_name = [p["name"] for p in Controller.instance().projects()]
i = 1
while new_project_name in existing_project_name:
new_project_name = "{}-{}".format(project_name, i)
i += 1
name, reply = QtWidgets.QInputDialog.getText(self,
"Duplicate project",
'Duplicate project "{}"?.'.format(project_name),
QtWidgets.QLineEdit.EchoMode.Normal,
new_project_name)
name = name.strip()
if reply and len(name) > 0:
reset_mac_addresses = self.uiResetMacAddressesCheckBox.isChecked()
if Controller.instance().isRemote():
Controller.instance().post("/projects/{project_id}/duplicate".format(project_id=project_id),
self._duplicateCallback,
body={"name": name, "reset_mac_addresses": reset_mac_addresses},
progressText="Duplicating project '{}'...".format(name),
timeout=None)
else:
project_location = os.path.join(Topology.instance().projectsDirPath(), name)
Controller.instance().post("/projects/{project_id}/duplicate".format(project_id=project_id),
self._duplicateCallback,
body={"name": name, "path": project_location, "reset_mac_addresses": reset_mac_addresses},
progressText="Duplicating project '{}'...".format(name),
timeout=None)
def _duplicateCallback(self, result, error=False, **kwargs):
if error:
log.error("Error while duplicating project: {}".format(result["message"]))
return
Controller.instance().refreshProjectList()
@qslot
def _updateProjectListSlot(self, *args):
self.uiProjectsTreeWidget.clear()
self.uiDeleteProjectButton.setEnabled(False)
if not error:
self._projects = result
self.uiProjectsTreeWidget.setUpdatesEnabled(False)
items = []
for project in result:
path = os.path.join(project["path"], project["filename"])
item = QtWidgets.QTreeWidgetItem([project["name"], project["status"], path])
item.setData(0, QtCore.Qt.UserRole, project["project_id"])
item.setData(1, QtCore.Qt.UserRole, project["name"])
item.setData(2, QtCore.Qt.UserRole, path)
items.append(item)
self.uiProjectsTreeWidget.addTopLevelItems(items)
self.uiProjectsTreeWidget.setUpdatesEnabled(False)
items = []
for project in Controller.instance().projects():
path = os.path.join(project["path"], project["filename"])
item = QtWidgets.QTreeWidgetItem([project["name"], project["status"], path])
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, project["project_id"])
item.setData(1, QtCore.Qt.ItemDataRole.UserRole, project["name"])
item.setData(2, QtCore.Qt.ItemDataRole.UserRole, path)
items.append(item)
self.uiProjectsTreeWidget.addTopLevelItems(items)
if len(result):
self.uiDeleteProjectButton.setEnabled(True)
if len(Controller.instance().projects()):
self.uiDeleteProjectButton.setEnabled(True)
self.uiProjectsTreeWidget.header().setResizeContentsPrecision(100) # How many row is checked for the resize for performance reason
self.uiProjectsTreeWidget.resizeColumnToContents(0)
self.uiProjectsTreeWidget.resizeColumnToContents(1)
self.uiProjectsTreeWidget.resizeColumnToContents(2)
self.uiProjectsTreeWidget.sortItems(0, QtCore.Qt.AscendingOrder)
self.uiProjectsTreeWidget.setUpdatesEnabled(True)
self.uiProjectsTreeWidget.header().setResizeContentsPrecision(100) # How many row is checked for the resize for performance reason
self.uiProjectsTreeWidget.resizeColumnToContents(0)
self.uiProjectsTreeWidget.resizeColumnToContents(1)
self.uiProjectsTreeWidget.resizeColumnToContents(2)
self.uiProjectsTreeWidget.sortItems(0, QtCore.Qt.SortOrder.AscendingOrder)
self.uiProjectsTreeWidget.setUpdatesEnabled(True)
def keyPressEvent(self, e):
"""
Event handler in order to properly handle escape.
"""
if e.key() == QtCore.Qt.Key_Escape:
if e.key() == QtCore.Qt.Key.Key_Escape:
self.close()
def _projectNameSlot(self, text):
@@ -187,58 +231,74 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
self._main_window.openProjectActionSlot()
self.reject()
def _showRecentProjectsSlot(self):
def _addRecentFilesMenu(self):
"""
lot to show all the recent projects in a menu.
Add recent projects in a menu.
"""
menu = QtWidgets.QMenu()
menu = QtWidgets.QMenu(parent=self)
if Controller.instance().isRemote():
for action in self._main_window.recent_project_actions:
menu.addAction(action)
else:
for action in self._main_window.recent_file_actions:
menu.addAction(action)
menu.triggered.connect(self._menuTriggeredSlot)
for action in self._main_window._recent_project_actions:
menu.addAction(action)
menu.exec_(QtGui.QCursor.pos())
self.uiRecentProjectsPushButton.setMenu(menu)
def _overwriteProjectCallback(self, result, error=False, **kwargs):
if error:
if "message" in result:
log.error("Error while overwrite project: {}".format(result["message"]))
return
self._projects = []
self._refreshProjects()
# A 404 could arrive if someone else as deleted the project
if "status" not in result or result["status"] != 404:
return
elif "message" in result:
QtWidgets.QMessageBox.critical(self,
"New Project",
"Error while overwrite project: {}".format(result["message"]))
Controller.instance().refreshProjectList()
self.done(True)
def _newProject(self):
project_name = self.uiNameLineEdit.text()
self._project_settings["project_name"] = self.uiNameLineEdit.text().strip()
if Controller.instance().isRemote():
self._project_settings.pop("project_path", None)
self._project_settings.pop("project_files_dir", None)
else:
project_location = self.uiLocationLineEdit.text().strip()
if not project_location:
QtWidgets.QMessageBox.critical(self, "New project", "Project location is empty")
return False
if not project_name:
self._project_settings["project_path"] = os.path.join(project_location, self._project_settings["project_name"] + ".gns3")
self._project_settings["project_files_dir"] = project_location
if len(self._project_settings["project_name"]) == 0:
QtWidgets.QMessageBox.critical(self, "New project", "Project name is empty")
return False
for existing_project in self._projects:
if project_name == existing_project["name"]:
for existing_project in Controller.instance().projects():
if self._project_settings["project_name"] == existing_project["name"] \
and ("project_files_dir" in self._project_settings and self._project_settings["project_files_dir"] == existing_project["path"]):
if existing_project["status"] == "opened":
QtWidgets.QMessageBox.critical(self,
"New project",
'Project "{}" is opened, it cannot be overwritten'.format(self._project_settings["project_name"]))
return False
reply = QtWidgets.QMessageBox.warning(self,
"New project",
"Project {} already exists, overwrite it?".format(project_name),
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No)
'Project "{}" already exists in location "{}", overwrite it?'.format(existing_project["name"], existing_project["path"]),
QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.No)
if reply == QtWidgets.QMessageBox.Yes:
Controller.instance().delete("/projects/{}".format(existing_project["project_id"]), self._overwriteProjectCallback)
if reply == QtWidgets.QMessageBox.StandardButton.Yes:
Controller.instance().deleteProject(existing_project["project_id"], self._overwriteProjectCallback)
# In all cases we cancel the new project and if project success to delete
# we will call done again
return False
self._project_settings["project_name"] = project_name
if not Controller.instance().isRemote():
project_location = self.uiLocationLineEdit.text()
if not project_location:
QtWidgets.QMessageBox.critical(self, "New project", "Project location is empty")
return False
self._project_settings["project_path"] = os.path.join(project_location, project_name + ".gns3")
self._project_settings["project_files_dir"] = project_location
return True
def done(self, result):
@@ -253,7 +313,6 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
QtWidgets.QMessageBox.critical(self, "Open project", "No project selected")
return
self._project_settings["project_id"] = current.data(0, QtCore.Qt.UserRole)
self._project_settings["project_name"] = current.data(1, QtCore.Qt.UserRole)
self._project_settings["project_path"] = current.data(2, QtCore.Qt.UserRole)
self._project_settings["project_id"] = current.data(0, QtCore.Qt.ItemDataRole.UserRole)
self._project_settings["project_name"] = current.data(1, QtCore.Qt.ItemDataRole.UserRole)
super().done(result)

View File

@@ -0,0 +1,144 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import os
import datetime
from gns3.qt import QtCore, QtWidgets
from ..local_server import LocalServer
from ..utils.progress_dialog import ProgressDialog
from ..utils.export_project_worker import ExportProjectWorker
from ..ui.export_project_wizard_ui import Ui_ExportProjectWizard
import logging
log = logging.getLogger(__name__)
class ExportProjectWizard(QtWidgets.QWizard, Ui_ExportProjectWizard):
"""
Export project wizard.
"""
def __init__(self, project, parent):
super().__init__(parent)
self.setupUi(self)
self._project = project
self._path = None
self.setWizardStyle(QtWidgets.QWizard.WizardStyle.ModernStyle)
if sys.platform.startswith("darwin"):
# we want to see the cancel button on OSX
self.setOptions(QtWidgets.QWizard.WizardOption.NoDefaultButton)
self.uiCompressionComboBox.addItem("None", "none")
self.uiCompressionComboBox.addItem("Zip compression (deflate)", "zip")
self.uiCompressionComboBox.addItem("Bzip2 compression", "bzip2")
self.uiCompressionComboBox.addItem("Lzma compression", "lzma")
# set zip compression by default
self.uiCompressionComboBox.setCurrentIndex(1)
self.helpRequested.connect(self._showHelpSlot)
self.uiPathBrowserToolButton.clicked.connect(self._pathBrowserSlot)
self._loadReadme()
def _loadReadme(self):
self._project.get("/files/README.txt", self._loadedReadme)
def _loadedReadme(self, result, error=False, raw_body=None, context={}, **kwargs):
if not error:
self.uiReadmeTextEdit.setPlainText(raw_body.decode("utf-8", errors="replace"))
else:
readme_text = "Project: '{}' created on {}\nAuthor: John Doe <john.doe@example.com>\n\nNo project description was given".format(self._project.name(), datetime.date.today())
self.uiReadmeTextEdit.setPlainText(readme_text)
def _pathBrowserSlot(self):
directory = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.DocumentsLocation)
if len(directory) == 0:
directory = LocalServer.instance().localServerSettings()["projects_path"]
path, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Export portable project", directory,
"GNS3 Portable Project (*.gns3project *.gns3p)",
"GNS3 Portable Project (*.gns3project *.gns3p)")
if path is None or len(path) == 0:
return
self.uiPathLineEdit.setText(path)
def _showHelpSlot(self):
include_image_help = """Including base images means additional images will not be requested to
import the project on another computer, however the resulting file will be much bigger.
Also, you are responsible to check if you have the right to distribute the image(s) as part of the project.
"""
QtWidgets.QMessageBox.information(self, "Help about export a project", include_image_help)
def validateCurrentPage(self):
"""
Validates if the project can be exported.
"""
if self.currentPage() == self.uiExportOptionsWizardPage:
path = self.uiPathLineEdit.text().strip()
if not path:
QtWidgets.QMessageBox.critical(self, "Export project", "Please select a path where to export the project")
return False
if not path.endswith(".gns3project") and not path.endswith(".gns3p"):
path += ".gns3project"
try:
open(path, 'wb+').close()
except OSError as e:
QtWidgets.QMessageBox.critical(self, "Export project", "Cannot export project to '{}': {}".format(path, e))
return False
self._path = path
elif self.currentPage() == self.uiProjectReadmeWizardPage:
text = self.uiReadmeTextEdit.toPlainText().strip()
if text:
self._project.post("/files/README.txt", self._saveReadmeCallback, body=text)
return True
def _saveReadmeCallback(self, result, error=False, **kwargs):
if error:
QtWidgets.QMessageBox.critical(self, "Export project", "Could not created readme file")
def done(self, result):
"""
This dialog is closed.
"""
if result:
include_images = include_snapshots = reset_mac_addresses = keep_compute_ids = "no"
if self.uiIncludeImagesCheckBox.isChecked():
include_images = "yes"
if self.uiIncludeSnapshotsCheckBox.isChecked():
include_snapshots = "yes"
if self.uiResetMacAddressesCheckBox.isChecked():
reset_mac_addresses = "yes"
if self.uiKeepComputeIdsCheckBox.isChecked():
keep_compute_ids = "yes"
compression = self.uiCompressionComboBox.currentData()
export_worker = ExportProjectWorker(self._project, self._path, include_images, include_snapshots, reset_mac_addresses, keep_compute_ids, compression)
progress_dialog = ProgressDialog(export_worker, "Exporting project", "Exporting portable project files...", "Cancel", parent=self, create_thread=False)
progress_dialog.show()
progress_dialog.exec()
super().done(result)

View File

@@ -0,0 +1,87 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import copy
from gns3.qt import QtWidgets, QtCore, qpartial
from gns3.ui.project_welcome_dialog_ui import Ui_ProjectWelcomeDialog
import logging
log = logging.getLogger(__name__)
class ProjectWelcomeDialog(QtWidgets.QDialog, Ui_ProjectWelcomeDialog):
"""
This dialog shows when project is imported and global variables assigned to the project are missing.
"""
def __init__(self, parent, project):
super().__init__(parent)
self._project = project
self.setupUi(self)
self.uiOkButton.clicked.connect(self._okButtonClickedSlot)
self.gridLayout.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
self.label.setOpenExternalLinks(True)
self._variables = self._getVariables(project)
self._loadReadme()
self._addMisingVariablesEdits()
def _getVariables(self, project):
variables = copy.copy(self._project.variables())
if variables is None:
variables = []
return variables
def _addMisingVariablesEdits(self):
#TODO: refactor this to use a QListWidget
missing = [v for v in self._variables if v.get("name") and v.get("value", "").strip() == ""]
for i, variable in enumerate(missing, start=0):
nameLabel = QtWidgets.QLabel()
nameLabel.setText(variable.get("name") + ":")
self.gridLayout.addWidget(nameLabel, i, 0)
valueEdit = QtWidgets.QLineEdit()
valueEdit.setText(variable.get("value", ""))
valueEdit.textChanged.connect(qpartial(self.onValueChange, variable))
self.gridLayout.addWidget(valueEdit, i, 1)
def _loadReadme(self):
self._project.get("/files/README.txt", self._loadedReadme)
def _loadedReadme(self, result, error=False, raw_body=None, context={}, **kwargs):
if not error:
self.label.setText(raw_body.decode("utf-8"))
def onValueChange(self, variable, text):
variable["value"] = text
def _okButtonClickedSlot(self):
missing = [v for v in self._variables if v.get("name") and v.get("value", "").strip() == ""]
if len(missing) > 0:
reply = QtWidgets.QMessageBox.warning(self,
"Missing values",
"Are you sure you want to continue without providing missing values?",
QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.No)
if reply == QtWidgets.QMessageBox.StandardButton.No:
return
self._project.setVariables(self._variables)
self._project.update()
self.accept()

View File

@@ -19,17 +19,20 @@ import sys
import os
import shutil
from gns3.qt import QtCore, QtWidgets, QtGui, QtNetwork
from gns3.qt import QtCore, QtWidgets, QtGui, QtNetwork, qslot
from gns3.controller import Controller
from gns3.local_server import LocalServer
from gns3.utils.progress_dialog import ProgressDialog
from gns3.utils.wait_for_connection_worker import WaitForConnectionWorker
from gns3.dialogs.new_appliance_dialog import NewApplianceDialog
from gns3.utils.interfaces import interfaces
from ..settings import DEFAULT_LOCAL_SERVER_HOST
from ..ui.setup_wizard_ui import Ui_SetupWizard
from ..version import __version__
import logging
log = logging.getLogger(__name__)
class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
"""
@@ -40,27 +43,31 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
super().__init__(parent)
self.setupUi(self)
self.adjustSize()
self._gns3_vm_settings = {
"enable": True,
"headless": False,
"when_exit": "stop",
"engine": "vmware",
"allocate_vcpus_ram": True,
"vcpus": 1,
"ram": 2048,
"vmname": "GNS3 VM"
"vmname": "GNS3 VM",
"port": 80
}
self.setWizardStyle(QtWidgets.QWizard.ModernStyle)
self.setWizardStyle(QtWidgets.QWizard.WizardStyle.ModernStyle)
if sys.platform.startswith("darwin"):
# we want to see the cancel button on OSX
self.setOptions(QtWidgets.QWizard.NoDefaultButton)
self.setOptions(QtWidgets.QWizard.WizardOption.NoDefaultButton)
self.uiGNS3VMDownloadLinkUrlLabel.setText('')
self.uiLocalServerToolButton.clicked.connect(self._localServerBrowserSlot)
self.uiGNS3VMDownloadLinkUrlLabel.setText("")
self.uiRefreshPushButton.clicked.connect(self._refreshVMListSlot)
self.uiVmwareRadioButton.clicked.connect(self._listVMwareVMsSlot)
self.uiVirtualBoxRadioButton.clicked.connect(self._listVirtualBoxVMsSlot)
self.uiVMwareBannerButton.clicked.connect(self._VMwareBannerButtonClickedSlot)
settings = parent.settings()
self.uiShowCheckBox.setChecked(settings["hide_setup_wizard"])
@@ -75,22 +82,24 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
# load all available addresses
for address in QtNetwork.QNetworkInterface.allAddresses():
address_string = address.toString()
# if address.protocol() == QtNetwork.QAbstractSocket.IPv6Protocol:
# we do not want the scope id when using an IPv6 address...
# address.setScopeId("")
self.uiLocalServerHostComboBox.addItem(address_string, address.toString())
if address.protocol() in [QtNetwork.QAbstractSocket.NetworkLayerProtocol.IPv4Protocol, QtNetwork.QAbstractSocket.NetworkLayerProtocol.IPv6Protocol]:
address_string = address.toString()
if address_string.startswith("169.254") or address_string.startswith("fe80"):
# ignore link-local addresses, could not use https://doc.qt.io/qt-5/qhostaddress.html#isLinkLocal
# because it was introduced in Qt 5.11
continue
self.uiLocalServerHostComboBox.addItem(address_string, address_string)
if sys.platform.startswith("darwin"):
self.uiVMwareBannerButton.setIcon(QtGui.QIcon(":/images/vmware_fusion_banner.jpg"))
else:
self.uiVMwareBannerButton.setIcon(QtGui.QIcon(":/images/vmware_workstation_banner.jpg"))
self.uiLocalServerHostComboBox.addItem("localhost", "localhost") # local host
self.uiLocalServerHostComboBox.addItem("::", "::") # all IPv6 addresses
self.uiLocalServerHostComboBox.addItem("0.0.0.0", "0.0.0.0") # all IPv4 addresses
if sys.platform.startswith("linux"):
self.uiVMRadioButton.setText("Run the topologies in an isolated and standard VM")
self.uiLocalRadioButton.setText("Run the topologies on my computer")
self.uiLocalRadioButton.setChecked(True)
self.uiLocalLabel.setVisible(False)
self.uiLocalLabel.setText("Dependencies like Dynamips and Qemu must be manually installed")
Controller.instance().connected_signal.connect(self._refreshLocalServerStatusSlot)
Controller.instance().connection_failed_signal.connect(self._refreshLocalServerStatusSlot)
def _localServerBrowserSlot(self):
"""
@@ -107,13 +116,6 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
self.uiLocalServerPathLineEdit.setText(path)
def _VMwareBannerButtonClickedSlot(self):
if sys.platform.startswith("darwin"):
url = "http://send.onenetworkdirect.net/z/616461/CD225091/"
else:
url = "http://send.onenetworkdirect.net/z/616460/CD225091/"
QtGui.QDesktopServices.openUrl(QtCore.QUrl(url))
def _listVMwareVMsSlot(self):
"""
Slot to refresh the VMware VMs list.
@@ -125,7 +127,7 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
from gns3.modules import VMware
settings = VMware.instance().settings()
if not os.path.exists(settings["vmrun_path"]):
QtWidgets.QMessageBox.critical(self, "VMware", "VMware vmrun tool could not be found, VMware or the VIX API (required for VMware player) is probably not installed. You can download it from https://www.vmware.com/support/developer/vix-api/")
QtWidgets.QMessageBox.critical(self, "VMware", "VMware vmrun tool could not be found, VMware or the VIX API (required for VMware player) is probably not installed. You can download it from https://customerconnect.vmware.com/downloads/details?downloadGroup=PLAYER-1400-VIX1170&productId=687. After installation you need to restart GNS3.")
return
self._refreshVMListSlot()
@@ -134,14 +136,13 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
Slot to refresh the VirtualBox VMs list.
"""
QtWidgets.QMessageBox.warning(self, "GNS3 VM on VirtualBox", "VirtualBox doesn't support nested virtualization, this means running Qemu based VM could be very slow")
download_url = "https://github.com/GNS3/gns3-gui/releases/download/v{version}/GNS3.VM.VirtualBox.{version}.zip".format(version=__version__)
self.uiGNS3VMDownloadLinkUrlLabel.setText('If you don\'t have the GNS3 Virtual Machine you can <a href="{download_url}">download it here</a>.<br>And import the VM in the virtualization software and hit refresh.'.format(download_url=download_url))
self.uiVmwareRadioButton.setChecked(False)
from gns3.modules import VirtualBox
settings = VirtualBox.instance().settings()
if not os.path.exists(settings["vboxmanage_path"]):
QtWidgets.QMessageBox.critical(self, "VirtualBox", "VBoxManage could not be found, VirtualBox is probably not installed")
QtWidgets.QMessageBox.critical(self, "VirtualBox", "VBoxManage could not be found, VirtualBox is probably not installed. After installation you need to restart GNS3.")
return
self._refreshVMListSlot()
@@ -155,7 +156,7 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
:returns: current QWidget
"""
pane = dialog.uiTreeWidget.findItems(name, QtCore.Qt.MatchFixedString)[0]
pane = dialog.uiTreeWidget.findItems(name, QtCore.Qt.MatchFlag.MatchFixedString)[0]
child_pane = pane.child(0)
dialog.uiTreeWidget.setCurrentItem(child_pane)
return dialog.uiStackedWidget.currentWidget()
@@ -176,6 +177,7 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
super().initializePage(page_id)
if self.page(page_id) == self.uiServerWizardPage:
Controller.instance().setDisplayError(False)
Controller.instance().get("/gns3vm", self._getSettingsCallback)
elif self.page(page_id) == self.uiVMWizardPage:
if self._GNS3VMSettings()["engine"] == "vmware":
@@ -193,17 +195,51 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
index = self.uiLocalServerHostComboBox.findData(local_server_settings["host"])
if index != -1:
self.uiLocalServerHostComboBox.setCurrentIndex(index)
else:
if self.uiVMRadioButton.isChecked():
# Try to bind with the IP address allocated for VMnet1
for interface in interfaces():
if "vmnet1" in interface["name"].lower():
index = self.uiLocalServerHostComboBox.findText(interface["ip_address"])
break
else:
index = self.uiLocalServerHostComboBox.findText(DEFAULT_LOCAL_SERVER_HOST)
if index != -1:
self.uiLocalServerHostComboBox.setCurrentIndex(index)
self.uiLocalServerPortSpinBox.setValue(local_server_settings["port"])
elif self.page(page_id) == self.uiRemoteControllerWizardPage:
local_server_settings = LocalServer.instance().localServerSettings()
if local_server_settings["host"] is None:
self.uiRemoteMainServerHostLineEdit.setText(DEFAULT_LOCAL_SERVER_HOST)
self.uiRemoteMainServerAuthCheckBox.setChecked(False)
self.uiRemoteMainServerUserLineEdit.setText("")
self.uiRemoteMainServerPasswordLineEdit.setText("")
else:
self.uiRemoteMainServerHostLineEdit.setText(local_server_settings["host"])
self.uiRemoteMainServerAuthCheckBox.setChecked(local_server_settings["auth"])
self.uiRemoteMainServerUserLineEdit.setText(local_server_settings["user"])
self.uiRemoteMainServerPasswordLineEdit.setText(local_server_settings["password"])
self.uiRemoteMainServerPortSpinBox.setValue(local_server_settings["port"])
elif self.page(page_id) == self.uiLocalServerStatusWizardPage:
self._refreshLocalServerStatusSlot()
elif self.page(page_id) == self.uiSummaryWizardPage:
use_local_server = self.uiLocalRadioButton.isChecked()
self.uiSummaryTreeWidget.clear()
if use_local_server:
if self.uiLocalRadioButton.isChecked():
local_server_settings = LocalServer.instance().localServerSettings()
self._addSummaryEntry("Server type:", "Local")
self._addSummaryEntry("Path:", local_server_settings["path"])
self._addSummaryEntry("Host:", local_server_settings["host"])
self._addSummaryEntry("Port:", str(local_server_settings["port"]))
elif self.uiRemoteControllerRadioButton.isChecked():
local_server_settings = LocalServer.instance().localServerSettings()
self._addSummaryEntry("Server type:", "Remote")
self._addSummaryEntry("Host:", local_server_settings["host"])
self._addSummaryEntry("Port:", str(local_server_settings["port"]))
self._addSummaryEntry("User:", local_server_settings["user"])
else:
self._addSummaryEntry("Server type:", "GNS3 Virtual Machine")
self._addSummaryEntry("VM engine:", self._GNS3VMSettings()["engine"].capitalize())
@@ -211,6 +247,22 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
self._addSummaryEntry("VM vCPUs:", str(self._GNS3VMSettings()["vcpus"]))
self._addSummaryEntry("VM RAM:", str(self._GNS3VMSettings()["ram"]) + " MB")
@qslot
def _refreshLocalServerStatusSlot(self):
"""
Refresh the local server status page
"""
self.uiLocalServerTextEdit.clear()
if Controller.instance().connected():
self.uiLocalServerTextEdit.setText("Connection to the local GNS3 server has been successful!")
Controller.instance().get("/gns3vm", self._getSettingsCallback)
elif Controller.instance().connecting():
self.uiLocalServerTextEdit.setText("Please wait connection to the GNS3 server...")
else:
local_server_settings = LocalServer.instance().localServerSettings()
self.uiLocalServerTextEdit.setText("Connection to local server failed. Please try one of the following:\n\n- Make sure GNS3 is allowed to run by your firewall.\n- Go back and try to change the server host binding and/or the port\n- Check with a browser if you can connect to {protocol}://{host}:{port}.\n- Try to run {path} in a terminal to see if you have an error.".format(protocol=local_server_settings["protocol"], host=local_server_settings["host"], port=local_server_settings["port"], path=local_server_settings["path"]))
def _GNS3VMSettings(self):
return self._gns3_vm_settings
@@ -220,7 +272,7 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
def _saveSettingsCallback(self, result, error=False, **kwargs):
if error:
if "message" in result:
QtWidgets.QMessageBox.critical(self, "Save settings", "Error while save settings: {}".format(result["message"]))
QtWidgets.QMessageBox.critical(self, "Save settings", "Error while saving settings: {}".format(result["message"]))
return
def _addSummaryEntry(self, name, value):
@@ -236,6 +288,7 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
Validates the settings.
"""
Controller.instance().setDisplayError(True)
if self.currentPage() == self.uiVMWizardPage:
vmname = self.uiVMListComboBox.currentText()
if vmname:
@@ -279,26 +332,30 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
return False
LocalServer.instance().updateLocalServerSettings(local_server_settings)
if not LocalServer.instance().localServerAutoStartIfRequired():
return False
elif self.currentPage() == self.uiRemoteControllerWizardPage:
local_server_settings = LocalServer.instance().localServerSettings()
local_server_settings["auto_start"] = False
local_server_settings["host"] = self.uiRemoteMainServerHostLineEdit.text()
local_server_settings["port"] = self.uiRemoteMainServerPortSpinBox.value()
local_server_settings["protocol"] = "http"
local_server_settings["user"] = self.uiRemoteMainServerUserLineEdit.text()
local_server_settings["password"] = self.uiRemoteMainServerPasswordLineEdit.text()
local_server_settings["auth"] = self.uiRemoteMainServerAuthCheckBox.isChecked()
LocalServer.instance().updateLocalServerSettings(local_server_settings)
elif self.currentPage() == self.uiSummaryWizardPage:
use_local_server = self.uiLocalRadioButton.isChecked()
if use_local_server:
if self.uiLocalRadioButton.isChecked():
# deactivate the GNS3 VM if using the local server
vm_settings = self._GNS3VMSettings()
vm_settings["enable"] = False
self._setGNS3VMSettings(vm_settings)
# update the modules so they use the local server
from gns3.modules import Dynamips
Dynamips.instance().setSettings({"use_local_server": use_local_server})
if sys.platform.startswith("linux"):
# IOU only works on Linux
from gns3.modules import IOU
IOU.instance().setSettings({"use_local_server": use_local_server})
from gns3.modules import Qemu
Qemu.instance().setSettings({"use_local_server": use_local_server})
from gns3.modules import VPCS
VPCS.instance().setSettings({"use_local_server": use_local_server})
elif self.currentPage() == self.uiLocalServerStatusWizardPage:
if not Controller.instance().connected():
return False
return True
@@ -345,12 +402,16 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
:param result: ignored
"""
Controller.instance().setDisplayError(True)
settings = self.parentWidget().settings()
settings["hide_setup_wizard"] = self.uiShowCheckBox.isChecked()
if result:
settings["hide_setup_wizard"] = True
else:
local_server_settings = LocalServer.instance().localServerSettings()
LocalServer.instance().updateLocalServerSettings(local_server_settings)
settings["hide_setup_wizard"] = not self.uiShowCheckBox.isChecked()
self.parentWidget().setSettings(settings)
super().done(result)
dialog = NewApplianceDialog(self.parentWidget())
dialog.show()
def nextId(self):
"""
@@ -358,9 +419,21 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
"""
current_id = self.currentId()
if self.page(current_id) == self.uiServerWizardPage and self.uiVMRadioButton.isChecked():
# skip the local server page if using the GNS3 VM
return self.uiLocalServerWizardPage.nextId()
if self.page(current_id) == self.uiLocalServerWizardPage:
return self.uiVMWizardPage.nextId()
if self.page(current_id) == self.uiLocalServerStatusWizardPage and not self.uiVMRadioButton.isChecked():
return self._pageId(self.uiSummaryWizardPage)
if self.page(current_id) == self.uiServerWizardPage and self.uiRemoteControllerRadioButton.isChecked():
return self._pageId(self.uiRemoteControllerWizardPage)
if self.page(current_id) == self.uiVMWizardPage:
return self._pageId(self.uiSummaryWizardPage)
return QtWidgets.QWizard.nextId(self)
def _pageId(self, page):
"""
Return id of the page
"""
for id in self.pageIds():
if self.page(id) == page:
return id
raise KeyError

View File

@@ -19,16 +19,8 @@
Dialog to manage the snapshots.
"""
import shutil
import re
import time
import os
from ..qt import QtCore, QtWidgets
from ..utils.progress_dialog import ProgressDialog
from ..utils.process_files_worker import ProcessFilesWorker
from ..ui.snapshots_dialog_ui import Ui_SnapshotsDialog
from ..node import Node
from ..controller import Controller
from datetime import datetime
@@ -64,7 +56,8 @@ class SnapshotsDialog(QtWidgets.QDialog, Ui_SnapshotsDialog):
"""
self.uiSnapshotsList.clear()
Controller.instance().get("/projects/{}/snapshots".format(self._project.id()), self._listSnapshotsCallback)
if self._project:
Controller.instance().get("/projects/{}/snapshots".format(self._project.id()), self._listSnapshotsCallback)
def _listSnapshotsCallback(self, result, error=False, server=None, context={}, **kwargs):
if error:
@@ -74,8 +67,8 @@ class SnapshotsDialog(QtWidgets.QDialog, Ui_SnapshotsDialog):
for snapshot in result:
item = QtWidgets.QListWidgetItem(self.uiSnapshotsList)
item.setText("{} on {}".format(snapshot["name"], datetime.fromtimestamp(snapshot["created_at"]).strftime("%d/%m/%y at %H:%M:%S")))
item.setData(QtCore.Qt.UserRole, snapshot["snapshot_id"])
item.setText("{} on {}".format(snapshot["name"], datetime.fromtimestamp(snapshot["created_at"]).strftime("%Y-%m-%d at %H:%M:%S")))
item.setData(QtCore.Qt.ItemDataRole.UserRole, snapshot["snapshot_id"])
if self.uiSnapshotsList.count():
self.uiSnapshotsList.setCurrentRow(0)
@@ -90,14 +83,20 @@ class SnapshotsDialog(QtWidgets.QDialog, Ui_SnapshotsDialog):
Slot to create a snapshot.
"""
snapshot_name, ok = QtWidgets.QInputDialog.getText(self, "Snapshot", "Snapshot name:", QtWidgets.QLineEdit.Normal, "Unnamed")
if ok and snapshot_name:
Controller.instance().post("/projects/{}/snapshots".format(self._project.id()), self._createSnapshotsCallback, {"name": snapshot_name})
snapshot_name, ok = QtWidgets.QInputDialog.getText(self, "Snapshot", "Snapshot name:", QtWidgets.QLineEdit.EchoMode.Normal, "Unnamed")
if ok and snapshot_name and self._project:
Controller.instance().post("/projects/{}/snapshots".format(self._project.id()),
self._createSnapshotsCallback,
{"name": snapshot_name},
progressText="Creation of snapshot '{}' in progress...".format(snapshot_name),
timeout=None)
def _createSnapshotsCallback(self, result, error=False, server=None, context={}, **kwargs):
if error:
if result:
log.error(result["message"])
else:
log.error("Cannot create snapshot of project")
return
self._listSnapshots()
@@ -108,10 +107,11 @@ class SnapshotsDialog(QtWidgets.QDialog, Ui_SnapshotsDialog):
item = self.uiSnapshotsList.currentItem()
if item:
snapshot_id = item.data(QtCore.Qt.UserRole)
snapshot_id = item.data(QtCore.Qt.ItemDataRole.UserRole)
Controller.instance().delete("/projects/{}/snapshots/{}".format(self._project.id(), snapshot_id), self._deleteSnapshotsCallback)
def _deleteSnapshotsCallback(self, result, error=False, server=None, context={}, **kwargs):
if error:
if result:
log.error(result["message"])
@@ -125,7 +125,7 @@ class SnapshotsDialog(QtWidgets.QDialog, Ui_SnapshotsDialog):
item = self.uiSnapshotsList.currentItem()
if item:
snapshot_id = item.data(QtCore.Qt.UserRole)
snapshot_id = item.data(QtCore.Qt.ItemDataRole.UserRole)
self._restoreSnapshot(snapshot_id)
def _restoreSnapshot(self, snapshot_id):
@@ -134,13 +134,16 @@ class SnapshotsDialog(QtWidgets.QDialog, Ui_SnapshotsDialog):
:param snapshot_id: id of the snapshot
"""
reply = QtWidgets.QMessageBox.question(self, "Snapshots", "This will discard any changes made to your project since the snapshot was taken?", QtWidgets.QMessageBox.Ok, QtWidgets.QMessageBox.Cancel)
if reply == QtWidgets.QMessageBox.Cancel:
reply = QtWidgets.QMessageBox.question(self, "Snapshots", "This will discard any changes made to your project since the snapshot was taken, would you like to proceed?", QtWidgets.QMessageBox.StandardButton.Ok, QtWidgets.QMessageBox.StandardButton.Cancel)
if reply == QtWidgets.QMessageBox.StandardButton.Cancel:
return
Controller.instance().post("/projects/{}/snapshots/{}/restore".format(self._project.id(), snapshot_id), self._restoreSnapshotsCallback)
Controller.instance().post("/projects/{}/snapshots/{}/restore".format(self._project.id(), snapshot_id),
self._restoreSnapshotsCallback, progressText="Restoring snapshot...", timeout=None)
def _restoreSnapshotsCallback(self, result, error=False, server=None, context={}, **kwargs):
if error:
if result:
log.error(result["message"])
@@ -152,5 +155,5 @@ class SnapshotsDialog(QtWidgets.QDialog, Ui_SnapshotsDialog):
Slot to restore a snapshot when it is double clicked.
"""
snapshot_id = item.data(QtCore.Qt.UserRole)
snapshot_id = item.data(QtCore.Qt.ItemDataRole.UserRole)
self._restoreSnapshot(snapshot_id)

View File

@@ -21,6 +21,8 @@ Style editor to edit Shape items.
from ..qt import QtCore, QtWidgets, QtGui
from ..ui.style_editor_dialog_ui import Ui_StyleEditorDialog
from ..items.shape_item import ShapeItem
from ..items.rectangle_item import RectangleItem
class StyleEditorDialog(QtWidgets.QDialog, Ui_StyleEditorDialog):
@@ -40,31 +42,56 @@ class StyleEditorDialog(QtWidgets.QDialog, Ui_StyleEditorDialog):
self._items = items
self.uiColorPushButton.clicked.connect(self._setColorSlot)
self.uiBorderColorPushButton.clicked.connect(self._setBorderColorSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).clicked.connect(self._applyPreferencesSlot)
self.uiBorderStyleComboBox.addItem("Solid", QtCore.Qt.SolidLine)
self.uiBorderStyleComboBox.addItem("Dash", QtCore.Qt.DashLine)
self.uiBorderStyleComboBox.addItem("Dot", QtCore.Qt.DotLine)
self.uiBorderStyleComboBox.addItem("Dash Dot", QtCore.Qt.DashDotLine)
self.uiBorderStyleComboBox.addItem("Dash Dot Dot", QtCore.Qt.DashDotDotLine)
self.uiBorderStyleComboBox.addItem("No border", QtCore.Qt.NoPen)
self.uiBorderStyleComboBox.addItem("Solid", QtCore.Qt.PenStyle.SolidLine)
self.uiBorderStyleComboBox.addItem("Dash", QtCore.Qt.PenStyle.DashLine)
self.uiBorderStyleComboBox.addItem("Dot", QtCore.Qt.PenStyle.DotLine)
self.uiBorderStyleComboBox.addItem("Dash Dot", QtCore.Qt.PenStyle.DashDotLine)
self.uiBorderStyleComboBox.addItem("Dash Dot Dot", QtCore.Qt.PenStyle.DashDotDotLine)
self.uiBorderStyleComboBox.addItem("No border", QtCore.Qt.PenStyle.NoPen)
# use the first item in the list as the model
first_item = items[0]
pen = first_item.pen()
brush = first_item.brush()
self._color = brush.color()
self.uiColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(self._color.red(),
self._color.green(),
self._color.blue(),
self._color.alpha()))
if hasattr(first_item, "brush"): # Line don't have brush
brush = first_item.brush()
self._color = brush.color()
self.uiColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(self._color.red(),
self._color.green(),
self._color.blue(),
self._color.alpha()))
else:
self.uiColorLabel.hide()
self.uiColorPushButton.hide()
self._color = None
self._border_color = pen.color()
self.uiBorderColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(self._border_color.red(),
self._border_color.green(),
self._border_color.blue(),
self._border_color.alpha()))
self.uiRotationSpinBox.setValue(first_item.rotation())
if isinstance(first_item, RectangleItem):
# use the horizontal corner radius first and then the vertical one if it's not set
# maybe we allow configuring them separately in the future
corner_radius = first_item.horizontalCornerRadius()
if not corner_radius:
corner_radius = first_item.verticalCornerRadius()
self.uiCornerRadiusSpinBox.setValue(corner_radius)
else:
self.uiCornerRadiusLabel.hide()
self.uiCornerRadiusSpinBox.hide()
self.uiRotationSpinBox.setValue(int(first_item.rotation()))
self.uiBorderWidthSpinBox.setValue(pen.width())
if isinstance(first_item, ShapeItem):
rect = first_item.rect()
self.uiWidthSpinBox.setValue(int(rect.width()))
self.uiHeightSpinBox.setValue(int(rect.height()))
else:
self.uiWidthSpinBox.hide()
self.uiWidthLabel.hide()
self.uiHeightSpinBox.hide()
self.uiHeightLabel.hide()
index = self.uiBorderStyleComboBox.findData(pen.style())
if index != -1:
self.uiBorderStyleComboBox.setCurrentIndex(index)
@@ -74,7 +101,7 @@ class StyleEditorDialog(QtWidgets.QDialog, Ui_StyleEditorDialog):
Slot to select the filling color.
"""
color = QtWidgets.QColorDialog.getColor(self._color, self, "Select Color", QtWidgets.QColorDialog.ShowAlphaChannel)
color = QtWidgets.QColorDialog.getColor(self._color, self, "Select Color", QtWidgets.QColorDialog.ColorDialogOption.ShowAlphaChannel)
if color.isValid():
self._color = color
self.uiColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(self._color.red(),
@@ -87,7 +114,7 @@ class StyleEditorDialog(QtWidgets.QDialog, Ui_StyleEditorDialog):
Slot to select the border color.
"""
color = QtWidgets.QColorDialog.getColor(self._border_color, self, "Select Color", QtWidgets.QColorDialog.ShowAlphaChannel)
color = QtWidgets.QColorDialog.getColor(self._border_color, self, "Select Color", QtWidgets.QColorDialog.ColorDialogOption.ShowAlphaChannel)
if color.isValid():
self._border_color = color
self.uiBorderColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(self._border_color.red(),
@@ -101,12 +128,26 @@ class StyleEditorDialog(QtWidgets.QDialog, Ui_StyleEditorDialog):
"""
border_style = QtCore.Qt.PenStyle(self.uiBorderStyleComboBox.itemData(self.uiBorderStyleComboBox.currentIndex()))
pen = QtGui.QPen(self._border_color, self.uiBorderWidthSpinBox.value(), border_style, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin)
brush = QtGui.QBrush(self._color)
pen = QtGui.QPen(self._border_color, self.uiBorderWidthSpinBox.value(), border_style, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin)
if self._color:
brush = QtGui.QBrush(self._color)
else:
brush = None
for item in self._items:
item.setPen(pen)
item.setBrush(brush)
# on multi-selection it's possible to select many type of items
# but brush can be applied only on ShapeItem,
if brush and isinstance(item, ShapeItem):
item.setBrush(brush)
if isinstance(item, RectangleItem):
corner_radius = self.uiCornerRadiusSpinBox.value()
# use the corner radius for both horizontal (rx) and vertical (ry)
# maybe we support setting them separately in the future
item.setHorizontalCornerRadius(corner_radius)
item.setVerticalCornerRadius(corner_radius)
if isinstance(item, ShapeItem):
item.setWidthAndHeight(self.uiWidthSpinBox.value(), self.uiHeightSpinBox.value())
item.setRotation(self.uiRotationSpinBox.value())
def done(self, result):

View File

@@ -0,0 +1,128 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Pekka Helenius
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Style editor to edit Link items.
"""
from ..qt import QtCore, QtWidgets, QtGui
from ..ui.style_editor_dialog_ui import Ui_StyleEditorDialog
class StyleEditorDialogLink(QtWidgets.QDialog, Ui_StyleEditorDialog):
"""
Style editor dialog.
:param parent: parent widget
:param link: selected link
"""
def __init__(self, link, parent):
super().__init__(parent)
self.setupUi(self)
self._link = link
self._link_style = {}
self.uiBorderColorLabel.setText("Link color")
self.uiBorderWidthLabel.setText("Link width")
self.uiBorderStyleLabel.setText("Link style")
self.uiBorderColorPushButton.clicked.connect(self._setBorderColorSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).clicked.connect(self._applyPreferencesSlot)
self.uiBorderStyleComboBox.addItem("Solid", QtCore.Qt.PenStyle.SolidLine)
self.uiBorderStyleComboBox.addItem("Dash", QtCore.Qt.PenStyle.DashLine)
self.uiBorderStyleComboBox.addItem("Dot", QtCore.Qt.PenStyle.DotLine)
self.uiBorderStyleComboBox.addItem("Dash Dot", QtCore.Qt.PenStyle.DashDotLine)
self.uiBorderStyleComboBox.addItem("Dash Dot Dot", QtCore.Qt.PenStyle.DashDotDotLine)
self.uiBorderStyleComboBox.addItem("Invisible", QtCore.Qt.PenStyle.NoPen)
self.uiColorLabel.hide()
self.uiColorPushButton.hide()
self._color = None
self.uiCornerRadiusLabel.hide()
self.uiCornerRadiusSpinBox.hide()
self.uiRotationLabel.hide()
self.uiRotationSpinBox.hide()
link.setHovered(False) # make sure we use the right style
pen = link.pen()
link.setHovered(True)
self._border_color = pen.color()
self.uiBorderColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(
self._border_color.red(),
self._border_color.green(),
self._border_color.blue(),
self._border_color.alpha())
)
self.uiBorderWidthSpinBox.setValue(pen.width())
index = self.uiBorderStyleComboBox.findData(pen.style())
if index != -1:
self.uiBorderStyleComboBox.setCurrentIndex(index)
self.adjustSize()
def _setBorderColorSlot(self):
"""
Slot to select the border color.
"""
color = QtWidgets.QColorDialog.getColor(self._border_color, self, "Select Color", QtWidgets.QColorDialog.ColorDialogOption.ShowAlphaChannel)
if color.isValid():
self._border_color = color
self.uiBorderColorPushButton.setStyleSheet("background-color: rgba({}, {}, {}, {});".format(self._border_color.red(),
self._border_color.green(),
self._border_color.blue(),
self._border_color.alpha()))
def _applyPreferencesSlot(self):
"""
Applies the new style settings.
"""
border_style = QtCore.Qt.PenStyle(self.uiBorderStyleComboBox.itemData(self.uiBorderStyleComboBox.currentIndex()))
pen = QtGui.QPen(self._border_color, self.uiBorderWidthSpinBox.value(), border_style, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin)
self._link.setPen(pen)
new_link_style = {
"color": self._border_color.name(),
"width": self.uiBorderWidthSpinBox.value(),
"type": border_style.value,
}
# Store values
self._link.setLinkStyle(new_link_style)
self._link.setHovered(False) # allow to see the new style
def done(self, result):
"""
Called when the dialog is closed.
:param result: boolean (accepted or rejected)
"""
if result:
self._applyPreferencesSlot()
super().done(result)

View File

@@ -22,10 +22,9 @@ Dialog to change node symbols.
import os
import pathlib
from ..qt import QtCore, QtGui, QtWidgets, qpartial
from ..qt import QtCore, QtGui, QtWidgets, qpartial, sip_is_deleted
from ..qt.qimage_svg_renderer import QImageSvgRenderer
from ..ui.symbol_selection_dialog_ui import Ui_SymbolSelectionDialog
from ..local_server import LocalServer
from ..controller import Controller
from ..symbol import Symbol
@@ -51,23 +50,24 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
self.setupUi(self)
self._items = items
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).clicked.connect(self._applyPreferencesSlot)
self.uiSymbolToolButton.clicked.connect(self._symbolBrowserSlot)
self.uiCustomSymbolRadioButton.toggled.connect(self._customSymbolToggledSlot)
self.uiBuiltInSymbolRadioButton.toggled.connect(self._builtInSymbolToggledSlot)
self.uiSearchLineEdit.textChanged.connect(self._searchTextChangedSlot)
self.uiBuiltinSymbolOnlyCheckBox.toggled.connect(self._builtinSymbolOnlyToggledSlot)
if not SymbolSelectionDialog._symbols_dir:
SymbolSelectionDialog._symbols_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.PicturesLocation)
SymbolSelectionDialog._symbols_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.PicturesLocation)
if not self._items:
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).hide()
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).hide()
self.uiBuiltInSymbolRadioButton.setChecked(True)
self.uiSymbolListWidget.setFocus()
self.uiSymbolListWidget.setIconSize(QtCore.QSize(64, 64))
self.uiSymbolTreeWidget.setFocus()
self.uiSymbolTreeWidget.setIconSize(QtCore.QSize(64, 64))
self._symbol_items = []
self._parents = {}
Controller.instance().clearStaticCache() # TODO: use etag to know when to refresh the cache
Controller.instance().get("/symbols", self._listSymbolsCallback)
def _listSymbolsCallback(self, result, error=False, **kwargs):
@@ -78,32 +78,41 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
self._symbol_items = []
for symbol in result:
symbol = Symbol(**symbol)
name = os.path.splitext(symbol.filename())[0]
item = QtWidgets.QListWidgetItem(self.uiSymbolListWidget)
item.setData(QtCore.Qt.UserRole, symbol)
self._symbol_items.append(item)
item.setText(name)
theme = symbol.theme()
if theme not in self._parents:
parent = QtWidgets.QTreeWidgetItem(self.uiSymbolTreeWidget)
parent.setText(0, theme)
font = parent.font(0)
font.setBold(True)
parent.setFont(0, font)
parent.setFlags(parent.flags() & ~QtCore.Qt.ItemFlag.ItemIsSelectable)
self._parents[theme] = parent
else:
parent = self._parents[theme]
image = QtGui.QImage(64, 64, QtGui.QImage.Format_ARGB32)
# Set the ARGB to 0 to prevent rendering artifacts
image.fill(0x00000000)
icon = QtGui.QIcon(QtGui.QPixmap.fromImage(image))
item.setIcon(icon)
name = os.path.splitext(symbol.filename())[0]
item = QtWidgets.QTreeWidgetItem(parent)
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, symbol)
item.setToolTip(0, symbol.id())
self._symbol_items.append(item)
item.setText(0, name)
def render(item, path):
if sip_is_deleted(item):
return
svg_renderer = QImageSvgRenderer(path)
image = QtGui.QImage(64, 64, QtGui.QImage.Format_ARGB32)
image = QtGui.QImage(64, 64, QtGui.QImage.Format.Format_ARGB32)
# Set the ARGB to 0 to prevent rendering artifacts
image.fill(0x00000000)
svg_renderer.render(QtGui.QPainter(image))
icon = QtGui.QIcon(QtGui.QPixmap.fromImage(image))
item.setIcon(icon)
item.setIcon(0, icon)
Controller.instance().getStatic(symbol.url(), qpartial(render, item))
self.adjustSize()
def _builtinSymbolOnlyToggledSlot(self, checked):
self._filter()
for parent in self._parents.values():
parent.sortChildren(0, QtCore.Qt.SortOrder.AscendingOrder)
self.adjustSize()
def _searchTextChangedSlot(self, text):
self._filter()
@@ -114,13 +123,13 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
"""
text = self.uiSearchLineEdit.text()
for item in self._symbol_items:
if self.uiBuiltinSymbolOnlyCheckBox.isChecked() and not item.data(QtCore.Qt.UserRole).builtin():
item.setHidden(True)
# if not item.data(0, QtCore.Qt.ItemDataRole.UserRole).builtin():
# item.setHidden(True)
# else:
if not text.strip() or text.strip().lower() in item.text(0).lower():
item.setHidden(False)
else:
if len(text.strip()) == 0 or text.strip().lower() in item.text().lower():
item.setHidden(False)
else:
item.setHidden(True)
item.setHidden(True)
def _customSymbolToggledSlot(self, checked):
"""
@@ -156,16 +165,18 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
"""
symbol_path = self.getSymbol()
if not symbol_path:
return False
for item in self._items:
item.setSymbol(symbol_path)
return True
def getSymbol(self):
if self.uiSymbolListWidget.isEnabled():
current = self.uiSymbolListWidget.currentItem()
if current:
return current.data(QtCore.Qt.UserRole).id()
if self.uiSymbolTreeWidget.isEnabled():
current = self.uiSymbolTreeWidget.currentItem()
if current and current.parent():
return current.data(0, QtCore.Qt.ItemDataRole.UserRole).id()
else:
return os.path.basename(self.uiSymbolLineEdit.text())
return None
@@ -173,7 +184,7 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
def _symbolBrowserSlot(self):
# supported image file formats
file_formats = "Image files (*.svg *.bmp *.jpeg *.jpg *.pbm *.pgm *.png *.ppm *.xbm *.xpm *.gif);;All files (*.*)"
file_formats = "Image files (*.svg *.bmp *.jpeg *.jpg *.pbm *.pgm *.png *.ppm *.xbm *.xpm *.gif);;All files (*)"
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Image", SymbolSelectionDialog._symbols_dir, file_formats)
if not path:
return
@@ -184,7 +195,7 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
def _finishSymbolUpload(self, path, result, error=False, **kwargs):
if error:
log.error("Error while uploading symbol: {}".format(path))
log.error("Error while uploading symbol: {}: {}".format(path, result.get("message", "unknown")))
return
self.uiSymbolLineEdit.clear()
self.uiSymbolLineEdit.setText(path)

View File

@@ -19,7 +19,7 @@
Text editor to edit Note items.
"""
from ..qt import QtCore, QtWidgets
from ..qt import QtCore, QtWidgets, qslot, sip_is_deleted
from ..ui.text_editor_dialog_ui import Ui_TextEditorDialog
@@ -39,17 +39,17 @@ class TextEditorDialog(QtWidgets.QDialog, Ui_TextEditorDialog):
self._items = items
self.uiFontPushButton.clicked.connect(self._setFontSlot)
self.uiColorPushButton.clicked.connect(self._setColorSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Apply).clicked.connect(self._applyPreferencesSlot)
# use the first item in the list as the model
first_item = items[0]
self._setColor(first_item.defaultTextColor())
self.uiRotationSpinBox.setValue(first_item.rotation())
self.uiRotationSpinBox.setValue(int(first_item.rotation()))
self.uiPlainTextEdit.setPlainText(first_item.toPlainText())
self.uiPlainTextEdit.setFont(first_item.font())
if not first_item.editable():
self.uiPlainTextEdit.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
self.uiPlainTextEdit.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.NoTextInteraction)
if len(self._items) == 1:
self.uiApplyColorToAllItemsCheckBox.setChecked(True)
@@ -70,30 +70,36 @@ class TextEditorDialog(QtWidgets.QDialog, Ui_TextEditorDialog):
color.blue(),
color.alpha()))
def _setFontSlot(self):
@qslot
def _setFontSlot(self, *args):
"""
Slot to select the font.
"""
selected_font, ok = QtWidgets.QFontDialog.getFont(self.uiPlainTextEdit.font(), self)
selected_font, ok = QtWidgets.QFontDialog.getFont(self.uiPlainTextEdit.font(), self,
options=QtWidgets.QFontDialog.FontDialogOption.DontUseNativeDialog)
if ok:
self.uiPlainTextEdit.setFont(selected_font)
def _setColorSlot(self):
@qslot
def _setColorSlot(self, *args):
"""
Slot to select the color.
"""
color = QtWidgets.QColorDialog.getColor(self._color, self, None, QtWidgets.QColorDialog.ShowAlphaChannel)
color = QtWidgets.QColorDialog.getColor(self._color, self, None, QtWidgets.QColorDialog.ColorDialogOption.ShowAlphaChannel)
if color.isValid():
self._setColor(color)
def _applyPreferencesSlot(self):
@qslot
def _applyPreferencesSlot(self, *args):
"""
Applies the new text settings.
"""
for item in self._items:
if sip_is_deleted(item):
continue
item.setFont(self.uiPlainTextEdit.font())
if self.uiApplyColorToAllItemsCheckBox.isChecked():
item.setDefaultTextColor(self._color)

View File

@@ -21,24 +21,22 @@ from gns3.qt import QtWidgets
from gns3.controller import Controller
class VMWithImagesWizard(VMWizard):
"""
Base class for VM wizard with image management (Qemu, IOU...)
:param devices: List of existing device for this type
:param use_local_server: Value the use_local_server settings for this module
:param parent: parent widget
"""
def __init__(self, devices, use_local_server, parent):
def __init__(self, devices, parent):
# The list of images combo box (Qemu support multiple images)
self._images_combo_boxes = set()
# The list of radio button for existing image or new images
self._radio_existing_images_buttons = set()
super().__init__(devices, use_local_server, parent)
super().__init__(devices, parent)
def refreshImageStepsButtons(self):
"""
@@ -90,8 +88,8 @@ class VMWithImagesWizard(VMWizard):
self._radio_existing_images_buttons.add(radio_button)
def _imageCreateSlot(self, line_edit, create_image_wizard, image_suffix):
create_dialog = create_image_wizard(self, self.getSettings()["server"], self.uiNameLineEdit.text() + image_suffix)
if QtWidgets.QDialog.Accepted == create_dialog.exec_():
create_dialog = create_image_wizard(self, self.getSettings()["compute_id"], self.uiNameLineEdit.text() + image_suffix)
if QtWidgets.QDialog.DialogCode.Accepted == create_dialog.exec():
line_edit.setText(create_dialog.uiLocationLineEdit.text())
def _imageBrowserSlot(self, line_edit, image_selector):
@@ -144,7 +142,7 @@ class VMWithImagesWizard(VMWizard):
:param endpoint: server endpoint with the list of Images
"""
Controller.instance().get("/computes/{}{}".format(self._compute_id, endpoint), self._getImagesFromServerCallback)
Controller.instance().getCompute(endpoint, self._compute_id, self._getImagesFromServerCallback)
def _getImagesFromServerCallback(self, result, error=False, **kwargs):
"""
@@ -183,10 +181,8 @@ class VMWithImagesWizard(VMWizard):
for vm in result:
combo_box.addItem(vm["path"], vm)
def _widgetOnCurrentPage(self, widget):
"""
:returns Boolean True if widget is current active Wizard page
"""
return self.currentPage().findChild(widget.__class__, widget.objectName()) is not None

View File

@@ -19,6 +19,7 @@ import sys
from gns3.qt import QtWidgets
from gns3.compute_manager import ComputeManager
from gns3.controller import Controller
class VMWizard(QtWidgets.QWizard):
@@ -26,32 +27,33 @@ class VMWizard(QtWidgets.QWizard):
Base class for VM wizard.
:param devices: List of existing device for this type
:param use_local_server: Value the use_local_server settings for this module
:param parent: parent widget
"""
def __init__(self, devices, use_local_server, parent):
def __init__(self, devices, parent):
super().__init__(parent)
self.setupUi(self)
self.setModal(True)
self._devices = devices
self._use_local_server = use_local_server
self._local_server_disable = False
self.setWizardStyle(QtWidgets.QWizard.ModernStyle)
self.setWizardStyle(QtWidgets.QWizard.WizardStyle.ModernStyle)
if sys.platform.startswith("darwin"):
# we want to see the cancel button on OSX
self.setOptions(QtWidgets.QWizard.NoDefaultButton)
self.setOptions(QtWidgets.QWizard.WizardOption.NoDefaultButton)
self.uiRemoteRadioButton.toggled.connect(self._remoteServerToggledSlot)
if hasattr(self, "uiVMRadioButton"):
self.uiVMRadioButton.toggled.connect(self._vmToggledSlot)
self.uiLocalRadioButton.toggled.connect(self._localToggledSlot)
if Controller.instance().isRemote():
self.uiLocalRadioButton.setText("Run device on the main server")
# By default we use the local server
self._compute_id = ComputeManager.instance().computes()[0].id()
self._compute_id = "local"
self.uiLocalRadioButton.setChecked(True)
self._localToggledSlot(True)
@@ -103,15 +105,16 @@ class VMWizard(QtWidgets.QWizard):
for compute in ComputeManager.instance().computes():
if compute.id() == "local":
self.uiLocalRadioButton.setEnabled(True)
elif compute.id() == "vm" and hasattr(self, "uiVMRadioButton"):
self.uiVMRadioButton.setEnabled(True)
elif compute.id() == "vm":
if hasattr(self, "uiVMRadioButton"):
self.uiVMRadioButton.setEnabled(True)
else:
self.uiRemoteRadioButton.setEnabled(True)
self.uiRemoteServersComboBox.addItem(compute.name(), compute.id())
if self._use_local_server and self.uiLocalRadioButton.isEnabled() and self.uiLocalRadioButton.isVisible():
if self.uiLocalRadioButton.isEnabled() and not self._local_server_disable:
self.uiLocalRadioButton.setChecked(True)
elif self.uiVMRadioButton.isEnabled():
elif hasattr(self, "uiVMRadioButton") and self.uiVMRadioButton.isEnabled():
self.uiVMRadioButton.setChecked(True)
else:
if self.uiRemoteRadioButton.isEnabled():
@@ -123,6 +126,7 @@ class VMWizard(QtWidgets.QWizard):
"""
Turn off the local server
"""
self._local_server_disable = True
self.uiLocalRadioButton.hide()
self.uiLocalRadioButton.setEnabled(False)
self.setStartId(0)

File diff suppressed because it is too large Load Diff

View File

@@ -15,18 +15,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .qt import sip
import json
import copy
import ipaddress
import http
import uuid
import pathlib
import urllib.request
import base64
import ipaddress
import urllib.request
import urllib.parse
from .version import __version__, __version_info__
from .qt import QtCore, QtNetwork, qpartial
from .qt import QtCore, QtNetwork, QtWidgets, qpartial, sip_is_deleted
from .utils import parse_version
import logging
@@ -44,46 +44,73 @@ class HTTPClient(QtCore.QObject):
"""
HTTP client.
:param settings: Dictionnary with connection information to the server
:param settings: Dictionary with connection information to the server
:param network_manager: A QT network manager
"""
# How many times we need to retry a connection
MAX_RETRY_CONNECTION = 5
# Callback class used for displaying progress
_progress_callback = None
connection_connected_signal = QtCore.Signal()
connection_disconnected_signal = QtCore.Signal()
def __init__(self, settings, network_manager=None):
def __init__(self, settings, network_manager=None, max_retry_connection=5):
super().__init__()
self._protocol = settings.get("protocol", "http")
self._host = settings["host"]
if self._host == "0.0.0.0":
self._host = "127.0.0.1"
try:
if self._host is None or self._host == "0.0.0.0":
self._host = "127.0.0.1"
elif ":" in self._host and ipaddress.IPv6Address(self._host) and str(ipaddress.IPv6Address(self._host)) == "::":
self._host = "::1"
except ipaddress.AddressValueError:
log.error("Invalid host name %s", self._host)
self._port = int(settings["port"])
self._user = settings.get("user", None)
self._password = settings.get("password", None)
# How many time we have retry connection
# How many time we have already retried connection
self._retry = 0
self._max_retry_connection = max_retry_connection
self._connected = False
self._shutdown = False # Shutdown in progress
self._accept_insecure_certificate = settings.get("accept_insecure_certificate", None)
# Add custom CA
# ssl_config = QtNetwork.QSslConfiguration.defaultConfiguration()
# if ssl_config.addCaCertificates("/path/to/rootCA.crt"):
# log.debug("CA certificate added")
# QtNetwork.QSslConfiguration.setDefaultConfiguration(ssl_config)
if self._protocol == "https":
if not QtNetwork.QSslSocket.supportsSsl():
log.error("SSL is not supported")
else:
log.debug(f"SSL is supported, version: {QtNetwork.QSslSocket().sslLibraryBuildVersionString()}")
# In order to detect computer hibernation we detect the date of the last
# query and disconnect if time is too long between two query
self._last_query_timestamp = None
self._max_time_difference_between_queries = None
if network_manager:
self._network_manager = network_manager
else:
self._network_manager = QtNetwork.QNetworkAccessManager()
# A buffer used by progress download
self._buffer = {}
# List of query waiting for the connection
self._query_waiting_connections = []
# To catch SSL errors
self._network_manager.sslErrors.connect(self._sslErrorsSlot)
# Store SSL error exceptions
self._ssl_exceptions = {}
def setMaxTimeDifferenceBetweenQueries(self, value):
self._max_time_difference_between_queries = value
def host(self):
"""
Host display to user
@@ -125,15 +152,20 @@ class HTTPClient(QtCore.QObject):
def url(self):
"""Returns current server url"""
if ":" in self.host():
return "{}://[{}]:{}".format(self.protocol(), self.host(), self.port())
return "{}://{}:{}".format(self.protocol(), self.host(), self.port())
def fullUrl(self):
"""Returns current server url including user and password"""
host = self.host()
if ":" in self.host():
host = "[{}]".format(host)
if self._user:
return "{}://{}:{}@{}:{}".format(self.protocol(), self._user, self._password, self.host(), self.port())
return "{}://{}:{}@{}:{}".format(self.protocol(), self._user, self._password, host, self.port())
else:
return "{}://{}:{}".format(self.protocol(), self.host(), self.port())
return "{}://{}:{}".format(self.protocol(), host, self.port())
def password(self):
return self._password
@@ -148,11 +180,30 @@ class HTTPClient(QtCore.QObject):
self.createHTTPQuery("POST", "/shutdown", None, showProgress=False)
self._shutdown = True
def getNetworkManager(self):
"""
:return: instance of NetworkManager
"""
return self._network_manager
def setMaxRetryConnection(self, retries):
"""
Sets how many times we need to retry a connection
:param retries: integer
"""
self._max_retry_connection = retries
def getMaxRetryConnection(self):
"""
Returns how many times we need to retry a connection
"""
return self._max_retry_connection
def _notify_progress_start_query(self, query_id, progress_text, response):
"""
Called when a query start
"""
if HTTPClient._progress_callback:
if not sip_is_deleted(HTTPClient._progress_callback):
if progress_text:
HTTPClient._progress_callback.add_query_signal.emit(query_id, progress_text, response)
else:
@@ -163,22 +214,24 @@ class HTTPClient(QtCore.QObject):
Called when a query is over
"""
if HTTPClient._progress_callback:
if not sip_is_deleted(HTTPClient._progress_callback):
HTTPClient._progress_callback.remove_query_signal.emit(query_id)
def _notify_progress_upload(self, query_id, sent, total):
"""
Called when a query upload progress
"""
if HTTPClient._progress_callback:
HTTPClient._progress_callback.progress_signal.emit(query_id, sent, total)
if not sip_is_deleted(HTTPClient._progress_callback):
HTTPClient._progress_callback.progress_signal.emit(query_id, str(abs(sent)), str(abs(total)))
def _notify_progress_download(self, query_id, sent, total):
"""
Called when a query download progress
"""
if HTTPClient._progress_callback:
HTTPClient._progress_callback.progress_signal.emit(query_id, sent, total)
if not sip_is_deleted(HTTPClient._progress_callback):
# abs() for maximum because sometimes the system send negative
# values
HTTPClient._progress_callback.progress_signal.emit(query_id, str(abs(sent)), str(abs(total)))
@classmethod
def setProgressCallback(cls, progress_callback):
@@ -201,6 +254,7 @@ class HTTPClient(QtCore.QObject):
Closes the connection with the server.
"""
self._connected = False
self._progress_callback.reset()
def _request(self, url):
"""
@@ -221,7 +275,25 @@ class HTTPClient(QtCore.QObject):
:param query: The Server to connect
"""
def createHTTPQuery(self, method, path, callback, body={}, context={}, downloadProgressCallback=None, showProgress=True, ignoreErrors=False, progressText=None, timeout=120, server=None, prefix="/v2", params={}, **kwargs):
def createHTTPQuery(
self,
method,
path,
callback,
body=None,
context=None,
downloadProgressCallback=None,
showProgress=True,
ignoreErrors=False,
progressText=None,
timeout=120,
server=None,
prefix="/v2",
params=None,
networkManager=None,
eventsHandler=None,
**kwargs
):
"""
Call the remote server, if not connected, check connection before
@@ -237,24 +309,66 @@ class HTTPClient(QtCore.QObject):
:param server: The server where the query will run
:param timeout: Delay in seconds before raising a timeout
:param prefix: Prefix to the path
:param networkManager: QNetworkAccessManager None use the default
:param eventsHandler: Handler receiving and triggering events like `updated`, `cancelled`.
If not specified and showProgress is `True` then `ProgressDialog` receives them.
:param params: Query arguments parameters
:returns: QNetworkReply
"""
if "dev" in __version__:
assert QtCore.QThread.currentThread() == self.thread(), "HTTP request not started from the main thread"
# Shutdown in progress do not execute the query
if self._shutdown:
return
request = qpartial(self._executeHTTPQuery, method, path, qpartial(callback), body, context, downloadProgressCallback=downloadProgressCallback, showProgress=showProgress, ignoreErrors=ignoreErrors, progressText=progressText, server=server, timeout=timeout, prefix=prefix, params=params)
# TODO: clean this
# We try to detect computer hibernation
# if time between two query is too long we trigger a disconnect
# if self._max_time_difference_between_queries:
# now = datetime.datetime.now().timestamp()
# if self._last_query_timestamp is not None and now > self._last_query_timestamp + self._max_time_difference_between_queries:
# log.warning("Synchronisation lost with the server.")
# self.disconnect()
# self._last_query_timestamp = None
# return
# self._last_query_timestamp = now
request = qpartial(
self._executeHTTPQuery,
method,
path,
qpartial(callback),
body,
context,
downloadProgressCallback=downloadProgressCallback,
showProgress=showProgress,
ignoreErrors=ignoreErrors,
progressText=progressText,
networkManager=networkManager,
server=server,
timeout=timeout,
prefix=prefix,
eventsHandler=eventsHandler,
params=params
)
if self._connected:
return request()
else:
self._query_waiting_connections.append((request, callback))
# If we are not connected and we enqueue the first query we open the conection
# enqueue the first query and open the connection if we are not connected
if len(self._query_waiting_connections) == 1:
log.info("Connection to {}".format(self.url()))
self._executeHTTPQuery("GET", "/version", self._callbackConnect, {}, server=server, timeout=5)
log.debug("Connection to {}".format(self.url()))
self._executeHTTPQuery(
"GET",
"/version",
self._callbackConnect,
server=server,
timeout=10,
showProgress=False
)
def _connectionError(self, callback, msg="", server=None):
"""
@@ -268,16 +382,25 @@ class HTTPClient(QtCore.QObject):
if len(msg) > 0:
msg = "Cannot connect to server {}: {}".format(self.url(), msg)
else:
msg = "Cannot connect to {}. Please check if GNS3 is allowed in your antivirus and firewall.".format(self.url())
msg = "Cannot connect to {}. Please check if GNS3 is allowed in your antivirus and firewall. And that server version is {}.".format(self.url(), __version__)
for request, callback in self._query_waiting_connections:
if callback is not None:
callback({"message": msg}, error=True, server=server)
callback({"message": msg}, error=True, server=server, connection_error=True)
self._query_waiting_connections = []
def _retryConnection(self, server=None):
log.debug("Retry connection to {}".format(self.url()))
self._retry += 1
QtCore.QTimer.singleShot(1000, qpartial(self._executeHTTPQuery, "GET", "/version", self._callbackConnect, {}, server=server, timeout=5))
QtCore.QTimer.singleShot(
1000,
qpartial(
self._executeHTTPQuery,
"GET",
"/version",
self._callbackConnect,
server=server,
timeout=5)
)
def _callbackConnect(self, params, error=False, server=None, **kwargs):
"""
@@ -291,7 +414,7 @@ class HTTPClient(QtCore.QObject):
"""
if error is not False:
if self._retry < self.MAX_RETRY_CONNECTION:
if self._retry < self.getMaxRetryConnection():
self._retryConnection(server=server)
return
for request, callback in self._query_waiting_connections:
@@ -300,7 +423,7 @@ class HTTPClient(QtCore.QObject):
return
if "version" not in params or "local" not in params:
if self._retry < self.MAX_RETRY_CONNECTION:
if self._retry < self.getMaxRetryConnection():
self._retryConnection(server=server)
return
msg = "The remote server {} is not a GNS3 server".format(self.url())
@@ -311,22 +434,18 @@ class HTTPClient(QtCore.QObject):
self._query_waiting_connections = []
return
if params["version"] != __version__:
msg = "Client version {} differs with server version {}".format(__version__, params["version"])
log.error(msg)
# Stable release
if __version_info__[3] == 0:
if params["version"].split("+")[0] != __version__.split("+")[0]:
msg = "Client version {} is not the same as server (controller) version {}".format(__version__, params["version"])
# We don't allow different versions to interact even with dev build
# (excepting post release corrections e.g 2.2.32.1, occassionally done when fixing a packaging problem)
# TODO: we should probably follow this standard starting with v3.0: https://semver.org/
if parse_version(__version__)[:3] != parse_version(params["version"])[:3]:
log.error(msg)
for request, callback in self._query_waiting_connections:
if callback is not None:
callback({"message": msg}, error=True, server=server)
return
# We don't allow different major version to interact even with dev build
elif parse_version(__version__)[:2] != parse_version(params["version"])[:2]:
for request, callback in self._query_waiting_connections:
if callback is not None:
callback({"message": msg}, error=True, server=server)
return
log.warning("Use a different client and server version can create bugs. Use it at your own risk.")
log.warning("{}\nUsing different versions may result in unexpected problems. Please upgrade or use at your own risk.".format(msg))
self._connected = True
self._retry = 0
@@ -356,11 +475,11 @@ class HTTPClient(QtCore.QObject):
data = QtCore.QByteArray(body.encode())
body = QtCore.QBuffer(self)
body.setData(data)
body.open(QtCore.QIODevice.ReadOnly)
body.open(QtCore.QIODeviceBase.OpenModeFlag.ReadOnly)
return body
elif isinstance(body, pathlib.Path):
body = QtCore.QFile(str(body), self)
body.open(QtCore.QFile.ReadOnly)
body.open(QtCore.QIODeviceBase.OpenModeFlag.ReadOnly)
request.setRawHeader(b"Content-Type", b"application/octet-stream")
# QT is smart and will compute the Content-Lenght for us
return body
@@ -369,7 +488,7 @@ class HTTPClient(QtCore.QObject):
data = QtCore.QByteArray(body.encode())
body = QtCore.QBuffer(self)
body.setData(data)
body.open(QtCore.QIODevice.ReadOnly)
body.open(QtCore.QIODeviceBase.OpenModeFlag.ReadOnly)
return body
else:
return None
@@ -385,7 +504,74 @@ class HTTPClient(QtCore.QObject):
request.setRawHeader(b"Authorization", auth_string.encode())
return request
def _executeHTTPQuery(self, method, path, callback, body, context={}, downloadProgressCallback=None, showProgress=True, ignoreErrors=False, progressText=None, server=None, timeout=120, prefix="/v2", params={}, **kwargs):
def connectWebSocket(self, websocket, path, prefix="/v2"):
"""
Path of the websocket endpoint
"""
host = self._getHostForQuery()
request = websocket.request()
ws_protocol = "ws"
if self._protocol == "https":
ws_protocol = "wss"
ws_url = "{protocol}://{host}:{port}{prefix}{path}".format(protocol=ws_protocol,
host=host,
port=self._port,
path=path,
prefix=prefix)
log.debug("Connecting to WebSocket endpoint: {}".format(ws_url))
request.setUrl(QtCore.QUrl(ws_url))
self._addAuth(request)
websocket.open(request)
return websocket
def _getHostForQuery(self):
"""
Get hostname that could be use by Qt
"""
try:
ip = self._host.rsplit('%', 1)[0]
ipaddress.IPv6Address(ip) # remove any scope ID
# this is an IPv6 address, we must surround it with brackets to be used with QUrl.
host = "[{}]".format(ip)
except ipaddress.AddressValueError:
host = self._host
return host
def _paramsToQueryString(self, params):
"""
:param params: Dictionary of query string parameters
:returns: String of the query string
"""
if params is None:
query_string = ""
else:
query_string = "?"
params = params.copy()
for key, value in params.copy().items():
if value is None:
del params[key]
query_string += urllib.parse.urlencode(params)
return query_string
def _executeHTTPQuery(
self,
method,
path,
callback,
body=None,
context=None,
downloadProgressCallback=None,
showProgress=True,
ignoreErrors=False,
progressText=None,
server=None,
timeout=120,
prefix="/v2",
params=None,
networkManager=None,
eventsHandler=None,
**kwargs
):
"""
Call the remote server
@@ -394,59 +580,61 @@ class HTTPClient(QtCore.QObject):
:param body: params to send (dictionary)
:param callback: callback method to call when the server replies
:param context: Pass a context to the response callback
:param downloadProgressCallback: Callback called when received something, it can be an incomplete response
:param downloadProgressCallback: callback called when received something, it can be an incomplete response
:param showProgress: Display progress to the user
:param networkManager: The network manager to use. If None use default
:param progressText: Text display to user in progress dialog. None for auto generated
:param ignoreErrors: Ignore connection error (usefull to not closing a connection when notification feed is broken)
:param server: The server where the query is executed
:param timeout: Delay in seconds before raising a timeout
:param eventsHandler: Handler receiving and triggering events like `updated`, `cancelled`.
If not specified and showProgress is `True` then `ProgressDialog` receives them.
:param params: Query arguments parameters
:returns: QNetworkReply
"""
# TODO: remove it when all call are migrated
if "compute/" in path:
log.warning("Legacy compute direct call %s", path)
try:
ip = self._host.rsplit('%', 1)[0]
ipaddress.IPv6Address(ip) # remove any scope ID
# this is an IPv6 address, we must surround it with brackets to be used with QUrl.
host = "[{}]".format(ip)
except ipaddress.AddressValueError:
host = self._host
if params == {}:
query_string = ""
else:
query_string = "?" + urllib.parse.urlencode(params)
host = self._getHostForQuery()
query_string = self._paramsToQueryString(params)
log.debug("{method} {protocol}://{host}:{port}{prefix}{path} {body}{query_string}".format(method=method, protocol=self._protocol, host=host, port=self._port, path=path, body=body, prefix=prefix, query_string=query_string))
url = QtCore.QUrl("{protocol}://{host}:{port}{prefix}{path}{query_string}".format(protocol=self._protocol, host=host, port=self._port, path=path, prefix=prefix, query_string=query_string))
if self._user:
url = QtCore.QUrl("{protocol}://{user}@{host}:{port}{prefix}{path}{query_string}".format(protocol=self._protocol, user=self._user, host=host, port=self._port, path=path, prefix=prefix, query_string=query_string))
else:
url = QtCore.QUrl("{protocol}://{host}:{port}{prefix}{path}{query_string}".format(protocol=self._protocol, host=host, port=self._port, path=path, prefix=prefix, query_string=query_string))
url.setUserName(self._user)
request = self._request(url)
request = self._addAuth(request)
request.setRawHeader(b"User-Agent", "GNS3 QT Client v{version}".format(version=__version__).encode())
# By default QT doesn't support GET with body even if it's in the RFC that's why we need to use sendCustomRequest
# By default, QT doesn't support GET with body even if it's in the RFC that's why we need to use sendCustomRequest
body = self._addBodyToRequest(body, request)
response = self._network_manager.sendCustomRequest(request, method.encode(), body)
if not networkManager:
networkManager = self._network_manager
context = copy.copy(context)
try:
response = networkManager.sendCustomRequest(request, method.encode(), body)
except SystemError as e:
log.error("Can't send query: {}".format(str(e)))
return None
if context:
context = copy.copy(context)
else:
context = dict()
context["query_id"] = str(uuid.uuid4())
response.finished.connect(qpartial(self._processResponse, response, server, callback, context, body, ignoreErrors))
response.errorOccurred.connect(qpartial(self._processError, response, server, callback, context, body, ignoreErrors))
if downloadProgressCallback is not None:
response.readyRead.connect(qpartial(self._readyReadySlot, response, downloadProgressCallback, context, server))
if HTTPClient._progress_callback and HTTPClient._progress_callback.progress_dialog():
request_canceled = qpartial(self._requestCanceled, response, context)
request_canceled = qpartial(self._requestCanceled, response, context)
if eventsHandler is not None:
eventsHandler.canceled.connect(request_canceled)
elif not sip_is_deleted(HTTPClient._progress_callback) and HTTPClient._progress_callback.progress_dialog():
HTTPClient._progress_callback.progress_dialog().canceled.connect(request_canceled)
if showProgress:
@@ -457,26 +645,26 @@ class HTTPClient(QtCore.QObject):
self._notify_progress_start_query(context["query_id"], progressText, response)
if timeout is not None:
QtCore.QTimer.singleShot(timeout * 1000, qpartial(self._timeoutSlot, response))
QtCore.QTimer.singleShot(timeout * 1000, qpartial(self._timeoutSlot, response, timeout))
return response
def _readyReadySlot(self, response, callback, context, server, *args):
"""
Process a packet receive on the notification feed.
The feed can contains qpartial JSON. If we found a
The feed can contain qpartial JSON. If we found a
part of a JSON we keep it for the next packet
"""
if response.error() != QtNetwork.QNetworkReply.NoError:
if response.error() != QtNetwork.QNetworkReply.NetworkError.NoError:
return
# HTTP error
status = response.attribute(QtNetwork.QNetworkRequest.HttpStatusCodeAttribute)
status = response.attribute(QtNetwork.QNetworkRequest.Attribute.HttpStatusCodeAttribute)
if status >= 300:
return
content = bytes(response.readAll())
content_type = response.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
content_type = response.header(QtNetwork.QNetworkRequest.KnownHeaders.ContentTypeHeader)
if content_type == "application/json":
content = content.decode("utf-8")
if context["query_id"] in self._buffer:
@@ -492,48 +680,56 @@ class HTTPClient(QtCore.QObject):
else:
callback(content, server=server, context=context)
def _timeoutSlot(self, response):
def _timeoutSlot(self, response, timeout):
"""
Beware it's call for all request you need to check the status of the response
"""
# We check if we received HTTP headers
if not len(response.rawHeaderList()) > 0:
response.abort()
if not sip.isdeleted(response) and response.isRunning() and not len(response.rawHeaderList()) > 0:
if not response.error() != QtNetwork.QNetworkReply.NetworkError.NoError:
method = response.request().attribute(QtNetwork.QNetworkRequest.Attribute.CustomVerbAttribute).data().decode()
log.warning("Timeout after {} seconds for request {} '{}'. Please check the connection is not blocked by a firewall or an anti-virus.".format(timeout, method, response.url().toString()))
response.abort()
def disconnect(self):
"""
Disconnect from the remote server
"""
self.connection_disconnected_signal.emit()
self.close()
def _requestCanceled(self, response, context):
if response.isRunning():
log.warn("Aborting request for {}".format(response.url()))
if response.isRunning() and not response.error() != QtNetwork.QNetworkReply.NetworkError.NoError:
log.warning("Aborting request for {}".format(response.url().toString()))
response.abort()
if "query_id" in context:
self._notify_progress_end_query(context["query_id"])
def _processResponse(self, response, server, callback, context, request_body, ignore_errors):
if request_body is not None:
request_body.close()
status = None
body = None
if "query_id" in context:
self._notify_progress_end_query(context["query_id"])
if response.error() != QtNetwork.QNetworkReply.NoError:
error_code = response.error()
error_message = response.errorString()
def _processError(self, response, server, callback, context, request_body, ignore_errors, error_code):
if error_code != QtNetwork.QNetworkReply.NetworkError.NoError:
error_message = "{} ({}:{})".format(response.errorString(), self._host, self._port)
if not ignore_errors:
log.debug("Response error: %s (error: %d)", error_message, error_code)
method = response.request().attribute(QtNetwork.QNetworkRequest.Attribute.CustomVerbAttribute).data().decode()
log.debug("Response error: %s for %s '%s' (error: %d)", error_message, method, response.url().toString(), error_code.value)
if error_code < 200:
if not ignore_errors:
self.close()
if callback is not None:
callback({"message": error_message}, error=True, server=server, context=context)
if "query_id" in context:
self._notify_progress_end_query(context["query_id"])
if error_code.value < 200 or error_code.value == 403:
if error_code == QtNetwork.QNetworkReply.NetworkError.OperationCanceledError: # It's legit to cancel do not disconnect
error_message = "Operation timeout" # It's clearer than cancel because cancel is triggered by us when we timeout
elif error_code == QtNetwork.QNetworkReply.NetworkError.NetworkSessionFailedError:
# ignore the network session failed error to let the network manager recover from it
return
elif not ignore_errors:
self.disconnect()
if callback is not None:
callback({"message": error_message}, error=True, server=server, context=context)
return
else:
status = response.attribute(QtNetwork.QNetworkRequest.HttpStatusCodeAttribute)
status = response.attribute(QtNetwork.QNetworkRequest.Attribute.HttpStatusCodeAttribute)
if status == 401:
log.error(error_message)
@@ -542,12 +738,12 @@ class HTTPClient(QtCore.QObject):
# Some time antivirus intercept our query and reply with garbage content
except UnicodeError:
body = None
content_type = response.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
content_type = response.header(QtNetwork.QNetworkRequest.KnownHeaders.ContentTypeHeader)
if callback is not None:
if not body or content_type != "application/json":
callback({"message": error_message}, error=True, server=server, context=context)
else:
log.debug(body)
# log.debug(body)
try:
callback(json.loads(body), error=True, server=server, context=context)
except ValueError:
@@ -559,8 +755,16 @@ class HTTPClient(QtCore.QObject):
log.error(json.loads(body)["message"])
except (ValueError, KeyError):
log.error(error_message)
else:
status = response.attribute(QtNetwork.QNetworkRequest.HttpStatusCodeAttribute)
def _processResponse(self, response, server, callback, context, request_body, ignore_errors):
if request_body is not None:
request_body.close()
if "query_id" in context:
self._notify_progress_end_query(context["query_id"])
if response.error() == QtNetwork.QNetworkReply.NetworkError.NoError:
status = response.attribute(QtNetwork.QNetworkRequest.Attribute.HttpStatusCodeAttribute)
log.debug("Decoding response from {} response {}".format(response.url().toString(), status))
try:
raw_body = bytes(response.readAll())
@@ -568,10 +772,13 @@ class HTTPClient(QtCore.QObject):
# Some time anti-virus intercept our query and reply with garbage content
except UnicodeDecodeError:
body = None
content_type = response.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
log.debug(body)
content_type = response.header(QtNetwork.QNetworkRequest.KnownHeaders.ContentTypeHeader)
if body and len(body.strip(" \n\t")) > 0 and content_type == "application/json":
params = json.loads(body)
try:
params = json.loads(body)
except ValueError: # Partial JSON
params = {}
status = 504
else:
params = {}
if callback is not None:
@@ -579,56 +786,130 @@ class HTTPClient(QtCore.QObject):
callback(params, error=True, server=server, context=context)
else:
callback(params, server=server, context=context, raw_body=raw_body)
# response.deleteLater()
if status == 400:
try:
params = json.loads(body)
e = HttpBadRequest(body)
e.fingerprint = params["path"]
# If something goes wrong for a any reason just raise the bad request
except Exception:
e = HttpBadRequest(body)
raise e
if status == 400:
try:
params = json.loads(body)
e = HttpBadRequest(body)
e.fingerprint = params["path"]
# If something goes wrong for a any reason just raise the bad request
except Exception:
e = HttpBadRequest(body)
raise e
def getSynchronous(self, endpoint, timeout=2):
def getSynchronous(self, method, endpoint, prefix="/v2", timeout=5):
"""
Synchronous check if a server is running
:returns: Tuple (Status code, json of anwser). Status 0 is a non HTTP error
:returns: Tuple (Status code, json of answer). Status 0 is a non HTTP error
"""
host = self._getHostForQuery()
log.debug("{method} {protocol}://{host}:{port}{prefix}{endpoint}".format(method=method, protocol=self._protocol, host=host, port=self._port, prefix=prefix, endpoint=endpoint))
url = QtCore.QUrl("{protocol}://{host}:{port}{prefix}{endpoint}".format(protocol=self._protocol, host=host, port=self._port, prefix=prefix, endpoint=endpoint))
if self._user:
url.setUserName(self._user)
request = self._request(url)
request = self._addAuth(request)
request.setRawHeader(b"User-Agent", "GNS3 QT Client v{version}".format(version=__version__).encode())
try:
url = "{protocol}://{host}:{port}/v2/{endpoint}".format(protocol=self._protocol, host=self._host, port=self._port, endpoint=endpoint)
response = self._network_manager.sendCustomRequest(request, method.encode())
except SystemError as e:
log.error("Can't send query: {}".format(str(e)))
return
if self._user is not None and len(self._user) > 0:
log.debug("Synchronous get {} with user '{}'".format(url, self._user))
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm="GNS3 server",
uri=url,
user=self._user,
passwd=self._password)
opener = urllib.request.build_opener(auth_handler)
urllib.request.install_opener(opener)
else:
log.debug("Synchronous get {} (no authentication)".format(url))
loop = QtCore.QEventLoop()
response.finished.connect(loop.quit)
response = urllib.request.urlopen(url, timeout=timeout)
content_type = response.getheader("CONTENT-TYPE")
if response.status == 200:
if content_type == "application/json":
content = response.read()
if timeout is not None:
QtCore.QTimer.singleShot(timeout * 1000, qpartial(self._timeoutSlot, response, timeout))
if not loop.isRunning():
loop.exec()
status = response.attribute(QtNetwork.QNetworkRequest.Attribute.HttpStatusCodeAttribute)
if response.error() != QtNetwork.QNetworkReply.NetworkError.NoError:
log.debug("Error while connecting to local server {}".format(response.errorString()))
else:
content_type = response.header(QtNetwork.QNetworkRequest.KnownHeaders.ContentTypeHeader)
if status == 200 and content_type == "application/json":
content = bytes(response.readAll())
try:
json_data = json.loads(content.decode("utf-8"))
return response.status, json_data
else:
return response.status, None
except http.client.InvalidURL as e:
log.warn("Invalid local server url: {}".format(e))
return 0, None
except urllib.error.URLError:
# Connection refused. It's a normal behavior if server is not started
return 0, None
except urllib.error.HTTPError as e:
log.debug("Error during get on {}:{}: {}".format(self.host(), self.port(), e))
return e.code, None
except (OSError, http.client.BadStatusLine, ValueError) as e:
log.debug("Error during get on {}:{}: {}".format(self.host(), self.port(), e))
return 0, None
except (UnicodeEncodeError, ValueError) as e:
log.warning("Could not read JSON data returned from {}: {}".format(url, e))
else:
return status, json_data
return status, None
def _sslErrorsSlot(self, response, ssl_errors):
self.handleSslError(response, ssl_errors)
def handleSslError(self, response, ssl_errors):
if self._accept_insecure_certificate:
response.ignoreSslErrors()
return
url = response.request().url()
host_port_key = f"{url.host()}:{url.port()}"
# get the certificate digest
ssl_config = response.sslConfiguration()
peer_cert = ssl_config.peerCertificate()
digest = peer_cert.digest()
if host_port_key in self._ssl_exceptions:
if self._ssl_exceptions[host_port_key] == digest:
response.ignoreSslErrors()
return
from gns3.main_window import MainWindow
main_window = MainWindow.instance()
msgbox = QtWidgets.QMessageBox(main_window)
msgbox.setWindowTitle("SSL error detected")
msgbox.setText(f"This server could not prove that it is {url.host()}:{url.port()}. Please carefully examine the certificate to make sure the server can be trusted.")
msgbox.setInformativeText(f"{ssl_errors[0].errorString()}")
msgbox.setDetailedText(peer_cert.toText())
msgbox.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
connect_button = QtWidgets.QPushButton(f"&Connect to {url.host()}:{url.port()}", msgbox)
msgbox.addButton(connect_button, QtWidgets.QMessageBox.ButtonRole.YesRole)
abort_button = QtWidgets.QPushButton("&Abort", msgbox)
msgbox.addButton(abort_button, QtWidgets.QMessageBox.ButtonRole.RejectRole)
msgbox.setDefaultButton(abort_button)
msgbox.setIcon(QtWidgets.QMessageBox.Icon.Critical)
msgbox.exec()
if msgbox.clickedButton() == connect_button:
self._ssl_exceptions[host_port_key] = digest
response.ignoreSslErrors()
else:
for error in ssl_errors:
log.error(f"SSL error detected: {error.errorString()}")
main_window.close()
@classmethod
def fromUrl(cls, url, network_manager=None, base_settings=None):
"""
Returns HttpClient instance based on the url
:param url: Url to parse
:param network_manager: Optional network_manager
:param base_settings: Source of the settings, if necessary
:return: HttpClient
"""
settings = {}
if base_settings is not None:
settings.update(**base_settings)
parse_results = urllib.parse.urlparse(url)
settings['protocol'] = parse_results.scheme
settings['host'] = parse_results.hostname
settings['port'] = parse_results.port
settings['user'] = parse_results.username
settings['password'] = parse_results.password
return cls(settings, network_manager)

View File

@@ -18,7 +18,6 @@
import os
import copy
import pathlib
import glob
from gns3.qt import QtWidgets
from gns3.local_server_config import LocalServerConfig
@@ -26,6 +25,7 @@ from gns3.settings import LOCAL_SERVER_SETTINGS
from gns3.controller import Controller
from gns3.utils.file_copy_worker import FileCopyWorker
from gns3.utils.progress_dialog import ProgressDialog
from gns3.registry.image import Image
class ImageManager:
@@ -34,7 +34,29 @@ class ImageManager:
# Remember if we already ask the user about this image for this server
self._asked_for_this_image = {}
def askCopyUploadImage(self, parent, path, server, node_type):
def _getUniqueDestinationPath(self, source_image, node_type, path):
"""
Get a unique destination path (with counter).
"""
if not os.path.exists(path):
return path
path, extension = os.path.splitext(path)
counter = 1
new_path = "{}-{}{}".format(path, counter, extension)
while os.path.exists(new_path):
destination_image = Image(node_type, new_path, filename=os.path.basename(new_path))
try:
if source_image.md5sum == destination_image.md5sum:
# the source and destination images are identical
return new_path
except OSError:
continue
counter += 1
new_path = "{}-{}{}".format(path, counter, extension)
return new_path
def askCopyUploadImage(self, parent, source_path, server, node_type):
"""
Ask user for copying the image to the default directory or upload
it to remote server.
@@ -46,35 +68,52 @@ class ImageManager:
:returns path: Final path
"""
if server and server != "local":
return self._uploadImageToRemoteServer(path, server, node_type)
if (server and server != "local") or Controller.instance().isRemote():
return self._uploadImageToRemoteServer(source_path, server, node_type)
else:
destination_directory = self.getDirectoryForType(node_type)
if os.path.normpath(os.path.dirname(path)) != destination_directory:
# the IOS image is not in the default images directory
destination_path = os.path.join(destination_directory, os.path.basename(source_path))
source_filename = os.path.basename(source_path)
destination_filename = os.path.basename(destination_path)
if os.path.normpath(os.path.dirname(source_path)) != destination_directory:
# the image is not in the default images directory
if source_filename == destination_filename:
# the filename already exists in the default images directory
source_image = Image(node_type, source_path, filename=source_filename)
destination_image = Image(node_type, destination_path, filename=destination_filename)
try:
if source_image.md5sum == destination_image.md5sum:
# the source and destination images are identical
return source_path
except OSError as e:
QtWidgets.QMessageBox.critical(parent, 'Image', 'Cannot compare image file {} with {}: {}.'.format(source_path, destination_path, str(e)))
return source_path
# find a new unique path to avoid overwriting existing destination file
destination_path = self._getUniqueDestinationPath(source_image, node_type, destination_path)
reply = QtWidgets.QMessageBox.question(parent,
'Image',
'Would you like to copy {} to the default images directory'.format(os.path.basename(path)),
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No)
if reply == QtWidgets.QMessageBox.Yes:
destination_path = os.path.join(destination_directory, os.path.basename(path))
'Would you like to copy {} to the default images directory'.format(source_filename),
QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.No)
if reply == QtWidgets.QMessageBox.StandardButton.Yes:
try:
os.makedirs(destination_directory, exist_ok=True)
except OSError as e:
QtWidgets.QMessageBox.critical(parent, 'Image', 'Could not create destination directory {}: {}'.format(destination_directory, str(e)))
return path
worker = FileCopyWorker(path, destination_path)
progress_dialog = ProgressDialog(worker, 'Image', 'Copying {}'.format(os.path.basename(path)), 'Cancel', busy=True, parent=parent)
return source_path
worker = FileCopyWorker(source_path, destination_path)
progress_dialog = ProgressDialog(worker, 'Image', 'Copying {}'.format(source_filename), 'Cancel', busy=True, parent=parent)
progress_dialog.show()
progress_dialog.exec_()
progress_dialog.exec()
errors = progress_dialog.errors()
if errors:
QtWidgets.QMessageBox.critical(parent, 'Image', '{}'.format(''.join(errors)))
return path
return source_path
else:
path = destination_path
return path
source_path = destination_path
return source_path
def _uploadImageToRemoteServer(self, path, server, node_type):
"""
@@ -96,22 +135,9 @@ class ImageManager:
raise Exception('Invalid node type')
filename = self._getRelativeImagePath(path, node_type).replace("\\", "/")
Controller.instance().post(r'/computes/{}{}/{}'.format(server, upload_endpoint, filename), None, body=pathlib.Path(path), progressText="Uploading {}".format(filename), timeout=None)
Controller.instance().postCompute('{}/{}'.format(upload_endpoint, filename), server, None, body=pathlib.Path(path), progressText="Uploading {}".format(filename), timeout=None)
return filename
def _askForUploadMissingImage(self, filename, server):
from gns3.main_window import MainWindow
parent = MainWindow.instance()
reply = QtWidgets.QMessageBox.warning(parent,
'Image',
'{} is missing on server {} but exist on your computer. Do you want to upload it?'.format(filename, server.url()),
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No)
if reply == QtWidgets.QMessageBox.Yes:
return True
return False
def _getRelativeImagePath(self, path, node_type):
"""
Get a path relative to images directory path
@@ -150,7 +176,7 @@ class ImageManager:
if node_type == 'DYNAMIPS':
return os.path.join(self.getDirectory(), 'IOS')
else:
return os.path.join(self.getDirectory(), node_type)
return os.path.join(self.getDirectory(), node_type.upper())
@staticmethod
def instance():

View File

@@ -0,0 +1,90 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import pathlib
import urllib.parse
from gns3.http_client import HTTPClient
import logging
log = logging.getLogger(__name__)
class ImageUploadManager(object):
"""
Manager over the image upload. Encapsulates file uploads to computes or via controller.
"""
def __init__(self, image, controller, compute_id, callback=None, directFileUpload=False):
self._image = image
self._compute_id = compute_id
self._callback = callback
self._directFileUpload = directFileUpload
self._controller = controller
def upload(self):
if not os.path.exists(self._image.path):
log.error("Image '{}' could not be found".format(self._image.path))
return
if self._directFileUpload:
# first obtain endpoint and know when target request
self._controller.getEndpoint(self._getComputePath(), self._compute_id, self._onLoadEndpointCallback, showProgress=False)
else:
self._fileUploadToController()
def _getComputePath(self):
return '/{emulator}/images/{filename}'.format(emulator=self._image.emulator, filename=self._image.filename)
def _onLoadEndpointCallback(self, result, error=False, **kwargs):
if error:
if "message" in result:
log.error("Error while getting endpoint: {}".format(result["message"]))
return
# we know where is the endpoint and we trying to post there a file
endpoint = result['endpoint']
self._fileUploadToCompute(endpoint)
def _checkIfSuccessfulCallback(self, result, error=False, **kwargs):
if error:
connection_error = kwargs.get('connection_error', False)
if connection_error:
log.debug("During direct file upload compute is not visible. Fallback to upload via controller.")
# there was an issue with connection, probably we don't have a direct access to compute
# we need to fallback to uploading files via controller
self._fileUploadToController()
else:
if "message" in result:
log.error("Error while direct file upload: {}".format(result["message"]))
return
self._callback(result, error, **kwargs)
def _fileUploadToCompute(self, endpoint):
log.debug("Uploading image '{}' to compute".format(self._image.path))
parse_results = urllib.parse.urlparse(endpoint)
network_manager = self._controller.getHttpClient().getNetworkManager()
client = HTTPClient.fromUrl(endpoint, network_manager=network_manager)
# We don't retry connection as in case of fail we try direct file upload
client.setMaxRetryConnection(0)
client.createHTTPQuery('POST', parse_results.path, self._checkIfSuccessfulCallback, body=pathlib.Path(self._image.path),
context={"image_path": self._image.path}, progressText="Uploading {}".format(self._image.filename), timeout=None, prefix="")
def _fileUploadToController(self):
log.debug("Uploading image '{}' to controller".format(self._image.path))
self._controller.postCompute(self._getComputePath(), self._compute_id, self._callback, body=pathlib.Path(self._image.path),
context={"image_path": self._image.path}, progressText="Uploading {}".format(self._image.filename), timeout=None)

View File

@@ -15,7 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from ..qt import QtCore, QtGui, QtWidgets, QtSvg
from ..qt import QtCore, QtWidgets, qslot, QtGui
from .utils import colorFromSvg
import uuid
import logging
@@ -24,6 +25,15 @@ log = logging.getLogger(__name__)
class DrawingItem:
# Map QT stroke to SVG style
QT_DASH_TO_SVG = {
QtCore.Qt.PenStyle.SolidLine: "",
QtCore.Qt.PenStyle.NoPen: None,
QtCore.Qt.PenStyle.DashLine: "25, 25",
QtCore.Qt.PenStyle.DotLine: "5, 25",
QtCore.Qt.PenStyle.DashDotLine: "5, 25, 25",
QtCore.Qt.PenStyle.DashDotDotLine: "25, 25, 5, 25, 5"
}
show_layer = False
@@ -31,11 +41,14 @@ class DrawingItem:
Base class for non emulation item
"""
def __init__(self, project=None, pos=None, drawing_id=None, svg=None, z=0, rotation=0, **kws):
def __init__(self, project=None, pos=None, drawing_id=None, svg=None, z=0, locked=False, rotation=0, **kws):
self._id = drawing_id
self._deleting = False
self._allow_snap_to_grid = True
self._locked = locked
if self._id is None:
self._id = str(uuid.uuid4())
self.setFlags(QtWidgets.QGraphicsItem.ItemIsMovable | QtWidgets.QGraphicsItem.ItemIsFocusable | QtWidgets.QGraphicsItem.ItemIsSelectable | QtWidgets.QGraphicsItem.ItemSendsGeometryChanges)
self.setFlags(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable | QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsFocusable | QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsSelectable | QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemSendsGeometryChanges)
from ..main_window import MainWindow
self._graphics_view = MainWindow.instance().uiGraphicsView
@@ -44,7 +57,7 @@ class DrawingItem:
self._project = project
# Store a hash of the SVG to avoid him
# to be send if he doesn't change
# to be sent if he doesn't change
self._hash_svg = None
if pos:
@@ -54,11 +67,14 @@ class DrawingItem:
if rotation:
self.setRotation(rotation)
self.setLocked(locked)
def drawing_id(self):
return self._id
def create(self):
self._project.post("/drawings", self._createDrawingCallback, body=self.__json__())
if self._project:
self._project.post("/drawings", self._createDrawingCallback, body=self.__json__())
def _createDrawingCallback(self, result, error=False, **kwargs):
"""
@@ -70,15 +86,16 @@ class DrawingItem:
"""
if error:
log.error("Error while setting up drawing: {}".format(result["message"]))
log.error("Error while creating drawing: {}".format(result["message"]))
return False
self._id = result["drawing_id"]
self.updateDrawingCallback(result)
def updateDrawing(self):
if self._id:
self._project.put("/drawings/" + self._id, self.updateDrawingCallback, body=self.__json__())
if self._id and not self.deleting() and self._project:
self._project.put("/drawings/" + self._id, self.updateDrawingCallback, body=self.__json__(), showProgress=False)
@qslot
def updateDrawingCallback(self, result, error=False, **kwargs):
"""
Callback for update.
@@ -89,10 +106,16 @@ class DrawingItem:
"""
if error:
log.error("Error while setting up drawing: {}".format(result["message"]))
if "doesn't exist" in result.get("message", ""):
log.warning("Drawing not found on server, recreating: {}".format(self._id))
self._id = None
self.create()
return True
log.error("Error while updating drawing: {}".format(result["message"]))
return False
self.setPos(QtCore.QPoint(result["x"], result["y"]))
self.setPos(QtCore.QPointF(result["x"], result["y"]))
self.setZValue(result["z"])
self.setLocked(result["locked"])
self.setRotation(result["rotation"])
if "svg" in result:
self.fromSvg(result["svg"])
@@ -106,18 +129,21 @@ class DrawingItem:
"""
key = event.key()
modifiers = event.modifiers()
if key in (QtCore.Qt.Key_P, QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal) and modifiers & QtCore.Qt.AltModifier \
or key == QtCore.Qt.Key_Plus and modifiers & QtCore.Qt.AltModifier and modifiers & QtCore.Qt.KeypadModifier:
if key in (QtCore.Qt.Key.Key_P, QtCore.Qt.Key.Key_Plus, QtCore.Qt.Key.Key_Equal) and modifiers & QtCore.Qt.KeyboardModifier.AltModifier \
or key == QtCore.Qt.Key.Key_Plus and modifiers & QtCore.Qt.KeyboardModifier.AltModifier and modifiers & QtCore.Qt.KeyboardModifier.KeypadModifier:
if self.rotation() == 0:
self.setRotation(359)
else:
self.setRotation(self.rotation() - 1)
return True
elif key in (QtCore.Qt.Key_M, QtCore.Qt.Key_Minus) and modifiers & QtCore.Qt.AltModifier \
or key == QtCore.Qt.Key_Minus and modifiers & QtCore.Qt.AltModifier and modifiers & QtCore.Qt.KeypadModifier:
elif key in (QtCore.Qt.Key.Key_M, QtCore.Qt.Key.Key_Minus) and modifiers & QtCore.Qt.KeyboardModifier.AltModifier \
or key == QtCore.Qt.Key.Key_Minus and modifiers & QtCore.Qt.KeyboardModifier.AltModifier and modifiers & QtCore.Qt.KeyboardModifier.KeypadModifier:
if self.rotation() < 360.0:
self.setRotation(self.rotation() + 1)
return True
elif modifiers & QtCore.Qt.KeyboardModifier.AltModifier:
self._allow_snap_to_grid = False
return True
return False
def keyPressEvent(self, event):
@@ -130,12 +156,22 @@ class DrawingItem:
if not self.handleKeyPressEvent(event):
QtWidgets.QGraphicsItem.keyPressEvent(self, event)
def keyReleaseEvent(self, event):
"""
Handles all key release events
:param event: QKeyEvent
"""
self._allow_snap_to_grid = True
def __json__(self):
data = {
"drawing_id": self._id,
"x": int(self.pos().x()),
"y": int(self.pos().y()),
"z": int(self.zValue()),
"locked": self._locked,
"rotation": int(self.rotation())
}
svg = self.toSvg()
@@ -145,49 +181,72 @@ class DrawingItem:
self._hash_svg = hash_svg
return data
def setZValue(self, value):
def locked(self):
"""
Sets a new Z value.
Is the drawing locked
"""
return self._locked
def setLocked(self, locked):
"""
Sets the locked value.
:param value: Z value
"""
QtWidgets.QGraphicsItem.setZValue(self, value)
if self.zValue() < 0:
self.setFlag(self.ItemIsSelectable, False)
self.setFlag(self.ItemIsMovable, False)
if locked is True:
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
else:
self.setFlag(self.ItemIsSelectable, True)
self.setFlag(self.ItemIsMovable, True)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, True)
self._locked = locked
def deleting(self):
"""
Is the drawing being deleted
"""
return self._deleting
def setDeleting(self):
"""
Mark this drawing as being deleted
"""
self._deleting = True
def delete(self, skip_controller=False):
"""
Deletes this drawing.
:param skip_controller: Do not replicate change on the controller (usefull when it's already deleted on controller)
:param skip_controller: Do not replicate change on the controller (useful when it's already deleted on controller)
"""
self.setDeleting()
self.scene().removeItem(self)
from ..topology import Topology
Topology.instance().removeDrawing(self)
if self._id and not skip_controller:
self._project.delete("/drawings/" + self._id, None, body=self.__json__())
self._project.delete("/drawings/" + self._id, None)
def itemChange(self, change, value):
if change == QtWidgets.QGraphicsItem.ItemPositionHasChanged and self.isActive() and self._main_window.uiSnapToGridAction.isChecked():
GRID_SIZE = 75
mid_x = self.boundingRect().width() / 2
tmp_x = (GRID_SIZE * round((self.x() + mid_x) / GRID_SIZE)) - mid_x
mid_y = self.boundingRect().height() / 2
tmp_y = (GRID_SIZE * round((self.y() + mid_y) / GRID_SIZE)) - mid_y
if tmp_x != self.x() and tmp_y != self.y():
self.setPos(tmp_x, tmp_y)
if change == QtWidgets.QGraphicsItem.ItemSelectedChange:
if change == QtWidgets.QGraphicsItem.GraphicsItemChange.ItemPositionChange and self._main_window.uiSnapToGridAction.isChecked() \
and self._allow_snap_to_grid:
grid_size = self._graphics_view.drawingGridSize()
mid_x = self.boundingRect().width() / 2
value.setX((grid_size * round((value.x() + mid_x) / grid_size)) - mid_x)
mid_y = self.boundingRect().height() / 2
value.setY((grid_size * round((value.y()+mid_y)/grid_size)) - mid_y)
if change == QtWidgets.QGraphicsItem.GraphicsItemChange.ItemSelectedChange:
if not value:
self.updateDrawing()
return QtWidgets.QGraphicsItem.itemChange(self, change, value)
def updateNode(self):
self.updateDrawing()
def drawLayerInfo(self, painter):
"""
Draws the layer position.
@@ -204,9 +263,54 @@ class DrawingItem:
return
center = self.mapFromItem(self, brect.width() / 2.0, brect.height() / 2.0)
painter.setBrush(QtCore.Qt.red)
painter.setPen(QtCore.Qt.red)
painter.drawRect((brect.width() / 2.0) - 10, (brect.height() / 2.0) - 10, 20, 20)
painter.setPen(QtCore.Qt.black)
painter.setBrush(QtCore.Qt.GlobalColor.red)
painter.setPen(QtCore.Qt.GlobalColor.red)
painter.drawRect(QtCore.QRectF((brect.width() / 2.0) - 10, (brect.height() / 2.0) - 10, 20, 20))
painter.setPen(QtCore.Qt.GlobalColor.black)
zval = str(int(self.zValue()))
painter.drawText(QtCore.QPointF(center.x() - 4, center.y() + 4), zval)
def _styleSvg(self, element):
"""
Add style from the shape item to the SVG element that we will
export
"""
style = ""
pen = self.pen()
if hasattr(self, "brush"): # Line don't have a brush
element.set("fill", "#{}".format(hex(self.brush().color().rgba())[4:]))
element.set("fill-opacity", str(self.brush().color().alphaF()))
dasharray = self.QT_DASH_TO_SVG[pen.style()]
if dasharray is None: # No border to the element
return element
elif dasharray == "":
pass # Solid line
else:
element.set("stroke-dasharray", dasharray)
element.set("stroke-width", str(pen.width()))
element.set("stroke", "#" + hex(pen.color().rgba())[4:])
return element
def _penFromSVGElement(self, svg):
"""
Get a pen from a SVG element
:param svg:
"""
pen = QtGui.QPen()
if svg.get("stroke-width"):
pen.setWidth(int(svg.get("stroke-width")))
if svg.get("stroke"):
pen.setColor(colorFromSvg(svg.get("stroke")))
# Map SVG stroke style (border of the element to the Qt version)
if not svg.get("stroke"):
pen.setStyle(QtCore.Qt.PenStyle.NoPen)
else:
pen.setStyle(QtCore.Qt.PenStyle.SolidLine)
stroke = svg.get("stroke-dasharray")
if stroke:
for (qt_stroke, svg_stroke) in self.QT_DASH_TO_SVG.items():
if svg_stroke == stroke:
pen.setStyle(qt_stroke)
return pen

View File

@@ -22,7 +22,7 @@ Graphical representation of an ellipse on the QGraphicsScene.
import math
import xml.etree.ElementTree as ET
from ..qt import QtCore, QtGui, QtWidgets
from ..qt import QtWidgets
from .shape_item import ShapeItem

View File

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Pekka Helenius
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
@@ -21,7 +22,7 @@ Graphical representation of an Ethernet link for QGraphicsScene.
from ..qt import QtCore, QtGui, QtWidgets
from .link_item import LinkItem
from .note_item import NoteItem
from .label_item import LabelItem
from ..ports.port import Port
@@ -36,12 +37,11 @@ class EthernetLinkItem(LinkItem):
:param destination_port: destination Port instance
:param link: Link instance (contains back-end stuff for this link)
:param adding_flag: indicates if this link is being added (no destination yet)
:param multilink: used to draw multiple link between the same source and destination
"""
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False, multilink=0):
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False):
super().__init__(source_item, source_port, destination_item, destination_port, link, adding_flag, multilink)
super().__init__(source_item, source_port, destination_item, destination_port, link, adding_flag)
self._source_collision_offset = 0.0
self._destination_collision_offset = 0.0
@@ -52,10 +52,16 @@ class EthernetLinkItem(LinkItem):
LinkItem.adjust(self)
if self._hovered:
self.setPen(QtGui.QPen(QtCore.Qt.red, self._pen_width + 1, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
else:
self.setPen(QtGui.QPen(QtCore.Qt.black, self._pen_width, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
try:
if self._hovered:
self.setPen(QtGui.QPen(QtCore.Qt.GlobalColor.red, self._link._link_style["width"] + 1, QtCore.Qt.PenStyle.SolidLine, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin))
else:
self.setPen(QtGui.QPen(QtGui.QColor(self._link._link_style["color"]), self._link._link_style["width"], QtCore.Qt.PenStyle(self._link._link_style["type"]), QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin))
except:
if self._hovered:
self.setPen(QtGui.QPen(QtCore.Qt.GlobalColor.red, self._pen_width + 1, QtCore.Qt.PenStyle.SolidLine, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin))
else:
self.setPen(QtGui.QPen(QtGui.QColor("#000000"), self._pen_width, QtCore.Qt.PenStyle.SolidLine, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin))
# draw a line between nodes
path = QtGui.QPainterPath(self.source)
@@ -107,25 +113,25 @@ class EthernetLinkItem(LinkItem):
"""
QtWidgets.QGraphicsPathItem.paint(self, painter, option, widget)
if not self._adding_flag and self._settings["draw_link_status_points"]:
if not self._adding_flag:
# points disappears if nodes are too close to each others.
if self.length < 100:
return
if self._source_port.status() == Port.started:
if self._link.suspended() or self._source_port.status() == Port.suspended:
# link or port is suspended
color = QtCore.Qt.GlobalColor.yellow
shape = QtCore.Qt.PenCapStyle.RoundCap
elif self._source_port.status() == Port.started:
# port is active
color = QtCore.Qt.green
shape = QtCore.Qt.RoundCap
elif self._source_port.status() == Port.suspended:
# port is suspended
color = QtCore.Qt.yellow
shape = QtCore.Qt.RoundCap
color = QtCore.Qt.GlobalColor.green
shape = QtCore.Qt.PenCapStyle.RoundCap
else:
color = QtCore.Qt.red
shape = QtCore.Qt.SquareCap
color = QtCore.Qt.GlobalColor.red
shape = QtCore.Qt.PenCapStyle.SquareCap
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.SolidLine, shape, QtCore.Qt.MiterJoin))
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.PenStyle.SolidLine, shape, QtCore.Qt.PenJoinStyle.MiterJoin))
point1 = QtCore.QPointF(self.source + self.edge_offset) + QtCore.QPointF((self.dx * self._source_collision_offset) / self.length, (self.dy * self._source_collision_offset) / self.length)
# avoid any collision of the status point with the source node
@@ -142,32 +148,33 @@ class EthernetLinkItem(LinkItem):
source_port_label = self._source_port.label()
if source_port_label is None:
source_port_label = NoteItem(self._source_item)
source_port_name = self._source_port.name()
source_port_label.setPlainText(source_port_name)
source_port_label = LabelItem(self._source_item)
source_port_label.setPlainText(self._source_port.shortName())
source_port_label.setPos(self.mapToItem(self._source_item, point1))
self._source_port.setLabel(source_port_label)
if self._draw_port_labels:
source_port_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, not self._source_item.locked())
source_port_label.show()
else:
source_port_label.hide()
painter.drawPoint(point1)
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.PenStyle.NoPen:
painter.drawPoint(point1)
if self._destination_port.status() == Port.started:
if self._link.suspended() or self._destination_port.status() == Port.suspended:
# link or port is suspended
color = QtCore.Qt.GlobalColor.yellow
shape = QtCore.Qt.PenCapStyle.RoundCap
elif self._destination_port.status() == Port.started:
# port is active
color = QtCore.Qt.green
shape = QtCore.Qt.RoundCap
elif self._destination_port.status() == Port.suspended:
# port is suspended
color = QtCore.Qt.yellow
shape = QtCore.Qt.RoundCap
color = QtCore.Qt.GlobalColor.green
shape = QtCore.Qt.PenCapStyle.RoundCap
else:
color = QtCore.Qt.red
shape = QtCore.Qt.SquareCap
color = QtCore.Qt.GlobalColor.red
shape = QtCore.Qt.PenCapStyle.SquareCap
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.SolidLine, shape, QtCore.Qt.MiterJoin))
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.PenStyle.SolidLine, shape, QtCore.Qt.PenJoinStyle.MiterJoin))
point2 = QtCore.QPointF(self.destination - self.edge_offset) - QtCore.QPointF((self.dx * self._destination_collision_offset) / self.length, (self.dy * self._destination_collision_offset) / self.length)
# avoid any collision of the status point with the destination node
@@ -184,17 +191,18 @@ class EthernetLinkItem(LinkItem):
destination_port_label = self._destination_port.label()
if destination_port_label is None:
destination_port_label = NoteItem(self._destination_item)
destination_port_name = self._destination_port.name()
destination_port_label.setPlainText(destination_port_name)
destination_port_label = LabelItem(self._destination_item)
destination_port_label.setPlainText(self._destination_port.shortName())
destination_port_label.setPos(self.mapToItem(self._destination_item, point2))
self._destination_port.setLabel(destination_port_label)
if self._draw_port_labels:
destination_port_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, not self._destination_item.locked())
destination_port_label.show()
else:
destination_port_label.hide()
painter.drawPoint(point2)
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.PenStyle.NoPen:
painter.drawPoint(point2)
self._drawCaptureSymbol()
self._drawSymbol()

View File

@@ -19,21 +19,18 @@
Graphical representation of an image on the QGraphicsScene.
"""
import xml.etree.ElementTree as ET
from ..qt import QtWidgets, QtCore, QtSvg
from ..qt import QtSvgWidgets
from ..qt.qimage_svg_renderer import QImageSvgRenderer
from .drawing_item import DrawingItem
class ImageItem(QtSvg.QGraphicsSvgItem, DrawingItem):
class ImageItem(QtSvgWidgets.QGraphicsSvgItem, DrawingItem):
"""
Class to insert an image on the scene.
"""
def __init__(self, image_path=None, pos=None, svg=None, **kws):
def __init__(self, image_path=None, pos=None, svg=None, **kws):
self._image_path = image_path
# Because we call the Qt C++ code we need to handle the case of pos is None otherwise we will get a conversion error
@@ -42,7 +39,6 @@ class ImageItem(QtSvg.QGraphicsSvgItem, DrawingItem):
else:
super().__init__(**kws)
if self._image_path:
renderer = QImageSvgRenderer(image_path)
self.setSharedRenderer(renderer)
@@ -56,6 +52,9 @@ class ImageItem(QtSvg.QGraphicsSvgItem, DrawingItem):
if svg:
svg = self.fromSvg(svg)
if 'z' in kws.keys():
self.setZValue(kws['z'])
def paint(self, painter, option, widget=None):
"""
Paints the contents of an item in local coordinates.
@@ -77,4 +76,3 @@ class ImageItem(QtSvg.QGraphicsSvgItem, DrawingItem):
Return an SVG version of the shape
"""
return self.renderer().svg()

View File

@@ -15,20 +15,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Graphical representation of a note on the QGraphicsScene.
"""
from ..qt import QtCore, QtWidgets, QtGui
from .utils import colorFromSvg
class NoteItem(QtWidgets.QGraphicsTextItem):
class LabelItem(QtWidgets.QGraphicsTextItem):
"""
Text note for the QGraphicsView.
Label for links and nodes.
:param parent: optional parent
"""
item_unselected_signal = QtCore.Signal()
show_layer = False
@@ -45,8 +42,7 @@ class NoteItem(QtWidgets.QGraphicsTextItem):
qt_font.fromString(view_settings["default_label_font"])
self.setDefaultTextColor(QtGui.QColor(view_settings["default_label_color"]))
self.setFont(qt_font)
self.setFlag(self.ItemIsMovable)
self.setFlag(self.ItemIsSelectable)
self.setFlags(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable | QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsSelectable)
self.setZValue(2)
self._editable = True
@@ -95,12 +91,12 @@ class NoteItem(QtWidgets.QGraphicsTextItem):
key = event.key()
modifiers = event.modifiers()
if key in (QtCore.Qt.Key_P, QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal) and modifiers & QtCore.Qt.AltModifier \
or key == QtCore.Qt.Key_Plus and modifiers & QtCore.Qt.AltModifier and modifiers & QtCore.Qt.KeypadModifier:
if key in (QtCore.Qt.Key.Key_P, QtCore.Qt.Key.Key_Plus, QtCore.Qt.Key.Key_Equal) and modifiers & QtCore.Qt.KeyboardModifier.AltModifier \
or key == QtCore.Qt.Key.Key_Plus and modifiers & QtCore.Qt.KeyboardModifier.AltModifier and modifiers & QtCore.Qt.KeyboardModifier.KeypadModifier:
if self.rotation() > -360.0:
self.setRotation(self.rotation() - 1)
elif key in (QtCore.Qt.Key_M, QtCore.Qt.Key_Minus) and modifiers & QtCore.Qt.AltModifier \
or key == QtCore.Qt.Key_Minus and modifiers & QtCore.Qt.AltModifier and modifiers & QtCore.Qt.KeypadModifier:
elif key in (QtCore.Qt.Key.Key_M, QtCore.Qt.Key.Key_Minus) and modifiers & QtCore.Qt.KeyboardModifier.AltModifier \
or key == QtCore.Qt.Key.Key_Minus and modifiers & QtCore.Qt.KeyboardModifier.AltModifier and modifiers & QtCore.Qt.KeyboardModifier.KeypadModifier:
if self.rotation() < 360.0:
self.setRotation(self.rotation() + 1)
else:
@@ -111,11 +107,11 @@ class NoteItem(QtWidgets.QGraphicsTextItem):
Edit mode for this note.
"""
self.setTextInteractionFlags(QtCore.Qt.TextEditorInteraction)
self.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.TextEditorInteraction)
self.setSelected(True)
self.setFocus()
cursor = self.textCursor()
cursor.select(QtGui.QTextCursor.Document)
cursor.select(QtGui.QTextCursor.SelectionType.Document)
self.setTextCursor(cursor)
def mouseDoubleClickEvent(self, event):
@@ -135,12 +131,12 @@ class NoteItem(QtWidgets.QGraphicsTextItem):
:param event: QFocusEvent instance
"""
self.setFlag(QtWidgets.QGraphicsItem.ItemIsFocusable, False)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsFocusable, False)
cursor = self.textCursor()
if cursor.hasSelection():
cursor.clearSelection()
self.setTextCursor(cursor)
self.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
self.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.NoTextInteraction)
if not self.toPlainText():
# delete the note if empty
self.delete()
@@ -167,47 +163,36 @@ class NoteItem(QtWidgets.QGraphicsTextItem):
return
center = self.mapFromItem(self, brect.width() / 2.0, brect.height() / 2.0)
painter.setBrush(QtCore.Qt.red)
painter.setPen(QtCore.Qt.red)
painter.drawRect((brect.width() / 2.0) - 10, (brect.height() / 2.0) - 10, 20, 20)
painter.setPen(QtCore.Qt.black)
painter.setBrush(QtCore.Qt.GlobalColor.red)
painter.setPen(QtCore.Qt.GlobalColor.red)
painter.drawRect(QtCore.QRectF((brect.width() / 2.0) - 10, (brect.height() / 2.0) - 10, 20, 20))
painter.setPen(QtCore.Qt.GlobalColor.black)
zval = str(int(self.zValue()))
painter.drawText(QtCore.QPointF(center.x(), center.y()), zval)
def setZValue(self, value):
"""
Sets a new Z value.
:param value: Z value
"""
super().setZValue(value)
if self.zValue() < 0:
self.setFlag(self.ItemIsSelectable, False)
self.setFlag(self.ItemIsMovable, False)
else:
self.setFlag(self.ItemIsSelectable, True)
self.setFlag(self.ItemIsMovable, True)
def setStyle(self, styles):
def setStyle(self, new_style):
"""
Set text style using a SVG style
"""
font = QtGui.QFont()
for style in styles.split(";"):
for style in new_style.split(";"):
if ":" in style:
key, val = style.split(":")
key = key.strip()
val = val.strip()
if key == "font-size":
font.setPointSize(int(val))
font.setPointSizeF(float(val))
elif key == "font-family":
font.setFamily(val)
elif key == "font-style" and val == "italic":
font.setItalic(True)
elif key == "font-weight" and val == "bold":
font.setBold(True)
elif key == "text-decoration" and val == "underline":
font.setUnderline(True)
elif key == "text-decoration" and val == "line-through":
font.setStrikeOut(True)
elif key == "fill":
new_color = colorFromSvg(val)
color = self.defaultTextColor()
@@ -228,7 +213,7 @@ class NoteItem(QtWidgets.QGraphicsTextItem):
:param change: GraphicsItemChange type
:param value: value of the change
"""
if change == QtWidgets.QGraphicsItem.ItemSelectedChange:
if change == QtWidgets.QGraphicsItem.GraphicsItemChange.ItemSelectedChange:
if value == 0:
self.item_unselected_signal.emit()
return super().itemChange(change, value)
@@ -248,7 +233,7 @@ class NoteItem(QtWidgets.QGraphicsTextItem):
style = ""
style += "font-family: {};".format(self.font().family())
style += "font-size: {};".format(self.font().pointSize())
style += "font-size: {};".format(self.font().pointSizeF())
if self.font().italic():
style += "font-style: italic;"
@@ -256,6 +241,11 @@ class NoteItem(QtWidgets.QGraphicsTextItem):
if self.font().bold():
style += "font-weight: bold;"
if self.font().strikeOut():
style += "text-decoration: line-through;"
elif self.font().underline():
style += "text-decoration: underline;"
style += "fill: {};".format("#" + hex(self.defaultTextColor().rgba())[4:])
style += "fill-opacity: {};".format(self.defaultTextColor().alphaF())

216
gns3/items/line_item.py Normal file
View File

@@ -0,0 +1,216 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Graphical representation of a rectangle on the QGraphicsScene.
"""
import xml.etree.ElementTree as ET
from ..qt import QtCore, QtGui, QtWidgets
from .drawing_item import DrawingItem
class LineItem(QtWidgets.QGraphicsLineItem, DrawingItem):
"""
Class to draw a rectangle on the scene.
"""
def __init__(self, dst=None, svg=None, **kws):
super().__init__(svg=svg, **kws)
self.setAcceptHoverEvents(True)
self._edge = None
self._border = 20
if svg is None:
if dst is not None:
self.setLine(0,
0,
dst.x(),
dst.y())
pen = QtGui.QPen(QtCore.Qt.GlobalColor.black, 2, QtCore.Qt.PenStyle.SolidLine, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin)
self.setPen(pen)
else:
self.fromSvg(svg)
if self._id is None:
self.create()
def paint(self, painter, option, widget=None):
"""
Paints the contents of an item in local coordinates.
:param painter: QPainter instance
:param option: QStyleOptionGraphicsItem instance
:param widget: QWidget instance
"""
super().paint(painter, option, widget)
self.drawLayerInfo(painter)
def toSvg(self):
"""
Return an SVG version of the shape
"""
svg = ET.Element("svg")
width = abs(self.line().x1() - self.line().x2())
height = abs(self.line().y1() - self.line().y2())
svg.set("width", str(int(width)))
svg.set("height", str(int(height)))
line = ET.SubElement(svg, "line")
line.set("x1", str(int(self.line().x1())))
line.set("x2", str(int(self.line().x2())))
line.set("y1", str(int(self.line().y1())))
line.set("y2", str(int(self.line().y2())))
line = self._styleSvg(line)
return ET.tostring(svg, encoding="utf-8").decode("utf-8")
def fromSvg(self, svg):
"""
Import element informations from an SVG
"""
svg = ET.fromstring(svg)
width = float(svg.get("width", 0))
height = float(svg.get("height", 0))
# Backup the pos and restore it
pos = self.pos()
y1 = self.line().y1()
self.setLine(0, 0, width, height)
pen = QtGui.QPen()
if len(svg):
pen = self._penFromSVGElement(svg[0])
self.setLine(
float(svg[0].get("x1")),
float(svg[0].get("y1")),
float(svg[0].get("x2")),
float(svg[0].get("y2"))
)
self.setPos(pos)
self.setPen(pen)
self.update()
def _isHorizontalLine(self):
return abs(self.line().x1() - self.line().x2()) > abs(self.line().y1() - self.line().y2())
def hoverMoveEvent(self, event):
"""
Handles all hover move events.
:param event: QGraphicsSceneHoverEvent instance
"""
# locked objects don't need cursors
if not self.locked():
if self._isHorizontalLine():
if event.pos().x() > (self.line().x2() - self._border):
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeHorCursor)
elif event.pos().x() < self._border:
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeHorCursor)
else:
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeAllCursor)
# Vertical line
else:
if event.pos().y() > (self.line().y2() - self._border):
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeVerCursor)
elif event.pos().y() < self._border:
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeVerCursor)
else:
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeAllCursor)
def mouseMoveEvent(self, event):
"""
Handles all mouse move events.
:param event: QMouseEvent instance
"""
self.update()
if self._edge:
scenePos = event.scenePos()
if self._edge == "left" or self._edge == "bottom":
diff_x = self.x() - scenePos.x()
diff_y = self.y() - scenePos.y()
self.setPos(scenePos.x(), scenePos.y())
self.setLine(
0,
0,
self.line().x2() + diff_x,
self.line().y2() + diff_y)
elif self._edge == "right" or self._edge == "top":
pos = self.mapFromScene(scenePos)
self.setLine(
0,
0,
pos.x(),
pos.y())
self.setPos(self.x(), self.y())
super().mouseMoveEvent(event)
def mousePressEvent(self, event):
"""
Handles all mouse press events.
:param event: QMouseEvent instance
"""
self.update()
if self._isHorizontalLine():
if event.pos().x() > (self.line().x2() - self._border):
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
self._edge = "right"
elif event.pos().x() < (self.line().x1() + self._border):
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
self._edge = "left"
else:
if event.pos().y() > (self.line().y2() - self._border):
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
self._edge = "top"
elif event.pos().y() < (self.line().y1() + self._border):
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
self._edge = "bottom"
super().mousePressEvent(event)
def mouseReleaseEvent(self, event):
"""
Handles all mouse release events.
:param: QMouseEvent instance
"""
self.update()
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable)
self._edge = None
super().mouseReleaseEvent(event)
def hoverLeaveEvent(self, event):
"""
Handles all hover leave events.
:param event: QGraphicsSceneHoverEvent instance
"""
# locked objects don't need cursors
if not self.locked():
self._graphics_view.setCursor(QtCore.Qt.CursorShape.ArrowCursor)

View File

@@ -21,21 +21,24 @@ Link items are graphical representation of a link on the QGraphicsScene
"""
import math
from ..qt import QtCore, QtGui, QtWidgets, QtSvg
from ..qt import QtCore, QtGui, QtWidgets, QtSvgWidgets, qslot, sip_is_deleted
from ..node import Node
from ..packet_capture import PacketCapture
from ..dialogs.filter_dialog import FilterDialog
from ..dialogs.style_editor_dialog_link import StyleEditorDialogLink
from ..utils.get_icon import get_icon
class SvgCaptureItem(QtSvg.QGraphicsSvgItem):
class SvgIconItem(QtSvgWidgets.QGraphicsSvgItem):
def __init__(self, symbol, parent):
QtSvg.QGraphicsSvgItem.__init__(self, symbol, parent)
QtSvgWidgets.QGraphicsSvgItem.__init__(self, symbol, parent)
def mousePressEvent(self, event):
self.parentItem().mousePressEvent(event)
if self.parentItem():
self.parentItem().mousePressEvent(event)
event.accept()
@@ -50,12 +53,12 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
:param destination_port: destination Port instance
:param link: Link instance (contains back-end stuff for this link)
:param adding_flag: indicates if this link is being added (no destination yet)
:param multilink: used to draw multiple link between the same source and destination
"""
_draw_port_labels = False
delete_link_item_signal = QtCore.Signal(str)
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False, multilink=0):
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False):
super().__init__()
self.setAcceptHoverEvents(True)
@@ -76,10 +79,6 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
# default pen size
self._pen_width = 2.0
# indicates the link position when there are multiple links
# between the same source and destination
self._multilink = multilink
# source & destination items and ports
self._source_item = source_item
self._destination_item = destination_item
@@ -91,13 +90,19 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
# QGraphicsSvgItem to indicate a capture
self._capturing_item = None
# QGraphicsSvgItem to indicate a filter is applied
self._filter_item = None
# QGraphicsSvgItem to indicate we suspend a link
self._suspend_item = None
# QGraphicsSvgItem to indicate a filter is applied and a capture is active
self._filter_capturing_item = None
if not self._adding_flag:
# there is a destination
self._link = link
self._link.updated_link_signal.connect(self._drawCaptureSymbol)
self._link.updated_link_signal.connect(self._drawSymbol)
self._link.delete_link_signal.connect(self._linkDeletedSlot)
self.setFlag(self.ItemIsFocusable)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsFocusable)
source_item.addLink(self)
destination_item.addLink(self)
self.setCustomToolTip()
@@ -108,8 +113,10 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
self.adjust()
def _linkDeletedSlot(self, link_id):
@qslot
def _linkDeletedSlot(self, link_id, *args):
# first delete the port labels if any
if self._source_port.label():
self._source_port.label().setParentItem(None)
self.scene().removeItem(self._source_port.label())
@@ -117,11 +124,34 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
self._destination_port.label().setParentItem(None)
self.scene().removeItem(self._destination_port.label())
self._source_item.removeLink(self)
self._destination_item.removeLink(self)
if self.scene():
if self in self.scene().items():
self.scene().removeItem(self)
if self in self.scene().items():
self.scene().removeItem(self)
@qslot
def _filterActionSlot(self, *args):
dialog = FilterDialog(self._main_window, self._link)
dialog.show()
dialog.exec()
@qslot
def _suspendActionSlot(self, *args):
self._link.toggleSuspend()
@qslot
def _styleActionSlot(self, *args):
style_dialog = StyleEditorDialogLink(self, self._main_window)
style_dialog.show()
style_dialog.exec()
def setLinkStyle(self, link_style):
self._link._link_style["color"] = link_style["color"]
self._link._link_style["width"] = link_style["width"]
self._link._link_style["type"] = link_style["type"]
# This refers to functions in link.py!
self._link.setLinkStyle(link_style)
self._link.update()
def delete(self):
"""
@@ -209,36 +239,62 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
if not self._link.capturing():
# start capture
start_capture_action = QtWidgets.QAction("Start capture", menu)
start_capture_action.setIcon(QtGui.QIcon(':/icons/capture-start.svg'))
start_capture_action = QtGui.QAction("Start capture", menu)
start_capture_action.setIcon(get_icon('capture-start.svg'))
start_capture_action.triggered.connect(self._startCaptureActionSlot)
menu.addAction(start_capture_action)
if self._link.capturing():
# stop capture
stop_capture_action = QtWidgets.QAction("Stop capture", menu)
stop_capture_action.setIcon(QtGui.QIcon(':/icons/capture-stop.svg'))
stop_capture_action = QtGui.QAction("Stop capture", menu)
stop_capture_action.setIcon(get_icon('capture-stop.svg'))
stop_capture_action.triggered.connect(self._stopCaptureActionSlot)
menu.addAction(stop_capture_action)
# start wireshark
start_wireshark_action = QtWidgets.QAction("Start Wireshark", menu)
start_wireshark_action = QtGui.QAction("Start Wireshark", menu)
start_wireshark_action.setIcon(QtGui.QIcon(":/icons/wireshark.png"))
start_wireshark_action.triggered.connect(self._startWiresharkActionSlot)
menu.addAction(start_wireshark_action)
if PacketCapture.instance().packetAnalyzerAvailable():
analyze_action = QtWidgets.QAction("Analyze capture", menu)
analyze_action = QtGui.QAction("Analyze capture", menu)
analyze_action.setIcon(QtGui.QIcon(':/icons/rtv.png'))
analyze_action.triggered.connect(self._analyzeCaptureActionSlot)
menu.addAction(analyze_action)
if self._link.suspended() is False:
# Edit filters
filter_action = QtGui.QAction("Packet filters", menu)
filter_action.setIcon(get_icon('filter.svg'))
filter_action.triggered.connect(self._filterActionSlot)
menu.addAction(filter_action)
# Suspend link
suspend_action = QtGui.QAction("Suspend", menu)
suspend_action.setIcon(get_icon('pause.svg'))
suspend_action.triggered.connect(self._suspendActionSlot)
menu.addAction(suspend_action)
else:
# Resume link
resume_action = QtGui.QAction("Resume", menu)
resume_action.setIcon(get_icon('start.svg'))
resume_action.triggered.connect(self._suspendActionSlot)
menu.addAction(resume_action)
# style
style_action = QtGui.QAction("Style", menu)
style_action.setIcon(get_icon("node_conception.svg"))
style_action.triggered.connect(self._styleActionSlot)
menu.addAction(style_action)
# delete
delete_action = QtWidgets.QAction("Delete", menu)
delete_action.setIcon(QtGui.QIcon(':/icons/delete.svg'))
delete_action = QtGui.QAction("Delete", menu)
delete_action.setIcon(get_icon('delete.svg'))
delete_action.triggered.connect(self._deleteActionSlot)
menu.addAction(delete_action)
@qslot
def mousePressEvent(self, event):
"""
Called when the link is clicked and shows a contextual menu.
@@ -246,22 +302,31 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
:param: QGraphicsSceneMouseEvent instance
"""
if event.button() == QtCore.Qt.RightButton:
if self._adding_flag:
# send a escape key to the main window to cancel the link addition
from ..main_window import MainWindow
key = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Escape, QtCore.Qt.NoModifier)
QtWidgets.QApplication.sendEvent(MainWindow.instance(), key)
return
if event.button() == QtCore.Qt.MouseButton.RightButton and self._adding_flag:
# send a escape key to the main window to cancel the link addition
from ..main_window import MainWindow
key = QtGui.QKeyEvent(QtCore.QEvent.Type.KeyPress, QtCore.Qt.Key.Key_Escape, QtCore.Qt.KeyboardModifier.NoModifier)
QtWidgets.QApplication.sendEvent(MainWindow.instance(), key)
return
else:
super().mousePressEvent(event)
def contextMenuEvent(self, event):
"""
Handles all context menu events.
:param event: QContextMenuEvent instance
"""
if not sip_is_deleted(self):
# create the contextual menu
self.setHovered(True)
self.setAcceptHoverEvents(False)
menu = QtWidgets.QMenu()
menu = QtWidgets.QMenu(parent=self.scene().parent())
self.populateLinkContextualMenu(menu)
menu.exec_(QtGui.QCursor.pos())
menu.exec(QtGui.QCursor.pos())
self.setAcceptHoverEvents(True)
self._hovered = False
self.adjust()
self.setHovered(False)
def keyPressEvent(self, event):
"""
@@ -271,7 +336,7 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
"""
# On pressing backspace or delete key, the selected link gets deleted
if event.key() == QtCore.Qt.Key_Delete or event.key() == QtCore.Qt.Key_Backspace:
if event.key() == QtCore.Qt.Key.Key_Delete or event.key() == QtCore.Qt.Key.Key_Backspace:
self._deleteActionSlot()
return
@@ -349,6 +414,7 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
self.setHovered(False)
@qslot
def adjust(self):
"""
Computes the source point and destination point.
@@ -376,15 +442,54 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
# compute the length of the line
self.length = math.sqrt(self.dx * self.dx + self.dy * self.dy)
multilink = self._computeMultiLink()
# multi-link management
if not self._adding_flag and self._multilink and self.length:
if not self._adding_flag and multilink and self.length:
angle = math.radians(90)
self.dxrot = math.cos(angle) * self.dx - math.sin(angle) * self.dy
self.dyrot = math.sin(angle) * self.dx + math.cos(angle) * self.dy
offset = QtCore.QPointF((self.dxrot * (self._multilink * 5)) / self.length, (self.dyrot * (self._multilink * 5)) / self.length)
offset = QtCore.QPointF((self.dxrot * (multilink * 5)) / self.length, (self.dyrot * (multilink * 5)) / self.length)
self.source = QtCore.QPointF(self.source + offset)
self.destination = QtCore.QPointF(self.destination + offset)
def _computeMultiLink(self):
# Multi-link management
#
# multi is the offset of the link
# +------+ multi = -1 Link 2 +-------+
# | +-----------------------------+ |
# | R1 | | R2 |
# | | multi = 0 Link 1 | |
# | +-----------------------------+ |
# | | multi = 1 Link 3 | |
# +------+-----------------------------+-------+
if self._source_item == self._destination_item:
multi = 0
elif not hasattr(self._destination_item, "node"): # Could be temporary a qpointf during link creation
multi = 0
else:
multi = 0
link_items = self._source_item.links()
for link_item in link_items:
if link_item == self:
break
if link_item.destinationItem().node().id() == self._destination_item.node().id():
multi += 1
if link_item.sourceItem().node().id() == self._destination_item.node().id():
multi += 1
# MAX 7 links on the scene between 2 nodes
if multi > 7:
multi = 0
# Pair item represent the bottom links
elif multi % 2 == 0:
multi = multi // 2
else:
multi = -multi // 2
return multi
def setMousePoint(self, scene_point):
"""
Sets new mouse point coordinates.
@@ -397,19 +502,91 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
self.adjust()
self.update()
def _drawCaptureSymbol(self):
@qslot
def _drawSymbol(self, *args):
"""
Draws a capture symbol in the middle of the link to indicate a capture is active.
Draws a symbol in the middle of the link to indicate a capture, a suspend or a filter is active.
"""
#FIXME: refactor ugly symbol management
if not self._adding_flag:
if self._link.capturing() and self.length >= 150:
link_center = QtCore.QPointF(self.source.x() + self.dx / 2.0 - 11, self.source.y() + self.dy / 2.0 - 11)
if self._capturing_item is None:
self._capturing_item = SvgCaptureItem(':/icons/inspect.svg', self)
self._capturing_item.setScale(0.6)
self._capturing_item.setPos(link_center)
if not self._capturing_item.isVisible():
self._capturing_item.show()
elif self._capturing_item:
self._capturing_item.hide()
if self._link.suspended():
if self.length >= 150:
link_center = QtCore.QPointF(self.source.x() + self.dx / 2.0 - 11, self.source.y() + self.dy / 2.0 - 11)
if self._suspend_item is None:
self._suspend_item = SvgIconItem(':/icons/pause.svg', self)
self._suspend_item.setScale(0.6)
if not self._suspend_item.isVisible():
self._suspend_item.show()
self._suspend_item.setPos(link_center)
if self._filter_item:
self._filter_item.hide()
elif self._suspend_item:
self._suspend_item.hide()
if self._filter_capturing_item:
self._filter_capturing_item.hide()
if self._capturing_item:
self._capturing_item.hide()
if self._filter_item:
self._filter_item.hide()
elif self._link.capturing() and len(self._link.filters()) > 0:
if self.length >= 150:
link_center = QtCore.QPointF(self.source.x() + self.dx / 2.0 - 11, self.source.y() + self.dy / 2.0 - 11)
if self._filter_capturing_item is None:
self._filter_capturing_item = SvgIconItem(':/icons/filter-capture.svg', self)
self._filter_capturing_item.setScale(0.6)
if not self._filter_capturing_item.isVisible():
self._filter_capturing_item.show()
self._filter_capturing_item.setPos(link_center)
elif self._filter_capturing_item:
self._filter_capturing_item.hide()
if self._capturing_item:
self._capturing_item.hide()
if self._filter_item:
self._filter_item.hide()
if self._suspend_item:
self._suspend_item.hide()
elif self._link.capturing():
if self.length >= 150:
link_center = QtCore.QPointF(self.source.x() + self.dx / 2.0 - 11, self.source.y() + self.dy / 2.0 - 11)
if self._capturing_item is None:
self._capturing_item = SvgIconItem(':/icons/inspect.svg', self)
self._capturing_item.setScale(0.6)
self._capturing_item.setPos(link_center)
if not self._capturing_item.isVisible():
self._capturing_item.show()
elif self._capturing_item:
self._capturing_item.hide()
if self._filter_capturing_item:
self._filter_capturing_item.hide()
if self._suspend_item:
self._suspend_item.hide()
elif len(self._link.filters()) > 0:
if self.length >= 150:
link_center = QtCore.QPointF(self.source.x() + self.dx / 2.0 - 11, self.source.y() + self.dy / 2.0 - 11)
if self._filter_item is None:
self._filter_item = SvgIconItem(':/icons/filter.svg', self)
self._filter_item.setScale(0.6)
if not self._filter_item.isVisible():
self._filter_item.show()
self._filter_item.setPos(link_center)
elif self._filter_item:
self._filter_item.hide()
if self._filter_capturing_item:
self._filter_capturing_item.hide()
if self._suspend_item:
self._suspend_item.hide()
else:
if self._capturing_item:
self._capturing_item.hide()
if self._suspend_item:
self._suspend_item.hide()
if self._filter_item:
self._filter_item.hide()
if self._filter_capturing_item:
self._filter_capturing_item.hide()

136
gns3/items/logo_item.py Normal file
View File

@@ -0,0 +1,136 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import urllib.parse
from ..qt import QtCore, QtGui, QtWidgets, QtSvgWidgets
from ..qt.qimage_svg_renderer import QImageSvgRenderer
from ..controller import Controller
import logging
log = logging.getLogger(__name__)
class LogoItem(QtSvgWidgets.QGraphicsSvgItem):
"""
Margin for the logo
"""
MARGIN = 20
"""
Logo for the scene.
:param logo_path: Path to the logo (remote)
:param logo_url: URL which needs to be open user clicks on the logo
:param project: Current project
"""
def __init__(self, logo_path, logo_url, project):
super().__init__()
self._logo_path = logo_path
self._logo_url = logo_url
self._project = project
# Temporary symbol during loading
renderer = QImageSvgRenderer(":/icons/reload.svg")
renderer.setObjectName("symbol_loading")
self.setSharedRenderer(renderer)
effect = QtWidgets.QGraphicsColorizeEffect()
effect.setColor(QtGui.QColor("black"))
effect.setStrength(0.8)
self.setGraphicsEffect(effect)
self.graphicsEffect().setEnabled(False)
# set graphical settings for this item
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsFocusable)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemSendsGeometryChanges)
self.setAcceptHoverEvents(True)
from ..main_window import MainWindow
self._main_window = MainWindow.instance()
self._settings = self._main_window.uiGraphicsView.settings()
self.updatePosition()
self._main_window.uiGraphicsView.viewport().installEventFilter(self)
remote_file = urllib.parse.quote('project-files/images/{}'.format(logo_path))
Controller.instance().getStatic(
'/projects/{}/files/{}'.format(project.id(), remote_file),
self.updateImage
)
# make it the last one
self.setZValue(-2)
def eventFilter(self, source, event):
if event.type() == QtCore.QEvent.Type.Paint:
self.updatePosition()
return QtWidgets.QWidget.eventFilter(self, source, event)
def updateImage(self, local_path):
renderer = QImageSvgRenderer(local_path)
renderer.setObjectName("project_logo")
self.setSharedRenderer(renderer)
def updatePosition(self):
"""
Updates position to be located in the right bottom corner
"""
logo_rect = self.boundingRect()
width = self._main_window.uiGraphicsView.viewport().width()
height = self._main_window.uiGraphicsView.viewport().height()
rect = self._main_window.uiGraphicsView.mapToScene(QtCore.QRect(0, 0, width, height)).boundingRect()
x = rect.x() + rect.width() - self.MARGIN - logo_rect.width()
y = rect.y() + rect.height() - self.MARGIN - logo_rect.height()
# update only when changes
if [int(self.x()), int(self.y())] != [int(x), int(y)]:
self.setX(x)
self.setY(y)
self.update()
def hoverEnterEvent(self, event):
"""
Handles all hover enter events for this item.
:param event: QGraphicsSceneHoverEvent instance
"""
if self._logo_url is not None:
self.graphicsEffect().setEnabled(True)
def hoverLeaveEvent(self, event):
"""
Handles all hover leave events for this item.
:param event: QGraphicsSceneHoverEvent instance
"""
self.graphicsEffect().setEnabled(False)
def mousePressEvent(self, event):
url = QtCore.QUrl(self._logo_url)
if not QtGui.QDesktopServices.openUrl(url):
QtWidgets.QMessageBox.warning(self, 'Open Url', 'Could not open url')

View File

@@ -19,9 +19,11 @@
Graphical representation of a node on the QGraphicsScene.
"""
from ..qt import QtCore, QtGui, QtWidgets, QtSvg
from ..qt import sip
from ..qt import QtCore, QtGui, QtWidgets, QtSvgWidgets, qslot
from ..qt.qimage_svg_renderer import QImageSvgRenderer
from .note_item import NoteItem
from .label_item import LabelItem
from ..symbol import Symbol
from ..controller import Controller
@@ -30,7 +32,7 @@ import logging
log = logging.getLogger(__name__)
class NodeItem(QtSvg.QGraphicsSvgItem):
class NodeItem(QtSvgWidgets.QGraphicsSvgItem):
"""
Node for the scene.
@@ -48,6 +50,8 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
# link items connected to this node item.
self._links = []
self._symbol = None
self._locked = False
self._allow_snap_to_grid = True
# says if the attached node has been initialized
# by the server.
@@ -56,9 +60,9 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
# node label
self._node_label = None
self.setPos(QtCore.QPointF(self._node.x(), self._node.y()))
# Temporary symbol during loading
self.setPos(QtCore.QPoint(self._node.x(), self._node.y()))
self.setZValue(self._node.z())
renderer = QImageSvgRenderer(":/icons/reload.svg")
renderer.setObjectName("symbol_loading")
self.setSharedRenderer(renderer)
@@ -70,12 +74,16 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
self.graphicsEffect().setEnabled(False)
# set graphical settings for this node
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable)
self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable)
self.setFlag(QtWidgets.QGraphicsItem.ItemIsFocusable)
self.setFlag(QtWidgets.QGraphicsItem.ItemSendsGeometryChanges)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsSelectable)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsFocusable)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemSendsGeometryChanges)
self.setAcceptHoverEvents(True)
# update z value and locked state
self.setLocked(self._node.locked())
self.setZValue(self._node.z())
# connect signals to know about some events
# e.g. when the node has been started, stopped or suspended etc.
node.created_signal.connect(self.createdSlot)
@@ -101,13 +109,17 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
if node.initialized():
self.createdSlot(node.id())
def _updateNode(self):
if self._main_window.uiSnapToGridAction.isChecked():
self.setPos(QtCore.QPointF(self._node.x() + 0.1, self._node.y()))
def updateNode(self):
"""
Sync change to the node
"""
if self._initialized:
self._node.setGraphics(self)
self._node.setGraphics(self)
@qslot
def setSymbol(self, symbol):
"""
:param symbol: Change the symbol path
@@ -128,16 +140,22 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
def symbol(self):
return self._symbol
def _symbolLoadedCallback(self, path):
renderer = QImageSvgRenderer(path)
@qslot
def _symbolLoadedCallback(self, path, *args):
renderer = QImageSvgRenderer(path, fallback=":/icons/cancel.svg")
renderer.setObjectName(path)
self.setSharedRenderer(renderer)
if self._settings["limit_size_node_symbols"] is True and renderer.defaultSize().height() > 80:
# resize the SVG
renderer.resize(80)
self.setSharedRenderer(renderer)
if self._node.settings().get("symbol") != self._symbol:
self._updateNode()
self.updateNode()
if not self._initialized:
self._showLabel()
self._initialized = True
self._updateNode()
self.updateNode()
def node(self):
"""
@@ -153,25 +171,39 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
self._node.setSettingValue("x", int(self.x()))
self._node.setSettingValue("y", int(self.y()))
def addLink(self, link):
@qslot
def addLink(self, link_item, *args):
"""
Adds a link items to this node item.
:param link: LinkItem instance
"""
self._links.append(link)
if not sip.isdeleted(link_item):
self._links.append(link_item)
link_item.link().delete_link_signal.connect(self._removeLink)
link_item.link().updated_link_signal.connect(self._linkUpdatedSlot)
self._node.updated_signal.emit()
@qslot
def _linkUpdatedSlot(self, *args):
"""
When a link change we also notify the listener of the node
"""
self._node.updated_signal.emit()
def removeLink(self, link):
@qslot
def _removeLink(self, link_id, *args):
"""
Removes a link items from this node item.
:param link: LinkItem instance
"""
if link in self._links:
self._links.remove(link)
for link_item in self._links:
if link_item.link().id() == link_id:
self._links.remove(link_item)
return
def links(self):
"""
@@ -182,7 +214,8 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
return self._links
def createdSlot(self, base_node_id):
@qslot
def createdSlot(self, base_node_id, *args):
"""
Slot to receive events from the attached Node instance
when a the node has been created/initialized.
@@ -190,58 +223,51 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
:param base_node_id: base node identifier (integer)
"""
if self is None:
return
self.setPos(QtCore.QPoint(self._node.x(), self._node.y()))
self.setPos(QtCore.QPointF(self._node.x(), self._node.y()))
self.setSymbol(self._node.symbol())
self.update()
def startedSlot(self):
@qslot
def startedSlot(self, *args):
"""
Slot to receive events from the attached Node instance
when a the node has started.
"""
if self is None:
return
for link in self._links:
link.update()
def stoppedSlot(self):
@qslot
def stoppedSlot(self, *args):
"""
Slot to receive events from the attached Node instance
when a the node has stopped.
"""
if self is None:
return
for link in self._links:
link.update()
def suspendedSlot(self):
@qslot
def suspendedSlot(self, *args):
"""
Slot to receive events from the attached Node instance
when a the node has suspended.
"""
if self is None:
return
for link in self._links:
link.update()
def updatedSlot(self):
@qslot
def updatedSlot(self, *args):
"""
Slot to receive events from the attached Node instance
when a the node has been updated.
"""
if self is None:
return
self.setSymbol(self._node.settings().get("symbol"))
self.setPos(self._node.settings().get("x", 0), self._node.settings().get("y", 0))
self.setZValue(self._node.settings().get("z", 0))
self.setLocked(self._node.settings().get("locked", False))
self._updateLabel()
# update the link tooltips in case the
@@ -249,18 +275,20 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
for link in self._links:
link.setCustomToolTip()
def deletedSlot(self):
@qslot
def deletedSlot(self, *args):
"""
Slot to receive events from the attached Node instance
when the node has been deleted.
"""
if self is None or not self.scene():
if not self.scene():
return
if self in self.scene().items():
self.scene().removeItem(self)
def serverErrorSlot(self, base_node_id, message):
@qslot
def serverErrorSlot(self, base_node_id, message, *args):
"""
Slot to receive events from the attached Node instance
when the node has received an error from the server.
@@ -269,10 +297,10 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
:param message: error message
"""
if self:
self._last_error = "{message}".format(message=message)
self._last_error = "{message}".format(message=message)
def errorSlot(self, base_node_id, message):
@qslot
def errorSlot(self, base_node_id, message, *args):
"""
Slot to receive events from the attached Node instance
when the node wants to report an error.
@@ -281,8 +309,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
:param message: error message
"""
if self:
self._last_error = "{message}".format(message=message)
self._last_error = "{message}".format(message=message)
def setCustomToolTip(self):
"""
@@ -311,7 +338,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
"""
Called when user unselect the label
"""
self._updateNode()
self.updateNode()
def _centerLabel(self):
"""
@@ -333,7 +360,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
"""
if not self._node_label:
self._node_label = NoteItem(self)
self._node_label = LabelItem(self)
self._node_label.item_unselected_signal.connect(self._labelUnselectedSlot)
self._node_label.setEditable(False)
self._updateLabel()
@@ -341,7 +368,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
def _updateLabel(self):
"""
Update the label using the informations stored in the node
Update the label using the information stored in the node
"""
if not self._node_label:
return
@@ -350,15 +377,22 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
if self._node_label.toPlainText() != label_data["text"]:
self._node_label.setPlainText(label_data["text"])
self._node_label.setStyle(label_data["style"])
self._node_label.setRotation(label_data["rotation"])
style = label_data.get("style")
if style:
self._node_label.setStyle(style)
self._node_label.setRotation(label_data.get("rotation", 0))
if self._node.locked():
self._node_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
if label_data["x"] is None:
self._centerLabel()
self._updateNode()
self.updateNode()
else:
self._node_label.setPos(label_data["x"], label_data["y"])
def connectToPort(self, unavailable_ports=[]):
def connectToPort(self, pos, unavailable_ports=[]):
"""
Shows a contextual menu for the user to choose port or auto-select one.
@@ -368,7 +402,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
"""
self._selected_port = None
menu = QtWidgets.QMenu()
menu = QtWidgets.QMenu(parent=self.scene().parent())
ports = self._node.ports()
if not ports:
QtWidgets.QMessageBox.critical(self.scene().parent(), "Link", "No port available, please configure this device")
@@ -406,7 +440,10 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
menu.addAction(QtGui.QIcon(':/icons/led_green.svg'), port_object.name())
menu.triggered.connect(self.selectedPortSlot)
menu.exec_(QtGui.QCursor.pos())
# add some delay before showing the menu
# https://github.com/GNS3/gns3-gui/issues/3169
QtCore.QThread.msleep(100)
menu.exec(pos)
return self._selected_port
def selectedPortSlot(self, action):
@@ -433,25 +470,24 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
:param value: value of the change
"""
if change == QtWidgets.QGraphicsItem.ItemPositionHasChanged and self.isActive() and self._main_window.uiSnapToGridAction.isChecked():
GRID_SIZE = 75
if change == QtWidgets.QGraphicsItem.GraphicsItemChange.ItemPositionChange and self._main_window.uiSnapToGridAction.isChecked() \
and self._allow_snap_to_grid:
grid_size = self._main_window.uiGraphicsView.nodeGridSize()
mid_x = self.boundingRect().width() / 2
tmp_x = (GRID_SIZE * round((self.x() + mid_x) / GRID_SIZE)) - mid_x
value.setX((grid_size * round((value.x() + mid_x) / grid_size)) - mid_x)
mid_y = self.boundingRect().height() / 2
tmp_y = (GRID_SIZE * round((self.y() + mid_y) / GRID_SIZE)) - mid_y
if tmp_x != self.x() and tmp_y != self.y():
self.setPos(tmp_x, tmp_y)
value.setY((grid_size * round((value.y() + mid_y) / grid_size)) - mid_y)
# dynamically change the renderer when this node item is selected/unselected.
if change == QtWidgets.QGraphicsItem.ItemSelectedChange:
if change == QtWidgets.QGraphicsItem.GraphicsItemChange.ItemSelectedChange:
if value:
self.graphicsEffect().setEnabled(True)
else:
self.graphicsEffect().setEnabled(False)
self._updateNode()
self.updateNode()
# adjust link item positions when this node is moving or has changed.
if change == QtWidgets.QGraphicsItem.ItemPositionChange or change == QtWidgets.QGraphicsItem.ItemPositionHasChanged:
if change == QtWidgets.QGraphicsItem.GraphicsItemChange.ItemPositionChange or change == QtWidgets.QGraphicsItem.GraphicsItemChange.ItemPositionHasChanged:
for link in self._links:
link.adjust()
@@ -468,16 +504,16 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
# don't show the selection rectangle
if not self._settings["draw_rectangle_selected_item"]:
option.state = QtWidgets.QStyle.State_None
option.state = QtWidgets.QStyle.StateFlag.State_None
super().paint(painter, option, widget)
if not self._initialized or self.show_layer:
brect = self.boundingRect()
center = self.mapFromItem(self, brect.width() / 2.0, brect.height() / 2.0)
painter.setBrush(QtCore.Qt.red)
painter.setPen(QtCore.Qt.red)
painter.drawRect((brect.width() / 2.0) - 10, (brect.height() / 2.0) - 10, 20, 20)
painter.setPen(QtCore.Qt.black)
painter.setBrush(QtCore.Qt.GlobalColor.red)
painter.setPen(QtCore.Qt.GlobalColor.red)
painter.drawRect(QtCore.QRectF((brect.width() / 2.0) - 10, (brect.height() / 2.0) - 10, 20, 20))
painter.setPen(QtCore.Qt.GlobalColor.black)
if self.show_layer:
text = str(int(self.zValue())) # Z value
elif self._last_error:
@@ -494,21 +530,52 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
"""
super().setZValue(value)
if self.zValue() < 0:
self.setFlag(self.ItemIsSelectable, False)
self.setFlag(self.ItemIsMovable, False)
if self._node_label:
self._node_label.setFlag(self.ItemIsSelectable, False)
self._node_label.setFlag(self.ItemIsMovable, False)
else:
self.setFlag(self.ItemIsSelectable, True)
self.setFlag(self.ItemIsMovable, True)
if self._node_label:
self._node_label.setFlag(self.ItemIsSelectable, True)
self._node_label.setFlag(self.ItemIsMovable, True)
for link in self._links:
link.adjust()
self._node.setSettingValue("z", int(value))
def keyPressEvent(self, event):
"""
Handles all key press events
:param event: QKeyEvent
"""
if event.modifiers() & QtCore.Qt.KeyboardModifier.AltModifier:
self._allow_snap_to_grid = False
else:
super().keyPressEvent(event)
def keyReleaseEvent(self, event):
"""
Handles all key release events
:param event: QKeyEvent
"""
self._allow_snap_to_grid = True
def locked(self):
return self._locked
def setLocked(self, locked):
"""
Sets the locked value.
:param value: Z value
"""
if locked is True:
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
if self._node_label:
self._node_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
else:
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, True)
if self._node_label:
self._node_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, True)
for link in self._links:
link.adjust()
self._locked = locked
def hoverEnterEvent(self, event):
"""
@@ -537,4 +604,4 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
It the item is select but mouse is not on it the event
is send also
"""
self._updateNode()
self.updateNode()

View File

@@ -32,8 +32,22 @@ class RectangleItem(QtWidgets.QGraphicsRectItem, ShapeItem):
"""
def __init__(self, width=200, height=100, **kws):
self._rx = 0
self._ry = 0
super().__init__(width=width, height=height, **kws)
def setHorizontalCornerRadius(self, radius: int):
self._rx = radius
def horizontalCornerRadius(self):
return self._rx
def setVerticalCornerRadius(self, radius: int):
self._ry = radius
def verticalCornerRadius(self):
return self._ry
def paint(self, painter, option, widget=None):
"""
Paints the contents of an item in local coordinates.
@@ -43,7 +57,9 @@ class RectangleItem(QtWidgets.QGraphicsRectItem, ShapeItem):
:param widget: QWidget instance
"""
super().paint(painter, option, widget)
painter.setPen(self.pen())
painter.setBrush(self.brush())
painter.drawRoundedRect(self.rect(), self._rx, self._ry)
self.drawLayerInfo(painter)
def toSvg(self):
@@ -57,8 +73,27 @@ class RectangleItem(QtWidgets.QGraphicsRectItem, ShapeItem):
rect = ET.SubElement(svg, "rect")
rect.set("width", str(int(self.rect().width())))
rect.set("height", str(int(self.rect().height())))
if self._rx:
rect.set("rx", str(self._rx))
if self._ry:
rect.set("ry", str(self._ry))
rect = self._styleSvg(rect)
return ET.tostring(svg, encoding="utf-8").decode("utf-8")
def fromSvg(self, svg):
svg_elem = ET.fromstring(svg)
if len(svg_elem):
# handle horizontal corner radius and vertical corner radius (specific to rectangles)
rx = svg_elem[0].get("rx")
ry = svg_elem[0].get("ry")
if rx:
self._rx = int(rx)
elif ry:
self._rx = int(ry) # defaults to ry if it is specified
if ry:
self._ry = int(ry)
elif rx:
self._ry = int(rx) # defaults to rx if it is specified
super().fromSvg(svg)

View File

@@ -22,7 +22,7 @@ Graphical representation of a Serial link on the QGraphicsScene.
import math
from ..qt import QtCore, QtGui, QtWidgets
from .link_item import LinkItem
from .note_item import NoteItem
from .label_item import LabelItem
from ..ports.port import Port
@@ -37,12 +37,11 @@ class SerialLinkItem(LinkItem):
:param destination_port: destination Port instance
:param link: Link instance (contains back-end stuff for this link)
:param adding_flag: indicates if this link is being added (no destination yet)
:param multilink: used to draw multiple link between the same source and destination
"""
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False, multilink=0):
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False):
super().__init__(source_item, source_port, destination_item, destination_port, link, adding_flag, multilink)
super().__init__(source_item, source_port, destination_item, destination_port, link, adding_flag)
def adjust(self):
"""
@@ -51,10 +50,16 @@ class SerialLinkItem(LinkItem):
LinkItem.adjust(self)
if self._hovered:
self.setPen(QtGui.QPen(QtCore.Qt.red, self._pen_width + 1, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
else:
self.setPen(QtGui.QPen(QtCore.Qt.darkRed, self._pen_width, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
try:
if self._hovered:
self.setPen(QtGui.QPen(QtCore.Qt.GlobalColor.red, self._link._link_style["width"] + 1, QtCore.Qt.PenStyle.SolidLine, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin))
else:
self.setPen(QtGui.QPen(QtGui.QColor(self._link._link_style["color"]), self._link._link_style["width"], QtCore.Qt.PenStyle(self._link._link_style["type"]), QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin))
except:
if self._hovered:
self.setPen(QtGui.QPen(QtCore.Qt.GlobalColor.red, self._pen_width + 1, QtCore.Qt.PenStyle.SolidLine, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin))
else:
self.setPen(QtGui.QPen(QtCore.Qt.GlobalColor.darkRed, self._pen_width, QtCore.Qt.PenStyle.SolidLine, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin))
# get source to destination angle
vector_angle = math.atan2(self.dy, self.dx)
@@ -108,71 +113,73 @@ class SerialLinkItem(LinkItem):
QtWidgets.QGraphicsPathItem.paint(self, painter, option, widget)
if not self._adding_flag and self._settings["draw_link_status_points"]:
if not self._adding_flag:
# points disappears if nodes are too close to each others.
if self.length < 80:
return
# source point color
if self._source_port.status() == Port.started:
if self._link.suspended() or self._source_port.status() == Port.suspended:
# link or port is suspended
shape = QtCore.Qt.PenCapStyle.RoundCap
color = QtCore.Qt.GlobalColor.yellow
elif self._source_port.status() == Port.started:
# port is active
shape = QtCore.Qt.RoundCap
color = QtCore.Qt.green
elif self._source_port.status() == Port.suspended:
# port is suspended
shape = QtCore.Qt.RoundCap
color = QtCore.Qt.yellow
shape = QtCore.Qt.PenCapStyle.RoundCap
color = QtCore.Qt.GlobalColor.green
else:
shape = QtCore.Qt.SquareCap
color = QtCore.Qt.red
shape = QtCore.Qt.PenCapStyle.SquareCap
color = QtCore.Qt.GlobalColor.red
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.MiterJoin))
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.PenStyle.SolidLine, shape, QtCore.Qt.PenJoinStyle.MiterJoin))
source_port_label = self._source_port.label()
if source_port_label is None:
source_port_label = NoteItem(self._source_item)
source_port_name = self._source_port.name()
source_port_label.setPlainText(source_port_name)
source_port_label = LabelItem(self._source_item)
source_port_label.setPlainText(self._source_port.shortName())
source_port_label.setPos(self.mapToItem(self._source_item, self.source))
self._source_port.setLabel(source_port_label)
if self._draw_port_labels:
source_port_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, not self._source_item.locked())
source_port_label.show()
else:
source_port_label.hide()
painter.drawPoint(self.source_point)
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.PenStyle.NoPen:
painter.drawPoint(self.source_point)
# destination point color
if self._destination_port.status() == Port.started:
if self._link.suspended() or self._destination_port.status() == Port.suspended:
# link or port is suspended
color = QtCore.Qt.GlobalColor.yellow
shape = QtCore.Qt.PenCapStyle.RoundCap
elif self._destination_port.status() == Port.started:
# port is active
color = QtCore.Qt.green
shape = QtCore.Qt.RoundCap
elif self._destination_port.status() == Port.suspended:
# port is suspended
color = QtCore.Qt.yellow
shape = QtCore.Qt.RoundCap
color = QtCore.Qt.GlobalColor.green
shape = QtCore.Qt.PenCapStyle.RoundCap
else:
color = QtCore.Qt.red
shape = QtCore.Qt.SquareCap
color = QtCore.Qt.GlobalColor.red
shape = QtCore.Qt.PenCapStyle.SquareCap
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.SolidLine, shape, QtCore.Qt.MiterJoin))
painter.setPen(QtGui.QPen(color, self._point_size, QtCore.Qt.PenStyle.SolidLine, shape, QtCore.Qt.PenJoinStyle.MiterJoin))
destination_port_label = self._destination_port.label()
if destination_port_label is None:
destination_port_label = NoteItem(self._destination_item)
destination_port_name = self._destination_port.name()
destination_port_label.setPlainText(destination_port_name)
destination_port_label = LabelItem(self._destination_item)
destination_port_label.setPlainText(self._destination_port.shortName())
destination_port_label.setPos(self.mapToItem(self._destination_item, self.destination))
self._destination_port.setLabel(destination_port_label)
if self._draw_port_labels:
destination_port_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, not self._destination_item.locked())
destination_port_label.show()
else:
destination_port_label.hide()
painter.drawPoint(self.destination_point)
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.PenStyle.NoPen:
painter.drawPoint(self.destination_point)
self._drawCaptureSymbol()
self._drawSymbol()

View File

@@ -20,7 +20,7 @@ Base class for shape items (Rectangle, ellipse etc.).
"""
import xml.etree.ElementTree as ET
from ..qt import QtCore, QtGui, QtWidgets, QtSvg
from ..qt import QtCore, QtGui, QtWidgets
from .drawing_item import DrawingItem
from .utils import colorFromSvg
@@ -30,17 +30,6 @@ log = logging.getLogger(__name__)
class ShapeItem(DrawingItem):
# Map QT stroke to SVG style
QT_DASH_TO_SVG = {
QtCore.Qt.SolidLine: "",
QtCore.Qt.NoPen: None,
QtCore.Qt.DashLine: "25, 25",
QtCore.Qt.DotLine: "5, 25",
QtCore.Qt.DashDotLine: "5, 25, 25",
QtCore.Qt.DashDotDotLine: "25, 25, 5, 25, 5"
}
"""
Base class to draw shapes on the scene.
"""
@@ -51,10 +40,11 @@ class ShapeItem(DrawingItem):
self.setAcceptHoverEvents(True)
self._border = 5
self._edge = None
self._originally_movable = True
if svg is None:
self.setRect(0, 0, width, height)
pen = QtGui.QPen(QtCore.Qt.black, 2, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin)
pen = QtGui.QPen(QtCore.Qt.GlobalColor.black, 2, QtCore.Qt.PenStyle.SolidLine, QtCore.Qt.PenCapStyle.RoundCap, QtCore.Qt.PenJoinStyle.RoundJoin)
self.setPen(pen)
brush = QtGui.QBrush(QtGui.QColor(255, 255, 255, 255)) # default color is white and not transparent
self.setBrush(brush)
@@ -71,22 +61,22 @@ class ShapeItem(DrawingItem):
"""
self.update()
self._originally_movable = bool(self.flags() & QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable)
if event.pos().x() > (self.rect().right() - self._border):
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
self._edge = "right"
elif event.pos().x() < (self.rect().left() + self._border):
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
self._edge = "left"
elif event.pos().y() < (self.rect().top() + self._border):
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
self._edge = "top"
elif event.pos().y() > (self.rect().bottom() - self._border):
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
self._edge = "bottom"
QtWidgets.QGraphicsItem.mousePressEvent(self, event)
def mouseReleaseEvent(self, event):
@@ -97,7 +87,7 @@ class ShapeItem(DrawingItem):
"""
self.update()
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, self._originally_movable)
self._edge = None
QtWidgets.QGraphicsItem.mouseReleaseEvent(self, event)
@@ -157,18 +147,18 @@ class ShapeItem(DrawingItem):
:param event: QGraphicsSceneHoverEvent instance
"""
# objects on the background layer don't need cursors
if self.zValue() >= 0:
# locked objects don't need cursors
if not self.locked():
if event.pos().x() > (self.rect().right() - self._border):
self._graphics_view.setCursor(QtCore.Qt.SizeHorCursor)
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeHorCursor)
elif event.pos().x() < (self.rect().left() + self._border):
self._graphics_view.setCursor(QtCore.Qt.SizeHorCursor)
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeHorCursor)
elif event.pos().y() < (self.rect().top() + self._border):
self._graphics_view.setCursor(QtCore.Qt.SizeVerCursor)
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeVerCursor)
elif event.pos().y() > (self.rect().bottom() - self._border):
self._graphics_view.setCursor(QtCore.Qt.SizeVerCursor)
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeVerCursor)
else:
self._graphics_view.setCursor(QtCore.Qt.SizeAllCursor)
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeAllCursor)
def hoverLeaveEvent(self, event):
"""
@@ -177,34 +167,16 @@ class ShapeItem(DrawingItem):
:param event: QGraphicsSceneHoverEvent instance
"""
# objects on the background layer don't need cursors
if self.zValue() >= 0:
self._graphics_view.setCursor(QtCore.Qt.ArrowCursor)
# locked objects don't need cursors
if not self.locked():
self._graphics_view.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
def _styleSvg(self, element):
"""
Add style from the shape item to the SVG element that we will
export
"""
style = ""
pen = self.pen()
element.set("fill", "#{}".format(hex(self.brush().color().rgba())[4:]))
element.set("fill-opacity", str(self.brush().color().alphaF()))
dasharray = self.QT_DASH_TO_SVG[pen.style()]
if dasharray is None: # No border to the element
return element
elif dasharray == "":
pass # Solid line
else:
element.set("stroke-dasharray", dasharray)
element.set("stroke-width", str(pen.width()))
element.set("stroke", "#" + hex(pen.color().rgba())[4:])
return element
def setWidthAndHeight(self, width, height):
self.setRect(0, 0, width, height)
def fromSvg(self, svg):
"""
Import element informations from an SVG
Import element information from SVG
"""
svg = ET.fromstring(svg)
width = float(svg.get("width", self.rect().width()))
@@ -212,13 +184,10 @@ class ShapeItem(DrawingItem):
self.setRect(0, 0, width, height)
pen = QtGui.QPen()
brush = QtGui.QBrush(QtCore.Qt.SolidPattern)
brush = QtGui.QBrush(QtCore.Qt.BrushStyle.SolidPattern)
if len(svg):
if svg[0].get("stroke-width"):
pen.setWidth(int(svg[0].get("stroke-width")))
if svg[0].get("stroke"):
pen.setColor(colorFromSvg(svg[0].get("stroke")))
pen = self._penFromSVGElement(svg[0])
if svg[0].get("fill"):
new_color = colorFromSvg(svg[0].get("fill"))
color = brush.color()
@@ -231,17 +200,6 @@ class ShapeItem(DrawingItem):
color.setAlphaF(float(svg[0].get("fill-opacity")))
brush.setColor(color)
# Map SVG stroke style (border of the element to the Qt version)
if not svg[0].get("stroke"):
pen.setStyle(QtCore.Qt.NoPen)
else:
pen.setStyle(QtCore.Qt.SolidLine)
stroke = svg[0].get("stroke-dasharray")
if stroke:
for (qt_stroke, svg_stroke) in self.QT_DASH_TO_SVG.items():
if svg_stroke == stroke:
pen.setStyle(qt_stroke)
self.setPen(pen)
self.setBrush(brush)
self.update()

View File

@@ -15,10 +15,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Graphical representation of a note on the QGraphicsScene.
"""
import xml.etree.ElementTree as ET
from ..qt import QtCore, QtWidgets, QtGui
@@ -26,10 +22,15 @@ from .drawing_item import DrawingItem
from .utils import colorFromSvg
import logging
log = logging.getLogger(__name__)
class TextItem(QtWidgets.QGraphicsTextItem, DrawingItem):
"""
Text item for the QGraphicsView.
"""
def __init__(self, svg=None, **kws):
super().__init__(**kws)
@@ -39,12 +40,19 @@ class TextItem(QtWidgets.QGraphicsTextItem, DrawingItem):
main_window = MainWindow.instance()
view_settings = main_window.uiGraphicsView.settings()
qt_font = QtGui.QFont()
qt_font.fromString(view_settings["default_label_font"])
self.setDefaultTextColor(QtGui.QColor(view_settings["default_label_color"]))
qt_font.fromString(view_settings["default_note_font"])
self.setDefaultTextColor(QtGui.QColor(view_settings["default_note_color"]))
self.setFont(qt_font)
if svg:
svg = self.fromSvg(svg)
try:
svg = self.fromSvg(svg)
except ET.ParseError as e:
log.warning(str(e))
# re-evaluate `z` position after creation
if 'z' in kws.keys():
self.setZValue(kws['z'])
if self._id is None:
self.create()
@@ -54,11 +62,11 @@ class TextItem(QtWidgets.QGraphicsTextItem, DrawingItem):
Edit mode for this note.
"""
self.setTextInteractionFlags(QtCore.Qt.TextEditorInteraction)
self.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.TextEditorInteraction)
self.setSelected(True)
self.setFocus()
cursor = self.textCursor()
cursor.select(QtGui.QTextCursor.Document)
cursor.select(QtGui.QTextCursor.SelectionType.Document)
self.setTextCursor(cursor)
def mouseDoubleClickEvent(self, event):
@@ -77,12 +85,12 @@ class TextItem(QtWidgets.QGraphicsTextItem, DrawingItem):
:param event: QFocusEvent instance
"""
self.setFlag(QtWidgets.QGraphicsItem.ItemIsFocusable, False)
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsFocusable, False)
cursor = self.textCursor()
if cursor.hasSelection():
cursor.clearSelection()
self.setTextCursor(cursor)
self.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
self.setTextInteractionFlags(QtCore.Qt.TextInteractionFlag.NoTextInteraction)
if not self.toPlainText():
# delete the note if empty
self.delete()
@@ -113,20 +121,36 @@ class TextItem(QtWidgets.QGraphicsTextItem, DrawingItem):
text = ET.SubElement(svg, "text")
text.set("font-family", self.font().family())
text.set("font-size", str(self.font().pointSize()))
text.set("font-size", str(self.font().pointSizeF()))
if self.font().italic():
text.set("font-style", "italic")
if self.font().bold():
text.set("font-weight", "bold")
if self.font().strikeOut():
text.set("text-decoration", "line-through")
elif self.font().underline():
text.set("text-decoration", "underline")
text.set("fill", "#" + hex(self.defaultTextColor().rgba())[4:])
text.set("fill-opacity", str(self.defaultTextColor().alphaF()))
text.text = self.toPlainText()
text.text = self.toPlainText() or " "
svg = ET.tostring(svg, encoding="utf-8").decode("utf-8")
return svg
def fromSvg(self, svg):
svg = ET.fromstring(svg)
# sometimes we receive \0 at the end of string inside <svg> element
try:
svg = svg.replace("\u0000", "")
except AttributeError:
pass
try:
svg = ET.fromstring(svg)
except ET.ParseError:
self.setPlainText("Unable to parse `text_item`")
return
text = svg[0]
font = QtGui.QFont()
@@ -145,12 +169,16 @@ class TextItem(QtWidgets.QGraphicsTextItem, DrawingItem):
color.setAlphaF(float(opacity))
self.setDefaultTextColor(color)
font.setPointSize(int(text.get("font-size", self.font().pointSize())))
font.setPointSizeF(float(text.get("font-size", self.font().pointSizeF())))
font.setFamily(text.get("font-family", self.font().family()))
if text.get("font-style") == "italic":
font.setItalic(True)
if text.get("font-weight") == "bold":
font.setBold(True)
if text.get("text-decoration") == "underline":
font.setUnderline(True)
if text.get("text-decoration") == "line-through":
font.setStrikeOut(True)
self.setFont(font)
self.setPlainText(text.text)

View File

@@ -23,7 +23,9 @@ def colorFromSvg(value):
Transform a color coming from a SVG file to a Qcolor
"""
value = value.strip('#')
if len(value) == 6: # If alpha channel is missing
if value == "":
value = "000000"
if len(value) == 6: # If alpha channel is missing
value = "ff" + value
value = int(value, base=16)
return QtGui.QColor.fromRgba(value)

View File

@@ -19,12 +19,11 @@
Manages and stores everything needed for a connection between 2 devices.
"""
import os
import re
from .qt import sip
import uuid
import tempfile
from .qt import QtCore, QtWidgets
from .qt import QtCore, QtNetwork
from .controller import Controller
@@ -59,10 +58,10 @@ class Link(QtCore.QObject):
super().__init__()
log.info("adding link from {} {} to {} {}".format(source_node.name(),
source_port.name(),
destination_node.name(),
destination_port.name()))
log.debug("adding link from {} {} to {} {}".format(source_node.name(),
source_port.name(),
destination_node.name(),
destination_port.name()))
# create an unique ID
self._id = Link._instance_count
@@ -76,18 +75,30 @@ class Link(QtCore.QObject):
self._destination_label = None
self._link_id = link_id
self._capturing = False
self._deleting = False
self._capture_file_path = None
self._capture_file = None
self._network_manager = None
self._response_stream = None
self._capture_compute_id = None
self._initialized = False
# Boolean if True we are creatin the first instance of this node
# if false the node already exist in the topology
# use to avoid erasing informations when reloading
self._creator = False
self._filters = {}
self._suspend = False
self._nodes = []
self._source_node.addLink(self)
self._destination_node.addLink(self)
# Boolean if True we are creating the first instance of this node
# if false the node already exist in the topology
# use to avoid erasing information when reloading
self._creator = False
# Add the default link style from the topology view settings
from .main_window import MainWindow
topology_view_settings = MainWindow.instance().uiGraphicsView.settings()
self._link_style = {
"color": topology_view_settings.get("default_link_color", "#000000"),
"width": topology_view_settings.get("default_link_width", 2),
"type": topology_view_settings.get("default_link_type", 1)
}
body = self._prepareParams()
if self._link_id:
@@ -99,31 +110,55 @@ class Link(QtCore.QObject):
Controller.instance().post("/projects/{project_id}/links".format(project_id=source_node.project().id()), self._linkCreatedCallback, body=body)
def _parseResponse(self, result):
self._capturing = result.get("capturing", False)
# If the controller is remote the capture path should be rewrite to something local
if Controller.instance().isRemote():
if self._capture_file_path is None and result.get("capture_file_path", None) is not None:
(handle, self._capture_file_path) = tempfile.mkstemp()
Controller.instance().get(
"/projects/{project_id}/links/{link_id}/pcap".format(
project_id=self.project().id(),
link_id=self._link_id),
None,
showProgress=False,
downloadProgressCallback=self._downloadPcapProgress,
timeout=None)
self._capturing = result.get("capturing", False)
if self._capturing:
self._capture_compute_id = result.get("capture_compute_id", None)
self._capture_file_path = result.get("capture_file_path", None)
if Controller.instance().isRemote() or (self._capture_compute_id and self._capture_compute_id != "local"):
# We need to stream the pcap file content if the controller or compute is remote
if Controller.instance().isRemote() or self._capture_file_path is None:
self._capture_file = QtCore.QTemporaryFile()
self._capture_file.open(QtCore.QIODeviceBase.OpenModeFlag.WriteOnly)
self._capture_file.setAutoRemove(True)
self._capture_file_path = self._capture_file.fileName()
else:
self._capture_file = QtCore.QFile(self._capture_file_path)
self._capture_file.open(QtCore.QIODeviceBase.OpenModeFlag.WriteOnly)
if self._network_manager is None:
self._network_manager = QtNetwork.QNetworkAccessManager(self)
self._response_stream = Controller.instance().get("/projects/{project_id}/links/{link_id}/pcap".format(project_id=self.project().id(), link_id=self._link_id),
None,
showProgress=False,
downloadProgressCallback=self._downloadPcapProgress,
ignoreErrors=True, # If something is wrong avoid disconnect us from server
timeout=None,
networkManager=self._network_manager)
log.debug("Has successfully started capturing packets on link {} to '{}'".format(self._link_id, self._capture_file_path))
else:
self._capture_file_path = result["capture_file_path"]
self._response_stream = None
if "nodes" in result:
self._nodes = result["nodes"]
self._updateLabels()
if "filters" in result:
self._filters = result["filters"]
if "link_style" in result:
self._link_style = result["link_style"]
if "suspend" in result:
self._suspend = result["suspend"]
self.updated_link_signal.emit(self._id)
def creator(self):
return self._creator
def suspended(self):
return self._suspend
def toggleSuspend(self):
self._suspend = not self._suspend
self.update()
def initialized(self):
return self._initialized
@@ -139,14 +174,20 @@ class Link(QtCore.QObject):
self._updateLabels()
def update(self):
if not self._link_id:
if not self._link_id or self.deleting():
return
body = self._prepareParams()
Controller.instance().put("/projects/{project_id}/links/{link_id}".format(project_id=self._source_node.project().id(), link_id=self._link_id), self.updateLinkCallback, body=body)
def listAvailableFilters(self, callback):
"""
Get the list of available filters
"""
Controller.instance().get("/projects/{project_id}/links/{link_id}/available_filters".format(project_id=self._source_node.project().id(), link_id=self._link_id), callback)
def updateLinkCallback(self, result, error=False, *args, **kwargs):
if error:
QtWidgets.QMessageBox.warning(None, "Update link", "Error while updating link: {}".format(result["message"]))
log.warning("Error while updating link: {}".format(result["message"]))
return
self._parseResponse(result)
@@ -160,12 +201,16 @@ class Link(QtCore.QObject):
raise NotImplementedError
def _updateLabel(self, label, label_data):
if not label:
if not label or sip.isdeleted(label):
return
label.setPlainText(label_data["text"])
label.setPos(label_data["x"], label_data["y"])
label.setStyle(label_data["style"])
label.setRotation(label_data["rotation"])
if "text" in label_data:
label.setPlainText(label_data["text"])
if "x" in label_data and "y" in label_data:
label.setPos(label_data["x"], label_data["y"])
if "style" in label_data:
label.setStyle(label_data["style"])
if "rotation" in label_data:
label.setRotation(label_data["rotation"])
def _prepareParams(self):
body = {
@@ -180,7 +225,10 @@ class Link(QtCore.QObject):
"adapter_number": self._destination_port.adapterNumber(),
"port_number": self._destination_port.portNumber()
}
]
],
"filters": self._filters,
"link_style": self._link_style,
"suspend": self._suspend
}
if self._source_port.label():
body["nodes"][0]["label"] = self._source_port.label().dump()
@@ -190,7 +238,8 @@ class Link(QtCore.QObject):
def _linkCreatedCallback(self, result, error=False, **kwargs):
if error:
QtWidgets.QMessageBox.warning(None, "Create link", "Error while creating link: {}".format(result["message"]))
log.warning("Error while creating link: {}".format(result["message"]))
self.deleteLink(skip_controller=True)
return
self._initialized = True
@@ -212,6 +261,19 @@ class Link(QtCore.QObject):
def link_id(self):
return self._link_id
def deleting(self):
"""
Is the link being deleted
"""
return self._deleting
def setDeleting(self):
"""
Mark this link as being deleted
"""
self._deleting = True
def capturing(self):
"""
Is a capture running on the link?
@@ -237,10 +299,18 @@ class Link(QtCore.QObject):
def __str__(self):
return "Link from {} port {} to {} port {}".format(self._source_node.name(),
self._source_port.name(),
self._destination_node.name(),
self._destination_port.name())
description = "Link from {} port {} to {} port {}".format(self._source_node.name(),
self._source_port.name(),
self._destination_node.name(),
self._destination_port.name())
if self.capturing():
description += "\nPacket capture is active"
for filter_type in self._filters.keys():
description += "\nPacket filter '{}' is active".format(filter_type)
return description
def capture_file_name(self):
"""
@@ -251,23 +321,25 @@ class Link(QtCore.QObject):
self._source_port.name(),
self._destination_node.name(),
self._destination_port.name())
return re.sub("[^0-9A-Za-z_-]", "", capture_file_name)
return re.sub(r"[^0-9A-Za-z_-]", "", capture_file_name)
def deleteLink(self, skip_controller=False):
"""
Deletes this link.
"""
log.info("deleting link from {} {} to {} {}".format(self._source_node.name(),
self._source_port.name(),
self._destination_node.name(),
self._destination_port.name()))
log.debug("deleting link from {} {} to {} {}".format(self._source_node.name(),
self._source_port.name(),
self._destination_node.name(),
self._destination_port.name()))
if skip_controller:
self._linkDeletedCallback({})
else:
self.setDeleting()
Controller.instance().delete("/projects/{project_id}/links/{link_id}".format(project_id=self.project().id(),
link_id=self._link_id), self._linkDeletedCallback)
link_id=self._link_id),
self._linkDeletedCallback)
def _linkDeletedCallback(self, result, error=False, **kwargs):
"""
@@ -292,63 +364,57 @@ class Link(QtCore.QObject):
"capture_file_name": capture_file_name,
"data_link_type": data_link_type
}
Controller.instance().post(
"/projects/{project_id}/links/{link_id}/start_capture".format(
project_id=self.project().id(),
link_id=self._link_id),
self._startCaptureCallback,
body=data)
Controller.instance().post("/projects/{project_id}/links/{link_id}/start_capture".format(project_id=self.project().id(), link_id=self._link_id),
self._startCaptureCallback,
body=data)
def _startCaptureCallback(self, result, error=False, **kwargs):
if error:
log.error("Error while starting capture on link: {}".format(result["message"]))
log.error("Error while starting capture on link {}: {}".format(self._link_id, result["message"]))
return
self._parseResponse(result)
def _downloadPcapProgress(self, content, server=None, context={}, **kwargs):
"""
Called for each part of the file of the PCAP
"""
if not self._capture_file_path:
return
try:
with open(self._capture_file_path, 'ab') as f:
f.write(content)
except OSError as e:
log.error("Can't write file {}: {}".format(self._capture_file_path, e), True)
return
self._capture_file.write(content)
self._capture_file.flush()
def stopCapture(self):
if Controller.instance().isRemote():
if self._capture_file_path:
try:
os.remove(self._capture_file_path)
except OSError as e:
log.error("Can't remove file {}".format(self._capture_file_path))
if Controller.instance().isRemote() or (self._capture_compute_id and self._capture_compute_id != "local"):
if self._capture_file:
self._capture_file.close()
self._capture_file = None
# if self._capture_file_path and os.path.exists(self._capture_file_path):
# try:
# os.remove(self._capture_file_path)
# except OSError as e:
# log.error("Cannot remove file {}: {}".format(self._capture_file_path, e))
self._capture_file_path = None
Controller.instance().post(
"/projects/{project_id}/links/{link_id}/stop_capture".format(
project_id=self.project().id(),
link_id=self._link_id),
self._stopCaptureCallback)
Controller.instance().post("/projects/{project_id}/links/{link_id}/stop_capture".format(project_id=self.project().id(),
link_id=self._link_id),
self._stopCaptureCallback)
def _stopCaptureCallback(self, result, error=False, **kwargs):
if error:
log.error("Error while stopping capture on link: {}".format(result["message"]))
log.error("Error while stopping capture on link {}: {}".format(self._link_id, result["message"]))
return
self._parseResponse(result)
log.debug("Has successfully stopped capturing packets on link {}".format(self._link_id))
def get(self, path, callback, **kwargs):
"""
HTTP Get from a link
"""
Controller.instance().get(
"/projects/{project_id}/links/{link_id}{path}".format(
project_id=self.project().id(),
link_id=self._link_id,
path=path),
callback,
**kwargs)
Controller.instance().get("/projects/{project_id}/links/{link_id}{path}".format(project_id=self.project().id(),
link_id=self._link_id,
path=path),
callback,
**kwargs)
def id(self):
"""
@@ -404,3 +470,21 @@ class Link(QtCore.QObject):
if self._destination_node == node:
return self._destination_port
return self._source_port
def filters(self):
"""
:returns: List the filters active on the node
"""
return self._filters
def setFilters(self, filters):
"""
:params filters: List of filters
"""
self._filters = filters
def setLinkStyle(self, link_style):
"""
:params _link_style: Set link style attributes
"""
self._link_style = link_style

View File

@@ -24,9 +24,10 @@ import copy
import psutil
from .qt import QtCore, QtWidgets
from .version import __version__
from .version import __version__, __version_info__
from .utils import parse_version
from .controller import Controller
from .local_server_config import LocalServerConfig
from .settings import LOCAL_SERVER_SETTINGS
import logging
log = logging.getLogger(__name__)
@@ -42,7 +43,7 @@ class LocalConfig(QtCore.QObject):
def __init__(self, config_file=None):
"""
:param config_file: Path to the config file (override all other config, usefull for tests)
:param config_file: Path to the config file (override all other config, useful for tests)
"""
super().__init__()
@@ -88,8 +89,30 @@ class LocalConfig(QtCore.QObject):
try:
# create the config file if it doesn't exist
os.makedirs(os.path.dirname(self._config_file), exist_ok=True)
with open(self._config_file, "w", encoding="utf-8") as f:
json.dump({"version": __version__, "type": "settings"}, f)
if sys.platform.startswith("win"):
old_config_path = os.path.join(os.path.expandvars("%APPDATA%"), "GNS3", filename)
else:
xgd_config_var = "$XDG_CONFIG_HOME"
xdg_config_res = os.path.expandvars(xgd_config_var)
if xdg_config_res != xgd_config_var:
old_config_path = os.path.join(xdg_config_res, "GNS3", filename)
else:
old_config_path = os.path.join(os.path.expanduser("~"), ".config", "GNS3", filename)
# TODO: migrate versioned config file from a previous version of GNS3 (for instance 2.2 -> 2.3) + support profiles
if os.path.exists(old_config_path):
# migrate post version 2.2.0 configuration file
shutil.copyfile(old_config_path, self._config_file)
# reset the local server path and ubridge path
settings = LocalServerConfig.instance().loadSettings("Server", LOCAL_SERVER_SETTINGS)
settings["path"] = ""
settings["ubridge_path"] = ""
LocalServerConfig.instance().saveSettings("Server", settings)
else:
# create a new config
with open(self._config_file, "w", encoding="utf-8") as f:
json.dump({"version": __version__, "type": "settings"}, f)
except OSError as e:
log.error("Could not create the config file {}: {}".format(self._config_file, e))
@@ -97,8 +120,7 @@ class LocalConfig(QtCore.QObject):
# overwrite system wide settings with user specific ones
self._settings.update(user_settings)
self._migrateOldConfig()
self._writeConfig()
Controller.instance().connected_signal.connect(self.refreshConfigFromController)
self.writeConfig()
def profile(self):
"""
@@ -116,45 +138,36 @@ class LocalConfig(QtCore.QObject):
self._config_file = None
self._resetLoadConfig()
def refreshConfigFromController(self):
"""
Refresh the configuration from the controller
"""
controller = Controller.instance()
if controller.connected():
controller.get("/settings", self._getSettingsCallback)
def _getSettingsCallback(self, result, error=False, **kwargs):
if error:
log.error("Can't get settings from controller")
return
if result == {} and self._settings != {}:
self._saveOnController()
return
self._settings.update(result)
# Update already loaded section
for section in self._settings.keys():
if isinstance(self._settings[section], dict):
self.loadSectionSettings(section, self._settings[section])
self.config_changed_signal.emit()
def configDirectory(self):
"""
Get the configuration directory
"""
version = "{}.{}".format(__version_info__[0], __version_info__[1])
if sys.platform.startswith("win"):
appdata = os.path.expandvars("%APPDATA%")
path = os.path.join(appdata, "GNS3")
path = os.path.join(appdata, "GNS3", version)
else:
home = os.path.expanduser("~")
path = os.path.join(home, ".config", "GNS3")
xgd_config_var = "$XDG_CONFIG_HOME"
xdg_config_res = os.path.expandvars(xgd_config_var)
if xdg_config_res != xgd_config_var:
path = os.path.join(xdg_config_res, "GNS3", version)
else:
home = os.path.expanduser("~")
path = os.path.join(home, ".config", "GNS3", version)
if self._profile is not None:
path = os.path.join(path, "profiles", self._profile)
return os.path.normpath(path)
def runAsRootPath(self):
"""
Gets run as root filename
:return: string
"""
return os.path.join(self.configDirectory(), "run_as_root")
def _migrateOldConfigPath(self):
"""
Migrate pre 1.4 config path
@@ -163,8 +176,9 @@ class LocalConfig(QtCore.QObject):
# In < 1.4 on Mac the config was in a gns3.net directory
# We have move to same location as Linux
if sys.platform.startswith("darwin"):
version = "{}.{}".format(__version_info__[0], __version_info__[1])
old_path = os.path.join(os.path.expanduser("~"), ".config", "gns3.net")
new_path = os.path.join(os.path.expanduser("~"), ".config", "GNS3")
new_path = os.path.join(os.path.expanduser("~"), ".config", "GNS3", version)
if os.path.exists(old_path) and not os.path.exists(new_path):
try:
shutil.copytree(old_path, new_path)
@@ -173,7 +187,7 @@ class LocalConfig(QtCore.QObject):
def _migrateOldConfig(self):
"""
Migrate pre 1.4 config
Migrate config from a previous version.
"""
# Display an error if settings come from a more recent version of GNS3
@@ -182,27 +196,30 @@ class LocalConfig(QtCore.QObject):
if "version" in self._settings:
if parse_version(self._settings["version"])[:2] > parse_version(__version__)[:2]:
app = QtWidgets.QApplication(sys.argv) # We need to create an application because settings are loaded before Qt init
QtWidgets.QMessageBox.critical(None, "Version error", "Your settings are for version {} of GNS3. You cannot use a previous version of GNS3 without risking losing data.".format(self._settings["version"]))
error_message = "Settings are for version {} of GNS3. It is not possible to use a previous version of GNS3 without risking losing data. Delete the settings in '{}' to start GNS3".format(self._settings["version"], self.configDirectory())
QtWidgets.QMessageBox.critical(False, "Version error", error_message)
# Exit immediately not clean but we want to avoid any side effect that could corrupt the file
QtCore.QTimer.singleShot(0, app.quit)
app.exec()
sys.exit(1)
if "version" not in self._settings or parse_version(self._settings["version"]) < parse_version("1.4.0alpha1"):
servers = self._settings.get("Servers", {})
servers = self._settings.get("Servers", {})
if "LocalServer" in self._settings:
if "LocalServer" in self._settings:
servers["local_server"] = copy.copy(self._settings["LocalServer"])
# We migrate the server binary for OSX due to the change from py2app to CX freeze
# We migrate the server binary for OSX due to the change from py2app to CX freeze
if servers["local_server"]["path"] == "/Applications/GNS3.app/Contents/Resources/server/Contents/MacOS/gns3server":
servers["local_server"]["path"] = "gns3server"
if "RemoteServers" in self._settings:
if "RemoteServers" in self._settings:
servers["remote_servers"] = copy.copy(self._settings["RemoteServers"])
self._settings["Servers"] = servers
self._settings["Servers"] = servers
if "GUI" in self._settings:
if "GUI" in self._settings:
main_window = self._settings.get("MainWindow", {})
main_window["hide_getting_started_dialog"] = self._settings["GUI"].get("hide_getting_started_dialog", False)
self._settings["MainWindow"] = main_window
@@ -212,10 +229,10 @@ class LocalConfig(QtCore.QObject):
from .settings import PRECONFIGURED_TELNET_CONSOLE_COMMANDS, DEFAULT_TELNET_CONSOLE_COMMAND
if "MainWindow" in self._settings:
if self._settings["MainWindow"]["telnet_console_command"] not in PRECONFIGURED_TELNET_CONSOLE_COMMANDS.values():
if self._settings["MainWindow"].get("telnet_console_command") not in PRECONFIGURED_TELNET_CONSOLE_COMMANDS.values():
self._settings["MainWindow"]["telnet_console_command"] = DEFAULT_TELNET_CONSOLE_COMMAND
# Migrate 1.X to 2.0
# Migrate 1.X to 2.0
if "version" not in self._settings or parse_version(self._settings["version"]) < parse_version("2.0.0"):
if "Qemu" in self._settings:
# The internet VM is replaced by the nat Node
@@ -226,12 +243,24 @@ class LocalConfig(QtCore.QObject):
vms.append(vm)
self._settings["Qemu"]["vms"] = vms
# Starting with 2.0.0dev5 IOU licence is stored in the settings
if "version" not in self._settings or parse_version(self._settings["version"]) < parse_version("2.0.0"):
if "IOU" in self._settings and "iourc_path" in self._settings["IOU"] and "iourc_content" not in self._settings["IOU"]:
try:
with open(self._settings["IOU"]["iourc_path"], "r", encoding="utf-8") as f:
self._settings["IOU"]["iourc_content"] = f.read().replace("\r\n", "\n")
del self._settings["IOU"]["iourc_path"]
except OSError as e:
log.warning("Can't import IOU licence {}: {}".format(self._settings["IOU"]["iourc_path"], str(e)))
except UnicodeDecodeError as e:
log.warning("Non ascii characters in iourc file {}, please remove them: {}".format(self._settings["IOU"]["iourc_path"], str(e)))
def _readConfig(self, config_path):
"""
Read the configuration file.
"""
log.info("Load config from %s", config_path)
log.debug("Load config from %s", config_path)
try:
with open(config_path, "r", encoding="utf-8") as f:
self._last_config_changed = os.stat(config_path).st_mtime
@@ -247,7 +276,7 @@ class LocalConfig(QtCore.QObject):
return dict()
def _writeConfig(self):
def writeConfig(self):
"""
Write the configuration file.
"""
@@ -258,34 +287,16 @@ class LocalConfig(QtCore.QObject):
with open(temporary, "w", encoding="utf-8") as f:
json.dump(self._settings, f, sort_keys=True, indent=4)
shutil.move(temporary, self._config_file)
log.info("Configuration save to %s", self._config_file)
log.debug("Configuration save to %s", self._config_file)
self._last_config_changed = os.stat(self._config_file).st_mtime
except (ValueError, OSError) as e:
log.error("Could not write the config file {}: {}".format(self._config_file, e))
self._saveOnController()
def _saveOnController(self):
"""
Save some settings on controller for the transition from
GUI to a central controller. Will be removed later
"""
if Controller.instance().connected():
# We save only non user specific sections
section_to_save_on_controller = ["Builtin", "Docker", "IOU", "Qemu", "VMware", "VPCS", "VirtualBox", "GraphicsView"]
controller_settings = {}
for key, val in self._settings.items():
if key in section_to_save_on_controller:
controller_settings[key] = val
# We want only the VM settings on the server
elif key == "Server":
controller_settings["Server"]["vm"] = self._settings["Server"]["vm"]
Controller.instance().post("/settings", None, body=controller_settings)
def checkConfigChanged(self):
try:
if self._last_config_changed and self._last_config_changed < os.stat(self._config_file).st_mtime:
log.info("Client config has changed, reloading it...")
log.debug("Client config has changed, reloading it...")
self._readConfig(self._config_file)
self.config_changed_signal.emit()
except OSError as e:
@@ -328,7 +339,8 @@ class LocalConfig(QtCore.QObject):
if self._settings != settings:
self._settings.update(settings)
self._writeConfig()
self.writeConfig()
self.config_changed_signal.emit()
def loadSectionSettings(self, section, default_settings):
"""
@@ -362,9 +374,8 @@ class LocalConfig(QtCore.QObject):
self._settings[section] = settings
if changed:
log.info("Section %s has missing default values. Adding keys %s Saving configuration", section, ','.join(set(default_settings.keys()) - set(settings.keys())))
self._writeConfig()
log.debug("Section %s has missing default values. Adding keys %s Saving configuration", section, ','.join(set(default_settings.keys()) - set(settings.keys())))
self.writeConfig()
return copy.deepcopy(settings)
def saveSectionSettings(self, section, settings):
@@ -380,8 +391,8 @@ class LocalConfig(QtCore.QObject):
if self._settings[section] != settings:
self._settings[section].update(copy.deepcopy(settings))
log.info("Section %s has changed. Saving configuration", section)
self._writeConfig()
log.debug("Section %s has changed. Saving configuration", section)
self.writeConfig()
else:
log.debug("Section %s has not changed. Skip saving configuration", section)
@@ -407,6 +418,50 @@ class LocalConfig(QtCore.QObject):
settings["multi_profiles"] = value
self.saveSectionSettings("MainWindow", settings)
def directFileUpload(self):
"""
:returns: Boolean. True if direct_file_upload is enabled
"""
from gns3.settings import GENERAL_SETTINGS
return self.loadSectionSettings("MainWindow", GENERAL_SETTINGS)["direct_file_upload"]
def setDirectFileUpload(self, value):
from gns3.settings import GENERAL_SETTINGS
settings = self.loadSectionSettings("MainWindow", GENERAL_SETTINGS)
settings["direct_file_upload"] = value
self.saveSectionSettings("MainWindow", settings)
def showInterfaceLabelsOnNewProject(self):
"""
:returns: Boolean. True if show_interface_labels_on_new_project is enabled
"""
from gns3.settings import GRAPHICS_VIEW_SETTINGS
return self.loadSectionSettings("GraphicsView", GRAPHICS_VIEW_SETTINGS).get("show_interface_labels_on_new_project", False)
def setShowInterfaceLabelsOnNewProject(self, value):
from gns3.settings import GRAPHICS_VIEW_SETTINGS
settings = self.loadSectionSettings("GraphicsView", GRAPHICS_VIEW_SETTINGS)
settings["show_interface_labels_on_new_project"] = value
self.saveSectionSettings("GraphicsView", settings)
def showGridOnNewProject(self):
"""
:returns: Boolean. True if show_grid_on_new_project is enabled
"""
from gns3.settings import GRAPHICS_VIEW_SETTINGS
return self.loadSectionSettings("GraphicsView", GRAPHICS_VIEW_SETTINGS).get("show_grid_on_new_project", False)
def snapToGridOnNewProject(self):
"""
:returns: Boolean. True if snap_to_grid_on_new_project is enabled
"""
from gns3.settings import GRAPHICS_VIEW_SETTINGS
return self.loadSectionSettings("GraphicsView", GRAPHICS_VIEW_SETTINGS).get("snap_to_grid_on_new_project", False)
@staticmethod
def instance():
"""
@@ -430,12 +485,12 @@ class LocalConfig(QtCore.QObject):
if os.path.exists(pid_path):
try:
with open(pid_path) as f:
with open(pid_path, encoding="utf-8") as f:
pid = int(f.read())
if pid != my_pid:
try:
process = psutil.Process(pid=pid)
ps_name = process.name()
ps_name = process.name().lower()
except (OSError, psutil.NoSuchProcess, psutil.AccessDenied):
pass
else:
@@ -445,9 +500,17 @@ class LocalConfig(QtCore.QObject):
return False
else:
return True
except (OSError, ValueError) as e:
except OSError as e:
log.critical("Can't read pid file %s: %s", pid_path, str(e))
return False
except ValueError as e:
log.warning("Invalid data in pid file %s: %s", pid_path, str(e))
try:
# try removing the file since it contains invalid data
os.remove(pid_path)
except OSError:
log.critical("Can't remove pid file %s", pid_path)
return False
try:
with open(pid_path, 'w+') as f:

View File

@@ -30,13 +30,12 @@ import signal
import subprocess
from gns3.qt import QtWidgets, QtCore
from gns3.settings import LOCAL_SERVER_SETTINGS
from gns3.qt import QtWidgets, QtCore, qslot
from gns3.settings import LOCAL_SERVER_SETTINGS, DEFAULT_LOCAL_SERVER_HOST
from gns3.local_config import LocalConfig
from gns3.local_server_config import LocalServerConfig
from gns3.utils.wait_for_connection_worker import WaitForConnectionWorker
from gns3.utils.progress_dialog import ProgressDialog
from gns3.utils.http import getSynchronous
from gns3.utils.sudo import sudo
from gns3.http_client import HTTPClient
from gns3.controller import Controller
@@ -52,24 +51,27 @@ class StopLocalServerWorker(QtCore.QObject):
the server
"""
# signals to update the progress dialog.
error = QtCore.pyqtSignal(str, bool)
finished = QtCore.pyqtSignal()
updated = QtCore.pyqtSignal(int)
error = QtCore.Signal(str, bool)
finished = QtCore.Signal()
updated = QtCore.Signal(int)
def __init__(self, local_server_process):
super().__init__()
self._local_server_process = local_server_process
self._precision = 100 # In MS
self._remaining_trial = int(10 * (1000 / self._precision))
@qslot
def _callbackSlot(self, *params):
self._local_server_process.poll()
if self._local_server_process.returncode is None and self._remaining_trial > 0:
self._remaining_trial -= 1
QtCore.QTimer.singleShot(self._precision, self._callbackSlot)
else:
self.finished.emit()
def run(self):
precision = 1
remaining_trial = 4 / precision # 4 Seconds
while remaining_trial > 0:
if self._local_server_process.returncode is None:
remaining_trial -= 1
self.thread().sleep(precision)
else:
break
self.finished.emit()
QtCore.QTimer.singleShot(1000, self._callbackSlot)
def cancel(self):
return
@@ -81,22 +83,30 @@ class LocalServer(QtCore.QObject):
"""
def __init__(self, parent=None):
# Remember if the server was started by us or not
self._server_started_by_me = False
self._local_server_path = ""
self._local_server_process = None
super().__init__()
self._parent = parent
self._local_server_path = ""
self._local_server_process = None
self._config_directory = LocalConfig.instance().configDirectory()
self._settings = {}
self.localServerSettings()
self._port = self._settings.get("port", 3080)
if not self._settings.get("auto_start", True):
self._http_client = HTTPClient(self._settings)
Controller.instance().setHttpClient(self._http_client)
if self._settings.get("host") is None:
self._http_client = HTTPClient(self._settings)
Controller.instance().setHttpClient(self._http_client)
else:
self._http_client = None
self._stopping = False
self._timer = QtCore.QTimer()
self._timer.setInterval(5000)
self._timer.timeout.connect(self._checkLocalServerRunningSlot)
self._timer.start()
def _pid_path(self):
"""
:returns: Path of the PID file
@@ -113,18 +123,24 @@ class LocalServer(QtCore.QObject):
return self._parent
def _checkWindowsService(self, service_name):
import pywintypes
import win32service
import win32serviceutil
try:
import pywintypes
import win32service
import win32serviceutil
except ImportError as e:
log.error("Could not check if the {} service is running: {}".format(service_name, e))
return
try:
if win32serviceutil.QueryServiceStatus(service_name, None)[1] != win32service.SERVICE_RUNNING:
return False
except pywintypes.error as e:
if e.winerror == 1060:
if e.winerror == 1060: # service is not installed
return False
else:
log.error("Could not check if the {} service is running: {}".format(service_name, e.strerror))
return True
def _checkUbridgePermissions(self):
@@ -134,7 +150,7 @@ class LocalServer(QtCore.QObject):
path = os.path.abspath(self._settings["ubridge_path"])
if not path or len(path) == 0 or not os.path.exists(path):
if not path or len(path) == 0 or not os.path.exists(path) or not os.path.isfile(path):
return False
if sys.platform.startswith("win"):
@@ -149,24 +165,23 @@ class LocalServer(QtCore.QObject):
if sys.platform.startswith("linux"):
# test if the executable has the CAP_NET_RAW capability (Linux only)
try:
if "security.capability" in os.listxattr(path):
caps = os.getxattr(path, "security.capability")
# test the 2nd byte and check if the 13th bit (CAP_NET_RAW) is set
if not struct.unpack("<IIIII", caps)[1] & 1 << 13:
proceed = QtWidgets.QMessageBox.question(
self.parent(),
"uBridge",
"uBridge requires CAP_NET_RAW capability to interact with network interfaces. Set the capability to uBridge?",
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No)
if proceed == QtWidgets.QMessageBox.Yes:
sudo(["setcap", "cap_net_admin,cap_net_raw=ep"])
else:
# capabilities not supported
request_setuid = True
# test the 2nd byte and check if the 13th bit (CAP_NET_RAW) is set
if "security.capability" not in os.listxattr(path) or not struct.unpack("<IIIII", os.getxattr(path, "security.capability"))[1] & 1 << 13:
proceed = QtWidgets.QMessageBox.question(
self.parent(),
"uBridge",
"uBridge requires CAP_NET_RAW capability to interact with network interfaces. Set the capability to uBridge? All users on the system will be able to read packet from the network interfaces.",
QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.No)
if proceed == QtWidgets.QMessageBox.StandardButton.Yes:
sudo(["setcap", "cap_net_admin,cap_net_raw=ep", path])
except AttributeError:
# Due to a Python bug, os.listxattr could be missing: https://github.com/GNS3/gns3-gui/issues/2010
log.warning("Could not determine if CAP_NET_RAW capability is set for uBridge (Python bug)")
return True
except OSError as e:
QtWidgets.QMessageBox.critical(self.parent(), "uBridge", "Can't set CAP_NET_RAW capability to uBridge {}: {}".format(path, str(e)))
return False
request_setuid = True
if sys.platform.startswith("darwin") or request_setuid:
try:
@@ -174,12 +189,15 @@ class LocalServer(QtCore.QObject):
proceed = QtWidgets.QMessageBox.question(
self.parent(),
"uBridge",
"uBridge requires root permissions to interact with network interfaces. Set root permissions to uBridge?",
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No)
if proceed == QtWidgets.QMessageBox.Yes:
sudo(["chmod", "4755", path])
sudo(["chown", "root", path])
"uBridge requires root permissions to interact with network interfaces. Set root permissions to uBridge? All admin users on the system will be able to read packet from the network interfaces.",
QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.No)
if proceed == QtWidgets.QMessageBox.StandardButton.Yes:
from gns3.utils.macos_ubridge_setuid import macos_ubridge_setuid
if sys.platform.startswith("darwin") and hasattr(sys, "frozen"):
macos_ubridge_setuid()
else:
sudo(["chown", "root:admin", path], ["chmod", "4750", path])
except OSError as e:
QtWidgets.QMessageBox.critical(self.parent(), "uBridge", "Can't set root permissions to uBridge {}: {}".format(path, str(e)))
return False
@@ -232,6 +250,9 @@ class LocalServer(QtCore.QObject):
"""
Update the local server settings. Keep the key not in new_settings
"""
if "host" in new_settings and new_settings["host"] is None:
new_settings["host"] = DEFAULT_LOCAL_SERVER_HOST
old_settings = copy.copy(self._settings)
if not self._settings:
self._settings = new_settings
@@ -243,13 +264,25 @@ class LocalServer(QtCore.QObject):
# Settings have changed we need to restart the server
if old_settings != self._settings:
if self._settings["auto_start"]:
self.stopLocalServer(wait=True)
self.localServerAutoStartIfRequire()
# We restart the local server only if we really need. Auth can be hot change
settings_require_restart = ('host', 'port', 'path')
need_restart = False
for s in settings_require_restart:
if old_settings.get(s) != self._settings.get(s):
need_restart = True
if need_restart:
self.stopLocalServer(wait=True)
self.localServerAutoStartIfRequired()
# If the controller is remote:
else:
self.stopLocalServer(wait=True)
self._http_client = HTTPClient(self._settings)
if self._settings.get("host") is None:
self._http_client = None
else:
self._http_client = HTTPClient(self._settings)
Controller.instance().setHttpClient(self._http_client)
def shouldLocalServerAutoStart(self):
@@ -260,7 +293,7 @@ class LocalServer(QtCore.QObject):
:returns: boolean
"""
return self._settings["auto_start"]
return self._settings["auto_start"] and self._settings["host"] is not None
def localServerPath(self):
"""
@@ -287,14 +320,19 @@ class LocalServer(QtCore.QObject):
# Permission issue, or process no longer exists, or file is empty
return
def localServerAutoStartIfRequire(self):
def localServerAutoStartIfRequired(self):
"""
Try to start the embed gns3 server.
Try to start the embedded gns3 server.
"""
if not self.shouldLocalServerAutoStart():
self._http_client = HTTPClient(self._settings)
Controller.instance().setHttpClient(self._http_client)
return
if self.isLocalServerRunning() and self._server_started_by_me:
return True
# We check if two gui are not launched at the same time
# to avoid killing the server of the other GUI
if not LocalConfig.isMainGui():
@@ -304,7 +342,7 @@ class LocalServer(QtCore.QObject):
return True
if self.isLocalServerRunning():
log.info("A local server already running on this host")
log.debug("A local server already running on this host")
# Try to kill the server. The server can be still running after
# if the server was started by hand
self._killAlreadyRunningServer()
@@ -324,12 +362,11 @@ class LocalServer(QtCore.QObject):
"Connecting to server {} on port {}...".format(self._settings["host"], self._port),
"Cancel", busy=True, parent=self.parent())
progress_dialog.show()
if not progress_dialog.exec_():
if not progress_dialog.exec():
return False
self._server_started_by_me = True
self._http_client = HTTPClient(self._settings)
Controller.instance().setHttpClient(self._http_client)
return True
def initLocalServer(self):
@@ -339,24 +376,26 @@ class LocalServer(QtCore.QObject):
self._checkUbridgePermissions()
if sys.platform.startswith('win'):
if not self._checkWindowsService("npf") and not self._checkWindowsService("npcap"):
QtWidgets.QMessageBox.critical(self.parent(), "Error", "The NPF or NPCAP service is not installed, please install Winpcap or Npcap and reboot.")
return
if sys.platform.startswith("win"):
import pywintypes
try:
if not self._checkWindowsService("npf") and not self._checkWindowsService("npcap"):
log.warning("The NPF or NPCAP service is not installed, please install Winpcap or Npcap and reboot.")
except pywintypes.error as e:
log.warning("Could not check if the NPF or Npcap service is running: {}".format(e.strerror))
self._port = self._settings["port"]
# check the local server path
local_server_path = self.localServerPath()
if not local_server_path:
log.warn("No local server is configured")
return
log.warning("No local server is configured")
return False
if not os.path.isfile(local_server_path):
QtWidgets.QMessageBox.critical(self.parent(), "Local server", "Could not find local server {}".format(local_server_path))
return
return False
elif not os.access(local_server_path, os.X_OK):
QtWidgets.QMessageBox.critical(self.parent(), "Local server", "{} is not an executable".format(local_server_path))
return
return False
try:
# check if the local address still exists
@@ -411,6 +450,7 @@ class LocalServer(QtCore.QObject):
Starts the local server process.
"""
self._stopping = False
path = self.localServerPath()
command = '"{executable}" --local'.format(executable=path)
@@ -435,25 +475,39 @@ class LocalServer(QtCore.QObject):
except FileNotFoundError:
pass
except OSError as e:
log.warn("could not delete server log file {}: {}".format(logpath, e))
log.warning("could not delete server log file {}: {}".format(logpath, e))
command += ' --log="{}" --pid="{}"'.format(logpath, self._pid_path())
log.info("Starting local server process with {}".format(command))
log.debug("Starting local server process with {}".format(command))
try:
if sys.platform.startswith("win"):
# use the string on Windows
self._local_server_process = subprocess.Popen(command, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
self._local_server_process = subprocess.Popen(
command,
creationflags=subprocess.CREATE_NEW_PROCESS_GROUP,
stderr=subprocess.PIPE,
env=os.environ)
else:
# use arguments on other platforms
args = shlex.split(command)
self._local_server_process = subprocess.Popen(args)
self._local_server_process = subprocess.Popen(args, stderr=subprocess.PIPE, env=os.environ)
except (OSError, subprocess.SubprocessError) as e:
log.warning('Could not start local server "{}": {}'.format(command, e))
return False
log.info("Local server process has started (PID={})".format(self._local_server_process.pid))
log.debug("Local server process has started (PID={})".format(self._local_server_process.pid))
return True
def _checkLocalServerRunningSlot(self):
if self._local_server_process and not self._stopping:
if not self.localServerProcessIsRunning():
log.error("Local server process has stopped")
try:
log.error(self._local_server_process.stderr.read().decode())
except (OSError, UnicodeDecodeError):
pass
self._local_server_process = None
def localServerProcessIsRunning(self):
"""
Returns either the local server is running.
@@ -475,10 +529,12 @@ class LocalServer(QtCore.QObject):
:returns: boolean
"""
status, json_data = getSynchronous(self._settings["host"], self._port, "version",
timeout=2, user=self._settings["user"], password=self._settings["password"])
if json_data is None or status != 200:
status, json_data = HTTPClient(self._settings).getSynchronous("GET", "/version")
if status == 401: # Auth issue that need to be solved later
return True
elif json_data is None:
return False
elif status != 200:
return False
else:
version = json_data.get("version", None)
@@ -495,7 +551,8 @@ class LocalServer(QtCore.QObject):
"""
if self.localServerProcessIsRunning():
log.info("Stopping local server (PID={})".format(self._local_server_process.pid))
self._stopping = True
log.debug("Stopping local server (PID={})".format(self._local_server_process.pid))
# local server is running, let's stop it
if self._http_client:
self._http_client.shutdown()
@@ -503,9 +560,10 @@ class LocalServer(QtCore.QObject):
worker = StopLocalServerWorker(self._local_server_process)
progress_dialog = ProgressDialog(worker, "Local server", "Waiting for the local server to stop...", None, busy=True, parent=self.parent())
progress_dialog.show()
progress_dialog.exec_()
progress_dialog.exec()
if self._local_server_process.returncode is None:
self._killLocalServer()
self._server_started_by_me = False
def _killLocalServer(self):
# the local server couldn't be stopped with the normal procedure
@@ -516,19 +574,19 @@ class LocalServer(QtCore.QObject):
self._local_server_process.send_signal(signal.SIGINT)
# If the process is already dead we received a permission error
# it's a race condition between the timeout and send signal
except PermissionError:
except (PermissionError, SystemError):
pass
try:
# wait for the server to stop for maximum 2 seconds
self._local_server_process.wait(timeout=2)
# wait for the server to stop for maximum x seconds
self._local_server_process.wait(timeout=60)
except subprocess.TimeoutExpired:
proceed = QtWidgets.QMessageBox.question(self.parent(),
"Local server",
"The Local server cannot be stopped, would you like to kill it?",
QtWidgets.QMessageBox.Yes,
QtWidgets.QMessageBox.No)
QtWidgets.QMessageBox.StandardButton.Yes,
QtWidgets.QMessageBox.StandardButton.No)
if proceed == QtWidgets.QMessageBox.Yes:
if proceed == QtWidgets.QMessageBox.StandardButton.Yes:
self._local_server_process.kill()
@staticmethod
@@ -553,5 +611,6 @@ def main():
local_server.localServerAutoStart()
local_server.stopLocalServer()
if __name__ == '__main__':
main()

View File

@@ -30,21 +30,25 @@ class LocalServerConfig:
Local server configuration.
"""
def __init__(self):
def __init__(self, config_file=None):
appname = "GNS3"
self._config = configparser.RawConfigParser()
if sys.platform.startswith("win"):
filename = "gns3_server.ini"
else:
filename = "gns3_server.conf"
from .local_config import LocalConfig
if sys.platform.startswith("win"):
self._config_file = os.path.join(LocalConfig.instance().configDirectory(), filename)
if config_file:
self._config_file = config_file
else:
self._config_file = os.path.join(LocalConfig.instance().configDirectory(), filename)
if sys.platform.startswith("win"):
filename = "gns3_server.ini"
else:
filename = "gns3_server.conf"
from .local_config import LocalConfig
if sys.platform.startswith("win"):
self._config_file = os.path.join(LocalConfig.instance().configDirectory(), filename)
else:
self._config_file = os.path.join(LocalConfig.instance().configDirectory(), filename)
try:
# create the config file if it doesn't exist
@@ -106,6 +110,8 @@ class LocalServerConfig:
settings[name] = self._config[section].getfloat(name, default)
else:
settings[name] = self._config[section].get(name, default)
if settings[name] == "None":
settings[name] = None
# sync with the config file
self.saveSettings(section, settings)
@@ -132,6 +138,18 @@ class LocalServerConfig:
if changed:
self.writeConfig()
def deleteSetting(self, section, name):
"""
Delete a specific setting in a given section.
:param section: section name
:param name: setting name to delete
"""
if section in self._config and name in self._config[section]:
del self._config[section][name]
self.writeConfig()
@staticmethod
def instance():
"""

View File

@@ -85,14 +85,33 @@ class ColouredStreamHandler(logging.StreamHandler):
def init_logger(level, logfile, quiet=False):
if sys.platform.startswith("win"):
stream_handler = logging.StreamHandler(sys.stdout)
stream_handler.formatter = ColouredFormatter("{asctime} {levelname} {filename}:{lineno} {message}", "%Y-%m-%d %H:%M:%S", "{")
stream_handler.formatter = ColouredFormatter("{asctime} {levelname} {name}:{lineno} {message}", "%Y-%m-%d %H:%M:%S", "{")
else:
stream_handler = ColouredStreamHandler(sys.stdout)
stream_handler.formatter = ColouredFormatter("{asctime} {levelname} {filename}:{lineno}#RESET# {message}", "%Y-%m-%d %H:%M:%S", "{")
stream_handler.formatter = ColouredFormatter("{asctime} {levelname} {name}:{lineno}#RESET# {message}", "%Y-%m-%d %H:%M:%S", "{")
logging.basicConfig(level=level, handlers=[stream_handler])
log = logging.getLogger()
log.addHandler(stream_handler)
log_factory = logging.getLogRecordFactory()
def factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, **kwargs):
"""
Reformat the log message to get something more clean
"""
# When qt message box is display the correct line number is a part of
# the name
if ":" in name:
name, lno = name.split(":")
lno = int(lno)
name = name.replace("gns3.", "")
try:
return log_factory(name, level, fn, lno, msg, args, exc_info, func=func, sinfo=sinfo, **kwargs)
except Exception as e: # To avoid recursion we just print the message if something is wrong when logging
print(msg)
return
logging.setLogRecordFactory(factory)
try:
try:
os.makedirs(os.path.dirname(logfile))
@@ -102,7 +121,7 @@ def init_logger(level, logfile, quiet=False):
handler.formatter = logging.Formatter("{asctime} {levelname} {filename}:{lineno} {message}", "%Y-%m-%d %H:%M:%S", "{")
log.addHandler(handler)
except OSError as e:
log.warn("could not log to {}: {}".format(logfile, e))
log.warning("could not log to {}: {}".format(logfile, e))
log.info('Log level: {}'.format(logging.getLevelName(level)))

View File

@@ -18,6 +18,7 @@
import sys
import os
import faulthandler
# Try to install updates & restart application if an update is installed
try:
@@ -29,26 +30,15 @@ try:
except Exception as e:
print("Fail update installation: {}".format(str(e)))
# WARNING
# Due to buggy user machines we choose to put this as the first loading modules
# otherwise the egg cache is initialized in his standard location and
# if is not writetable the application crash. It's the user fault
# because one day the user as used sudo to run an egg and break his
# filesystem permissions, but it's a common mistake.
from gns3.utils.get_resource import get_resource
import datetime
import traceback
import time
import locale
import argparse
import signal
import psutil
try:
from gns3.qt import QtCore, QtGui, QtWidgets
from gns3.qt import QtCore, QtWidgets
except ImportError:
raise SystemExit("Can't import Qt modules: Qt and/or PyQt is probably not installed correctly...")
from gns3.main_window import MainWindow
@@ -59,13 +49,12 @@ from gns3.local_config import LocalConfig
from gns3.application import Application
from gns3.utils import parse_version
from gns3.dialogs.profile_select import ProfileSelectDialog
from gns3.version import __version__
import logging
log = logging.getLogger(__name__)
from gns3.version import __version__
def locale_check():
"""
@@ -90,13 +79,13 @@ def locale_check():
log.error("could not determine the current locale: {}".format(e))
if not language and not encoding:
try:
log.warn("could not find a default locale, switching to C.UTF-8...")
log.warning("could not find a default locale, switching to C.UTF-8...")
locale.setlocale(locale.LC_ALL, ("C", "UTF-8"))
except locale.Error as e:
log.error("could not switch to the C.UTF-8 locale: {}".format(e))
raise SystemExit
elif encoding != "UTF-8":
log.warn("your locale {}.{} encoding is not UTF-8, switching to the UTF-8 version...".format(language, encoding))
log.warning("your locale {}.{} encoding is not UTF-8, switching to the UTF-8 version...".format(language, encoding))
try:
locale.setlocale(locale.LC_ALL, (language, "UTF-8"))
except locale.Error as e:
@@ -111,42 +100,58 @@ def main():
Entry point for GNS3 GUI.
"""
# Get Python tracebacks explicitly, on a fault like segfault
faulthandler.enable()
# Sometimes (for example at first launch) the OSX app service launcher add
# an extra argument starting with -psn_. We filter it
if sys.platform.startswith("darwin"):
sys.argv = [a for a in sys.argv if not a.startswith("-psn_")]
if parse_version(QtCore.QT_VERSION_STR) < parse_version("5.15.2"):
# Fixes issue on macOS Big Sur: https://github.com/GNS3/gns3-gui/issues/3037
os.environ["QT_MAC_WANTS_LAYER"] = "1"
parser = argparse.ArgumentParser()
parser.add_argument("project", help="load a GNS3 project (.gns3)", metavar="path", nargs="?")
parser.add_argument("--version", help="show the version", action="version", version=__version__)
parser.add_argument("--debug", help="print out debug messages", action="store_true", default=False)
parser.add_argument("-q", "--quiet", action="store_true", help="do not show logs on stdout")
parser.add_argument("--config", help="Configuration file")
parser.add_argument("--profile", help="Settings profile (blank will use default settings files)")
options = parser.parse_args()
exception_file_path = "exceptions.log"
if options.project:
options.project = os.path.abspath(options.project)
try:
import truststore
truststore.inject_into_ssl()
log.info("Using system certificate store for SSL connections")
except ImportError:
pass
if hasattr(sys, "frozen"):
# We add to the path where the OS search executable our binary location starting by GNS3
# packaged binary
frozen_dir = os.path.dirname(os.path.abspath(sys.executable))
if sys.platform.startswith("darwin"):
frozen_dirs = [
frozen_dir,
os.path.normpath(os.path.join(frozen_dir, '..', 'Resources'))
]
frozen_dirs = [frozen_dir]
elif sys.platform.startswith("win"):
frozen_dirs = [
frozen_dir,
os.path.normpath(os.path.join(frozen_dir, 'dynamips')),
os.path.normpath(os.path.join(frozen_dir, 'vpcs'))
os.path.normpath(os.path.join(frozen_dir, 'ubridge')),
os.path.normpath(os.path.join(frozen_dir, 'vpcs')),
os.path.normpath(os.path.join(frozen_dir, 'traceng'))
]
os.environ["PATH"] = os.pathsep.join(frozen_dirs) + os.pathsep + os.environ.get("PATH", "")
if options.project:
options.project = os.path.abspath(options.project)
os.chdir(frozen_dir)
def exceptionHook(exception, value, tb):
if exception == KeyboardInterrupt:
@@ -178,19 +183,12 @@ def main():
# catch exceptions to write them in a file
sys.excepthook = exceptionHook
current_year = datetime.date.today().year
print("GNS3 GUI version {}".format(__version__))
print("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
# we only support Python 3 version >= 3.9
if sys.version_info < (3, 9):
raise SystemExit("Python 3.9 or higher is required")
# we only support Python 3 version >= 3.4
if sys.version_info < (3, 4):
raise SystemExit("Python 3.4 or higher is required")
if parse_version(QtCore.QT_VERSION_STR) < parse_version("5.0.0"):
raise SystemExit("Requirement is PyQt5 version 5.0.0 or higher, got version {}".format(QtCore.QT_VERSION_STR))
if parse_version(psutil.__version__) < parse_version("2.2.1"):
raise SystemExit("Requirement is psutil version 2.2.1 or higher, got version {}".format(psutil.__version__))
if parse_version(QtCore.QT_VERSION_STR) < parse_version("6.3.1"):
raise SystemExit("Requirement is PyQt6 version 6.3.1 or higher, got version {}".format(QtCore.QT_VERSION_STR))
# check for the correct locale
# (UNIX/Linux only)
@@ -204,7 +202,7 @@ def main():
# always use the INI format on Windows and OSX (because we don't like the registry and plist files)
if sys.platform.startswith('win') or sys.platform.startswith('darwin'):
QtCore.QSettings.setDefaultFormat(QtCore.QSettings.IniFormat)
QtCore.QSettings.setDefaultFormat(QtCore.QSettings.Format.IniFormat)
if sys.platform.startswith('win') and hasattr(sys, "frozen"):
try:
@@ -217,36 +215,53 @@ def main():
if not options.debug:
try:
# hide the console
# win32console.AllocConsole()
console_window = win32console.GetConsoleWindow()
win32gui.ShowWindow(console_window, win32con.SW_HIDE)
parent_window = win32gui.GetParent(console_window)
if not parent_window and console_window:
win32gui.ShowWindow(console_window, win32con.SW_HIDE)
elif parent_window:
win32gui.ShowWindow(parent_window, win32con.SW_HIDE)
else:
log.warning("Could not get the console window")
except win32console.error as e:
print("warning: could not allocate console: {}".format(e))
log.warning("Could not allocate console: {}".format(e))
local_config = LocalConfig.instance()
global app
app = Application(sys.argv)
local_config = LocalConfig.instance()
if local_config.multiProfiles():
if local_config.multiProfiles() and not options.profile:
profile_select = ProfileSelectDialog()
profile_select.show()
profile_select.exec_()
options.profile = profile_select.profile()
if profile_select.exec():
options.profile = profile_select.profile()
else:
sys.exit(0)
# Init the config
if options.config:
local_config.setConfigFilePath(options.config)
elif options.profile:
local_config.setProfile(options.profile)
profile = options.profile
# save client logging info to a file
logfile = os.path.join(LocalConfig.instance().configDirectory(), "gns3_gui.log")
# on debug enable logging to stdout
if options.debug:
root_logger = init_logger(logging.DEBUG, logfile)
init_logger(logging.DEBUG, logfile)
elif options.quiet:
init_logger(logging.ERROR, logfile)
else:
root_logger = init_logger(logging.INFO, logfile)
init_logger(logging.INFO, logfile)
current_year = datetime.date.today().year
log.info("GNS3 GUI version {}".format(__version__))
log.info("Copyright (c) 2007-{} GNS3 Technologies Inc.".format(current_year))
log.info("Application started with {}".format(" ".join(sys.argv)))
log.debug("PATH={}".format(os.environ["PATH"]))
# update the exception file path to have it in the same directory as the settings file.
exception_file_path = os.path.join(LocalConfig.instance().configDirectory(), exception_file_path)
@@ -255,7 +270,10 @@ def main():
# issue when people run GNS3 from the .dmg
if sys.platform.startswith("darwin") and hasattr(sys, "frozen"):
if not os.path.realpath(sys.executable).startswith("/Applications"):
QtWidgets.QMessageBox.critical(None, "Error", "You need to copy GNS3 in your /Applications folder before using it.")
error_message = "GNS3.app must be moved to the '/Applications' folder before it can be used"
QtWidgets.QMessageBox.critical(False, "Loading error", error_message)
QtCore.QTimer.singleShot(0, app.quit)
app.exec()
sys.exit(1)
global mainwindow
@@ -278,8 +296,7 @@ def main():
mainwindow.show()
exit_code = app.exec_()
exit_code = app.exec()
signal.signal(signal.SIGINT, orig_sigint)
signal.signal(signal.SIGTERM, orig_sigterm)
@@ -288,7 +305,7 @@ def main():
# We force deleting the app object otherwise it's segfault on Fedora
del app
# We force a full garbage collect before exit
# for unknow reason otherwise Qt Segfault on OSX in some
# for unknown reason otherwise Qt Segfault on OSX in some
# conditions
import gc
gc.collect()

File diff suppressed because it is too large Load Diff

View File

@@ -19,9 +19,12 @@ from gns3.modules.builtin import Builtin
from gns3.modules.dynamips import Dynamips
from gns3.modules.iou import IOU
from gns3.modules.vpcs import VPCS
from gns3.modules.traceng import TraceNG
from gns3.modules.virtualbox import VirtualBox
from gns3.modules.qemu import Qemu
from gns3.modules.vmware import VMware
from gns3.modules.docker import Docker
#MODULES = [Builtin, VPCS, Dynamips, IOU, Qemu, VirtualBox, VMware, Docker, TraceNG]
#FIXME: deactivate TraceNG module
MODULES = [Builtin, VPCS, Dynamips, IOU, Qemu, VirtualBox, VMware, Docker]

View File

@@ -21,6 +21,7 @@ Built-in module implementation.
from gns3.qt import QtWidgets
from gns3.local_config import LocalConfig
from gns3.local_server_config import LocalServerConfig
from ..module import Module
from .cloud import Cloud
@@ -29,14 +30,7 @@ from .ethernet_hub import EthernetHub
from .ethernet_switch import EthernetSwitch
from .frame_relay_switch import FrameRelaySwitch
from .atm_switch import ATMSwitch
from .settings import (
BUILTIN_SETTINGS,
CLOUD_SETTINGS,
NAT_SETTINGS,
ETHERNET_HUB_SETTINGS,
ETHERNET_SWITCH_SETTINGS
)
from .settings import BUILTIN_SETTINGS
import logging
log = logging.getLogger(__name__)
@@ -50,39 +44,8 @@ class Builtin(Module):
def __init__(self):
super().__init__()
self._settings = {}
self._nodes = []
self._cloud_nodes = {}
self._nat_nodes = {}
self._ethernet_hubs = {}
self._ethernet_switches = {}
# load the settings
self._loadSettings()
def configChangedSlot(self):
pass
def settings(self):
"""
Returns the module settings
:returns: module settings (dictionary)
"""
return self._settings
def setSettings(self, settings):
"""Sets the module settings
:param settings: module settings (dictionary)
"""
self._settings.update(settings)
self._saveSettings()
def _saveSettings(self):
"""
Saves the settings to the persistent settings file.
@@ -90,6 +53,15 @@ class Builtin(Module):
LocalConfig.instance().saveSectionSettings(self.__class__.__name__, self._settings)
server_settings = {}
config = LocalServerConfig.instance()
if self._settings["default_nat_interface"]:
# save some settings to the local server config file
server_settings["default_nat_interface"] = self._settings["default_nat_interface"]
config.saveSettings(self.__class__.__name__, server_settings)
else:
config.deleteSetting(self.__class__.__name__, "default_nat_interface")
def _loadSettings(self):
"""
Loads the settings from the persistent settings file.
@@ -97,215 +69,48 @@ class Builtin(Module):
local_config = LocalConfig.instance()
self._settings = local_config.loadSectionSettings(self.__class__.__name__, BUILTIN_SETTINGS)
self._loadNodes()
def _loadBuilinNodesPerType(self, node_dict, node_type, default_settings):
settings = LocalConfig.instance().settings()
if node_type in settings.get(self.__class__.__name__, {}):
for device in settings[self.__class__.__name__][node_type]:
name = device.get("name")
server = device.get("server")
key = "{server}:{name}".format(server=server, name=name)
if key in node_dict or not name or not server:
continue
node_settings = default_settings.copy()
node_settings.update(device)
node_dict[key] = node_settings
def _loadNodes(self):
"""
Load the built-in nodes from the persistent settings file.
"""
self._loadBuilinNodesPerType(self._cloud_nodes, "cloud_nodes", CLOUD_SETTINGS)
self._loadBuilinNodesPerType(self._ethernet_hubs, "ethernet_hubs", ETHERNET_HUB_SETTINGS)
self._loadBuilinNodesPerType(self._ethernet_switches, "ethernet_switches", ETHERNET_SWITCH_SETTINGS)
def _saveNodes(self):
"""
Saves the built-in nodes to the persistent settings file.
"""
self._settings["cloud_nodes"] = list(self._cloud_nodes.values())
self._settings["ethernet_hubs"] = list(self._ethernet_hubs.values())
self._settings["ethernet_switches"] = list(self._ethernet_switches.values())
self._saveSettings()
def cloudNodes(self):
"""
Returns cloud nodes settings.
:returns: Cloud nodes settings (dictionary)
"""
return self._cloud_nodes
def setCloudNodes(self, new_cloud_nodes):
"""
Sets cloud nodes settings.
:param new_cloud_nodes: cloud nodes settings (dictionary)
"""
self._cloud_nodes = new_cloud_nodes.copy()
self._saveNodes()
def ethernetHubs(self):
"""
Returns Ethernet hubs settings.
:returns: Ethernet hubs settings (dictionary)
"""
return self._ethernet_hubs
def setEthernetHubs(self, new_ethernet_hubs):
"""
Sets Ethernet hubs settings.
:param new_ethernet_hubs: Ethernet hubs settings (dictionary)
"""
self._ethernet_hubs = new_ethernet_hubs.copy()
self._saveNodes()
def ethernetSwitches(self):
"""
Returns Ethernet switches settings.
:returns: Ethernet switches settings (dictionary)
"""
return self._ethernet_switches
def setEthernetSwitches(self, new_ethernet_switches):
"""
Sets Ethernet switches settings.
:param new_ethernet_switches: Ethernet switches settings (dictionary)
"""
self._ethernet_switches = new_ethernet_switches.copy()
self._saveNodes()
def addNode(self, node):
"""
Adds a node to this module.
:param node: Node instance
"""
self._nodes.append(node)
def removeNode(self, node):
"""
Removes a node from this module.
:param node: Node instance
"""
if node in self._nodes:
self._nodes.remove(node)
def reset(self):
"""
Resets the module.
"""
self._nodes.clear()
def instantiateNode(self, node_class, server, project):
"""
Instantiate a new node.
:param node_class: Node object
:param server: HTTPClient instance
:param project: Project instance
"""
log.info("instantiating node {}".format(node_class))
# create an instance of the node class
return node_class(self, server, project)
def createNode(self, node, node_name):
"""
Creates a node.
:param node: Node instance
:param node_name: Node name
"""
log.info("creating node {}".format(node))
if isinstance(node, Cloud):
for key, info in self._cloud_nodes.items():
if node_name == info["name"]:
node.create(ports=info["ports_mapping"], default_name_format=info["default_name_format"])
return
elif isinstance(node, Nat):
for key, info in self._nat_nodes.items():
if node_name == info["name"]:
node.create(default_name_format=info["default_name_format"])
return
elif isinstance(node, EthernetHub):
for key, info in self._ethernet_hubs.items():
if node_name == info["name"]:
node.create(ports=info["ports_mapping"], default_name_format=info["default_name_format"])
return
elif isinstance(node, EthernetSwitch):
for key, info in self._ethernet_switches.items():
if node_name == info["name"]:
node.create(ports=info["ports_mapping"], default_name_format=info["default_name_format"])
return
node.create()
@staticmethod
def findAlternativeInterface(node, missing_interface):
from gns3.main_window import MainWindow
mainwindow = MainWindow.instance()
available_interfaces = []
for interface in node.settings()["interfaces"]:
available_interfaces.append(interface["name"])
if available_interfaces:
selection, ok = QtWidgets.QInputDialog.getItem(mainwindow,
"Cloud interfaces", "Interface {} could not be found\nPlease select an alternative from your existing interfaces:".format(missing_interface),
available_interfaces, 0, False)
if ok:
return selection
QtWidgets.QMessageBox.warning(mainwindow, "Cloud interface", "No alternative interface chosen to replace {} on this host, this may lead to issues".format(missing_interface))
return None
else:
QtWidgets.QMessageBox.critical(mainwindow, "Cloud interface", "Could not find interface {} on this host".format(missing_interface))
return missing_interface
@staticmethod
def getNodeClass(name):
def configurationPage(node_type):
"""
Returns the object with the corresponding name.
Returns the configuration page for this module.
:param name: object name
:returns: QWidget object
"""
if name in globals():
return globals()[name]
from .pages.ethernet_hub_configuration_page import EthernetHubConfigurationPage
from .pages.ethernet_switch_configuration_page import EthernetSwitchConfigurationPage
from .pages.cloud_configuration_page import CloudConfigurationPage
if node_type == "ethernet_hub":
return EthernetHubConfigurationPage
elif node_type == "ethernet_switch":
return EthernetSwitchConfigurationPage
elif node_type == "cloud":
return CloudConfigurationPage
return None
@staticmethod
def getNodeType(name, platform=None):
if name == "cloud":
def getNodeClass(node_type, platform=None):
"""
Returns the class corresponding to node type.
:param node_type: node type (string)
:param platform: not used
:returns: class or None
"""
if node_type == "cloud":
return Cloud
elif name == "nat":
elif node_type == "nat":
return Nat
elif name == "ethernet_hub":
elif node_type == "ethernet_hub":
return EthernetHub
elif name == "ethernet_switch":
elif node_type == "ethernet_switch":
return EthernetSwitch
elif name == "frame_relay_switch":
elif node_type == "frame_relay_switch":
return FrameRelaySwitch
elif name == "atm_switch":
elif node_type == "atm_switch":
return ATMSwitch
return None
@@ -319,59 +124,6 @@ class Builtin(Module):
return [Nat, Cloud, EthernetHub, EthernetSwitch, FrameRelaySwitch, ATMSwitch]
def nodes(self):
"""
Returns all the node data necessary to represent a node
in the nodes view and create a node on the scene.
"""
nodes = []
for node_class in Builtin.classes():
nodes.append(
{"class": node_class.__name__,
"name": node_class.symbolName(),
"categories": node_class.categories(),
"symbol": node_class.defaultSymbol(),
"builtin": True,
"node_type": node_class.URL_PREFIX
}
)
# add custom cloud node templates
for cloud_node in self._cloud_nodes.values():
nodes.append(
{"class": Cloud.__name__,
"name": cloud_node["name"],
"server": cloud_node["server"],
"symbol": cloud_node["symbol"],
"categories": [cloud_node["category"]]
}
)
# add custom Ethernet hub templates
for hub in self._ethernet_hubs.values():
nodes.append(
{"class": EthernetHub.__name__,
"name": hub["name"],
"server": hub["server"],
"symbol": hub["symbol"],
"categories": [hub["category"]]
}
)
# add custom Ethernet switch templates
for switch in self._ethernet_switches.values():
nodes.append(
{"class": EthernetSwitch.__name__,
"name": switch["name"],
"server": switch["server"],
"symbol": switch["symbol"],
"categories": [switch["category"]]
}
)
return nodes
@staticmethod
def preferencePages():
"""
@@ -396,3 +148,10 @@ class Builtin(Module):
if not hasattr(Builtin, "_instance"):
Builtin._instance = Builtin()
return Builtin._instance
def __str__(self):
"""
Returns the module name.
"""
return "builtin"

View File

@@ -17,7 +17,6 @@
import re
import uuid
from gns3.node import Node
@@ -34,6 +33,7 @@ class ATMSwitch(Node):
:param server: GNS3 server instance
:param project: Project instance
"""
URL_PREFIX = "atm_switch"
def __init__(self, module, server, project):
@@ -44,50 +44,6 @@ class ATMSwitch(Node):
self._always_on = True
self.settings().update({"mappings": {}})
def create(self, name=None, node_id=None, mappings=None, default_name_format="ATM{0}"):
"""
Creates this ATM switch.
:param name: optional name for this switch.
:param node_id: Node identifier on the server
:param mappings: mappings to be automatically added when creating this ATM switch
"""
params = {}
if mappings:
params["mappings"] = mappings
self._create(name, node_id, params, default_name_format)
def _createCallback(self, result):
"""
Callback for create.
:param result: server response (dict)
"""
self.settings()["mappings"] = result["mappings"]
def update(self, new_settings):
"""
Updates the settings for this ATM switch.
:param new_settings: settings dictionary
"""
params = {}
for name, value in new_settings.items():
if name in self._settings and self._settings[name] != value:
params[name] = value
if params:
self._update(params)
def _updateCallback(self, result):
"""
Callback for update.
:param result: server response
"""
self.settings()["mappings"] = result["mappings"]
def info(self):
"""
Returns information about this ATM switch.
@@ -96,14 +52,14 @@ class ATMSwitch(Node):
"""
info = """ATM switch {name} is always-on
Local node ID is {id}
Server's Node ID is {node_id}
Running on server {host} with port {port}
Local ID is {id} and server ID is {node_id}
Hardware is Dynamips emulated simple ATM switch
Switch's server runs on {host}
""".format(name=self.name(),
id=self.id(),
node_id=self._node_id,
host=self._compute.name())
host=self._compute.name(),
port=self._compute.port())
port_info = ""
mapping = re.compile(r"""^([0-9]*):([0-9]*):([0-9]*)$""")
@@ -154,41 +110,6 @@ class ATMSwitch(Node):
return info + port_info
def dump(self):
"""
Returns a representation of this ATM switch
(to be saved in a topology file).
:returns: dictionary
"""
atmsw = super().dump()
if self._settings["mappings"]:
atmsw["properties"]["mappings"] = self._settings["mappings"]
return atmsw
def load(self, node_info):
"""
Loads an ATM switch representation
(from a topology file).
:param node_info: representation of the node (dictionary)
"""
super().load(node_info)
properties = node_info["properties"]
name = properties.pop("name")
# ATM switches do not have an UUID before version 2.0
node_id = properties.get("node_id", str(uuid.uuid4()))
mappings = {}
if "mappings" in properties:
mappings = properties["mappings"]
log.info("ATM switch {} is loading".format(name))
self.create(name, node_id, mappings)
def configPage(self):
"""
Returns the configuration page widget to be used by the node properties dialog.
@@ -209,11 +130,6 @@ class ATMSwitch(Node):
return ":/symbols/atm_switch.svg"
@staticmethod
def symbolName():
return "ATM switch"
@staticmethod
def categories():
"""

View File

@@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from gns3.node import Node
from .settings import CLOUD_SETTINGS
import logging
log = logging.getLogger(__name__)
@@ -36,56 +37,32 @@ class Cloud(Node):
def __init__(self, module, server, project):
super().__init__(module, server, project)
# this is an always-on node
self.setStatus(Node.started)
self._always_on = True
self._interfaces = {}
self._cloud_settings = {"ports_mapping": []}
self._cloud_settings = {"ports_mapping": [],
"remote_console_host": CLOUD_SETTINGS["remote_console_host"],
"remote_console_port": CLOUD_SETTINGS["remote_console_port"],
"remote_console_type": CLOUD_SETTINGS["remote_console_type"],
"remote_console_http_path": CLOUD_SETTINGS["remote_console_http_path"]
}
self.settings().update(self._cloud_settings)
def interfaces(self):
return self._interfaces
def create(self, name=None, node_id=None, ports=None, default_name_format="Cloud{0}"):
"""
Creates this cloud.
:param name: optional name for this cloud
:param node_id: Node identifier on the server
:param ports: ports to be automatically added when creating this cloud
"""
params = {}
if ports:
params["ports_mapping"] = ports
self._create(name, node_id, params, default_name_format)
def _createCallback(self, result, error=False, **kwargs):
def _createCallback(self, result):
"""
Callback for create.
:param result: server response
"""
if "ports_mapping" in result:
self._settings["ports_mapping"] = result["ports_mapping"].copy()
if "interfaces" in result:
self._interfaces = result["interfaces"].copy()
def update(self, new_settings):
"""
Updates the settings for this cloud.
:param new_settings: settings dictionary
"""
params = {}
for name, value in new_settings.items():
if name in self._settings and self._settings[name] != value:
params[name] = value
if params:
self._update(params)
def _updateCallback(self, result):
"""
Callback for update.
@@ -93,12 +70,42 @@ class Cloud(Node):
:param result: server response
"""
if "ports_mapping" in result:
self._settings["ports_mapping"] = result["ports_mapping"].copy()
if "interfaces" in result:
self._interfaces = result["interfaces"].copy()
def consoleType(self):
"""
Get the console type.
"""
return self.settings()["remote_console_type"]
def consoleHost(self):
"""
Returns the host to connect to the console.
:returns: host (string)
"""
return self.settings()["remote_console_host"]
def console(self):
"""
Returns the console port number of this node
:returns: port number
"""
return self.settings()["remote_console_port"]
def consoleHttpPath(self):
"""
Returns the path of the web ui
:returns: string
"""
return self._settings["remote_console_http_path"]
def info(self):
"""
Returns information about this cloud.
@@ -106,9 +113,23 @@ class Cloud(Node):
:returns: formatted string
"""
info = """Cloud device {name} is always-on
This is a node for external connections
""".format(name=self.name())
info = """Cloud {name} is always-on
Running on server {host} with port {port}
""".format(name=self.name(),
host=self.compute().name(),
port=self.compute().port())
if self.consoleType() != "none":
info += """ Remote console is {console_host} on port {console} and type is {console_type}
""".format(console_host=self.consoleHost(),
console=self.console(),
console_type=self.consoleType())
if self.consoleType() in ("http", "https"):
info += """ Remote console HTTP path is '{console_http_path}'
""".format(console_http_path=self.consoleHttpPath())
else:
info += """ No remote console configured
"""
port_info = ""
for port in self._ports:
@@ -140,11 +161,6 @@ This is a node for external connections
return ":/symbols/cloud.svg"
@staticmethod
def symbolName():
return "Cloud"
@staticmethod
def categories():
"""

View File

@@ -20,26 +20,24 @@ Wizard for cloud nodes.
"""
from gns3.qt import QtGui, QtWidgets
from gns3.node import Node
from gns3.dialogs.vm_wizard import VMWizard
from ..ui.cloud_wizard_ui import Ui_CloudNodeWizard
from .. import Builtin
class CloudWizard(VMWizard, Ui_CloudNodeWizard):
"""
Wizard to create a cloud node template.
Wizard to create a cloud node.
:param parent: parent widget
"""
def __init__(self, cloud_nodes, parent):
super().__init__(cloud_nodes, Builtin.instance().settings()["use_local_server"], parent)
super().__init__(cloud_nodes, parent)
self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/cloud.svg"))
self.setPixmap(QtWidgets.QWizard.WizardPixmap.LogoPixmap, QtGui.QPixmap(":/symbols/cloud.svg"))
self.uiNameWizardPage.registerField("name*", self.uiNameLineEdit)
def getSettings(self):
@@ -51,7 +49,6 @@ class CloudWizard(VMWizard, Ui_CloudNodeWizard):
settings = {"name": self.uiNameLineEdit.text(),
"symbol": ":/symbols/cloud.svg",
"category": Node.end_devices,
"server": self._compute_id}
"compute_id": self._compute_id}
return settings

View File

@@ -24,22 +24,21 @@ from gns3.node import Node
from gns3.dialogs.vm_wizard import VMWizard
from ..ui.ethernet_hub_wizard_ui import Ui_EthernetHubWizard
from .. import Builtin
class EthernetHubWizard(VMWizard, Ui_EthernetHubWizard):
"""
Wizard to create an Ethernet hub template.
Wizard to create an Ethernet hub.
:param parent: parent widget
"""
def __init__(self, ethernet_hubs, parent):
super().__init__(ethernet_hubs, Builtin.instance().settings()["use_local_server"], parent)
super().__init__(ethernet_hubs, parent)
self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/hub.svg"))
self.setPixmap(QtWidgets.QWizard.WizardPixmap.LogoPixmap, QtGui.QPixmap(":/symbols/hub.svg"))
self.uiNameWizardPage.registerField("name*", self.uiNameLineEdit)
def getSettings(self):
@@ -50,14 +49,14 @@ class EthernetHubWizard(VMWizard, Ui_EthernetHubWizard):
"""
ports = []
for port_number in range(1, self.uiPortsSpinBox.value() + 1):
for port_number in range(0, self.uiPortsSpinBox.value()):
ports.append({"port_number": int(port_number),
"name": "Ethernet{}".format(port_number)})
settings = {"name": self.uiNameLineEdit.text(),
"symbol": ":/symbols/hub.svg",
"category": Node.switches,
"server": self._compute_id,
"compute_id": self._compute_id,
"ports_mapping": ports}
return settings

View File

@@ -24,22 +24,21 @@ from gns3.node import Node
from gns3.dialogs.vm_wizard import VMWizard
from ..ui.ethernet_switch_wizard_ui import Ui_EthernetSwitchWizard
from .. import Builtin
class EthernetSwitchWizard(VMWizard, Ui_EthernetSwitchWizard):
"""
Wizard to create an Ethernet switch template.
Wizard to create an Ethernet switch.
:param parent: parent widget
"""
def __init__(self, ethernet_switches, parent):
super().__init__(ethernet_switches, Builtin.instance().settings()["use_local_server"], parent)
super().__init__(ethernet_switches, parent)
self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/symbols/ethernet_switch.svg"))
self.setPixmap(QtWidgets.QWizard.WizardPixmap.LogoPixmap, QtGui.QPixmap(":/symbols/ethernet_switch.svg"))
self.uiNameWizardPage.registerField("name*", self.uiNameLineEdit)
def getSettings(self):
@@ -50,7 +49,7 @@ class EthernetSwitchWizard(VMWizard, Ui_EthernetSwitchWizard):
"""
ports = []
for port_number in range(1, self.uiPortsSpinBox.value() + 1):
for port_number in range(0, self.uiPortsSpinBox.value()):
ports.append({"port_number": int(port_number),
"name": "Ethernet{}".format(port_number),
"type": "access",
@@ -60,7 +59,7 @@ class EthernetSwitchWizard(VMWizard, Ui_EthernetSwitchWizard):
settings = {"name": self.uiNameLineEdit.text(),
"symbol": ":/symbols/ethernet_switch.svg",
"category": Node.switches,
"server": self._compute_id,
"compute_id": self._compute_id,
"ports_mapping": ports}
return settings

View File

@@ -29,6 +29,7 @@ class EthernetHub(Node):
:param server: GNS3 server instance
:param project: Project instance
"""
URL_PREFIX = "ethernet_hub"
def __init__(self, module, server, project):
@@ -39,51 +40,6 @@ class EthernetHub(Node):
self._always_on = True
self.settings().update({"ports_mapping": []})
def create(self, name=None, node_id=None, ports=None, default_name_format="Hub{0}"):
"""
Creates this hub.
:param name: optional name for this hub
:param node_id: node identifier on the server
:param ports: ports to automatically be added when creating this hub
"""
params = {}
if ports:
params["ports_mapping"] = ports
self._create(name, node_id, params, default_name_format)
def _createCallback(self, result):
"""
Callback for create.
:param result: server response (dict)
"""
self.settings()["ports_mapping"] = result["ports_mapping"]
def update(self, new_settings):
"""
Updates the settings for this Ethernet hub.
:param new_settings: settings dictionary
"""
params = {}
if "name" in new_settings:
params["name"] = new_settings["name"]
if "ports_mapping" in new_settings:
params["ports_mapping"] = new_settings["ports_mapping"]
if params:
self._update(params)
def _updateCallback(self, result):
"""
Callback for update.
:param result: server response
"""
self.settings()["ports_mapping"] = result["ports_mapping"]
def info(self):
"""
Returns information about this Ethernet hub.
@@ -92,13 +48,13 @@ class EthernetHub(Node):
"""
info = """Ethernet hub {name} is always-on
Local node ID is {id}
Server's node ID is {node_id}
Hub's server runs on {host}
Running on server {host} with port {port}
Local ID is {id} and server ID is {node_id}
""".format(name=self.name(),
id=self.id(),
node_id=self._node_id,
host=self.compute().id())
host=self.compute().name(),
port=self.compute().port())
port_info = ""
for port in self._ports:
@@ -130,11 +86,6 @@ class EthernetHub(Node):
return ":/symbols/hub.svg"
@staticmethod
def symbolName():
return "Ethernet hub"
@staticmethod
def categories():
"""

View File

@@ -22,7 +22,6 @@ log = logging.getLogger(__name__)
class EthernetSwitch(Node):
"""
Ethernet switch.
@@ -30,6 +29,7 @@ class EthernetSwitch(Node):
:param server: GNS3 server instance
:param project: Project instance
"""
URL_PREFIX = "ethernet_switch"
def __init__(self, module, server, project):
@@ -38,51 +38,7 @@ class EthernetSwitch(Node):
# this is an always-on node
self.setStatus(Node.started)
self._always_on = True
self.settings().update({"ports_mapping": []})
def create(self, name=None, node_id=None, ports=None, default_name_format="SW{0}"):
"""
Creates this Ethernet switch.
:param name: optional name for this switch
:param node_id: node identifier on the server
:param ports: ports to be automatically added when creating this switch
"""
params = {}
if ports:
params["ports_mapping"] = ports
self._create(name, node_id, params, default_name_format)
def _createCallback(self, result):
"""
Callback for create.
:param result: server response (dict)
"""
self.settings()["ports_mapping"] = result["ports_mapping"]
def update(self, new_settings):
"""
Updates the settings for this Ethernet switch.
:param new_settings: settings dictionary
"""
params = {}
for name, value in new_settings.items():
if name in self._settings and self._settings[name] != value:
params[name] = value
if params:
self._update(params)
def _updateCallback(self, result):
"""
Callback for update.
:param result: server response
"""
self.settings()["ports_mapping"] = result["ports_mapping"]
self.settings().update({"ports_mapping": [], "console_type": "none"})
def info(self):
"""
@@ -92,13 +48,16 @@ class EthernetSwitch(Node):
"""
info = """Ethernet switch {name} is always-on
Local node ID is {id}
Server's Node ID is {node_id}
Switch's server runs on {host}
Running on server {host} with port {port}
Local ID is {id} and server ID is {node_id}
Console is on port {console} and type is {console_type}
""".format(name=self.name(),
id=self.id(),
node_id=self._node_id,
host=self.compute().id())
host=self.compute().name(),
port=self.compute().port(),
console=self._settings["console"],
console_type=self._settings["console_type"])
port_info = ""
for port in self._ports:
@@ -126,7 +85,7 @@ class EthernetSwitch(Node):
port_ethertype_info=port_ethertype_info,
port_vlan_info=port_vlan_info)
port_info += " {port_description}\n".format(port_description=port.description())
break
break
return info + port_info
@@ -150,11 +109,6 @@ class EthernetSwitch(Node):
return ":/symbols/ethernet_switch.svg"
@staticmethod
def symbolName():
return "Ethernet switch"
@staticmethod
def categories():
"""

View File

@@ -41,50 +41,6 @@ class FrameRelaySwitch(Node):
self._always_on = True
self.settings().update({"mappings": {}})
def create(self, name=None, node_id=None, mappings={}, default_name_format="FR{0}"):
"""
Creates this Frame Relay switch.
:param name: name for this switch.
:param node_id: node identifier on the server
:param mappings: mappings to be automatically added when creating this Frame relay switch
"""
params = {}
if mappings:
params["mappings"] = mappings
self._create(name, node_id, params, default_name_format)
def _createCallback(self, result):
"""
Callback for create.
:param result: server response (dict)
"""
self.settings()["mappings"] = result["mappings"]
def update(self, new_settings):
"""
Updates the settings for this Frame Relay switch.
:param new_settings: settings dictionary
"""
params = {}
for name, value in new_settings.items():
if name in self._settings and self._settings[name] != value:
params[name] = value
if params:
self._update(params)
def _updateCallback(self, result):
"""
Callback for update.
:param result: server response
"""
self.settings()["mappings"] = result["mappings"]
def info(self):
"""
Returns information about this Frame Relay switch.
@@ -93,14 +49,13 @@ class FrameRelaySwitch(Node):
"""
info = """Frame relay switch {name} is always-on
Local node ID is {id}
Server's Node ID is {node_id}
Running on server {host} with port {port}
Local ID is {id} and server ID is {node_id}
Hardware is Dynamips emulated simple Frame relay switch
Switch's server runs on {host}:{port}
""".format(name=self.name(),
id=self.id(),
node_id=self._node_id,
host=self._compute.host(),
host=self._compute.name(),
port=self._compute.port())
port_info = ""
@@ -151,11 +106,6 @@ class FrameRelaySwitch(Node):
return ":/symbols/frame_relay_switch.svg"
@staticmethod
def symbolName():
return "Frame Relay switch"
@staticmethod
def categories():
"""

View File

@@ -42,56 +42,6 @@ class Nat(Node):
self._nat_settings = {}
self.settings().update(self._nat_settings)
def interfaces(self):
return self._interfaces
def create(self, name=None, node_id=None, default_name_format="Nat{0}"):
"""
Creates this nat.
:param name: optional name for this nat
:param node_id: Node identifier on the server
"""
params = {}
self._create(name, node_id, params, default_name_format)
def _createCallback(self, result, error=False, **kwargs):
"""
Callback for create.
:param result: server response
"""
if error:
log.error("Error while creating nat: {}".format(result["message"]))
return
def update(self, new_settings):
"""
Updates the settings for this nat.
:param new_settings: settings dictionary
"""
params = {}
for name, value in new_settings.items():
if name in self._settings and self._settings[name] != value:
params[name] = value
if params:
self._update(params)
def _updateCallback(self, result, error=False, **kwargs):
"""
Callback for update.
:param result: server response
"""
if error:
log.error("Error while creating nat: {}".format(result["message"]))
return
def info(self):
"""
Returns information about this nat.
@@ -99,9 +49,11 @@ class Nat(Node):
:returns: formatted string
"""
info = """Nat device {name} is always-on
This is a node for external connections
""".format(name=self.name())
info = """NAT node {name} is always-on
Running on server {host} with port {port}
""".format(name=self.name(),
host=self.compute().name(),
port=self.compute().port())
port_info = ""
for port in self._ports:
@@ -121,12 +73,7 @@ This is a node for external connections
:returns: symbol path (or resource).
"""
return ":/symbols/cloud.svg"
@staticmethod
def symbolName():
return "Nat"
return ":/symbols/nat.svg"
@staticmethod
def categories():

View File

@@ -35,15 +35,15 @@ class ATMSwitchConfigurationPage(QtWidgets.QWidget, Ui_atmSwitchConfigPageWidget
super().__init__()
self.setupUi(self)
self._mapping = {}
self._node = None
# connect slots
self.uiAddPushButton.clicked.connect(self._addMappingSlot)
self.uiDeletePushButton.clicked.connect(self._deleteMappingSlot)
self.uiMappingTreeWidget.itemActivated.connect(self._mappingSelectedSlot)
self.uiMappingTreeWidget.itemSelectionChanged.connect(self._mappingSelectionChangedSlot)
# enable sorting
self.uiMappingTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
self.uiMappingTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
self.uiMappingTreeWidget.setSortingEnabled(True)
def _mappingSelectedSlot(self, item, column):
@@ -61,11 +61,11 @@ class ATMSwitchConfigurationPage(QtWidgets.QWidget, Ui_atmSwitchConfigPageWidget
match_destination_mapping = mapping.search(destination)
if match_source_mapping and match_destination_mapping:
self.uiVPICheckBox.setCheckState(QtCore.Qt.Unchecked)
self.uiVPICheckBox.setCheckState(QtCore.Qt.CheckState.Unchecked)
(source_port, source_vpi, source_vci) = match_source_mapping.group(1, 2, 3)
(destination_port, destination_vpi, destination_vci) = match_destination_mapping.group(1, 2, 3)
else:
self.uiVPICheckBox.setCheckState(QtCore.Qt.Checked)
self.uiVPICheckBox.setCheckState(QtCore.Qt.CheckState.Checked)
(source_port, source_vpi) = source.split(':')
(destination_port, destination_vpi) = destination.split(':')
source_vci = destination_vci = 0
@@ -103,7 +103,7 @@ class ATMSwitchConfigurationPage(QtWidgets.QWidget, Ui_atmSwitchConfigPageWidget
destination_vpi = self.uiDestinationVPISpinBox.value()
destination_vci = self.uiDestinationVCISpinBox.value()
if self.uiVPICheckBox.checkState() == QtCore.Qt.Unchecked:
if self.uiVPICheckBox.checkState() == QtCore.Qt.CheckState.Unchecked:
source = "{port}:{vpi}:{vci}".format(port=source_port,
vpi=source_vpi,
vci=source_vci)

View File

@@ -16,48 +16,69 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Configuration page for Built-in preferences.
Configuration page for builtins preferences.
"""
from gns3.qt import QtWidgets
from gns3.utils.interfaces import interfaces
from .. import Builtin
from ..ui.builtin_preferences_page_ui import Ui_BuiltinPreferencesPageWidget
from ..settings import BUILTIN_SETTINGS
class BuiltinPreferencesPage(QtWidgets.QWidget, Ui_BuiltinPreferencesPageWidget):
"""QWidget preference page for Built-in."""
"""
QWidget preference page for builtins.
"""
def __init__(self):
super().__init__()
self.setupUi(self)
# connect signals
self.uiRestoreDefaultsPushButton.clicked.connect(self._restoreDefaultsSlot)
def _restoreDefaultsSlot(self):
"""Slot to populate the page widgets with the default settings."""
"""
Slot to populate the page widgets with the default settings.
"""
self._populateWidgets(BUILTIN_SETTINGS)
def _populateWidgets(self, settings):
"""Populates the widgets with the settings.
"""
Populates the widgets with the settings.
:param settings: Built-in settings
:param settings: builtins settings
"""
self.uiUseLocalServercheckBox.setChecked(settings["use_local_server"])
self.uiNATInterfaceComboBox.clear()
self.uiNATInterfaceComboBox.addItem("")
for interface in interfaces():
self.uiNATInterfaceComboBox.addItem(interface["name"])
# load the default NAT interface
index = self.uiNATInterfaceComboBox.findText(settings["default_nat_interface"])
if index != -1:
self.uiNATInterfaceComboBox.setCurrentIndex(index)
def loadPreferences(self):
"""Loads Built-in preferences."""
"""
Loads builtins preferences.
"""
builtin_settings = Builtin.instance().settings()
self._populateWidgets(builtin_settings)
def savePreferences(self):
"""Saves Built-in preferences."""
"""
Saves builtins preferences.
"""
new_settings = {}
new_settings["use_local_server"] = self.uiUseLocalServercheckBox.isChecked()
# save the default NAT interface
default_nat_interface = self.uiNATInterfaceComboBox.currentText()
new_settings["default_nat_interface"] = default_nat_interface
Builtin.instance().setSettings(new_settings)

View File

@@ -19,13 +19,13 @@
Configuration page for clouds.
"""
from gns3.qt import QtGui, QtCore, QtWidgets
from gns3.qt import QtCore, QtGui, QtWidgets
from gns3.dialogs.symbol_selection_dialog import SymbolSelectionDialog
from ....dialogs.node_properties_dialog import ConfigurationError
from gns3.controller import Controller
from gns3.node import Node
from ..ui.cloud_configuration_page_ui import Ui_cloudConfigPageWidget
from ..cloud import Cloud
class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
@@ -48,8 +48,10 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
# connect Ethernet slots
self.uiEthernetListWidget.itemSelectionChanged.connect(self._EthernetChangedSlot)
self.uiEthernetWarningPushButton.clicked.connect(self._EthernetWarningSlot)
self.uiAddEthernetPushButton.clicked.connect(self._EthernetAddSlot)
self.uiAddAllEthernetPushButton.clicked.connect(self._EthernetAddAllSlot)
self.uiRefreshEthernetPushButton.clicked.connect(self._EthernetRefreshSlot)
self.uiDeleteEthernetPushButton.clicked.connect(self._EthernetDeleteSlot)
# connect TAP slots
@@ -57,6 +59,7 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
self.uiTAPListWidget.itemSelectionChanged.connect(self._TAPChangedSlot)
self.uiAddTAPPushButton.clicked.connect(self._TAPAddSlot)
self.uiAddAllTAPPushButton.clicked.connect(self._TAPAddAllSlot)
self.uiRefreshTAPPushButton.clicked.connect(self._TAPRefreshSlot)
self.uiDeleteTAPPushButton.clicked.connect(self._TAPDeleteSlot)
# connect UDP slots
@@ -65,8 +68,29 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
self.uiAddUDPPushButton.clicked.connect(self._UDPAddSlot)
self.uiDeleteUDPPushButton.clicked.connect(self._UDPDeleteSlot)
# connect other slots
self.uiShowSpecialInterfacesCheckBox.stateChanged.connect(self._showSpecialInterfacesSlot)
self.uiSymbolToolButton.clicked.connect(self._symbolBrowserSlot)
self.uiConsoleTypeComboBox.currentTextChanged.connect(self._consoleTypeChangedSlot)
# add an icon to the warning button
icon = QtGui.QIcon.fromTheme("dialog-warning")
if icon.isNull():
icon = QtGui.QIcon(':/icons/dialog-warning.svg')
self.uiEthernetWarningPushButton.setIcon(icon)
def _refreshInterfaces(self):
"""
Refresh the network interfaces.
"""
if self._node:
self._interfaces = self._node.interfaces()
self._loadNetworkInterfaces(self._interfaces)
try:
self._node.updated_signal.disconnect(self._refreshInterfaces)
except (TypeError, RuntimeError):
pass # was not connected
def _EthernetChangedSlot(self):
"""
@@ -79,6 +103,13 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
else:
self.uiDeleteEthernetPushButton.setEnabled(False)
def _EthernetWarningSlot(self):
"""
Shows a warning about Wifi Ethernet interfaces.
"""
QtWidgets.QMessageBox.warning(self, "Ethernet interfaces", "Wifi interfaces may not work properly. It is recommended to use wired Ethernet or Loopback interfaces only.")
def _EthernetAddSlot(self, interface=None):
"""
Adds a new Ethernet interface.
@@ -108,6 +139,15 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
interface = self.uiEthernetComboBox.itemText(index)
self._EthernetAddSlot(interface)
def _EthernetRefreshSlot(self):
"""
Refresh all Ethernet interfaces.
"""
if self._node:
self._node.update({}, force=True)
self._node.updated_signal.connect(self._refreshInterfaces)
def _EthernetDeleteSlot(self):
"""
Deletes the selected Ethernet interface.
@@ -186,6 +226,15 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
interface = self.uiTAPComboBox.itemText(index)
self._TAPAddSlot(interface)
def _TAPRefreshSlot(self):
"""
Refresh all TAP interfaces.
"""
if self._node:
self._node.update({}, force=True)
self._node.updated_signal.connect(self._refreshInterfaces)
def _TAPDeleteSlot(self):
"""
Deletes a TAP interface.
@@ -305,6 +354,9 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
self.uiUDPNameLineEdit.setText("UDP tunnel {}".format(nb_tunnels + 1))
def _showSpecialInterfacesSlot(self, state):
"""
Shows special Ethernet interfaces.
"""
self.uiEthernetComboBox.clear()
index = 0
@@ -312,7 +364,7 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
if interface["type"] == "ethernet":
if not state and interface["special"]:
continue
if self.uiEthernetListWidget.findItems(interface["name"], QtCore.Qt.MatchFixedString):
if self.uiEthernetListWidget.findItems(interface["name"], QtCore.Qt.MatchFlag.MatchFixedString):
continue
self.uiEthernetComboBox.addItem(interface["name"])
index += 1
@@ -325,12 +377,15 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
symbol_path = self.uiSymbolLineEdit.text()
dialog = SymbolSelectionDialog(self, symbol=symbol_path)
dialog.show()
if dialog.exec_():
if dialog.exec():
new_symbol_path = dialog.getSymbol()
self.uiSymbolLineEdit.setText(new_symbol_path)
self.uiSymbolLineEdit.setToolTip('<img src="{}"/>'.format(new_symbol_path))
def _loadNetworkInterfaces(self, interfaces):
"""
Loads Ethernet and TAP interfaces.
"""
self.uiEthernetComboBox.clear()
index = 0
@@ -362,6 +417,25 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
self._interfaces = result
self._loadNetworkInterfaces(result)
def _consoleTypeChangedSlot(self, console_type):
"""
Slot called when the console type has been changed.
:param console_type: console type
"""
if console_type in ("http", "https"):
self.uiConsoleHttpPathLineEdit.setEnabled(True)
else:
self.uiConsoleHttpPathLineEdit.setEnabled(False)
if console_type != "none":
self.uiConsoleHostLineEdit.setEnabled(True)
self.uiConsolePortSpinBox.setEnabled(True)
else:
self.uiConsoleHostLineEdit.setEnabled(False)
self.uiConsolePortSpinBox.setEnabled(False)
def loadSettings(self, settings, node=None, group=False):
"""
Loads the cloud settings.
@@ -373,13 +447,18 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
if not group:
self.uiNameLineEdit.setText(settings["name"])
self.uiConsoleHostLineEdit.setText(settings["remote_console_host"])
self.uiConsolePortSpinBox.setValue(settings["remote_console_port"])
index = self.uiConsoleTypeComboBox.findText(settings["remote_console_type"])
if index != -1:
self.uiConsoleTypeComboBox.setCurrentIndex(index)
self.uiConsoleHttpPathLineEdit.setText(settings["remote_console_http_path"])
else:
self.uiNameLineEdit.setEnabled(False)
if not node:
# these are template settings
# rename the label from "Name" to "Template name"
self.uiNameLabel.setText("Template name:")
# load the default name format
@@ -394,9 +473,9 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
if index != -1:
self.uiCategoryComboBox.setCurrentIndex(index)
Controller.instance().get("/computes/{}/network/interfaces".format(settings["server"]),
self._getInterfacesFromServerCallback,
progressText="Retrieving network interfaces...")
Controller.instance().getCompute("/network/interfaces", settings["compute_id"],
self._getInterfacesFromServerCallback,
progressText="Retrieving network interfaces...")
else:
self.uiDefaultNameFormatLabel.hide()
@@ -452,6 +531,17 @@ class CloudConfigurationPage(QtWidgets.QWidget, Ui_cloudConfigPageWidget):
if not group:
settings["name"] = self.uiNameLineEdit.text()
console_host = self.uiConsoleHostLineEdit.text().strip()
if self.uiConsoleTypeComboBox.currentText().lower() != "none":
if not console_host:
QtWidgets.QMessageBox.critical(self, "Console host", "Console host cannot be blank if console type is not set to none")
raise ConfigurationError()
settings["remote_console_host"] = console_host
settings["remote_console_port"] = self.uiConsolePortSpinBox.value()
settings["remote_console_type"] = self.uiConsoleTypeComboBox.currentText().lower()
settings["remote_console_http_path"] = self.uiConsoleHttpPathLineEdit.text().strip()
if not node:
# these are template settings

Some files were not shown because too many files have changed in this diff Show More