mirror of
https://github.com/GNS3/gns3-gui.git
synced 2026-05-17 08:56:06 +03:00
Compare commits
453 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f34eb18d1 | ||
|
|
3a822c02b2 | ||
|
|
84967d4c87 | ||
|
|
6981870554 | ||
|
|
7c06038072 | ||
|
|
86be15d474 | ||
|
|
2c64f83d05 | ||
|
|
6cc024ed91 | ||
|
|
607343292b | ||
|
|
03f74d77e4 | ||
|
|
1cf86ed4b5 | ||
|
|
c4570098a4 | ||
|
|
45fe2189f9 | ||
|
|
852ebddf3b | ||
|
|
7baf6af346 | ||
|
|
030c6a4d6d | ||
|
|
39759e2da0 | ||
|
|
9447f21de8 | ||
|
|
0fe25f61b3 | ||
|
|
96aa00f33b | ||
|
|
05813736ee | ||
|
|
adf0ed84f4 | ||
|
|
5f5c128183 | ||
|
|
a016726bb1 | ||
|
|
ec5e0071f8 | ||
|
|
af2bf23abb | ||
|
|
da7a95da97 | ||
|
|
da9c36f476 | ||
|
|
cd7e9221fd | ||
|
|
e6c5e2101b | ||
|
|
5e225020e0 | ||
|
|
adb8d37a91 | ||
|
|
f356c743c7 | ||
|
|
e5e9eb02bc | ||
|
|
898a03f676 | ||
|
|
6a033658ef | ||
|
|
d56b9660c9 | ||
|
|
3709b7646d | ||
|
|
b1af4c7f8b | ||
|
|
a6e26d8ea9 | ||
|
|
c98e0753f2 | ||
|
|
f34af19101 | ||
|
|
fb984e5e89 | ||
|
|
c4deabc3fa | ||
|
|
05927453b3 | ||
|
|
bc4e5f7300 | ||
|
|
9568f08058 | ||
|
|
b3a4822335 | ||
|
|
699ad62b54 | ||
|
|
8a24ff6aa8 | ||
|
|
2c0f925d5f | ||
|
|
457bc6823d | ||
|
|
9e89bb6971 | ||
|
|
e6e2a1cafb | ||
|
|
d60908897f | ||
|
|
5b7a25c8a7 | ||
|
|
93a9e44afe | ||
|
|
2168af80c7 | ||
|
|
00929a2c71 | ||
|
|
8b2b639c1b | ||
|
|
92e5b06534 | ||
|
|
5e14bbf488 | ||
|
|
c4881446e1 | ||
|
|
cce0bd4009 | ||
|
|
b7cd582384 | ||
|
|
265d1c5934 | ||
|
|
9d14aab04a | ||
|
|
de5ad831e2 | ||
|
|
8593357ab0 | ||
|
|
5b2a102ef4 | ||
|
|
5c57de7550 | ||
|
|
48b0e96e37 | ||
|
|
702709b7f9 | ||
|
|
b2b50ce273 | ||
|
|
fe2537319b | ||
|
|
ec5800d7fc | ||
|
|
ce4b74e4ea | ||
|
|
b3579861d3 | ||
|
|
37ffd741e3 | ||
|
|
6a91bf22f1 | ||
|
|
8dc3ef0784 | ||
|
|
862f77fa7b | ||
|
|
55d08125d5 | ||
|
|
81fe00bd31 | ||
|
|
0f613c03c6 | ||
|
|
64eb41d275 | ||
|
|
52feb4a07b | ||
|
|
b2c5ed755e | ||
|
|
1219877a90 | ||
|
|
1cdec97a12 | ||
|
|
e6a083eb0e | ||
|
|
370dd6ed82 | ||
|
|
d892b77012 | ||
|
|
07a8657ec1 | ||
|
|
e224a9ac29 | ||
|
|
5b87f36cfd | ||
|
|
a9354da184 | ||
|
|
91d7ed187b | ||
|
|
740fdc40c5 | ||
|
|
0f8724edc4 | ||
|
|
4e7f480af4 | ||
|
|
5ce4863baa | ||
|
|
bb5bfee256 | ||
|
|
0a74872ea2 | ||
|
|
20ed599e65 | ||
|
|
2722b2854b | ||
|
|
6b32d8bad6 | ||
|
|
fcf62fc507 | ||
|
|
c811c270ec | ||
|
|
dbc519e0af | ||
|
|
bcbf8be182 | ||
|
|
43df10520f | ||
|
|
55b37716a3 | ||
|
|
e08253e362 | ||
|
|
b9a59183a1 | ||
|
|
342ca95bd2 | ||
|
|
187ef561fd | ||
|
|
97070718fa | ||
|
|
9466b2a1fb | ||
|
|
3edde1274b | ||
|
|
e17e7fc033 | ||
|
|
bfe11d7976 | ||
|
|
2b98d51ff7 | ||
|
|
f6fb0100e2 | ||
|
|
804b871cd6 | ||
|
|
c604ff70c7 | ||
|
|
63a7f36cfe | ||
|
|
731fee1217 | ||
|
|
714dae44f3 | ||
|
|
c67dc19ec8 | ||
|
|
1c5f6b362b | ||
|
|
683400c204 | ||
|
|
5efb3019f4 | ||
|
|
23e0520cd2 | ||
|
|
1199de27df | ||
|
|
b3140f9d8e | ||
|
|
1b50cdc341 | ||
|
|
bd15734c30 | ||
|
|
24fff8972a | ||
|
|
9614a1253c | ||
|
|
a3a0be863e | ||
|
|
9b5713df03 | ||
|
|
6df7dc4730 | ||
|
|
e84ef8bf13 | ||
|
|
f7703e3fa2 | ||
|
|
de8b9bc8f1 | ||
|
|
f21a530729 | ||
|
|
be2b5eecf6 | ||
|
|
2d4f6e6ecf | ||
|
|
c152de84de | ||
|
|
d34e7b377c | ||
|
|
74c55241cf | ||
|
|
6edb9c9303 | ||
|
|
5d14dd9ab8 | ||
|
|
0c7cae2222 | ||
|
|
9b882924c0 | ||
|
|
fccfc01f2e | ||
|
|
46872c664d | ||
|
|
89166b9d35 | ||
|
|
d0421e8b1f | ||
|
|
b35ce7303d | ||
|
|
47432568e6 | ||
|
|
42ea34ca6c | ||
|
|
9f3598d36d | ||
|
|
8df248a1e6 | ||
|
|
7196aeb3cf | ||
|
|
38657f4112 | ||
|
|
84017fa0f1 | ||
|
|
3aa5a5369f | ||
|
|
0ed791b946 | ||
|
|
133732b7ae | ||
|
|
2ed48def9f | ||
|
|
279a91d402 | ||
|
|
4906678d13 | ||
|
|
a5ff9318f0 | ||
|
|
faa802d59c | ||
|
|
01b5b8bfa8 | ||
|
|
b22c5c8442 | ||
|
|
141e7d8307 | ||
|
|
1e80354e4e | ||
|
|
d340b1f50a | ||
|
|
d7bb195610 | ||
|
|
d963dd4746 | ||
|
|
60addccd95 | ||
|
|
80b654ba53 | ||
|
|
b67a8c87a7 | ||
|
|
53ece94a08 | ||
|
|
a6c7e0be59 | ||
|
|
fcea25dcbb | ||
|
|
f29c065164 | ||
|
|
c6b5494ce6 | ||
|
|
02b14f6aea | ||
|
|
e2cc378aee | ||
|
|
812aedebe3 | ||
|
|
2f0d2063cf | ||
|
|
ce0515f0ae | ||
|
|
bc10c69a2d | ||
|
|
3707758388 | ||
|
|
8aaefac91b | ||
|
|
19157ab49d | ||
|
|
38b98cd883 | ||
|
|
e9419924c5 | ||
|
|
cf3c5c09fa | ||
|
|
9e89cf5ad5 | ||
|
|
131ef09b55 | ||
|
|
2df18ee04e | ||
|
|
854e1fded6 | ||
|
|
31711a9d4e | ||
|
|
fd2e236927 | ||
|
|
21409a899d | ||
|
|
25be9e7ec7 | ||
|
|
1260c2bc2d | ||
|
|
1441e38876 | ||
|
|
3c8cff20b7 | ||
|
|
f831d71c3f | ||
|
|
f71b6dcda1 | ||
|
|
62289e7be3 | ||
|
|
7447e9b7d4 | ||
|
|
c5961f400e | ||
|
|
6ca61905b2 | ||
|
|
130e91da76 | ||
|
|
bbc5b3e4ac | ||
|
|
2a72ad5e0b | ||
|
|
88ed9407b9 | ||
|
|
18be274fed | ||
|
|
fefda50378 | ||
|
|
3df374e784 | ||
|
|
04fb449b44 | ||
|
|
fc54b76ee1 | ||
|
|
59b284e18b | ||
|
|
1d4492c911 | ||
|
|
9d8b6a172e | ||
|
|
8c3ef7a968 | ||
|
|
947733aada | ||
|
|
a199fef03b | ||
|
|
29b851207b | ||
|
|
ca5557e579 | ||
|
|
7331ae29ef | ||
|
|
3a7e06e14b | ||
|
|
0a81af8248 | ||
|
|
a882956ec9 | ||
|
|
9f4361d66f | ||
|
|
d10c3c7308 | ||
|
|
0cd7d7e4c2 | ||
|
|
8f3f72ff54 | ||
|
|
7fbc0befa1 | ||
|
|
9d9668442e | ||
|
|
932083be88 | ||
|
|
82e7c151c4 | ||
|
|
7e5c363bc3 | ||
|
|
15d029a7fb | ||
|
|
9087ba8f5a | ||
|
|
3d89d6e6cc | ||
|
|
91bae81300 | ||
|
|
7de5bf6bd5 | ||
|
|
9de238619a | ||
|
|
ed88466d63 | ||
|
|
478b793b04 | ||
|
|
841c29e6f6 | ||
|
|
f9d96051f5 | ||
|
|
607e201674 | ||
|
|
18950ca64f | ||
|
|
c0b5f39c4c | ||
|
|
3e717999ca | ||
|
|
800d14363d | ||
|
|
2dd9d61c57 | ||
|
|
10afb5a8de | ||
|
|
3413afe952 | ||
|
|
7222da9512 | ||
|
|
dbe8df5a37 | ||
|
|
a9890265b9 | ||
|
|
97b777ceea | ||
|
|
c06e534935 | ||
|
|
025276f8a7 | ||
|
|
6777961d29 | ||
|
|
7f6cace0d5 | ||
|
|
1a739c0c37 | ||
|
|
6d855045ef | ||
|
|
fef734bbbe | ||
|
|
b079443735 | ||
|
|
4a32ae9736 | ||
|
|
9793d00131 | ||
|
|
2b7840279a | ||
|
|
9243083321 | ||
|
|
3a8b3e5c4a | ||
|
|
e2168a3c81 | ||
|
|
01deb01e6a | ||
|
|
1133ee6e1b | ||
|
|
7512ffec64 | ||
|
|
3527e5551c | ||
|
|
72960f8f2b | ||
|
|
8abb502c72 | ||
|
|
08c729e83a | ||
|
|
aac004bd2f | ||
|
|
70677d8f18 | ||
|
|
fba1ff4208 | ||
|
|
e4edbefc23 | ||
|
|
d93f9afe74 | ||
|
|
162d197e36 | ||
|
|
5c21dd8a2f | ||
|
|
aa9b9d3b0b | ||
|
|
eae9eec15b | ||
|
|
a3bf832721 | ||
|
|
67890d74d9 | ||
|
|
ab4325f951 | ||
|
|
2a947b9cc5 | ||
|
|
601c082288 | ||
|
|
7701d57bd0 | ||
|
|
f0b4148a20 | ||
|
|
2fdcbafbc1 | ||
|
|
5d82cea935 | ||
|
|
b0e3e93c41 | ||
|
|
535f53737d | ||
|
|
354f3eecec | ||
|
|
35a6a5c8c7 | ||
|
|
23cba0a28d | ||
|
|
9c3d7bc95a | ||
|
|
cf2802b15a | ||
|
|
b162c55078 | ||
|
|
bb42b0ed0b | ||
|
|
e108b5194d | ||
|
|
e9ef8735be | ||
|
|
e8e90bb16a | ||
|
|
49f77930f4 | ||
|
|
a58451a552 | ||
|
|
0a43b9e6e9 | ||
|
|
4f32619ed8 | ||
|
|
20740748c1 | ||
|
|
8a5ab6b374 | ||
|
|
e11ce27f7b | ||
|
|
4b7cf4e553 | ||
|
|
b72358461c | ||
|
|
2987bcf91a | ||
|
|
5e97bc0f86 | ||
|
|
e3a3de5df7 | ||
|
|
e1693ce113 | ||
|
|
522091d219 | ||
|
|
1446748934 | ||
|
|
3f0ce380e8 | ||
|
|
bd71383354 | ||
|
|
9649895378 | ||
|
|
8579ffa20a | ||
|
|
3206743329 | ||
|
|
29c87b6e96 | ||
|
|
93b2721d6a | ||
|
|
1ff369683f | ||
|
|
7c56a2467c | ||
|
|
59ef34c17d | ||
|
|
d1fae54049 | ||
|
|
49bd61f769 | ||
|
|
9a4faddd10 | ||
|
|
7654681a94 | ||
|
|
9bfecde957 | ||
|
|
705cbf8bb9 | ||
|
|
ab6e0ce496 | ||
|
|
8042c9eb6f | ||
|
|
ad3c8a09db | ||
|
|
ea4a7f201e | ||
|
|
28c82b8718 | ||
|
|
6a4dd59e81 | ||
|
|
7418c190a8 | ||
|
|
737e32f5c3 | ||
|
|
cfc09d2c14 | ||
|
|
f6ab5cae16 | ||
|
|
39ec7eb8ea | ||
|
|
64c579d43c | ||
|
|
98cc82e6fd | ||
|
|
4b795112b4 | ||
|
|
0e186afaf1 | ||
|
|
b218f7fdf8 | ||
|
|
f1cb6d66f3 | ||
|
|
29758f1b4f | ||
|
|
445dcf3e3b | ||
|
|
f623f28509 | ||
|
|
9d02d57162 | ||
|
|
df03f50e3d | ||
|
|
3b72a66ca5 | ||
|
|
f8aee44442 | ||
|
|
6dd4d1700e | ||
|
|
9b674669db | ||
|
|
53073d458f | ||
|
|
957d89d450 | ||
|
|
db02cbdb2f | ||
|
|
0c9f70152f | ||
|
|
9016975958 | ||
|
|
bf295060fd | ||
|
|
c22ec9f8bd | ||
|
|
bb49cadc6a | ||
|
|
131a49160c | ||
|
|
225b829eae | ||
|
|
e5ef6180b1 | ||
|
|
6e7947eea3 | ||
|
|
3922d370a8 | ||
|
|
833b9d00c9 | ||
|
|
377b8dfcaf | ||
|
|
e68937475f | ||
|
|
6f418f0853 | ||
|
|
8e59927ada | ||
|
|
1012686053 | ||
|
|
672bd850ad | ||
|
|
5db5e1f9fe | ||
|
|
ca94c71bf2 | ||
|
|
76264c55ce | ||
|
|
fd243c42a8 | ||
|
|
a6521ef9e4 | ||
|
|
9fa833762c | ||
|
|
ca0c6468b5 | ||
|
|
15f6945a94 | ||
|
|
645deb8c79 | ||
|
|
428f12a2b3 | ||
|
|
9ad5760ee6 | ||
|
|
82fc4fb3c9 | ||
|
|
df42147d92 | ||
|
|
da5520aa90 | ||
|
|
491c66a315 | ||
|
|
e5c81da700 | ||
|
|
65fad1b4f4 | ||
|
|
34661908d9 | ||
|
|
aee5ffa17f | ||
|
|
e9e8be42b5 | ||
|
|
ae0d928383 | ||
|
|
8db3c1be42 | ||
|
|
f50da3ebd7 | ||
|
|
75b52fc9a4 | ||
|
|
1952da5876 | ||
|
|
1f620026d4 | ||
|
|
1d293618e5 | ||
|
|
2622549ce6 | ||
|
|
900bd1c0b4 | ||
|
|
0b3dbb2843 | ||
|
|
ef4f6b2b27 | ||
|
|
e9806345ca | ||
|
|
ee23e32c75 | ||
|
|
fbeacdcb2a | ||
|
|
b3937c7b94 | ||
|
|
181bf3f360 | ||
|
|
f2711732db | ||
|
|
148ac4b072 | ||
|
|
65eeb79b26 | ||
|
|
537304ce08 | ||
|
|
f22df5f016 | ||
|
|
8dfc8b7714 | ||
|
|
8c6fa9433f | ||
|
|
63837578c5 | ||
|
|
b719703dbe | ||
|
|
084d14c17e | ||
|
|
8c0fca1dd7 | ||
|
|
863d05c923 | ||
|
|
3ebaac8a2c | ||
|
|
16878c9dfa | ||
|
|
45da18bb7c | ||
|
|
7a6d06ea0c | ||
|
|
d371042647 |
16
.github/workflows/add-new-issues-to-project.yml
vendored
Normal file
16
.github/workflows/add-new-issues-to-project.yml
vendored
Normal 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
93
.github/workflows/codeql.yml
vendored
Normal 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}}"
|
||||
2
.github/workflows/testing.yml
vendored
2
.github/workflows/testing.yml
vendored
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v5
|
||||
- name: Build and run Docker image
|
||||
run: |
|
||||
docker build -t gns3-gui-test .
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -63,3 +63,4 @@ __pycache__
|
||||
|
||||
# Virtualenv
|
||||
env
|
||||
venv
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
"scanSettings": {
|
||||
"configMode": "AUTO",
|
||||
"configExternalURL": "",
|
||||
"projectToken" : ""
|
||||
"projectToken" : "",
|
||||
"baseBranches": ["master", "2.2", "3.0"]
|
||||
},
|
||||
"checkRunSettings": {
|
||||
"vulnerableCheckRunConclusionLevel": "failure"
|
||||
|
||||
259
CHANGELOG
259
CHANGELOG
@@ -1,5 +1,264 @@
|
||||
# Change Log
|
||||
|
||||
## 2.2.59 08/05/2026
|
||||
|
||||
* Remove psutil version check
|
||||
* Fix remaining PyQt6 compatibility issues. Fixes #3822
|
||||
* Add --title to remote-viewer console commands. Fixes #3783
|
||||
* Fix deleting drawings. Ref #3810
|
||||
|
||||
## 2.2.58.1 12/04/2026
|
||||
|
||||
* Fix callback issues in found in v2.2.58
|
||||
|
||||
## 2.2.58 10/04/2026
|
||||
|
||||
* Update snapshot date & time format
|
||||
* Fix bug when HTTP DELETE requests are silently dropped. Fixes #3810
|
||||
* Show if a linked base VM or not in device's properties
|
||||
* Add HTTP method to response timeout slot. Ref #3810
|
||||
* Add default link style section in preferences
|
||||
* Update the default style colors based on the interface style
|
||||
* Support bring to front for vnc and spice consoles on Linux. Fixes #3783
|
||||
* Update appliance schemas
|
||||
* Fix bug when adding multiple nodes at the same time. Fixes #3807
|
||||
* Fix QWebSocket error signal. Fixes #3804
|
||||
|
||||
## 2.2.57 23/03/2026
|
||||
|
||||
* Fix errors from controller are not reported
|
||||
* Deactivate 'use default IOU values' by default and update RAM/NVRAM values
|
||||
* Fix QMenu parents
|
||||
* Fix UltraVNC preconfigured command
|
||||
* Dark style
|
||||
* Fix bug when dragging scene
|
||||
* Upgrade pytest and jsonschema dependencies
|
||||
* Upgrade sentry-sdk and psutil dependencies
|
||||
* Fix mouse manipulation bug
|
||||
* Add Multi VNC tab handling in Superputty
|
||||
* Fixing tab name in Superputty + Adding Superputty VNC support
|
||||
* settings.py: add OpenBSD packet capture command
|
||||
|
||||
## 2.2.56.1 28/01/2026
|
||||
|
||||
* Fix line style support for links
|
||||
* Fix cannot add IOS in preferences
|
||||
* Fix cannot add IOU in preferences
|
||||
* Upgrade dependencies
|
||||
* Drop Python 3.8 support
|
||||
* Display a warning if a SVG image format isn't supported
|
||||
* Fix error in profile selection window after PyQt6 migration
|
||||
|
||||
## 2.2.56 21/01/2026
|
||||
|
||||
* Fixing tab name in MobaXterm
|
||||
* PyQt6 migration
|
||||
* Add XDG Config Home support
|
||||
|
||||
## 2.2.55 19/11/2025
|
||||
|
||||
* Fix SyntaxWarning: invalid escape sequence. Fixes #3760
|
||||
* Support for Python 3.14
|
||||
* Clicking the "console connect to all nodes" opens all consoles in name order with case-insensitively
|
||||
|
||||
## 2.2.54 21/04/2025
|
||||
|
||||
* Replace "Docker hub" by "Docker repository" because it is possible to use different repositories
|
||||
* Upgrade dependencies
|
||||
* Fix bring console in front when clicking on "Open all consoles". Fixes #3706
|
||||
* Add -F arg to wmctrl. Ref #3706
|
||||
|
||||
## 2.2.53 21/01/2025
|
||||
|
||||
* Update file browser filters for all files and IOU images
|
||||
* Upgrade dependencies
|
||||
* Fix Linux Mint default terminal configuration
|
||||
|
||||
## 2.2.52 02/12/2024
|
||||
|
||||
* Add iol extension filter. Ref #3664
|
||||
* Remove maximum 64GB RAM limitation for QEMU VMs. Fixes #3658
|
||||
* Bring to front support for consoles on Linux.
|
||||
* Relax setuptools requirement to allow for easier Debian packaging on Ubuntu Focal & Jammy
|
||||
|
||||
## 2.2.51 07/11/2024
|
||||
|
||||
* Python 3.13 support
|
||||
* Upgrade dependencies
|
||||
* Add keyboard shortcut for Add Link
|
||||
|
||||
## 2.2.50 21/10/2024
|
||||
|
||||
* Fix issue when pid file contains invalid data
|
||||
* Add comment to indicate sentry-sdk is optional. Ref https://github.com/GNS3/gns3-server/issues/2423
|
||||
* Improve information provided when uploading invalid appliance image. Fixes #3637
|
||||
* Use "experimental features" option to force listening for HTTP notification streams. Ref #3579
|
||||
* Fix to allow packet capture on more than 6 links. Fixes #3594
|
||||
* Support for configuring MAC address in Docker containers
|
||||
* Add KRDC to pre-configured VNC console commands
|
||||
|
||||
## 2.2.49 06/08/2024
|
||||
|
||||
* Upgrade jsonschema and sentry-sdk packages
|
||||
* Upgrade to PyQt5 v5.15.11
|
||||
* Add shortcuts info dialog
|
||||
* Added Key Shortcuts
|
||||
|
||||
## 2.2.48.1 12/07/2024
|
||||
|
||||
* No changes
|
||||
|
||||
## 2.2.48 08/07/2024
|
||||
|
||||
* Use "experimental features" to allow bypassing hostname validation. Ref #3524
|
||||
* Update appliance_v8.json. Ref https://github.com/GNS3/gns3-registry/pull/897
|
||||
* Option to keep the compute IDs unchanged when exporting a project
|
||||
* Upgrade sentry-sdk and psutil packages
|
||||
* Switch to PyQt5 5.15.10 for macOS build
|
||||
|
||||
## 2.2.47 15/05/2024
|
||||
|
||||
* Remove maximum size for capture dialog. Ref #3576
|
||||
* Change sentry-sdk version
|
||||
* Upgrade aiohttp, sentry-sdk and truststore
|
||||
* Upgrade jsonschema and aiohttp
|
||||
* Drop Python 3.7
|
||||
* Remove dev requirements for Python 3.6
|
||||
* Add NAT symbols
|
||||
* Only show log message if event has "message"
|
||||
|
||||
## 2.2.46 26/02/2024
|
||||
|
||||
* Add GNS3 console command "env" to show what environment variables are used. Ref https://github.com/GNS3/gns3-server/issues/2306
|
||||
* Add CTRL+C shortcut to copy status bar message. Ref #3561
|
||||
* Key modifier (ALT) to ignore snap to grid. Fixes #3538
|
||||
* 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
|
||||
* Add reset GUI state feature. Ref #3549
|
||||
* Fix for hiding Windows terminal. Ref #3290
|
||||
* Drop support for Python 3.6
|
||||
* Upgrade sentry-sdk, psutil and distro dependencies
|
||||
|
||||
## 2.2.45 12/01/2024
|
||||
|
||||
* Add missing console_type values in appliance_v8.json. Ref https://github.com/GNS3/gns3-registry/issues/849
|
||||
* Handle moved project notifications on controller stream
|
||||
* Add debug for PATH env variable
|
||||
* Add custom executable paths on Windows
|
||||
* Add --suppressApplicationTitle for Windows terminal. Fixes https://github.com/GNS3/gns3-gui/issues/3544
|
||||
* Upgrade sentry-sdk and aiohttp
|
||||
|
||||
## 2.2.44.1 07/11/2023
|
||||
|
||||
* No changes
|
||||
|
||||
## 2.2.44 06/11/2023
|
||||
|
||||
* Fix timeout issue when creating Qemu disk image. Fixes https://github.com/GNS3/gns3-server/issues/2313
|
||||
* Refactor command variables support
|
||||
* Add vendor_logo_url in appliance schemas. Ref https://github.com/GNS3/gns3-registry/pull/825
|
||||
* Add Qemu IGB network device
|
||||
* Add the ability to edit width and height in the style edit dialog.
|
||||
|
||||
## 2.2.43 19/09/2023
|
||||
|
||||
* Add KiTTY to preconfigured telnet consoles. Fixes #3507
|
||||
* Fix generic icon in Wayland. Ref #3501
|
||||
* Support for appliance format version 8.
|
||||
* Use importlib instead of pkg_resources
|
||||
* Upgrade to PyQt 5.15.9 and pywin32
|
||||
* Add support for appliance version 8 format
|
||||
|
||||
## 2.2.42 09/08/2023
|
||||
|
||||
* Use the system's certificate store for SSL connections
|
||||
* Give a node some time to start before opening the console (for console auto start). Fixes #3474
|
||||
* Use Mate Terminal by default if installed on Debian, Ubuntu and Linux Mint.
|
||||
* Support for gnome-terminal tabs to be opened in the same window.
|
||||
* Remove import urllib3 and let sentry_sdk import and patch it. Fixes https://github.com/GNS3/gns3-gui/issues/3498
|
||||
* Add import sys in sudo.py
|
||||
* Rounded Rectangle support
|
||||
|
||||
## 2.2.41 12/07/2023
|
||||
|
||||
* Use alternative method to set the correct permissions for uBridge on macOS
|
||||
* Remove sending stats to GA
|
||||
* Catch urllib3 exceptions when sending crash report. Ref https://github.com/GNS3/gns3-gui/issues/3483
|
||||
* Backport UEFI boot mode support for Qemu VMs
|
||||
* Add debug for dropEvent. Ref https://github.com/GNS3/gns3-server/issues/2242
|
||||
|
||||
## 2.2.40.1 10/06/2023
|
||||
|
||||
* No changes
|
||||
|
||||
## 2.2.40 06/06/2023
|
||||
|
||||
* Change log messages for Websocket errors
|
||||
* Do not proceed if an appliance symbol cannot be downloaded. Ref #3466
|
||||
* Delete a node or link from topology summary view using Delete key. Ref #3445
|
||||
* Fix "Start the capture visualization program" checkbox works only one (first) time for a given link. Fixes #3442
|
||||
* Let the selected link style applied when editing a link. Fixes #3460
|
||||
* Fix hovered color shown in style editing dialog. Fixes #3460
|
||||
|
||||
## 2.2.39 08/05/2023
|
||||
|
||||
* Fix nodes are not snapped to the grid at the moment of creation
|
||||
* Upgrade distro and aiohttp dependencies
|
||||
|
||||
## 2.2.38 28/02/2023
|
||||
|
||||
* Add long description content type in setup.py
|
||||
* Automatically add new issues to GNS3 project
|
||||
* Development 2.2.38.dev1
|
||||
|
||||
## 2.2.37 25/01/2023
|
||||
|
||||
* Upgrade to PyQt5 v5.15.7
|
||||
* Changed Windows Terminal telnet console profile from OS X to windows ref: issue #3193
|
||||
|
||||
## 2.2.36 04/01/2023
|
||||
|
||||
* Add Trusted Platform Module (TPM) support for Qemu VMs
|
||||
* Add "on_close" setting to appliance schema. Fixes https://github.com/GNS3/gns3-server/issues/2148
|
||||
* Add default 'ide' disk interface when manually creating Qemu VM template. Fixes #3360
|
||||
* Fix zoom factor is multiplied when loading projects. Fixes #3408
|
||||
* Remove deprecated PuTTY option in preferences. Ref https://github.com/GNS3/gns3-gui/discussions/3415
|
||||
|
||||
|
||||
## 2.2.35.1 10/11/2022
|
||||
|
||||
* Re-release Web-Ui v2.2.35
|
||||
|
||||
## 2.2.35 08/11/2022
|
||||
|
||||
* Fix "variables": [] in project file leads to unlimited increase of empty name/value pairs in GUI. Fixes #3397
|
||||
* Make version PEP 440 compliant
|
||||
* Support for Python 3.11
|
||||
* Upgrade PyQt to 5.15.7 and pywin32 to v305
|
||||
* Allow for more dependency versions at patch level
|
||||
* Replace deprecated distro.linux_distribution() call
|
||||
* Add a fix for the CVE-2007-4559
|
||||
|
||||
## 2.2.34 28/08/2022
|
||||
|
||||
* Upgrade dev dependencies
|
||||
* Implement new option (Delete All) to contextual menu in "Console" dock. Fixes #3325
|
||||
* Fix 2560x1440 resolution for Docker container
|
||||
|
||||
## 2.2.33.1 21/06/2022
|
||||
|
||||
* Match GNS3 server version
|
||||
|
||||
## 2.2.33 20/06/2022
|
||||
|
||||
* Upgrade sentry-sdk and psutil
|
||||
* Check that node names for Qemu and Docker are valid
|
||||
* Backport reset all console connections. Fixes #2072
|
||||
* Add more video resolutions to Docker containers using VNC. Fixes #3329
|
||||
* Add python_requires=">=3.4" in setup.py. Fixes #3326
|
||||
* Only allow post release corrective versions of GUI and server to interact
|
||||
* Allow minor versions of GUI and server to interact
|
||||
* Update VirtViewer path. Fixes #3334
|
||||
|
||||
## 2.2.32 27/04/2022
|
||||
|
||||
* Use public DSNs for Sentry
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# Run tests inside a container
|
||||
FROM ubuntu:18.04
|
||||
FROM ubuntu:latest
|
||||
MAINTAINER GNS3 Team
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y --force-yes python3.6 python3-pyqt5 python3-pip python3-pyqt5.qtsvg python3-pyqt5.qtwebsockets python3.6-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 --no-cache-dir -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.6 -m pytest -vv
|
||||
CMD xvfb-run python3 -m pytest -vv
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
include README.rst
|
||||
include README.md
|
||||
include AUTHORS
|
||||
include LICENSE
|
||||
include MANIFEST.in
|
||||
|
||||
62
README.md
Normal file
62
README.md
Normal file
@@ -0,0 +1,62 @@
|
||||
GNS3-gui
|
||||
========
|
||||
|
||||
[](https://github.com/GNS3/gns3-gui/actions?query=workflow%3Atesting)
|
||||
|
||||
[](https://pypi.python.org/pypi/gns3-gui)
|
||||
|
||||
[](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>
|
||||
60
README.rst
60
README.rst
@@ -1,60 +0,0 @@
|
||||
GNS3-gui
|
||||
========
|
||||
|
||||
.. image:: https://github.com/GNS3/gns3-gui/workflows/testing/badge.svg
|
||||
:target: https://github.com/GNS3/gns3-gui/actions?query=workflow%3Atesting
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/gns3-gui.svg
|
||||
:target: https://pypi.python.org/pypi/gns3-gui
|
||||
|
||||
.. image:: https://snyk.io/test/github/GNS3/gns3-gui/badge.svg
|
||||
:target: https://snyk.io/test/github/GNS3/gns3-gui
|
||||
|
||||
|
||||
GNS3 GUI repository.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Please see https://docs.gns3.com/
|
||||
|
||||
Software dependencies
|
||||
---------------------
|
||||
|
||||
PyQt5 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:
|
||||
|
||||
.. 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
|
||||
|
||||
Security issues
|
||||
----------------
|
||||
|
||||
Please contact us at security@gns3.net
|
||||
|
||||
|
||||
5
SECURITY.md
Normal file
5
SECURITY.md
Normal 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
|
||||
19
appveyor.yml
19
appveyor.yml
@@ -1,19 +0,0 @@
|
||||
version: '{build}-{branch}'
|
||||
|
||||
image: Visual Studio 2017
|
||||
|
||||
platform: x64
|
||||
|
||||
environment:
|
||||
PYTHON: "C:\\Python36-x64"
|
||||
DISTUTILS_USE_SDK: "1"
|
||||
|
||||
install:
|
||||
- cinst nmap
|
||||
- "%PYTHON%\\python.exe -m pip install -r dev-requirements.txt"
|
||||
- "%PYTHON%\\python.exe -m pip install -r win-requirements.txt"
|
||||
|
||||
build: off
|
||||
|
||||
test_script:
|
||||
- "%PYTHON%\\python.exe -m pytest -v"
|
||||
@@ -1,5 +1,5 @@
|
||||
-rrequirements.txt
|
||||
|
||||
pytest==6.2.4
|
||||
flake8==3.9.2
|
||||
pytest-timeout==1.4.2
|
||||
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
|
||||
|
||||
@@ -27,25 +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, hdpi=True):
|
||||
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
|
||||
if hdpi:
|
||||
if sys.platform.startswith("linux"):
|
||||
log.warning("HDPI mode is enabled. HDPI support on Linux is not fully stable and GNS3 may crash depending of your version of Linux. To disabled HDPI mode please edit ~/.config/GNS3/gns3_gui.conf and set 'hdpi' to 'false'")
|
||||
self.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
|
||||
self.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
|
||||
else:
|
||||
log.info("HDPI mode is disabled")
|
||||
self.setAttribute(QtCore.Qt.AA_DisableHighDpiScaling)
|
||||
|
||||
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")
|
||||
@@ -57,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):
|
||||
|
||||
@@ -251,7 +251,7 @@ class BaseNode(QtCore.QObject):
|
||||
|
||||
return self._ports
|
||||
|
||||
def controllerHttpPost(self, path, callback, body={}, context={}, **kwargs):
|
||||
def controllerHttpPost(self, path, callback, body=None, context=None, **kwargs):
|
||||
"""
|
||||
POST on current server / project
|
||||
|
||||
@@ -263,7 +263,7 @@ class BaseNode(QtCore.QObject):
|
||||
|
||||
self._project.post(path, callback, body=body, context=context, **kwargs)
|
||||
|
||||
def controllerHttpPut(self, path, callback, body={}, context={}, **kwargs):
|
||||
def controllerHttpPut(self, path, callback, body=None, context=None, **kwargs):
|
||||
"""
|
||||
PUT on current server / project
|
||||
|
||||
@@ -275,7 +275,7 @@ class BaseNode(QtCore.QObject):
|
||||
|
||||
self._project.put(path, callback, body=body, context=context, **kwargs)
|
||||
|
||||
def controllerHttpGet(self, path, callback, context={}, **kwargs):
|
||||
def controllerHttpGet(self, path, callback, context=None, **kwargs):
|
||||
"""
|
||||
Get on current server / project
|
||||
|
||||
@@ -287,7 +287,7 @@ class BaseNode(QtCore.QObject):
|
||||
|
||||
self._project.get(path, callback, context=context, **kwargs)
|
||||
|
||||
def controllerHttpDelete(self, path, callback, context={}, **kwargs):
|
||||
def controllerHttpDelete(self, path, callback, context=None, **kwargs):
|
||||
"""
|
||||
Delete on current server / project
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ class ComputeItem(QtWidgets.QTreeWidgetItem):
|
||||
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.AscendingOrder)
|
||||
self._parent.sortItems(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
|
||||
# add nodes belonging to this compute
|
||||
self.takeChildren()
|
||||
@@ -98,7 +98,7 @@ class ComputeItem(QtWidgets.QTreeWidgetItem):
|
||||
else:
|
||||
item.setIcon(0, QtGui.QIcon(':/icons/led_red.svg'))
|
||||
self.addChild(item)
|
||||
self.sortChildren(0, QtCore.Qt.AscendingOrder)
|
||||
self.sortChildren(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
|
||||
|
||||
class ComputeSummaryView(QtWidgets.QTreeWidget):
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
Handles commands typed in the GNS3 console.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import cmd
|
||||
import struct
|
||||
@@ -34,6 +35,14 @@ 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.
|
||||
|
||||
@@ -22,7 +22,7 @@ import inspect
|
||||
import datetime
|
||||
import platform
|
||||
|
||||
from .qt import QtCore
|
||||
from .qt import QtCore, QtGui
|
||||
from .topology import Topology
|
||||
from .version import __version__
|
||||
from .console_cmd import ConsoleCmd
|
||||
@@ -109,6 +109,29 @@ class ConsoleView(PyCutExt, ConsoleCmd):
|
||||
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.
|
||||
|
||||
@@ -25,6 +25,8 @@ from .qt import QtCore, QtNetwork, QtGui, QtWidgets, QtWebSockets, qpartial, qsl
|
||||
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
|
||||
@@ -151,13 +153,13 @@ class Controller(QtCore.QObject):
|
||||
self.connection_failed_signal.emit()
|
||||
if self._display_error:
|
||||
self._error_dialog = QtWidgets.QMessageBox(self.parent())
|
||||
self._error_dialog.setWindowModality(QtCore.Qt.ApplicationModal)
|
||||
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.Critical)
|
||||
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))
|
||||
@@ -245,7 +247,7 @@ class Controller(QtCore.QObject):
|
||||
|
||||
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:
|
||||
@@ -416,19 +418,26 @@ class Controller(QtCore.QObject):
|
||||
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"):
|
||||
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)
|
||||
self._notification_stream.error.connect(self._websocket_error)
|
||||
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:
|
||||
@@ -449,7 +458,7 @@ class Controller(QtCore.QObject):
|
||||
@qslot
|
||||
def _websocket_error(self, error):
|
||||
if self._notification_stream:
|
||||
log.error("Websocket notification stream error: {}".format(self._notification_stream.errorString()))
|
||||
log.error("Websocket controller notification stream error: {}".format(self._notification_stream.errorString()))
|
||||
self._notification_stream = None
|
||||
self._startListenNotifications()
|
||||
|
||||
@@ -479,11 +488,21 @@ class Controller(QtCore.QObject):
|
||||
elif result["action"] == "compute.created" or result["action"] == "compute.updated":
|
||||
from .compute_manager import ComputeManager
|
||||
ComputeManager.instance().computeDataReceivedCallback(result["event"])
|
||||
elif result["action"] == "log.error":
|
||||
log.error(result["event"]["message"])
|
||||
elif result["action"] == "log.warning":
|
||||
log.warning(result["event"]["message"])
|
||||
elif result["action"] == "log.info":
|
||||
log.info(result["event"]["message"], extra={"show": True})
|
||||
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
|
||||
|
||||
@@ -15,12 +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/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import platform
|
||||
import struct
|
||||
import distro
|
||||
|
||||
try:
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.logging import LoggingIntegration
|
||||
@@ -29,7 +23,12 @@ except ImportError:
|
||||
# Sentry SDK is not installed with deb package in order to simplify packaging
|
||||
SENTRY_SDK_AVAILABLE = False
|
||||
|
||||
from .utils.get_resource import get_resource
|
||||
import sys
|
||||
import os
|
||||
import platform
|
||||
import struct
|
||||
import distro
|
||||
|
||||
from .version import __version__, __version_info__
|
||||
|
||||
import logging
|
||||
@@ -51,7 +50,7 @@ class CrashReport:
|
||||
Report crash to a third party service
|
||||
"""
|
||||
|
||||
DSN = "https://8aa9e09917494af7b7def60f0aed8512@o19455.ingest.sentry.io/38506"
|
||||
DSN = "https://dd662ce99d7e4a04714a89939ec523c9@o19455.ingest.us.sentry.io/38506"
|
||||
_instance = None
|
||||
|
||||
def __init__(self):
|
||||
@@ -64,29 +63,23 @@ class CrashReport:
|
||||
self._sentry_initialized = False
|
||||
|
||||
if SENTRY_SDK_AVAILABLE:
|
||||
cacert = None
|
||||
if hasattr(sys, "frozen"):
|
||||
cacert_resource = get_resource("cacert.pem")
|
||||
if cacert_resource is not None and os.path.isfile(cacert_resource):
|
||||
cacert = cacert_resource
|
||||
else:
|
||||
log.error("The SSL certificate bundle file '{}' could not be found".format(cacert_resource))
|
||||
|
||||
# Don't send log records as events.
|
||||
sentry_logging = LoggingIntegration(level=logging.INFO, event_level=None)
|
||||
|
||||
sentry_sdk.init(dsn=CrashReport.DSN,
|
||||
release=__version__,
|
||||
ca_certs=cacert,
|
||||
default_integrations=False,
|
||||
integrations=[sentry_logging])
|
||||
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
|
||||
|
||||
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(distro.linux_distribution()),
|
||||
"os:linux": distro.name(pretty=True),
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
images_directories.append(emulator_images_dir)
|
||||
|
||||
images_directories.append(os.path.dirname(self._path))
|
||||
download_directory = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.DownloadLocation)
|
||||
download_directory = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.DownloadLocation)
|
||||
if download_directory != "" and download_directory != os.path.dirname(self._path):
|
||||
images_directories.append(download_directory)
|
||||
|
||||
@@ -94,9 +94,11 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
self.setWindowTitle("Install {} appliance".format(self._appliance["name"]))
|
||||
|
||||
# add a custom button to show appliance information
|
||||
self.setButtonText(QtWidgets.QWizard.CustomButton1, "&Appliance info")
|
||||
self.setOption(QtWidgets.QWizard.HaveCustomButton1, True)
|
||||
self.customButtonClicked.connect(self._showApplianceInfoSlot)
|
||||
if self._appliance["registry_version"] < 8:
|
||||
# FIXME: show appliance info for v8
|
||||
self.setButtonText(QtWidgets.QWizard.WizardButton.CustomButton1, "&Appliance info")
|
||||
self.setOption(QtWidgets.QWizard.WizardOption.HaveCustomButton1, True)
|
||||
self.customButtonClicked.connect(self._showApplianceInfoSlot)
|
||||
|
||||
# customize the server selection
|
||||
self.uiRemoteRadioButton.toggled.connect(self._remoteServerToggledSlot)
|
||||
@@ -139,23 +141,14 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
symbol = ":/symbols/computer.svg"
|
||||
else:
|
||||
symbol = ":/symbols/{}.svg".format(self._appliance["category"])
|
||||
self.page(page_id).setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(symbol))
|
||||
self.page(page_id).setPixmap(QtWidgets.QWizard.WizardPixmap.LogoPixmap, QtGui.QPixmap(symbol))
|
||||
|
||||
if self.page(page_id) == self.uiServerWizardPage:
|
||||
|
||||
Controller.instance().getSymbols(self._getSymbolsCallback)
|
||||
|
||||
if "qemu" in self._appliance:
|
||||
emulator_type = "qemu"
|
||||
elif "iou" in self._appliance:
|
||||
emulator_type = "iou"
|
||||
elif "docker" in self._appliance:
|
||||
emulator_type = "docker"
|
||||
elif "dynamips" in self._appliance:
|
||||
emulator_type = "dynamips"
|
||||
else:
|
||||
QtWidgets.QMessageBox.warning(self, "Appliance", "Could not determine the emulator type")
|
||||
|
||||
template_type = self._appliance.template_type()
|
||||
if not template_type:
|
||||
raise ApplianceError("No template type found for appliance {}".format(self._appliance["name"]))
|
||||
is_mac = ComputeManager.instance().localPlatform().startswith("darwin")
|
||||
is_win = ComputeManager.instance().localPlatform().startswith("win")
|
||||
|
||||
@@ -173,11 +166,11 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
if ComputeManager.instance().localPlatform() is None:
|
||||
self.uiLocalRadioButton.setEnabled(False)
|
||||
elif is_mac or is_win:
|
||||
if emulator_type == "qemu":
|
||||
if template_type == "qemu":
|
||||
# disallow usage of the local server because Qemu has issues on OSX and Windows
|
||||
if not LocalConfig.instance().experimental():
|
||||
self.uiLocalRadioButton.setEnabled(False)
|
||||
elif emulator_type != "dynamips":
|
||||
elif template_type != "dynamips":
|
||||
self.uiLocalRadioButton.setEnabled(False)
|
||||
|
||||
if ComputeManager.instance().vmCompute():
|
||||
@@ -195,27 +188,55 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
|
||||
elif self.page(page_id) == self.uiFilesWizardPage:
|
||||
if Controller.instance().isRemote() or self._compute_id != "local":
|
||||
self._registry.getRemoteImageList(self._appliance.emulator(), self._compute_id)
|
||||
self._registry.getRemoteImageList(self._appliance.template_type(), self._compute_id)
|
||||
else:
|
||||
self.images_changed_signal.emit()
|
||||
|
||||
elif self.page(page_id) == self.uiQemuWizardPage:
|
||||
if self._appliance['qemu'].get('kvm', 'require') == 'require':
|
||||
if self._appliance.template_properties().get('kvm', 'require') == 'require':
|
||||
self._server_check = False
|
||||
Qemu.instance().getQemuCapabilitiesFromServer(self._compute_id, qpartial(self._qemuServerCapabilitiesCallback))
|
||||
else:
|
||||
self._server_check = True
|
||||
Qemu.instance().getQemuBinariesFromServer(self._compute_id, qpartial(self._getQemuBinariesFromServerCallback), [self._appliance["qemu"]["arch"]])
|
||||
if self._appliance["registry_version"] >= 8:
|
||||
qemu_platform = self._appliance.template_properties()["platform"]
|
||||
else:
|
||||
qemu_platform = self._appliance.template_properties()["arch"]
|
||||
Qemu.instance().getQemuBinariesFromServer(self._compute_id, qpartial(self._getQemuBinariesFromServerCallback), [qemu_platform])
|
||||
|
||||
elif self.page(page_id) == self.uiInstructionsPage:
|
||||
|
||||
installation_instructions = self._appliance.get("installation_instructions", "No installation instructions available")
|
||||
self.uiInstructionsTextEdit.setText(installation_instructions.strip())
|
||||
|
||||
elif self.page(page_id) == self.uiUsageWizardPage:
|
||||
self.uiUsageTextEdit.setText("The template will be available in the {} category.\n\n{}".format(self._appliance["category"].replace("_", " "), self._appliance.get("usage", "")))
|
||||
# TODO: allow taking these info fields at the version level in v8
|
||||
category = self._appliance["category"].replace("_", " ")
|
||||
usage = self._appliance.get("usage", "No usage information available")
|
||||
if self._appliance["registry_version"] >= 8:
|
||||
default_username = self._appliance.get("default_username")
|
||||
default_password = self._appliance.get("default_password")
|
||||
if default_username and default_password:
|
||||
usage += "\n\nDefault username: {}\nDefault password: {}".format(default_username, default_password)
|
||||
|
||||
usage_info = """
|
||||
The template will be available in the {} category.
|
||||
|
||||
Usage: {}
|
||||
""".format(category, usage)
|
||||
|
||||
self.uiUsageTextEdit.setText(usage_info.strip())
|
||||
|
||||
def _qemuServerCapabilitiesCallback(self, result, error=None, *args, **kwargs):
|
||||
"""
|
||||
Check if the server supports KVM or not
|
||||
"""
|
||||
|
||||
if error is None and "kvm" in result and self._appliance["qemu"]["arch"] in result["kvm"]:
|
||||
if self._appliance["registry_version"] >= 8:
|
||||
qemu_platform = self._appliance.template_properties()["platform"]
|
||||
else:
|
||||
qemu_platform = self._appliance.template_properties()["arch"]
|
||||
if error is None and "kvm" in result and qemu_platform in result["kvm"]:
|
||||
self._server_check = True
|
||||
else:
|
||||
if error:
|
||||
@@ -236,7 +257,7 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
log.error("Error while uploading image '{}': {}".format(image_path, result["message"]))
|
||||
else:
|
||||
log.info("Image '{}' has been successfully uploaded".format(image_path))
|
||||
self._registry.getRemoteImageList(self._appliance.emulator(), self._compute_id)
|
||||
self._registry.getRemoteImageList(self._appliance.template_type(), self._compute_id)
|
||||
|
||||
def _showApplianceInfoSlot(self):
|
||||
"""
|
||||
@@ -306,10 +327,10 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
msgbox = QtWidgets.QMessageBox(self)
|
||||
msgbox.setWindowTitle("Appliance information")
|
||||
msgbox.setStyleSheet("QLabel{min-width: 600px;}") # TODO: resize details box QTextEdit{min-height: 500px;}
|
||||
msgbox.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
msgbox.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
msgbox.setText(text_info)
|
||||
msgbox.setDetailedText(self._appliance["description"])
|
||||
msgbox.exec_()
|
||||
msgbox.exec()
|
||||
|
||||
@qslot
|
||||
def _refreshVersions(self, *args):
|
||||
@@ -356,9 +377,9 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
image_widget.setToolTip(2, image["path"])
|
||||
|
||||
# Associated data stored are col 0: version, col 1: image
|
||||
image_widget.setData(0, QtCore.Qt.UserRole, version)
|
||||
image_widget.setData(1, QtCore.Qt.UserRole, image)
|
||||
image_widget.setData(2, QtCore.Qt.UserRole, self._appliance)
|
||||
image_widget.setData(0, QtCore.Qt.ItemDataRole.UserRole, version)
|
||||
image_widget.setData(1, QtCore.Qt.ItemDataRole.UserRole, image)
|
||||
image_widget.setData(2, QtCore.Qt.ItemDataRole.UserRole, self._appliance)
|
||||
top.addChild(image_widget)
|
||||
|
||||
font = top.font(0)
|
||||
@@ -372,10 +393,10 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
expand = False
|
||||
top.setForeground(2, QtGui.QBrush(QtGui.QColor("green")))
|
||||
|
||||
top.setData(1, QtCore.Qt.DisplayRole, human_filesize(size))
|
||||
top.setData(2, QtCore.Qt.DisplayRole, status)
|
||||
top.setData(0, QtCore.Qt.UserRole, version)
|
||||
top.setData(2, QtCore.Qt.UserRole, self._appliance)
|
||||
top.setData(1, QtCore.Qt.ItemDataRole.DisplayRole, human_filesize(size))
|
||||
top.setData(2, QtCore.Qt.ItemDataRole.DisplayRole, status)
|
||||
top.setData(0, QtCore.Qt.ItemDataRole.UserRole, version)
|
||||
top.setData(2, QtCore.Qt.ItemDataRole.UserRole, self._appliance)
|
||||
self.uiApplianceVersionTreeWidget.addTopLevelItem(top)
|
||||
if expand:
|
||||
top.setExpanded(True)
|
||||
@@ -407,7 +428,7 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
|
||||
for version in self._appliance["versions"]:
|
||||
for image in version["images"].values():
|
||||
img = self._registry.search_image_file(self._appliance.emulator(),
|
||||
img = self._registry.search_image_file(self._appliance.template_type(),
|
||||
image["filename"],
|
||||
image.get("md5sum"),
|
||||
image.get("filesize"),
|
||||
@@ -438,7 +459,7 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
if current is None or sip.isdeleted(current):
|
||||
return
|
||||
|
||||
image = current.data(1, QtCore.Qt.UserRole)
|
||||
image = current.data(1, QtCore.Qt.ItemDataRole.UserRole)
|
||||
if image is not None:
|
||||
if "direct_download_url" in image or "download_url" in image:
|
||||
self.uiDownloadPushButton.show()
|
||||
@@ -459,7 +480,7 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
if current is None or sip.isdeleted(current):
|
||||
return
|
||||
|
||||
data = current.data(1, QtCore.Qt.UserRole)
|
||||
data = current.data(1, QtCore.Qt.ItemDataRole.UserRole)
|
||||
if data is not None:
|
||||
if "direct_download_url" in data:
|
||||
QtGui.QDesktopServices.openUrl(QtCore.QUrl(data["direct_download_url"]))
|
||||
@@ -479,16 +500,16 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
if current is None:
|
||||
QtWidgets.QMessageBox.critical(self.parent(), "Base version", "Please select a base version")
|
||||
return
|
||||
base_version = current.data(0, QtCore.Qt.UserRole)
|
||||
base_version = current.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
|
||||
new_version_name, ok = QtWidgets.QInputDialog.getText(self, "Creating a new version", "Create a new version for this appliance.\nPlease share your experience on the GNS3 community if this version works.\n\nVersion name:", QtWidgets.QLineEdit.Normal, base_version.get("name"))
|
||||
new_version_name, ok = QtWidgets.QInputDialog.getText(self, "Creating a new version", "Create a new version for this appliance.\nPlease share your experience on the GNS3 community if this version works.\n\nVersion name:", QtWidgets.QLineEdit.EchoMode.Normal, base_version.get("name"))
|
||||
if ok:
|
||||
new_version = {"name": new_version_name}
|
||||
new_version["images"] = {}
|
||||
|
||||
for disk_type in base_version["images"]:
|
||||
base_filename = base_version["images"][disk_type]["filename"]
|
||||
filename, ok = QtWidgets.QInputDialog.getText(self, "Image", "Disk image filename for {}".format(disk_type), QtWidgets.QLineEdit.Normal, base_filename)
|
||||
filename, ok = QtWidgets.QInputDialog.getText(self, "Image", "Disk image filename for {}".format(disk_type), QtWidgets.QLineEdit.EchoMode.Normal, base_filename)
|
||||
if not ok:
|
||||
filename = base_filename
|
||||
new_version["images"][disk_type] = {"filename": filename, "version": new_version_name}
|
||||
@@ -513,19 +534,29 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
current = self.uiApplianceVersionTreeWidget.currentItem()
|
||||
if not current:
|
||||
return
|
||||
disk = current.data(1, QtCore.Qt.UserRole)
|
||||
disk = current.data(1, QtCore.Qt.ItemDataRole.UserRole)
|
||||
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName()
|
||||
if len(path) == 0:
|
||||
return
|
||||
|
||||
image = Image(self._appliance.emulator(), path, filename=disk["filename"])
|
||||
image = Image(self._appliance.template_type(), path, filename=disk["filename"])
|
||||
try:
|
||||
if "md5sum" in disk and image.md5sum != disk["md5sum"]:
|
||||
reply = QtWidgets.QMessageBox.question(self, "Add appliance",
|
||||
"This is not the correct file. The MD5 sum is {} and should be {}.\nDo you want to accept it at your own risks?".format(image.md5sum, disk["md5sum"]),
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
reply = QtWidgets.QMessageBox.question(
|
||||
self,
|
||||
"Add appliance",
|
||||
"This is not the correct file.\n\n"
|
||||
"MD5 checksum\n"
|
||||
f"actual:\t{image.md5sum}\n"
|
||||
f"expected:\t{disk['md5sum']}\n\n"
|
||||
"File size\n"
|
||||
f"actual:\t{image.filesize} bytes\n"
|
||||
f"expected:\t{disk['filesize']} bytes\n\n"
|
||||
"Do you want to accept it at your own risks?",
|
||||
QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No
|
||||
)
|
||||
if reply == QtWidgets.QMessageBox.StandardButton.No:
|
||||
return
|
||||
except OSError as e:
|
||||
QtWidgets.QMessageBox.warning(self.parent(), "Add appliance", "Can't access to the image file {}: {}.".format(path, str(e)))
|
||||
@@ -554,7 +585,11 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
if self.uiQemuListComboBox.count() == 1:
|
||||
self.next()
|
||||
else:
|
||||
i = self.uiQemuListComboBox.findData(self._appliance["qemu"]["arch"], flags=QtCore.Qt.MatchEndsWith)
|
||||
if self._appliance["registry_version"] >= 8:
|
||||
qemu_platform = self._appliance.template_properties()["platform"]
|
||||
else:
|
||||
qemu_platform = self._appliance.template_properties()["arch"]
|
||||
i = self.uiQemuListComboBox.findData(qemu_platform, flags=QtCore.Qt.MatchFlag.MatchEndsWith)
|
||||
if i != -1:
|
||||
self.uiQemuListComboBox.setCurrentIndex(i)
|
||||
|
||||
@@ -567,8 +602,8 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
|
||||
if version is None:
|
||||
appliance_configuration = self._appliance.copy()
|
||||
if "docker" not in appliance_configuration:
|
||||
# only Docker do not have version
|
||||
if self._appliance.template_type() != "docker":
|
||||
# only Docker do not have versions
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
@@ -580,22 +615,27 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
template_manager = TemplateManager().instance()
|
||||
while len(appliance_configuration["name"]) == 0 or not template_manager.is_name_available(appliance_configuration["name"]):
|
||||
QtWidgets.QMessageBox.warning(self.parent(), "Add template", "The name \"{}\" is already used by another template".format(appliance_configuration["name"]))
|
||||
appliance_configuration["name"], ok = QtWidgets.QInputDialog.getText(self.parent(), "Add template", "New name:", QtWidgets.QLineEdit.Normal, appliance_configuration["name"])
|
||||
appliance_configuration["name"], ok = QtWidgets.QInputDialog.getText(self.parent(), "Add template", "New name:", QtWidgets.QLineEdit.EchoMode.Normal, appliance_configuration["name"])
|
||||
if not ok:
|
||||
return False
|
||||
appliance_configuration["name"] = appliance_configuration["name"].strip()
|
||||
|
||||
if "qemu" in appliance_configuration:
|
||||
if self._appliance["registry_version"] >= 8:
|
||||
if "settings" in appliance_configuration:
|
||||
for settings in appliance_configuration["settings"]:
|
||||
if settings["template_type"] == "qemu":
|
||||
settings["template_properties"]["path"] = self.uiQemuListComboBox.currentData()
|
||||
elif "qemu" in appliance_configuration:
|
||||
appliance_configuration["qemu"]["path"] = self.uiQemuListComboBox.currentData()
|
||||
|
||||
new_template = ApplianceToTemplate().new_template(appliance_configuration, self._compute_id, self._symbols, parent=self)
|
||||
new_template = ApplianceToTemplate().new_template(appliance_configuration, self._compute_id, version, self._symbols, parent=self)
|
||||
TemplateManager.instance().createTemplate(Template(new_template), callback=self._templateCreatedCallback)
|
||||
return False
|
||||
|
||||
#worker = WaitForLambdaWorker(lambda: self._create_template(appliance_configuration, self._compute_id), allowed_exceptions=[ConfigException, OSError])
|
||||
#progress_dialog = ProgressDialog(worker, "Add template", "Installing a new template...", None, busy=True, parent=self)
|
||||
#progress_dialog.show()
|
||||
#if progress_dialog.exec_():
|
||||
#if progress_dialog.exec():
|
||||
# QtWidgets.QMessageBox.information(self.parent(), "Add template", "{} template has been installed!".format(appliance_configuration["name"]))
|
||||
# return True
|
||||
#return False
|
||||
@@ -603,7 +643,7 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
# worker = WaitForLambdaWorker(lambda: config.save(), allowed_exceptions=[ConfigException, OSError])
|
||||
# progress_dialog = ProgressDialog(worker, "Add appliance", "Install the appliance...", None, busy=True, parent=self)
|
||||
# progress_dialog.show()
|
||||
# if progress_dialog.exec_():
|
||||
# if progress_dialog.exec():
|
||||
# QtWidgets.QMessageBox.information(self.parent(), "Add appliance", "{} installed!".format(appliance_configuration["name"]))
|
||||
# return True
|
||||
|
||||
@@ -632,7 +672,7 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
if not Controller.instance().isRemote() and self._compute_id == "local" and image["path"].startswith(ImageManager.instance().getDirectory()):
|
||||
log.debug("{} is already on the local server".format(image["path"]))
|
||||
return
|
||||
image = Image(self._appliance.emulator(), image["path"], filename=image["filename"])
|
||||
image = Image(self._appliance.template_type(), image["path"], filename=image["filename"])
|
||||
image_upload_manager = ImageUploadManager(image, Controller.instance(), self._compute_id, self._applianceImageUploadedCallback, LocalConfig.instance().directFileUpload())
|
||||
image_upload_manager.upload()
|
||||
self._image_uploading_count += 1
|
||||
@@ -649,12 +689,16 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
|
||||
def nextId(self):
|
||||
if self.currentPage() == self.uiServerWizardPage:
|
||||
if "docker" in self._appliance:
|
||||
if self._appliance.template_type() == "docker":
|
||||
# skip Qemu binary selection and files pages if this is a Docker appliance
|
||||
return super().nextId() + 2
|
||||
elif "qemu" not in self._appliance:
|
||||
return super().nextId() + 3
|
||||
elif self._appliance.template_type() != "qemu":
|
||||
# skip the Qemu binary selection page if not a Qemu appliance
|
||||
return super().nextId() + 1
|
||||
if self.currentPage() == self.uiQemuWizardPage:
|
||||
if not self._appliance.get("installation_instructions"):
|
||||
# skip the installation instructions page if there are no instructions
|
||||
return super().nextId() + 1
|
||||
return super().nextId()
|
||||
|
||||
def validateCurrentPage(self):
|
||||
@@ -670,18 +714,18 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
current = self.uiApplianceVersionTreeWidget.currentItem()
|
||||
if current is None or sip.isdeleted(current):
|
||||
return False
|
||||
version = current.data(0, QtCore.Qt.UserRole)
|
||||
version = current.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
if version is None:
|
||||
return False
|
||||
appliance = current.data(2, QtCore.Qt.UserRole)
|
||||
appliance = current.data(2, QtCore.Qt.ItemDataRole.UserRole)
|
||||
try:
|
||||
self._appliance.search_images_for_version(version["name"])
|
||||
except ApplianceError as e:
|
||||
QtWidgets.QMessageBox.critical(self, "Appliance", "Cannot install {} version {}: {}".format(appliance["name"], version["name"], e))
|
||||
return False
|
||||
reply = QtWidgets.QMessageBox.question(self, "Appliance", "Would you like to install {} version {}?".format(appliance["name"], version["name"]),
|
||||
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 False
|
||||
|
||||
self._uploadImages(appliance["name"], version["name"])
|
||||
@@ -696,7 +740,7 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
return False
|
||||
current = self.uiApplianceVersionTreeWidget.currentItem()
|
||||
if current:
|
||||
version = current.data(0, QtCore.Qt.UserRole)
|
||||
version = current.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
return self._install(version["name"])
|
||||
else:
|
||||
return self._install(None)
|
||||
@@ -715,14 +759,13 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
if ComputeManager.instance().localPlatform():
|
||||
if (ComputeManager.instance().localPlatform().startswith("darwin") or ComputeManager.instance().localPlatform().startswith("win")):
|
||||
if "qemu" in self._appliance:
|
||||
reply = QtWidgets.QMessageBox.question(self, "Appliance", "Qemu on Windows and macOS is not supported by the GNS3 team. Do you want to continue?", QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
reply = QtWidgets.QMessageBox.question(self, "Appliance", "Qemu on Windows and macOS is not supported by the GNS3 team. Do you want to continue?", QtWidgets.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.No)
|
||||
if reply == QtWidgets.QMessageBox.StandardButton.No:
|
||||
return False
|
||||
self._compute_id = "local"
|
||||
|
||||
elif self.currentPage() == self.uiQemuWizardPage:
|
||||
# validate the Qemu
|
||||
|
||||
if self._server_check is False:
|
||||
QtWidgets.QMessageBox.critical(self, "Checking for KVM support", "Please wait for the server to reply...")
|
||||
return False
|
||||
@@ -778,8 +821,8 @@ class ApplianceWizard(QtWidgets.QWizard, Ui_ApplianceWizard):
|
||||
reply = QtWidgets.QMessageBox.question(self, "Custom files",
|
||||
"This option allows files with different MD5 checksums. This feature is only for advanced users and can lead "
|
||||
"to unexpected problems. Do you want to proceed?",
|
||||
QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.No)
|
||||
QtWidgets.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.No)
|
||||
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
if reply == QtWidgets.QMessageBox.StandardButton.No:
|
||||
self.allowCustomFiles.setChecked(False)
|
||||
return False
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -59,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:
|
||||
|
||||
@@ -93,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():
|
||||
@@ -123,7 +123,7 @@ 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_():
|
||||
if dialog.exec():
|
||||
return True, dialog.uiCommandPlainTextEdit.toPlainText().replace("\n", " ")
|
||||
return False, None
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class CustomAdaptersConfigurationDialog(QtWidgets.QDialog, Ui_CustomAdaptersConf
|
||||
self._custom_adapters = custom_adapters
|
||||
self._base_mac_address = base_mac_address
|
||||
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self._resetSlot)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Reset).clicked.connect(self._resetSlot)
|
||||
|
||||
if self._default_adapter_type and self._adapter_types:
|
||||
self.uiAdaptersTreeWidget.setColumnCount(3)
|
||||
@@ -115,10 +115,10 @@ class CustomAdaptersConfigurationDialog(QtWidgets.QDialog, Ui_CustomAdaptersConf
|
||||
adapter_number = 0
|
||||
for port_name in self._ports:
|
||||
item = TreeWidgetItem(self.uiAdaptersTreeWidget)
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemFlag.ItemIsEditable)
|
||||
item.setText(0, "Adapter {}".format(adapter_number))
|
||||
item.setData(0, QtCore.Qt.UserRole, adapter_number)
|
||||
item.setData(1, QtCore.Qt.UserRole, port_name)
|
||||
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))
|
||||
|
||||
@@ -131,7 +131,7 @@ class CustomAdaptersConfigurationDialog(QtWidgets.QDialog, Ui_CustomAdaptersConf
|
||||
index = 0
|
||||
for adapter_type, adapter_description in self._adapter_types.items():
|
||||
combobox.addItem("{}".format(adapter_type))
|
||||
combobox.setItemData(index, adapter_description, QtCore.Qt.ToolTipRole)
|
||||
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)
|
||||
@@ -147,7 +147,7 @@ class CustomAdaptersConfigurationDialog(QtWidgets.QDialog, Ui_CustomAdaptersConf
|
||||
adapter_number += 1
|
||||
|
||||
self.uiAdaptersTreeWidget.setItemDelegateForColumn(0, NoEditDelegate(self))
|
||||
self.uiAdaptersTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
|
||||
self.uiAdaptersTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
self.uiAdaptersTreeWidget.setSortingEnabled(True)
|
||||
|
||||
for column in range(self.uiAdaptersTreeWidget.columnCount()):
|
||||
@@ -166,9 +166,9 @@ class CustomAdaptersConfigurationDialog(QtWidgets.QDialog, Ui_CustomAdaptersConf
|
||||
custom_adapter_settings = {}
|
||||
item = self.uiAdaptersTreeWidget.topLevelItem(row)
|
||||
port_name = item.text(1)
|
||||
adapter_number = item.data(0, QtCore.Qt.UserRole)
|
||||
adapter_number = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
custom_adapter_settings["adapter_number"] = adapter_number
|
||||
original_port_name = item.data(1, QtCore.Qt.UserRole)
|
||||
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
|
||||
|
||||
@@ -223,4 +223,4 @@ if __name__ == '__main__':
|
||||
main = QtWidgets.QMainWindow()
|
||||
dialog = DoctorDialog(main, console=True)
|
||||
# dialog.show()
|
||||
#exit_code = app.exec_()
|
||||
#exit_code = app.exec()
|
||||
|
||||
@@ -121,4 +121,4 @@ if __name__ == '__main__':
|
||||
main = QtWidgets.QMainWindow()
|
||||
dialog = EditComputeDialog(main)
|
||||
dialog.show()
|
||||
exit_code = app.exec_()
|
||||
exit_code = app.exec()
|
||||
|
||||
@@ -39,26 +39,18 @@ class EditProjectDialog(QtWidgets.QDialog, Ui_EditProjectDialog):
|
||||
self.uiNodeGridSizeSpinBox.setValue(self._project.nodeGridSize())
|
||||
self.uiDrawingGridSizeSpinBox.setValue(self._project.drawingGridSize())
|
||||
|
||||
self.uiGlobalVariablesGrid.setAlignment(QtCore.Qt.AlignTop)
|
||||
self.uiGlobalVariablesGrid.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
|
||||
self.uiNewVarButton = QtWidgets.QPushButton('Add new variable', self)
|
||||
self.uiNewVarButton.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
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.AlignRight)
|
||||
self.uiGlobalVariablesGrid.addWidget(self.uiNewVarButton, 0, 3, QtCore.Qt.AlignmentFlag.AlignRight)
|
||||
|
||||
self._variables = self.setUpVariables()
|
||||
self._variables = self._project.variables()
|
||||
if not self._variables:
|
||||
self._variables = [{"name": "", "value": ""}]
|
||||
self.updateGlobalVariables()
|
||||
|
||||
def setUpVariables(self):
|
||||
new_variable = {"name": "", "value": ""}
|
||||
variables = self._project.variables()
|
||||
|
||||
if variables is not None:
|
||||
variables.append(new_variable)
|
||||
else:
|
||||
variables = [new_variable]
|
||||
return variables
|
||||
|
||||
def updateGlobalVariables(self):
|
||||
while True:
|
||||
item = self.uiGlobalVariablesGrid.takeAt(1)
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -38,9 +38,9 @@ class FilterDialog(QtWidgets.QDialog, Ui_FilterDialog):
|
||||
self._link.listAvailableFilters(self._listAvailableFiltersCallback)
|
||||
self._initialized = False
|
||||
self._filter_items = {}
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self._helpSlot)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self._resetSlot)
|
||||
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:
|
||||
@@ -91,7 +91,7 @@ class FilterDialog(QtWidgets.QDialog, Ui_FilterDialog):
|
||||
spinBox.setMinimum(param["minimum"])
|
||||
spinBox.setMaximum(param["maximum"])
|
||||
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(spinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -112,7 +112,7 @@ class FilterDialog(QtWidgets.QDialog, Ui_FilterDialog):
|
||||
textEdit = QtWidgets.QTextEdit()
|
||||
textEdit.setAcceptRichText(False)
|
||||
filter["textEdits"].append(textEdit)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
textEdit.setMinimumWidth(300)
|
||||
@@ -128,7 +128,7 @@ class FilterDialog(QtWidgets.QDialog, Ui_FilterDialog):
|
||||
|
||||
line += 1
|
||||
|
||||
spacerItem = QtWidgets.QSpacerItem(1, 1, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
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)
|
||||
|
||||
@@ -33,8 +33,8 @@ 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
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
import sys
|
||||
import tempfile
|
||||
import json
|
||||
import sip
|
||||
import os
|
||||
|
||||
from ..qt import sip
|
||||
from gns3.qt import QtCore, QtWidgets, qpartial
|
||||
from gns3.controller import Controller
|
||||
from gns3.appliance_manager import ApplianceManager
|
||||
@@ -41,16 +41,16 @@ class NewTemplateWizard(QtWidgets.QWizard, Ui_NewTemplateWizard):
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
|
||||
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)
|
||||
|
||||
# add a custom button to show appliance information
|
||||
self.setButtonText(QtWidgets.QWizard.CustomButton1, "&Update from online registry")
|
||||
self.setOption(QtWidgets.QWizard.HaveCustomButton1, True)
|
||||
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.CustomButton1).hide()
|
||||
self.button(QtWidgets.QWizard.WizardButton.CustomButton1).hide()
|
||||
self.uiFilterLineEdit.textChanged.connect(self._filterTextChangedSlot)
|
||||
ApplianceManager.instance().appliances_changed_signal.connect(self._appliancesChangedSlot)
|
||||
|
||||
@@ -154,16 +154,16 @@ class NewTemplateWizard(QtWidgets.QWizard, Ui_NewTemplateWizard):
|
||||
self.uiAppliancesTreeWidget.clear()
|
||||
parent_routers = QtWidgets.QTreeWidgetItem(self.uiAppliancesTreeWidget)
|
||||
parent_routers.setText(0, "Routers")
|
||||
parent_routers.setFlags(parent_routers.flags() & ~QtCore.Qt.ItemIsSelectable)
|
||||
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.ItemIsSelectable)
|
||||
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.ItemIsSelectable)
|
||||
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.ItemIsSelectable)
|
||||
parent_firewalls.setFlags(parent_firewalls.flags() & ~QtCore.Qt.ItemFlag.ItemIsSelectable)
|
||||
self.uiAppliancesTreeWidget.expandAll()
|
||||
|
||||
for appliance in ApplianceManager.instance().appliances():
|
||||
@@ -200,14 +200,14 @@ class NewTemplateWizard(QtWidgets.QWizard, Ui_NewTemplateWizard):
|
||||
item.setText(1, "N/A")
|
||||
|
||||
item.setText(2, appliance["vendor_name"])
|
||||
item.setData(0, QtCore.Qt.UserRole, appliance)
|
||||
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.AscendingOrder)
|
||||
self.uiAppliancesTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
self.uiAppliancesTreeWidget.resizeColumnToContents(0)
|
||||
if not appliance_filter:
|
||||
self.uiAppliancesTreeWidget.collapseAll()
|
||||
@@ -221,19 +221,19 @@ class NewTemplateWizard(QtWidgets.QWizard, Ui_NewTemplateWizard):
|
||||
|
||||
super().initializePage(page_id)
|
||||
if self.page(page_id) == self.uiApplianceFromServerWizardPage:
|
||||
self.button(QtWidgets.QWizard.CustomButton1).show()
|
||||
self.setButtonText(QtWidgets.QWizard.FinishButton, "&Install")
|
||||
self.button(QtWidgets.QWizard.WizardButton.CustomButton1).show()
|
||||
self.setButtonText(QtWidgets.QWizard.WizardButton.FinishButton, "&Install")
|
||||
self._get_appliances_from_server()
|
||||
else:
|
||||
self.button(QtWidgets.QWizard.CustomButton1).hide()
|
||||
self.button(QtWidgets.QWizard.WizardButton.CustomButton1).hide()
|
||||
|
||||
def cleanupPage(self, page_id):
|
||||
"""
|
||||
Restore button default settings on the first page.
|
||||
"""
|
||||
|
||||
self.button(QtWidgets.QWizard.CustomButton1).hide()
|
||||
self.setButtonText(QtWidgets.QWizard.FinishButton, "&Finish")
|
||||
self.button(QtWidgets.QWizard.WizardButton.CustomButton1).hide()
|
||||
self.setButtonText(QtWidgets.QWizard.WizardButton.FinishButton, "&Finish")
|
||||
super().cleanupPage(page_id)
|
||||
|
||||
def validateCurrentPage(self):
|
||||
@@ -274,7 +274,7 @@ class NewTemplateWizard(QtWidgets.QWizard, Ui_NewTemplateWizard):
|
||||
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.UserRole), f)
|
||||
json.dump(item.data(0, QtCore.Qt.ItemDataRole.UserRole), f)
|
||||
f.close()
|
||||
MainWindow.instance().loadPath(f.name)
|
||||
try:
|
||||
|
||||
@@ -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,19 +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.Help).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.Help).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.Help).show()
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help).show()
|
||||
else:
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Help).hide()
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help).hide()
|
||||
|
||||
def on_uiButtonBox_clicked(self, button):
|
||||
"""
|
||||
@@ -157,13 +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.Help):
|
||||
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Help):
|
||||
self.showHelp()
|
||||
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Cancel):
|
||||
elif button == self.uiButtonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Cancel):
|
||||
QtWidgets.QDialog.reject(self)
|
||||
else:
|
||||
self.applySettings()
|
||||
|
||||
@@ -54,12 +54,12 @@ class NotifDialog(QtWidgets.QWidget):
|
||||
super().__init__(parent)
|
||||
self._notifs = []
|
||||
|
||||
self.setWindowFlags(QtCore.Qt.FramelessWindowHint |
|
||||
QtCore.Qt.WindowDoesNotAcceptFocus |
|
||||
QtCore.Qt.SubWindow)
|
||||
# QtCore.Qt.Tool)
|
||||
# QtCore.Qt.WindowStaysOnTopHint)
|
||||
self.setAttribute(QtCore.Qt.WA_ShowWithoutActivating) # | QtCore.Qt.WA_TranslucentBackground)
|
||||
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()
|
||||
|
||||
@@ -70,7 +70,7 @@ class NotifDialog(QtWidgets.QWidget):
|
||||
|
||||
for i in range(0, MAX_ELEMENTS):
|
||||
l = QtWidgets.QLabel()
|
||||
l.setAlignment(QtCore.Qt.AlignTop)
|
||||
l.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
l.setWordWrap(True)
|
||||
l.hide()
|
||||
self._layout.addWidget(l)
|
||||
@@ -187,4 +187,4 @@ if __name__ == '__main__':
|
||||
main.setMinimumWidth(600)
|
||||
main.setMinimumHeight(600)
|
||||
main.show()
|
||||
exit_code = app.exec_()
|
||||
exit_code = app.exec()
|
||||
|
||||
@@ -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
|
||||
@@ -49,8 +49,9 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
|
||||
# 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:
|
||||
@@ -60,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}")
|
||||
@@ -73,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):
|
||||
@@ -95,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)
|
||||
@@ -111,7 +112,7 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
|
||||
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]:
|
||||
@@ -176,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)
|
||||
@@ -192,9 +193,9 @@ class PreferencesDialog(QtWidgets.QDialog, Ui_PreferencesDialog):
|
||||
for index in range(0, self.uiStackedWidget.count()):
|
||||
page = self.uiStackedWidget.widget(index)
|
||||
if self.uiStackedWidget.currentIndex() == index:
|
||||
page.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
page.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
else:
|
||||
page.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
|
||||
page.setSizePolicy(QtWidgets.QSizePolicy.Policy.Ignored, QtWidgets.QSizePolicy.Policy.Ignored)
|
||||
|
||||
def _applyPreferences(self):
|
||||
"""
|
||||
@@ -223,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)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ 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__
|
||||
@@ -46,7 +46,7 @@ class ProfileSelectDialog(QtWidgets.QDialog, Ui_ProfileSelectDialog):
|
||||
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])
|
||||
@@ -54,8 +54,14 @@ class ProfileSelectDialog(QtWidgets.QDialog, Ui_ProfileSelectDialog):
|
||||
appdata = os.path.expandvars("%APPDATA%")
|
||||
path = os.path.join(appdata, "GNS3", version)
|
||||
else:
|
||||
home = os.path.expanduser("~")
|
||||
path = os.path.join(home, ".config", "GNS3", version)
|
||||
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())
|
||||
@@ -103,4 +109,4 @@ if __name__ == '__main__':
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
dialog = ProfileSelectDialog()
|
||||
dialog.show()
|
||||
exit_code = app.exec_()
|
||||
exit_code = app.exec()
|
||||
|
||||
@@ -93,15 +93,15 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
|
||||
for project in self.uiProjectsTreeWidget.selectedItems():
|
||||
if sip_is_deleted(project):
|
||||
continue
|
||||
project_id = project.data(0, QtCore.Qt.UserRole)
|
||||
project_name = project.data(1, QtCore.Qt.UserRole)
|
||||
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:
|
||||
@@ -118,8 +118,8 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
|
||||
return
|
||||
|
||||
for project in self.uiProjectsTreeWidget.selectedItems():
|
||||
project_id = project.data(0, QtCore.Qt.UserRole)
|
||||
project_name = project.data(1, QtCore.Qt.UserRole)
|
||||
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()]
|
||||
@@ -131,7 +131,7 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
|
||||
name, reply = QtWidgets.QInputDialog.getText(self,
|
||||
"Duplicate project",
|
||||
'Duplicate project "{}"?.'.format(project_name),
|
||||
QtWidgets.QLineEdit.Normal,
|
||||
QtWidgets.QLineEdit.EchoMode.Normal,
|
||||
new_project_name)
|
||||
name = name.strip()
|
||||
if reply and len(name) > 0:
|
||||
@@ -167,9 +167,9 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
|
||||
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.UserRole, project["project_id"])
|
||||
item.setData(1, QtCore.Qt.UserRole, project["name"])
|
||||
item.setData(2, QtCore.Qt.UserRole, 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)
|
||||
|
||||
@@ -180,7 +180,7 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
|
||||
self.uiProjectsTreeWidget.resizeColumnToContents(0)
|
||||
self.uiProjectsTreeWidget.resizeColumnToContents(1)
|
||||
self.uiProjectsTreeWidget.resizeColumnToContents(2)
|
||||
self.uiProjectsTreeWidget.sortItems(0, QtCore.Qt.AscendingOrder)
|
||||
self.uiProjectsTreeWidget.sortItems(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
self.uiProjectsTreeWidget.setUpdatesEnabled(True)
|
||||
|
||||
def keyPressEvent(self, e):
|
||||
@@ -188,7 +188,7 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
|
||||
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):
|
||||
@@ -289,10 +289,10 @@ class ProjectDialog(QtWidgets.QDialog, Ui_ProjectDialog):
|
||||
reply = QtWidgets.QMessageBox.warning(self,
|
||||
"New project",
|
||||
'Project "{}" already exists in location "{}", overwrite it?'.format(existing_project["name"], existing_project["path"]),
|
||||
QtWidgets.QMessageBox.Yes,
|
||||
QtWidgets.QMessageBox.No)
|
||||
QtWidgets.QMessageBox.StandardButton.Yes,
|
||||
QtWidgets.QMessageBox.StandardButton.No)
|
||||
|
||||
if reply == QtWidgets.QMessageBox.Yes:
|
||||
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
|
||||
@@ -313,6 +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_id"] = current.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
self._project_settings["project_name"] = current.data(1, QtCore.Qt.ItemDataRole.UserRole)
|
||||
super().done(result)
|
||||
|
||||
@@ -41,10 +41,10 @@ class ExportProjectWizard(QtWidgets.QWizard, Ui_ExportProjectWizard):
|
||||
|
||||
self._project = project
|
||||
self._path = None
|
||||
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.uiCompressionComboBox.addItem("None", "none")
|
||||
self.uiCompressionComboBox.addItem("Zip compression (deflate)", "zip")
|
||||
@@ -71,7 +71,7 @@ class ExportProjectWizard(QtWidgets.QWizard, Ui_ExportProjectWizard):
|
||||
|
||||
def _pathBrowserSlot(self):
|
||||
|
||||
directory = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.DocumentsLocation)
|
||||
directory = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.DocumentsLocation)
|
||||
if len(directory) == 0:
|
||||
directory = LocalServer.instance().localServerSettings()["projects_path"]
|
||||
|
||||
@@ -126,21 +126,19 @@ class ExportProjectWizard(QtWidgets.QWizard, Ui_ExportProjectWizard):
|
||||
"""
|
||||
|
||||
if result:
|
||||
include_images = include_snapshots = reset_mac_addresses = keep_compute_ids = "no"
|
||||
if self.uiIncludeImagesCheckBox.isChecked():
|
||||
include_images = "yes"
|
||||
else:
|
||||
include_images = "no"
|
||||
if self.uiIncludeSnapshotsCheckBox.isChecked():
|
||||
include_snapshots = "yes"
|
||||
else:
|
||||
include_snapshots = "no"
|
||||
if self.uiResetMacAddressesCheckBox.isChecked():
|
||||
reset_mac_addresses = "yes"
|
||||
else:
|
||||
reset_mac_addresses = "no"
|
||||
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, compression)
|
||||
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_()
|
||||
progress_dialog.exec()
|
||||
super().done(result)
|
||||
|
||||
@@ -35,7 +35,7 @@ class ProjectWelcomeDialog(QtWidgets.QDialog, Ui_ProjectWelcomeDialog):
|
||||
self._project = project
|
||||
self.setupUi(self)
|
||||
self.uiOkButton.clicked.connect(self._okButtonClickedSlot)
|
||||
self.gridLayout.setAlignment(QtCore.Qt.AlignTop)
|
||||
self.gridLayout.setAlignment(QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
self.label.setOpenExternalLinks(True)
|
||||
self._variables = self._getVariables(project)
|
||||
self._loadReadme()
|
||||
@@ -76,9 +76,9 @@ class ProjectWelcomeDialog(QtWidgets.QDialog, Ui_ProjectWelcomeDialog):
|
||||
reply = QtWidgets.QMessageBox.warning(self,
|
||||
"Missing values",
|
||||
"Are you sure you want to continue without providing missing values?",
|
||||
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
|
||||
|
||||
self._project.setVariables(self._variables)
|
||||
|
||||
@@ -57,10 +57,10 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
|
||||
"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.uiLocalServerToolButton.clicked.connect(self._localServerBrowserSlot)
|
||||
|
||||
@@ -82,7 +82,7 @@ class SetupWizard(QtWidgets.QWizard, Ui_SetupWizard):
|
||||
|
||||
# load all available addresses
|
||||
for address in QtNetwork.QNetworkInterface.allAddresses():
|
||||
if address.protocol() in [QtNetwork.QAbstractSocket.IPv4Protocol, QtNetwork.QAbstractSocket.IPv6Protocol]:
|
||||
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
|
||||
@@ -156,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()
|
||||
|
||||
@@ -67,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)
|
||||
@@ -83,7 +83,7 @@ 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")
|
||||
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,
|
||||
@@ -107,7 +107,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)
|
||||
Controller.instance().delete("/projects/{}/snapshots/{}".format(self._project.id(), snapshot_id), self._deleteSnapshotsCallback)
|
||||
|
||||
def _deleteSnapshotsCallback(self, result, error=False, server=None, context={}, **kwargs):
|
||||
@@ -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):
|
||||
@@ -135,8 +135,8 @@ 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, would you like to proceed?", 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),
|
||||
@@ -155,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)
|
||||
|
||||
@@ -22,6 +22,7 @@ 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):
|
||||
@@ -41,14 +42,14 @@ 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]
|
||||
@@ -70,8 +71,27 @@ class StyleEditorDialog(QtWidgets.QDialog, Ui_StyleEditorDialog):
|
||||
self._border_color.green(),
|
||||
self._border_color.blue(),
|
||||
self._border_color.alpha()))
|
||||
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)
|
||||
@@ -81,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(),
|
||||
@@ -94,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(),
|
||||
@@ -108,7 +128,7 @@ 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)
|
||||
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:
|
||||
@@ -116,10 +136,18 @@ class StyleEditorDialog(QtWidgets.QDialog, Ui_StyleEditorDialog):
|
||||
|
||||
for item in self._items:
|
||||
item.setPen(pen)
|
||||
# on multiselection it's possible to select many type of items
|
||||
# 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):
|
||||
|
||||
@@ -41,30 +41,41 @@ class StyleEditorDialogLink(QtWidgets.QDialog, Ui_StyleEditorDialog):
|
||||
self._link = link
|
||||
self._link_style = {}
|
||||
|
||||
self.uiBorderColorPushButton.clicked.connect(self._setBorderColorSlot)
|
||||
self.uiButtonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self._applyPreferencesSlot)
|
||||
self.uiBorderColorLabel.setText("Link color")
|
||||
self.uiBorderWidthLabel.setText("Link width")
|
||||
self.uiBorderStyleLabel.setText("Link style")
|
||||
|
||||
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("Invisible", QtCore.Qt.NoPen)
|
||||
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.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:
|
||||
@@ -77,7 +88,7 @@ class StyleEditorDialogLink(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(),
|
||||
@@ -91,17 +102,19 @@ class StyleEditorDialogLink(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)
|
||||
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 = {}
|
||||
new_link_style["color"] = self._border_color.name()
|
||||
new_link_style["width"] = self.uiBorderWidthSpinBox.value()
|
||||
new_link_style["type"] = border_style
|
||||
|
||||
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):
|
||||
"""
|
||||
|
||||
@@ -50,16 +50,16 @@ 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)
|
||||
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.uiSymbolTreeWidget.setFocus()
|
||||
@@ -85,14 +85,14 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
|
||||
font = parent.font(0)
|
||||
font.setBold(True)
|
||||
parent.setFont(0, font)
|
||||
parent.setFlags(parent.flags() & ~QtCore.Qt.ItemIsSelectable)
|
||||
parent.setFlags(parent.flags() & ~QtCore.Qt.ItemFlag.ItemIsSelectable)
|
||||
self._parents[theme] = parent
|
||||
else:
|
||||
parent = self._parents[theme]
|
||||
|
||||
name = os.path.splitext(symbol.filename())[0]
|
||||
item = QtWidgets.QTreeWidgetItem(parent)
|
||||
item.setData(0, QtCore.Qt.UserRole, symbol)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, symbol)
|
||||
item.setToolTip(0, symbol.id())
|
||||
self._symbol_items.append(item)
|
||||
item.setText(0, name)
|
||||
@@ -101,7 +101,7 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
|
||||
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))
|
||||
@@ -111,7 +111,7 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
|
||||
Controller.instance().getStatic(symbol.url(), qpartial(render, item))
|
||||
|
||||
for parent in self._parents.values():
|
||||
parent.sortChildren(0, QtCore.Qt.AscendingOrder)
|
||||
parent.sortChildren(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
self.adjustSize()
|
||||
|
||||
def _searchTextChangedSlot(self, text):
|
||||
@@ -123,7 +123,7 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
|
||||
"""
|
||||
text = self.uiSearchLineEdit.text()
|
||||
for item in self._symbol_items:
|
||||
# if not item.data(0, QtCore.Qt.UserRole).builtin():
|
||||
# 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():
|
||||
@@ -176,7 +176,7 @@ class SymbolSelectionDialog(QtWidgets.QDialog, Ui_SymbolSelectionDialog):
|
||||
if self.uiSymbolTreeWidget.isEnabled():
|
||||
current = self.uiSymbolTreeWidget.currentItem()
|
||||
if current and current.parent():
|
||||
return current.data(0, QtCore.Qt.UserRole).id()
|
||||
return current.data(0, QtCore.Qt.ItemDataRole.UserRole).id()
|
||||
else:
|
||||
return os.path.basename(self.uiSymbolLineEdit.text())
|
||||
return None
|
||||
@@ -184,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
|
||||
|
||||
@@ -39,7 +39,7 @@ 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]
|
||||
@@ -49,7 +49,7 @@ class TextEditorDialog(QtWidgets.QDialog, Ui_TextEditorDialog):
|
||||
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)
|
||||
@@ -77,7 +77,7 @@ class TextEditorDialog(QtWidgets.QDialog, Ui_TextEditorDialog):
|
||||
"""
|
||||
|
||||
selected_font, ok = QtWidgets.QFontDialog.getFont(self.uiPlainTextEdit.font(), self,
|
||||
options=QtWidgets.QFontDialog.DontUseNativeDialog)
|
||||
options=QtWidgets.QFontDialog.FontDialogOption.DontUseNativeDialog)
|
||||
if ok:
|
||||
self.uiPlainTextEdit.setFont(selected_font)
|
||||
|
||||
@@ -87,7 +87,7 @@ class TextEditorDialog(QtWidgets.QDialog, Ui_TextEditorDialog):
|
||||
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)
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class VMWithImagesWizard(VMWizard):
|
||||
|
||||
def _imageCreateSlot(self, line_edit, create_image_wizard, image_suffix):
|
||||
create_dialog = create_image_wizard(self, self.getSettings()["compute_id"], self.uiNameLineEdit.text() + image_suffix)
|
||||
if QtWidgets.QDialog.Accepted == create_dialog.exec_():
|
||||
if QtWidgets.QDialog.DialogCode.Accepted == create_dialog.exec():
|
||||
line_edit.setText(create_dialog.uiLocationLineEdit.text())
|
||||
|
||||
def _imageBrowserSlot(self, line_edit, image_selector):
|
||||
|
||||
@@ -39,10 +39,10 @@ class VMWizard(QtWidgets.QWizard):
|
||||
self._devices = devices
|
||||
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"):
|
||||
|
||||
@@ -74,6 +74,10 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
:param parent: parent widget
|
||||
"""
|
||||
|
||||
# Class-level constants for default colors
|
||||
DEFAULT_DRAWING_GRID_COLOR = QtGui.QColor(208, 208, 208) # #D0D0D0
|
||||
DEFAULT_NODE_GRID_COLOR = QtGui.QColor(190, 190, 190) # #BEBEBE
|
||||
|
||||
def __init__(self, parent):
|
||||
|
||||
# Our parent is the central widget which parent is the main window.
|
||||
@@ -92,6 +96,8 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
self._dragging = False
|
||||
self._grid_size = 75
|
||||
self._drawing_grid_size = 25
|
||||
self._drawing_grid_color = self.DEFAULT_DRAWING_GRID_COLOR
|
||||
self._node_grid_color = self.DEFAULT_NODE_GRID_COLOR
|
||||
self._last_mouse_position = None
|
||||
self._topology = Topology.instance()
|
||||
self._background_warning_msgbox = QtWidgets.QErrorMessage(self)
|
||||
@@ -105,14 +111,14 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
self.setSceneSize(width, height)
|
||||
|
||||
# set the custom flags for this view
|
||||
self.setDragMode(QtWidgets.QGraphicsView.RubberBandDrag)
|
||||
self.setRenderHint(QtGui.QPainter.Antialiasing)
|
||||
self.setTransformationAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse)
|
||||
self.setResizeAnchor(QtWidgets.QGraphicsView.AnchorViewCenter)
|
||||
self.setDragMode(QtWidgets.QGraphicsView.DragMode.RubberBandDrag)
|
||||
self.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing)
|
||||
self.setTransformationAnchor(QtWidgets.QGraphicsView.ViewportAnchor.AnchorUnderMouse)
|
||||
self.setResizeAnchor(QtWidgets.QGraphicsView.ViewportAnchor.AnchorViewCenter)
|
||||
|
||||
# default directories for QFileDialog
|
||||
self._import_config_directory = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.DocumentsLocation)
|
||||
self._export_config_directory = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.DocumentsLocation)
|
||||
self._import_config_directory = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.DocumentsLocation)
|
||||
self._export_config_directory = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.DocumentsLocation)
|
||||
self._local_addresses = ['0.0.0.0', '127.0.0.1', 'localhost', '::1', '0:0:0:0:0:0:0:1', '::', QtNetwork.QHostInfo.localHostName()]
|
||||
|
||||
def setSceneSize(self, width, height):
|
||||
@@ -121,8 +127,6 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
def setZoom(self, zoom):
|
||||
"""
|
||||
Sets zoom of the Graphics View
|
||||
:param zoom:
|
||||
:return:
|
||||
"""
|
||||
if zoom:
|
||||
factor = zoom / 100.
|
||||
@@ -193,6 +197,9 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
# clear all objects on the scene
|
||||
self.scene().clear()
|
||||
|
||||
# reset zoom / scale
|
||||
self.resetTransform()
|
||||
|
||||
|
||||
def _loadSettings(self):
|
||||
"""
|
||||
@@ -230,12 +237,12 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
"""
|
||||
|
||||
if enabled:
|
||||
self.setCursor(QtCore.Qt.CrossCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.CrossCursor)
|
||||
else:
|
||||
if self._newlink and self._newlink in self.scene().items():
|
||||
self.scene().removeItem(self._newlink)
|
||||
self._newlink = None
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
self._adding_link = enabled
|
||||
|
||||
def addNote(self, state):
|
||||
@@ -247,10 +254,10 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
if state:
|
||||
self._adding_note = True
|
||||
self.setCursor(QtCore.Qt.IBeamCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.IBeamCursor)
|
||||
else:
|
||||
self._adding_note = False
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
|
||||
def addRectangle(self, state):
|
||||
"""
|
||||
@@ -261,10 +268,10 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
if state:
|
||||
self._adding_rectangle = True
|
||||
self.setCursor(QtCore.Qt.PointingHandCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
|
||||
else:
|
||||
self._adding_rectangle = False
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
|
||||
def addEllipse(self, state):
|
||||
"""
|
||||
@@ -275,10 +282,10 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
if state:
|
||||
self._adding_ellipse = True
|
||||
self.setCursor(QtCore.Qt.PointingHandCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
|
||||
else:
|
||||
self._adding_ellipse = False
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
|
||||
def addLine(self, state):
|
||||
"""
|
||||
@@ -289,10 +296,10 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
if state:
|
||||
self._adding_line = True
|
||||
self.setCursor(QtCore.Qt.PointingHandCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.PointingHandCursor)
|
||||
else:
|
||||
self._adding_line = False
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
|
||||
def addImage(self, image_path):
|
||||
"""
|
||||
@@ -394,7 +401,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
# link addition code
|
||||
if not self._newlink:
|
||||
source_item = item
|
||||
source_port = source_item.connectToPort(event.globalPos())
|
||||
source_port = source_item.connectToPort(event.globalPosition().toPoint())
|
||||
if not source_port:
|
||||
return
|
||||
|
||||
@@ -403,15 +410,15 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
return
|
||||
|
||||
if source_port.linkType() == "Serial":
|
||||
self._newlink = SerialLinkItem(source_item, source_port, self.mapToScene(event.pos()), None, adding_flag=True)
|
||||
self._newlink = SerialLinkItem(source_item, source_port, self.mapToScene(event.position().toPoint()), None, adding_flag=True)
|
||||
else:
|
||||
self._newlink = EthernetLinkItem(source_item, source_port, self.mapToScene(event.pos()), None, adding_flag=True)
|
||||
self._newlink = EthernetLinkItem(source_item, source_port, self.mapToScene(event.position().toPoint()), None, adding_flag=True)
|
||||
self.scene().addItem(self._newlink)
|
||||
else:
|
||||
source_item = self._newlink.sourceItem()
|
||||
source_port = self._newlink.sourcePort()
|
||||
destination_item = item
|
||||
destination_port = destination_item.connectToPort(event.globalPos())
|
||||
destination_port = destination_item.connectToPort(event.globalPosition().toPoint())
|
||||
if not destination_port:
|
||||
return
|
||||
|
||||
@@ -434,9 +441,11 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
is_not_link = True
|
||||
is_not_logo = True
|
||||
|
||||
item = self.itemAt(event.pos())
|
||||
item = self.itemAt(event.position().toPoint())
|
||||
if item and sip.isdeleted(item):
|
||||
return
|
||||
elif not item:
|
||||
self._main_window.uiStatusBar.clearMessage() # reset the status bar message when clicking on the scene
|
||||
|
||||
if item and (isinstance(item, LinkItem) or isinstance(item.parentItem(), LinkItem)):
|
||||
is_not_link = False
|
||||
@@ -447,57 +456,57 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
if isinstance(it, LinkItem):
|
||||
it.setHovered(False)
|
||||
|
||||
if (event.buttons() == QtCore.Qt.LeftButton and event.modifiers() == QtCore.Qt.ShiftModifier) or event.buttons() == QtCore.Qt.MidButton:
|
||||
if (event.buttons() == QtCore.Qt.MouseButton.LeftButton and event.modifiers() == QtCore.Qt.KeyboardModifier.ShiftModifier) or event.buttons() == QtCore.Qt.MouseButton.MiddleButton:
|
||||
# checks to see if either the middle mouse is pressed
|
||||
# or a combination of left mouse button and SHIT key are pressed to start dragging the view
|
||||
self._last_mouse_position = self.mapFromGlobal(event.globalPos())
|
||||
self._last_mouse_position = self.mapFromGlobal(event.globalPosition())
|
||||
self._dragging = True
|
||||
self.setCursor(QtCore.Qt.ClosedHandCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ClosedHandCursor)
|
||||
return
|
||||
|
||||
if is_not_link and item and event.modifiers() == QtCore.Qt.ControlModifier and event.button() == QtCore.Qt.LeftButton and item and not self._adding_link:
|
||||
if is_not_link and item and event.modifiers() == QtCore.Qt.KeyboardModifier.ControlModifier and event.button() == QtCore.Qt.MouseButton.LeftButton and item and not self._adding_link:
|
||||
# manual selection using CTRL
|
||||
if item.isSelected():
|
||||
item.setSelected(False)
|
||||
else:
|
||||
item.setSelected(True)
|
||||
elif is_not_link and is_not_logo and event.button() == QtCore.Qt.RightButton and not self._adding_link:
|
||||
elif is_not_link and is_not_logo and event.button() == QtCore.Qt.MouseButton.RightButton and not self._adding_link:
|
||||
pass #TODO: remove this without creating a bug...
|
||||
elif is_not_link and self._adding_link and event.button() == QtCore.Qt.RightButton:
|
||||
elif is_not_link and self._adding_link and event.button() == QtCore.Qt.MouseButton.RightButton:
|
||||
# send a escape key to the main window to cancel the link addition
|
||||
key = QtGui.QKeyEvent(QtCore.QEvent.KeyPress, QtCore.Qt.Key_Escape, QtCore.Qt.NoModifier)
|
||||
key = QtGui.QKeyEvent(QtCore.QEvent.Type.KeyPress, QtCore.Qt.Key.Key_Escape, QtCore.Qt.KeyboardModifier.NoModifier)
|
||||
QtWidgets.QApplication.sendEvent(self._main_window, key)
|
||||
elif item and isinstance(item, NodeItem) and self._adding_link and event.button() == QtCore.Qt.LeftButton:
|
||||
elif item and isinstance(item, NodeItem) and self._adding_link and event.button() == QtCore.Qt.MouseButton.LeftButton:
|
||||
self._userNodeLinking(event, item)
|
||||
#context_event = QtGui.QContextMenuEvent(QtGui.QContextMenuEvent.Mouse, event.pos())
|
||||
#context_event = QtGui.QContextMenuEvent(QtGui.QContextMenuEvent.Reason.Mouse, event.pos())
|
||||
#QtWidgets.QApplication.sendEvent(self, context_event)
|
||||
elif event.button() == QtCore.Qt.LeftButton and self._adding_note:
|
||||
pos = self.mapToScene(event.pos())
|
||||
elif event.button() == QtCore.Qt.MouseButton.LeftButton and self._adding_note:
|
||||
pos = self.mapToScene(event.position().toPoint())
|
||||
note = self.createDrawingItem("text", int(pos.x()), int(pos.y()), 2)
|
||||
pos_x = note.pos().x()
|
||||
pos_y = note.pos().y() - (note.boundingRect().height() / 2)
|
||||
note.setPos(pos_x, pos_y)
|
||||
note.editText()
|
||||
self._main_window.uiAddNoteAction.setChecked(False)
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
self._adding_note = False
|
||||
elif event.button() == QtCore.Qt.LeftButton and self._adding_rectangle:
|
||||
pos = self.mapToScene(event.pos())
|
||||
elif event.button() == QtCore.Qt.MouseButton.LeftButton and self._adding_rectangle:
|
||||
pos = self.mapToScene(event.position().toPoint())
|
||||
self.createDrawingItem("rect", int(pos.x()), int(pos.y()), 1)
|
||||
self._main_window.uiDrawRectangleAction.setChecked(False)
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
self._adding_rectangle = False
|
||||
elif event.button() == QtCore.Qt.LeftButton and self._adding_ellipse:
|
||||
pos = self.mapToScene(event.pos())
|
||||
elif event.button() == QtCore.Qt.MouseButton.LeftButton and self._adding_ellipse:
|
||||
pos = self.mapToScene(event.position().toPoint())
|
||||
self.createDrawingItem("ellipse", int(pos.x()), int(pos.y()), 1)
|
||||
self._main_window.uiDrawEllipseAction.setChecked(False)
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
self._adding_ellipse = False
|
||||
elif event.button() == QtCore.Qt.LeftButton and self._adding_line:
|
||||
pos = self.mapToScene(event.pos())
|
||||
elif event.button() == QtCore.Qt.MouseButton.LeftButton and self._adding_line:
|
||||
pos = self.mapToScene(event.position().toPoint())
|
||||
self.createDrawingItem("line", int(pos.x()), int(pos.y()), 1)
|
||||
self._main_window.uiDrawLineAction.setChecked(False)
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
self._adding_line = False
|
||||
else:
|
||||
super().mousePressEvent(event)
|
||||
@@ -531,7 +540,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
if item and not sip.isdeleted(item):
|
||||
# Prevent right clicking on a selected item from de-selecting all other items
|
||||
if not item.isSelected():
|
||||
if not event.modifiers() & QtCore.Qt.ControlModifier:
|
||||
if not (event.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier):
|
||||
for it in self.scene().items():
|
||||
it.setSelected(False)
|
||||
item.setSelected(True)
|
||||
@@ -557,12 +566,12 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
# If the left mouse button is not still pressed TOGETHER with the SHIFT key and neither is the middle button
|
||||
# this means the user is no longer trying to drag the view
|
||||
if self._dragging and not (event.buttons() == QtCore.Qt.LeftButton and event.modifiers() == QtCore.Qt.ShiftModifier) and not event.buttons() & QtCore.Qt.MidButton:
|
||||
if self._dragging and not (event.buttons() == QtCore.Qt.MouseButton.LeftButton and event.modifiers() == QtCore.Qt.KeyboardModifier.ShiftModifier) and not (event.buttons() & QtCore.Qt.MouseButton.MiddleButton):
|
||||
self._dragging = False
|
||||
self.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
else:
|
||||
item = self.itemAt(event.pos())
|
||||
if item is not None and not event.modifiers() & QtCore.Qt.ControlModifier:
|
||||
item = self.itemAt(event.position().toPoint())
|
||||
if item is not None and not (event.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier):
|
||||
item.setSelected(True)
|
||||
super().mouseReleaseEvent(event)
|
||||
|
||||
@@ -575,7 +584,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
:param: QWheelEvent instance
|
||||
"""
|
||||
|
||||
if event.modifiers() == QtCore.Qt.ControlModifier:
|
||||
if event.modifiers() == QtCore.Qt.KeyboardModifier.ControlModifier:
|
||||
delta = event.angleDelta()
|
||||
if delta is not None and delta.x() == 0:
|
||||
# CTRL is pressed then use the mouse wheel to zoom in or out.
|
||||
@@ -594,7 +603,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
if factor < 0.10 or factor > 10:
|
||||
return
|
||||
self.scale(scale_factor, scale_factor)
|
||||
self._main_window.uiStatusBar.showMessage("Zoom: {}%".format(round(self.transform().m11() * 100)), 2000)
|
||||
self._main_window.uiStatusBar.showMessage("Zoom: {}%".format(round(self.transform().m11() * 100)), 5000)
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
"""
|
||||
@@ -603,7 +612,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
:param event: QKeyEvent
|
||||
"""
|
||||
|
||||
if event.key() == QtCore.Qt.Key_Delete:
|
||||
if event.key() == QtCore.Qt.Key.Key_Delete:
|
||||
# check if we are editing an LabelItem instance, then send the delete key event to it
|
||||
for item in self.scene().selectedItems():
|
||||
if (isinstance(item, LabelItem) or isinstance(item, TextItem)) and item.hasFocus():
|
||||
@@ -623,23 +632,23 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
# This if statement event checks to see if the user is dragging the scene
|
||||
# if so it sets the value of the scene scroll bars based on the change between
|
||||
# the previous and current mouse position
|
||||
mapped_global_pos = self.mapFromGlobal(event.globalPos())
|
||||
mapped_global_pos = self.mapFromGlobal(event.globalPosition())
|
||||
hBar = self.horizontalScrollBar()
|
||||
vBar = self.verticalScrollBar()
|
||||
delta = mapped_global_pos - self._last_mouse_position
|
||||
hBar.setValue(hBar.value() + (delta.x() if QtWidgets.QApplication.isRightToLeft() else -delta.x()))
|
||||
vBar.setValue(vBar.value() - delta.y())
|
||||
hBar.setValue(int(hBar.value() + (delta.x() if QtWidgets.QApplication.isRightToLeft() else -delta.x())))
|
||||
vBar.setValue(int(vBar.value() - delta.y()))
|
||||
self._last_mouse_position = mapped_global_pos
|
||||
if self._adding_link and self._newlink and self._newlink in self.scene().items():
|
||||
# update the mouse position when the user is adding a link.
|
||||
self._newlink.setMousePoint(self.mapToScene(event.pos()))
|
||||
self._newlink.setMousePoint(self.mapToScene(event.position().toPoint()))
|
||||
event.ignore()
|
||||
else:
|
||||
item = self.itemAt(event.pos())
|
||||
item = self.itemAt(event.position().toPoint())
|
||||
if item:
|
||||
# show item coords in the status bar
|
||||
coords = "X: {} Y: {} Z: {}".format(item.x(), item.y(), item.zValue())
|
||||
self._main_window.uiStatusBar.showMessage(coords, 2000)
|
||||
self._main_window.uiStatusBar.showMessage(coords)
|
||||
|
||||
# force the children to redraw because of a problem with QGraphicsEffect
|
||||
for item in self.scene().selectedItems():
|
||||
@@ -654,7 +663,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
:param event: QMouseEvent instance
|
||||
"""
|
||||
|
||||
item = self.itemAt(event.pos())
|
||||
item = self.itemAt(event.position().toPoint())
|
||||
|
||||
if not self._adding_link:
|
||||
if isinstance(item, NodeItem) and item.node().initialized():
|
||||
@@ -663,7 +672,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
self.configureSlot()
|
||||
return
|
||||
else:
|
||||
if sys.platform.startswith("win") and item.node().bringToFront():
|
||||
if item.node().bringToFront():
|
||||
return
|
||||
self.consoleFromItems(self.scene().selectedItems())
|
||||
return
|
||||
@@ -688,7 +697,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
node_properties = NodePropertiesDialog(items, self._main_window)
|
||||
node_properties.setModal(True)
|
||||
node_properties.show()
|
||||
node_properties.exec_()
|
||||
node_properties.exec()
|
||||
|
||||
def dragMoveEvent(self, event):
|
||||
"""
|
||||
@@ -712,24 +721,25 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
:param event: QDropEvent instance
|
||||
"""
|
||||
|
||||
log.debug("Drop event received with mime data: {}".format(event.mimeData().formats()))
|
||||
# check if what has been dropped is handled by this view
|
||||
if event.mimeData().hasFormat("application/x-gns3-template"):
|
||||
template_id = event.mimeData().data("application/x-gns3-template").data().decode()
|
||||
event.setDropAction(QtCore.Qt.CopyAction)
|
||||
event.setDropAction(QtCore.Qt.DropAction.CopyAction)
|
||||
event.accept()
|
||||
if event.keyboardModifiers() == QtCore.Qt.ShiftModifier:
|
||||
if event.modifiers() == QtCore.Qt.KeyboardModifier.ShiftModifier:
|
||||
max_nodes_per_line = 10 # max number of nodes on a single line
|
||||
offset = 100 # spacing between elements
|
||||
integer, ok = QtWidgets.QInputDialog.getInt(self, "Nodes", "Number of nodes:", 2, 1, 100, 1)
|
||||
if ok:
|
||||
for node_number in range(integer):
|
||||
x = event.pos().x() - (150 // 2) + (node_number % max_nodes_per_line) * offset
|
||||
y = event.pos().y() - (70 // 2) + (node_number // max_nodes_per_line) * offset
|
||||
if self.createNodeFromTemplateId(template_id, QtCore.QPoint(x, y)) is False:
|
||||
x = event.position().x() - (150 // 2) + (node_number % max_nodes_per_line) * offset
|
||||
y = event.position().y() - (70 // 2) + (node_number // max_nodes_per_line) * offset
|
||||
if self.createNodeFromTemplateId(template_id, QtCore.QPointF(x, y)) is False:
|
||||
event.ignore()
|
||||
break
|
||||
else:
|
||||
if self.createNodeFromTemplateId(template_id, event.pos()) is False:
|
||||
if self.createNodeFromTemplateId(template_id, event.position()) is False:
|
||||
event.ignore()
|
||||
elif event.mimeData().hasFormat("text/uri-list") and event.mimeData().hasUrls():
|
||||
# This should not arrive but we received bug report with it...
|
||||
@@ -752,9 +762,9 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
:param pos: position where to display the menu
|
||||
"""
|
||||
|
||||
menu = QtWidgets.QMenu()
|
||||
menu = QtWidgets.QMenu(parent=self)
|
||||
self.populateDeviceContextualMenu(menu)
|
||||
menu.exec_(pos)
|
||||
menu.exec(pos)
|
||||
menu.clear()
|
||||
# Make sure to deselect all items.
|
||||
# This is to prevent a bug on Windows
|
||||
@@ -775,145 +785,145 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and hasattr(item.node(), "configPage"), items)):
|
||||
# Action: Configure node
|
||||
configure_action = QtWidgets.QAction("Configure", menu)
|
||||
configure_action = QtGui.QAction("Configure", menu)
|
||||
configure_action.setIcon(get_icon("configuration.svg"))
|
||||
configure_action.triggered.connect(self.configureActionSlot)
|
||||
menu.addAction(configure_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and item.node().console() is not None, items)):
|
||||
console_action = QtWidgets.QAction("Console", menu)
|
||||
console_action = QtGui.QAction("Console", menu)
|
||||
console_action.setIcon(get_icon("console.svg"))
|
||||
console_action.triggered.connect(self.consoleActionSlot)
|
||||
menu.addAction(console_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and hasattr(item.node(), "auxConsole"), items)):
|
||||
aux_console_action = QtWidgets.QAction("Auxiliary console", menu)
|
||||
aux_console_action = QtGui.QAction("Auxiliary console", menu)
|
||||
aux_console_action.setIcon(get_icon("aux-console.svg"))
|
||||
aux_console_action.triggered.connect(self.auxConsoleActionSlot)
|
||||
menu.addAction(aux_console_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and not item.node().isAlwaysOn(), items)):
|
||||
start_action = QtWidgets.QAction("Start", menu)
|
||||
start_action = QtGui.QAction("Start", menu)
|
||||
start_action.setIcon(get_icon("start.svg"))
|
||||
start_action.triggered.connect(self.startActionSlot)
|
||||
menu.addAction(start_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and not item.node().isAlwaysOn(), items)):
|
||||
suspend_action = QtWidgets.QAction("Suspend", menu)
|
||||
suspend_action = QtGui.QAction("Suspend", menu)
|
||||
suspend_action.setIcon(get_icon("pause.svg"))
|
||||
suspend_action.triggered.connect(self.suspendActionSlot)
|
||||
menu.addAction(suspend_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and not item.node().isAlwaysOn(), items)):
|
||||
stop_action = QtWidgets.QAction("Stop", menu)
|
||||
stop_action = QtGui.QAction("Stop", menu)
|
||||
stop_action.setIcon(get_icon("stop.svg"))
|
||||
stop_action.triggered.connect(self.stopActionSlot)
|
||||
menu.addAction(stop_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and not item.node().isAlwaysOn(), items)):
|
||||
reload_action = QtWidgets.QAction("Reload", menu)
|
||||
reload_action = QtGui.QAction("Reload", menu)
|
||||
reload_action.setIcon(get_icon("reload.svg"))
|
||||
reload_action.triggered.connect(self.reloadActionSlot)
|
||||
menu.addAction(reload_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and item.node().console() is not None, items)):
|
||||
console_edit_action = QtWidgets.QAction("Custom console", menu)
|
||||
console_edit_action = QtGui.QAction("Custom console", menu)
|
||||
console_edit_action.setIcon(get_icon("console_edit.svg"))
|
||||
console_edit_action.triggered.connect(self.customConsoleActionSlot)
|
||||
menu.addAction(console_edit_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem), items)):
|
||||
# Action: Change hostname
|
||||
change_hostname_action = QtWidgets.QAction("Change hostname", menu)
|
||||
change_hostname_action = QtGui.QAction("Change hostname", menu)
|
||||
change_hostname_action.setIcon(get_icon("show-hostname.svg"))
|
||||
change_hostname_action.triggered.connect(self.changeHostnameActionSlot)
|
||||
menu.addAction(change_hostname_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem), items)):
|
||||
# Action: Change symbol
|
||||
change_symbol_action = QtWidgets.QAction("Change symbol", menu)
|
||||
change_symbol_action = QtGui.QAction("Change symbol", menu)
|
||||
change_symbol_action.setIcon(get_icon("node_conception.svg"))
|
||||
change_symbol_action.triggered.connect(self.changeSymbolActionSlot)
|
||||
menu.addAction(change_symbol_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, DrawingItem) or isinstance(item, NodeItem), items)):
|
||||
duplicate_action = QtWidgets.QAction("Duplicate", menu)
|
||||
duplicate_action = QtGui.QAction("Duplicate", menu)
|
||||
duplicate_action.setIcon(get_icon("duplicate.svg"))
|
||||
duplicate_action.triggered.connect(self.duplicateActionSlot)
|
||||
menu.addAction(duplicate_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and hasattr(item.node(), "info"), items)):
|
||||
# Action: Show node information
|
||||
show_node_info_action = QtWidgets.QAction("Show node information", menu)
|
||||
show_node_info_action = QtGui.QAction("Show node information", menu)
|
||||
show_node_info_action.setIcon(get_icon("help.svg"))
|
||||
show_node_info_action.triggered.connect(self.showNodeInfoSlot)
|
||||
menu.addAction(show_node_info_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and hasattr(item.node(), "nodeDir"), items)):
|
||||
# Action: Show in file manager
|
||||
show_in_file_manager_action = QtWidgets.QAction("Show in file manager", menu)
|
||||
show_in_file_manager_action = QtGui.QAction("Show in file manager", menu)
|
||||
show_in_file_manager_action.setIcon(get_icon("open.svg"))
|
||||
show_in_file_manager_action.triggered.connect(self.showInFileManagerSlot)
|
||||
menu.addAction(show_in_file_manager_action)
|
||||
|
||||
if sys.platform.startswith("win") and True in list(map(lambda item: isinstance(item, NodeItem) and hasattr(item.node(), "bringToFront"), items)):
|
||||
# Action: bring console or window to front (Windows only)
|
||||
bring_to_front_action = QtWidgets.QAction("Bring to front", menu)
|
||||
if not sys.platform.startswith("darwin") and True in list(map(lambda item: isinstance(item, NodeItem) and hasattr(item.node(), "bringToFront"), items)):
|
||||
# Action: bring console or window to front (Windows and Linux only)
|
||||
bring_to_front_action = QtGui.QAction("Bring to front", menu)
|
||||
bring_to_front_action.setIcon(get_icon("front.svg"))
|
||||
bring_to_front_action.triggered.connect(self.bringToFrontSlot)
|
||||
menu.addAction(bring_to_front_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and bool(item.node().configFiles()), items)):
|
||||
import_config_action = QtWidgets.QAction("Import config", menu)
|
||||
import_config_action = QtGui.QAction("Import config", menu)
|
||||
import_config_action.setIcon(get_icon("import.svg"))
|
||||
import_config_action.triggered.connect(self.importConfigActionSlot)
|
||||
menu.addAction(import_config_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and bool(item.node().configFiles()), items)):
|
||||
export_config_action = QtWidgets.QAction("Export config", menu)
|
||||
export_config_action = QtGui.QAction("Export config", menu)
|
||||
export_config_action.setIcon(get_icon("export.svg"))
|
||||
export_config_action.triggered.connect(self.exportConfigActionSlot)
|
||||
menu.addAction(export_config_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and bool(item.node().configTextFiles()), items)):
|
||||
export_config_action = QtWidgets.QAction("Edit config", menu)
|
||||
export_config_action = QtGui.QAction("Edit config", menu)
|
||||
export_config_action.setIcon(get_icon("edit.svg"))
|
||||
export_config_action.triggered.connect(self.editConfigActionSlot)
|
||||
menu.addAction(export_config_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and hasattr(item.node(), "idlepc"), items)):
|
||||
idlepc_action = QtWidgets.QAction("Idle-PC", menu)
|
||||
idlepc_action = QtGui.QAction("Idle-PC", menu)
|
||||
idlepc_action.setIcon(get_icon("calculate.svg"))
|
||||
idlepc_action.triggered.connect(self.idlepcActionSlot)
|
||||
menu.addAction(idlepc_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, NodeItem) and hasattr(item.node(), "idlepc"), items)):
|
||||
auto_idlepc_action = QtWidgets.QAction("Auto Idle-PC", menu)
|
||||
auto_idlepc_action = QtGui.QAction("Auto Idle-PC", menu)
|
||||
auto_idlepc_action.setIcon(get_icon("calculate.svg"))
|
||||
auto_idlepc_action.triggered.connect(self.autoIdlepcActionSlot)
|
||||
menu.addAction(auto_idlepc_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, LabelItem), items)):
|
||||
text_edit_action = QtWidgets.QAction("Text edit", menu)
|
||||
text_edit_action = QtGui.QAction("Text edit", menu)
|
||||
text_edit_action.setIcon(get_icon("show-hostname.svg"))
|
||||
text_edit_action.triggered.connect(self.textEditActionSlot)
|
||||
menu.addAction(text_edit_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, TextItem), items)):
|
||||
text_edit_action = QtWidgets.QAction("Text edit", menu)
|
||||
text_edit_action = QtGui.QAction("Text edit", menu)
|
||||
text_edit_action.setIcon(get_icon("edit.svg"))
|
||||
text_edit_action.triggered.connect(self.textEditActionSlot)
|
||||
menu.addAction(text_edit_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, ShapeItem) or isinstance(item, LineItem), items)):
|
||||
style_action = QtWidgets.QAction("Style", menu)
|
||||
style_action = QtGui.QAction("Style", menu)
|
||||
style_action.setIcon(get_icon("node_conception.svg"))
|
||||
style_action.triggered.connect(self.styleActionSlot)
|
||||
menu.addAction(style_action)
|
||||
|
||||
if True in list(map(lambda item: isinstance(item, LabelItem), items)) and False in list(map(lambda item: item.parentItem() is None, items)):
|
||||
# action only for port labels
|
||||
reset_label_position_action = QtWidgets.QAction("Reset position", menu)
|
||||
reset_label_position_action = QtGui.QAction("Reset position", menu)
|
||||
reset_label_position_action.setIcon(get_icon("reset.svg"))
|
||||
reset_label_position_action.triggered.connect(self.resetLabelPositionActionSlot)
|
||||
menu.addAction(reset_label_position_action)
|
||||
@@ -922,41 +932,41 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
if True in list(map(lambda item: item.parentItem() is None, items)):
|
||||
|
||||
if len(items) > 1:
|
||||
horizontal_align_action = QtWidgets.QAction("Align horizontally", menu)
|
||||
horizontal_align_action = QtGui.QAction("Align horizontally", menu)
|
||||
horizontal_align_action.setIcon(get_icon("horizontally.svg"))
|
||||
horizontal_align_action.triggered.connect(self.horizontalAlignmentSlot)
|
||||
menu.addAction(horizontal_align_action)
|
||||
|
||||
vertical_align_action = QtWidgets.QAction("Align vertically", menu)
|
||||
vertical_align_action = QtGui.QAction("Align vertically", menu)
|
||||
vertical_align_action.setIcon(get_icon("vertically.svg"))
|
||||
vertical_align_action.triggered.connect(self.verticalAlignmentSlot)
|
||||
menu.addAction(vertical_align_action)
|
||||
|
||||
raise_layer_action = QtWidgets.QAction("Raise one layer", menu)
|
||||
raise_layer_action = QtGui.QAction("Raise one layer", menu)
|
||||
raise_layer_action.setIcon(get_icon("raise_z_value.svg"))
|
||||
raise_layer_action.triggered.connect(self.raiseLayerActionSlot)
|
||||
menu.addAction(raise_layer_action)
|
||||
|
||||
lower_layer_action = QtWidgets.QAction("Lower one layer", menu)
|
||||
lower_layer_action = QtGui.QAction("Lower one layer", menu)
|
||||
lower_layer_action.setIcon(get_icon("lower_z_value.svg"))
|
||||
lower_layer_action.triggered.connect(self.lowerLayerActionSlot)
|
||||
menu.addAction(lower_layer_action)
|
||||
|
||||
if len(items) > 1:
|
||||
lock_action = QtWidgets.QAction("Lock or unlock items", menu)
|
||||
lock_action = QtGui.QAction("Lock or unlock items", menu)
|
||||
lock_action.setIcon(get_icon("lock.svg"))
|
||||
else:
|
||||
item = items[0]
|
||||
if item.flags() & QtWidgets.QGraphicsItem.ItemIsMovable:
|
||||
lock_action = QtWidgets.QAction("Lock item", menu)
|
||||
if item.flags() & QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable:
|
||||
lock_action = QtGui.QAction("Lock item", menu)
|
||||
lock_action.setIcon(get_icon("lock.svg"))
|
||||
else:
|
||||
lock_action = QtWidgets.QAction("Unlock item", menu)
|
||||
lock_action = QtGui.QAction("Unlock item", menu)
|
||||
lock_action.setIcon(get_icon("unlock.svg"))
|
||||
lock_action.triggered.connect(self.lockActionSlot)
|
||||
menu.addAction(lock_action)
|
||||
|
||||
delete_action = QtWidgets.QAction("Delete", menu)
|
||||
delete_action = QtGui.QAction("Delete", menu)
|
||||
delete_action.setIcon(get_icon("delete.svg"))
|
||||
delete_action.triggered.connect(self.deleteActionSlot)
|
||||
menu.addAction(delete_action)
|
||||
@@ -1023,12 +1033,12 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
for item in self.scene().selectedItems():
|
||||
if isinstance(item, NodeItem) and item.node().initialized():
|
||||
new_hostname, ok = QtWidgets.QInputDialog.getText(self, "Change hostname", "Hostname:", QtWidgets.QLineEdit.Normal, item.node().name())
|
||||
new_hostname, ok = QtWidgets.QInputDialog.getText(self, "Change hostname", "Hostname:", QtWidgets.QLineEdit.EchoMode.Normal, item.node().name())
|
||||
if ok:
|
||||
if not new_hostname.strip():
|
||||
QtWidgets.QMessageBox.critical(self, "Change hostname", "Hostname cannot be blank")
|
||||
continue
|
||||
if hasattr(item.node(), "validateHostname"):
|
||||
if hasattr(item.node(), "validateHostname") and not LocalConfig.instance().experimental():
|
||||
if not item.node().validateHostname(new_hostname):
|
||||
QtWidgets.QMessageBox.critical(self, "Change hostname", "Invalid name detected for this node: {}".format(new_hostname))
|
||||
continue
|
||||
@@ -1047,7 +1057,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
if items:
|
||||
dialog = SymbolSelectionDialog(self, items)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
def showInFileManagerSlot(self):
|
||||
"""
|
||||
@@ -1069,8 +1079,8 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
QtWidgets.QMessageBox.critical(self, "Show in file manager", "Failed to open {}".format(node_dir))
|
||||
break
|
||||
else:
|
||||
reply = QtWidgets.QMessageBox.information(self, "Show in file manager", "The device directory is located in {} on {}\n\nCopy path to clipboard?".format(node_dir, node.compute().name()), QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
||||
if reply == QtWidgets.QMessageBox.Yes:
|
||||
reply = QtWidgets.QMessageBox.information(self, "Show in file manager", "The device directory is located in {} on {}\n\nCopy path to clipboard?".format(node_dir, node.compute().name()), QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No)
|
||||
if reply == QtWidgets.QMessageBox.StandardButton.Yes:
|
||||
QtWidgets.QApplication.clipboard().setText(node_dir)
|
||||
break
|
||||
|
||||
@@ -1127,7 +1137,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
delay = self._main_window.settings()["delay_console_all"]
|
||||
counter = 0
|
||||
for name in sorted(nodes.keys()):
|
||||
for name in sorted(nodes.keys(), key=str.casefold):
|
||||
node = nodes[name]
|
||||
callback = qpartial(self.consoleToNode, node)
|
||||
self._main_window.run_later(counter, callback)
|
||||
@@ -1145,10 +1155,10 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
proceed = QtWidgets.QMessageBox.question(self,
|
||||
"Console to all nodes",
|
||||
"You are about to open console windows to {} nodes. Are you sure?".format(nb_items),
|
||||
QtWidgets.QMessageBox.Yes,
|
||||
QtWidgets.QMessageBox.No)
|
||||
QtWidgets.QMessageBox.StandardButton.Yes,
|
||||
QtWidgets.QMessageBox.StandardButton.No)
|
||||
|
||||
if proceed == QtWidgets.QMessageBox.No:
|
||||
if proceed == QtWidgets.QMessageBox.StandardButton.No:
|
||||
return
|
||||
self.consoleFromItems(items)
|
||||
|
||||
@@ -1206,7 +1216,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
delay = self._main_window.settings()["delay_console_all"]
|
||||
counter = 0
|
||||
for name in sorted(nodes.keys()):
|
||||
for name in sorted(nodes.keys(), key=str.casefold):
|
||||
node = nodes[name]
|
||||
callback = qpartial(self.consoleToNode, node, aux=True)
|
||||
self._main_window.run_later(counter, callback)
|
||||
@@ -1245,7 +1255,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(self,
|
||||
"Import {}".format(os.path.basename(config_file)),
|
||||
self._import_config_directory,
|
||||
"All files (*.*);;Config files (*.cfg)",
|
||||
"All files (*);;Config files (*.cfg)",
|
||||
"Config files (*.cfg)")
|
||||
if not path:
|
||||
continue
|
||||
@@ -1274,7 +1284,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
continue
|
||||
dialog = FileEditorDialog(item.node(), config_file, parent=self)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
def exportConfigActionSlot(self):
|
||||
"""
|
||||
@@ -1292,7 +1302,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
for item in items:
|
||||
for config_file in item.node().configFiles():
|
||||
path, ok = QtWidgets.QFileDialog.getSaveFileName(self, "Export file", os.path.join(self._export_config_directory, item.node().name() + "_" + os.path.basename(config_file)), "All files (*.*);;Config files (*.cfg)")
|
||||
path, ok = QtWidgets.QFileDialog.getSaveFileName(self, "Export file", os.path.join(self._export_config_directory, item.node().name() + "_" + os.path.basename(config_file)), "All files (*);;Config files (*.cfg)")
|
||||
if not path:
|
||||
continue
|
||||
self._export_config_directory = os.path.dirname(path)
|
||||
@@ -1312,7 +1322,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
if isinstance(item, NodeItem):
|
||||
dialog = NodeInfoDialog(item.node(), parent=self)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
def bringToFrontSlot(self):
|
||||
"""
|
||||
@@ -1353,7 +1363,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
if idlepcs and idlepcs[0] != "0x0":
|
||||
dialog = IdlePCDialog(router, idlepcs, parent=self)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
else:
|
||||
QtWidgets.QMessageBox.critical(self, "Idle-PC", "Sorry no Idle-PC values could be computed, please check again with Cisco IOS in a different state")
|
||||
|
||||
@@ -1436,7 +1446,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
if items:
|
||||
style_dialog = StyleEditorDialog(self._main_window, items)
|
||||
style_dialog.show()
|
||||
style_dialog.exec_()
|
||||
style_dialog.exec()
|
||||
|
||||
def textEditActionSlot(self):
|
||||
"""
|
||||
@@ -1451,7 +1461,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
if items:
|
||||
text_edit_dialog = TextEditorDialog(self._main_window, items)
|
||||
text_edit_dialog.show()
|
||||
text_edit_dialog.exec_()
|
||||
text_edit_dialog.exec()
|
||||
|
||||
def resetLabelPositionActionSlot(self):
|
||||
"""
|
||||
@@ -1509,7 +1519,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
for item in self.scene().selectedItems():
|
||||
if item.parentItem() is None:
|
||||
if not (item.flags() & QtWidgets.QGraphicsItem.ItemIsMovable):
|
||||
if not (item.flags() & QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable):
|
||||
log.error("Cannot move object to a upper layer because it is locked")
|
||||
continue
|
||||
item.setZValue(item.zValue() + 1)
|
||||
@@ -1524,7 +1534,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
|
||||
for item in self.scene().selectedItems():
|
||||
if item.parentItem() is None:
|
||||
if not (item.flags() & QtWidgets.QGraphicsItem.ItemIsMovable):
|
||||
if not (item.flags() & QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable):
|
||||
log.error("Cannot move object to a lower layer because it is locked")
|
||||
continue
|
||||
item.setZValue(item.zValue() - 1)
|
||||
@@ -1570,8 +1580,8 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
else:
|
||||
question = "Do you want to permanently delete {}?".format(selected_nodes[0].name())
|
||||
reply = QtWidgets.QMessageBox.question(self, "Delete", question,
|
||||
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
|
||||
for item in self.scene().selectedItems():
|
||||
if isinstance(item, NodeItem):
|
||||
@@ -1607,7 +1617,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
"""
|
||||
Ask the server to create a node using this template
|
||||
"""
|
||||
pos = self.mapToScene(pos)
|
||||
pos = self.mapToScene(pos.toPoint())
|
||||
return TemplateManager().instance().createNodeFromTemplateId(self._topology.project(), template_id, pos.x(), pos.y())
|
||||
|
||||
def createNodeItem(self, node, symbol, x, y):
|
||||
@@ -1638,15 +1648,15 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
def createDrawingItem(self, type, x, y, z, locked=False, rotation=0, svg=None, drawing_id=None):
|
||||
|
||||
if type == "ellipse":
|
||||
item = EllipseItem(pos=QtCore.QPoint(x, y), z=z, locked=locked, rotation=rotation, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
item = EllipseItem(pos=QtCore.QPointF(x, y), z=z, locked=locked, rotation=rotation, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
elif type == "rect":
|
||||
item = RectangleItem(pos=QtCore.QPoint(x, y), z=z, locked=locked, rotation=rotation, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
item = RectangleItem(pos=QtCore.QPointF(x, y), z=z, locked=locked, rotation=rotation, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
elif type == "line":
|
||||
item = LineItem(pos=QtCore.QPoint(x, y), dst=QtCore.QPoint(200, 0), z=z, locked=locked, rotation=rotation, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
item = LineItem(pos=QtCore.QPointF(x, y), dst=QtCore.QPoint(200, 0), z=z, locked=locked, rotation=rotation, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
elif type == "image":
|
||||
item = ImageItem(pos=QtCore.QPoint(x, y), z=z, rotation=rotation, locked=locked, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
item = ImageItem(pos=QtCore.QPointF(x, y), z=z, rotation=rotation, locked=locked, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
elif type == "text":
|
||||
item = TextItem(pos=QtCore.QPoint(x, y), z=z, rotation=rotation, locked=locked, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
item = TextItem(pos=QtCore.QPointF(x, y), z=z, rotation=rotation, locked=locked, project=self._topology.project(), drawing_id=drawing_id, svg=svg)
|
||||
|
||||
if drawing_id is None:
|
||||
item.create()
|
||||
@@ -1655,11 +1665,39 @@ class GraphicsView(QtWidgets.QGraphicsView):
|
||||
self._topology.addDrawing(item)
|
||||
return item
|
||||
|
||||
@QtCore.Property(QtGui.QColor)
|
||||
def drawingGridColor(self):
|
||||
"""Returns the drawing grid color"""
|
||||
return self._drawing_grid_color
|
||||
|
||||
@drawingGridColor.setter
|
||||
def drawingGridColor(self, color):
|
||||
"""Sets the drawing grid color"""
|
||||
self._drawing_grid_color = color
|
||||
self.viewport().update()
|
||||
|
||||
@QtCore.Property(QtGui.QColor)
|
||||
def nodeGridColor(self):
|
||||
"""Returns the node grid color"""
|
||||
return self._node_grid_color
|
||||
|
||||
@nodeGridColor.setter
|
||||
def nodeGridColor(self, color):
|
||||
"""Sets the node grid color"""
|
||||
self._node_grid_color = color
|
||||
self.viewport().update()
|
||||
|
||||
def resetGridColors(self):
|
||||
"""Reset grid colors to defaults"""
|
||||
self._drawing_grid_color = self.DEFAULT_DRAWING_GRID_COLOR
|
||||
self._node_grid_color = self.DEFAULT_NODE_GRID_COLOR
|
||||
self.viewport().update()
|
||||
|
||||
def drawBackground(self, painter, rect):
|
||||
super().drawBackground(painter, rect)
|
||||
if self._main_window.uiShowGridAction.isChecked():
|
||||
grids = [(self.drawingGridSize(), QtGui.QColor(208, 208, 208)),
|
||||
(self.nodeGridSize(), QtGui.QColor(190, 190, 190))]
|
||||
grids = [(self.drawingGridSize(), self._drawing_grid_color),
|
||||
(self.nodeGridSize(), self._node_grid_color)]
|
||||
painter.save()
|
||||
for (grid, colour) in grids:
|
||||
if not grid:
|
||||
|
||||
@@ -275,18 +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={},
|
||||
networkManager=None,
|
||||
eventsHandler=None,
|
||||
**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
|
||||
|
||||
@@ -328,17 +335,24 @@ class HTTPClient(QtCore.QObject):
|
||||
# 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)
|
||||
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()
|
||||
@@ -347,7 +361,14 @@ class HTTPClient(QtCore.QObject):
|
||||
# enqueue the first query and open the connection if we are not connected
|
||||
if len(self._query_waiting_connections) == 1:
|
||||
log.debug("Connection to {}".format(self.url()))
|
||||
self._executeHTTPQuery("GET", "/version", self._callbackConnect, {}, server=server, timeout=10, showProgress=False)
|
||||
self._executeHTTPQuery(
|
||||
"GET",
|
||||
"/version",
|
||||
self._callbackConnect,
|
||||
server=server,
|
||||
timeout=10,
|
||||
showProgress=False
|
||||
)
|
||||
|
||||
def _connectionError(self, callback, msg="", server=None):
|
||||
"""
|
||||
@@ -370,7 +391,16 @@ class HTTPClient(QtCore.QObject):
|
||||
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):
|
||||
"""
|
||||
@@ -404,17 +434,12 @@ class HTTPClient(QtCore.QObject):
|
||||
self._query_waiting_connections = []
|
||||
return
|
||||
|
||||
if params["version"].split("-")[0] != __version__.split("-")[0]:
|
||||
if params["version"].split("+")[0] != __version__.split("+")[0]:
|
||||
msg = "Client version {} is not the same as server (controller) version {}".format(__version__, params["version"])
|
||||
# Stable release
|
||||
if __version_info__[3] == 0:
|
||||
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]:
|
||||
# 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:
|
||||
@@ -450,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
|
||||
@@ -463,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
|
||||
@@ -517,7 +542,7 @@ class HTTPClient(QtCore.QObject):
|
||||
:param params: Dictionary of query string parameters
|
||||
:returns: String of the query string
|
||||
"""
|
||||
if params == {}:
|
||||
if params is None:
|
||||
query_string = ""
|
||||
else:
|
||||
query_string = "?"
|
||||
@@ -528,7 +553,25 @@ class HTTPClient(QtCore.QObject):
|
||||
query_string += urllib.parse.urlencode(params)
|
||||
return query_string
|
||||
|
||||
def _executeHTTPQuery(self, method, path, callback, body, context={}, downloadProgressCallback=None, showProgress=True, ignoreErrors=False, progressText=None, server=None, timeout=120, prefix="/v2", params={}, networkManager=None, eventsHandler=None, **kwargs):
|
||||
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
|
||||
|
||||
@@ -537,7 +580,7 @@ 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
|
||||
@@ -563,7 +606,7 @@ class HTTPClient(QtCore.QObject):
|
||||
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)
|
||||
|
||||
if not networkManager:
|
||||
@@ -573,13 +616,16 @@ class HTTPClient(QtCore.QObject):
|
||||
response = networkManager.sendCustomRequest(request, method.encode(), body)
|
||||
except SystemError as e:
|
||||
log.error("Can't send query: {}".format(str(e)))
|
||||
return
|
||||
return None
|
||||
|
||||
context = copy.copy(context)
|
||||
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.error.connect(qpartial(self._processError, 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))
|
||||
@@ -606,19 +652,19 @@ class HTTPClient(QtCore.QObject):
|
||||
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:
|
||||
@@ -640,8 +686,9 @@ class HTTPClient(QtCore.QObject):
|
||||
"""
|
||||
# We check if we received HTTP headers
|
||||
if not sip.isdeleted(response) and response.isRunning() and not len(response.rawHeaderList()) > 0:
|
||||
if not response.error() != QtNetwork.QNetworkReply.NoError:
|
||||
log.warning("Timeout after {} seconds for request {}. Please check the connection is not blocked by a firewall or an anti-virus.".format(timeout, response.url().toString()))
|
||||
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):
|
||||
@@ -653,26 +700,27 @@ class HTTPClient(QtCore.QObject):
|
||||
|
||||
def _requestCanceled(self, response, context):
|
||||
|
||||
if response.isRunning() and not response.error() != QtNetwork.QNetworkReply.NoError:
|
||||
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 _processError(self, response, server, callback, context, request_body, ignore_errors, error_code):
|
||||
if error_code != QtNetwork.QNetworkReply.NoError:
|
||||
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 for %s (error: %d)", error_message, response.url().toString(), 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 "query_id" in context:
|
||||
self._notify_progress_end_query(context["query_id"])
|
||||
|
||||
if error_code < 200 or error_code == 403:
|
||||
if error_code == QtNetwork.QNetworkReply.OperationCanceledError: # It's legit to cancel do not disconnect
|
||||
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.NetworkSessionFailedError:
|
||||
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:
|
||||
@@ -681,7 +729,7 @@ class HTTPClient(QtCore.QObject):
|
||||
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)
|
||||
|
||||
@@ -690,7 +738,7 @@ 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)
|
||||
@@ -715,8 +763,8 @@ class HTTPClient(QtCore.QObject):
|
||||
if "query_id" in context:
|
||||
self._notify_progress_end_query(context["query_id"])
|
||||
|
||||
if response.error() == QtNetwork.QNetworkReply.NoError:
|
||||
status = response.attribute(QtNetwork.QNetworkRequest.HttpStatusCodeAttribute)
|
||||
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())
|
||||
@@ -724,7 +772,7 @@ 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)
|
||||
content_type = response.header(QtNetwork.QNetworkRequest.KnownHeaders.ContentTypeHeader)
|
||||
if body and len(body.strip(" \n\t")) > 0 and content_type == "application/json":
|
||||
try:
|
||||
params = json.loads(body)
|
||||
@@ -780,13 +828,13 @@ class HTTPClient(QtCore.QObject):
|
||||
QtCore.QTimer.singleShot(timeout * 1000, qpartial(self._timeoutSlot, response, timeout))
|
||||
|
||||
if not loop.isRunning():
|
||||
loop.exec_()
|
||||
loop.exec()
|
||||
|
||||
status = response.attribute(QtNetwork.QNetworkRequest.HttpStatusCodeAttribute)
|
||||
if response.error() != QtNetwork.QNetworkReply.NoError:
|
||||
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.ContentTypeHeader)
|
||||
content_type = response.header(QtNetwork.QNetworkRequest.KnownHeaders.ContentTypeHeader)
|
||||
if status == 200 and content_type == "application/json":
|
||||
content = bytes(response.readAll())
|
||||
try:
|
||||
@@ -829,14 +877,14 @@ class HTTPClient(QtCore.QObject):
|
||||
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.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
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.YesRole)
|
||||
msgbox.addButton(connect_button, QtWidgets.QMessageBox.ButtonRole.YesRole)
|
||||
abort_button = QtWidgets.QPushButton("&Abort", msgbox)
|
||||
msgbox.addButton(abort_button, QtWidgets.QMessageBox.RejectRole)
|
||||
msgbox.addButton(abort_button, QtWidgets.QMessageBox.ButtonRole.RejectRole)
|
||||
msgbox.setDefaultButton(abort_button)
|
||||
msgbox.setIcon(QtWidgets.QMessageBox.Critical)
|
||||
msgbox.exec_()
|
||||
msgbox.setIcon(QtWidgets.QMessageBox.Icon.Critical)
|
||||
msgbox.exec()
|
||||
|
||||
if msgbox.clickedButton() == connect_button:
|
||||
self._ssl_exceptions[host_port_key] = digest
|
||||
|
||||
@@ -94,9 +94,9 @@ class ImageManager:
|
||||
reply = QtWidgets.QMessageBox.question(parent,
|
||||
'Image',
|
||||
'Would you like to copy {} to the default images directory'.format(source_filename),
|
||||
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:
|
||||
try:
|
||||
os.makedirs(destination_directory, exist_ok=True)
|
||||
except OSError as e:
|
||||
@@ -106,7 +106,7 @@ class ImageManager:
|
||||
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)))
|
||||
|
||||
@@ -27,12 +27,12 @@ log = logging.getLogger(__name__)
|
||||
class 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"
|
||||
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
|
||||
@@ -44,10 +44,11 @@ class DrawingItem:
|
||||
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
|
||||
@@ -56,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:
|
||||
@@ -105,9 +106,14 @@ class DrawingItem:
|
||||
"""
|
||||
|
||||
if error:
|
||||
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"])
|
||||
@@ -123,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):
|
||||
@@ -147,6 +156,15 @@ 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,
|
||||
@@ -178,9 +196,9 @@ class DrawingItem:
|
||||
"""
|
||||
|
||||
if locked is True:
|
||||
self.setFlag(self.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
|
||||
else:
|
||||
self.setFlag(self.ItemIsMovable, True)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, True)
|
||||
self._locked = locked
|
||||
|
||||
def deleting(self):
|
||||
@@ -201,7 +219,7 @@ class DrawingItem:
|
||||
"""
|
||||
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()
|
||||
@@ -209,18 +227,19 @@ class DrawingItem:
|
||||
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.ItemPositionChange and self.isActive() and self._main_window.uiSnapToGridAction.isChecked():
|
||||
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.ItemSelectedChange:
|
||||
if change == QtWidgets.QGraphicsItem.GraphicsItemChange.ItemSelectedChange:
|
||||
if not value:
|
||||
self.updateDrawing()
|
||||
return QtWidgets.QGraphicsItem.itemChange(self, change, value)
|
||||
@@ -244,10 +263,10 @@ 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.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.black)
|
||||
painter.setPen(QtCore.Qt.GlobalColor.black)
|
||||
zval = str(int(self.zValue()))
|
||||
painter.drawText(QtCore.QPointF(center.x() - 4, center.y() + 4), zval)
|
||||
|
||||
@@ -286,9 +305,9 @@ class DrawingItem:
|
||||
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.NoPen)
|
||||
pen.setStyle(QtCore.Qt.PenStyle.NoPen)
|
||||
else:
|
||||
pen.setStyle(QtCore.Qt.SolidLine)
|
||||
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():
|
||||
|
||||
@@ -54,14 +54,14 @@ class EthernetLinkItem(LinkItem):
|
||||
|
||||
try:
|
||||
if self._hovered:
|
||||
self.setPen(QtGui.QPen(QtCore.Qt.red, self._link._link_style["width"] + 1, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
|
||||
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"], self._link._link_style["type"], QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
|
||||
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.red, self._pen_width + 1, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
|
||||
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.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
|
||||
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)
|
||||
@@ -121,17 +121,17 @@ class EthernetLinkItem(LinkItem):
|
||||
|
||||
if self._link.suspended() or self._source_port.status() == Port.suspended:
|
||||
# link or port is suspended
|
||||
color = QtCore.Qt.yellow
|
||||
shape = QtCore.Qt.RoundCap
|
||||
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
|
||||
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
|
||||
@@ -154,27 +154,27 @@ class EthernetLinkItem(LinkItem):
|
||||
self._source_port.setLabel(source_port_label)
|
||||
|
||||
if self._draw_port_labels:
|
||||
source_port_label.setFlag(source_port_label.ItemIsMovable, not self._source_item.locked())
|
||||
source_port_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, not self._source_item.locked())
|
||||
source_port_label.show()
|
||||
else:
|
||||
source_port_label.hide()
|
||||
|
||||
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.NoPen:
|
||||
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.PenStyle.NoPen:
|
||||
painter.drawPoint(point1)
|
||||
|
||||
if self._link.suspended() or self._destination_port.status() == Port.suspended:
|
||||
# link or port is suspended
|
||||
color = QtCore.Qt.yellow
|
||||
shape = QtCore.Qt.RoundCap
|
||||
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
|
||||
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
|
||||
@@ -197,12 +197,12 @@ class EthernetLinkItem(LinkItem):
|
||||
self._destination_port.setLabel(destination_port_label)
|
||||
|
||||
if self._draw_port_labels:
|
||||
destination_port_label.setFlag(destination_port_label.ItemIsMovable, not self._destination_item.locked())
|
||||
destination_port_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, not self._destination_item.locked())
|
||||
destination_port_label.show()
|
||||
else:
|
||||
destination_port_label.hide()
|
||||
|
||||
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.NoPen:
|
||||
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.PenStyle.NoPen:
|
||||
painter.drawPoint(point2)
|
||||
|
||||
self._drawSymbol()
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
Graphical representation of an image on the QGraphicsScene.
|
||||
"""
|
||||
|
||||
from ..qt import 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.
|
||||
|
||||
@@ -42,7 +42,7 @@ class LabelItem(QtWidgets.QGraphicsTextItem):
|
||||
qt_font.fromString(view_settings["default_label_font"])
|
||||
self.setDefaultTextColor(QtGui.QColor(view_settings["default_label_color"]))
|
||||
self.setFont(qt_font)
|
||||
self.setFlags(QtWidgets.QGraphicsItem.ItemIsMovable | QtWidgets.QGraphicsItem.ItemIsSelectable)
|
||||
self.setFlags(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable | QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsSelectable)
|
||||
self.setZValue(2)
|
||||
self._editable = True
|
||||
|
||||
@@ -91,12 +91,12 @@ class LabelItem(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:
|
||||
@@ -107,11 +107,11 @@ class LabelItem(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):
|
||||
@@ -131,12 +131,12 @@ class LabelItem(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()
|
||||
@@ -163,10 +163,10 @@ class LabelItem(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.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.black)
|
||||
painter.setPen(QtCore.Qt.GlobalColor.black)
|
||||
zval = str(int(self.zValue()))
|
||||
painter.drawText(QtCore.QPointF(center.x(), center.y()), zval)
|
||||
|
||||
@@ -213,7 +213,7 @@ class LabelItem(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)
|
||||
|
||||
@@ -44,7 +44,7 @@ class LineItem(QtWidgets.QGraphicsLineItem, DrawingItem):
|
||||
0,
|
||||
dst.x(),
|
||||
dst.y())
|
||||
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)
|
||||
else:
|
||||
self.fromSvg(svg)
|
||||
@@ -124,19 +124,19 @@ class LineItem(QtWidgets.QGraphicsLineItem, DrawingItem):
|
||||
|
||||
if self._isHorizontalLine():
|
||||
if event.pos().x() > (self.line().x2() - self._border):
|
||||
self._graphics_view.setCursor(QtCore.Qt.SizeHorCursor)
|
||||
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeHorCursor)
|
||||
elif event.pos().x() < self._border:
|
||||
self._graphics_view.setCursor(QtCore.Qt.SizeHorCursor)
|
||||
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeHorCursor)
|
||||
else:
|
||||
self._graphics_view.setCursor(QtCore.Qt.SizeAllCursor)
|
||||
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.SizeVerCursor)
|
||||
self._graphics_view.setCursor(QtCore.Qt.CursorShape.SizeVerCursor)
|
||||
elif event.pos().y() < 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 mouseMoveEvent(self, event):
|
||||
"""
|
||||
@@ -177,17 +177,17 @@ class LineItem(QtWidgets.QGraphicsLineItem, DrawingItem):
|
||||
self.update()
|
||||
if self._isHorizontalLine():
|
||||
if event.pos().x() > (self.line().x2() - self._border):
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
|
||||
self._edge = "right"
|
||||
elif event.pos().x() < (self.line().x1() + self._border):
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
|
||||
self._edge = "left"
|
||||
else:
|
||||
if event.pos().y() > (self.line().y2() - self._border):
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
|
||||
self._edge = "top"
|
||||
elif event.pos().y() < (self.line().y1() + self._border):
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
|
||||
self._edge = "bottom"
|
||||
super().mousePressEvent(event)
|
||||
|
||||
@@ -199,7 +199,7 @@ class LineItem(QtWidgets.QGraphicsLineItem, DrawingItem):
|
||||
"""
|
||||
|
||||
self.update()
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable)
|
||||
|
||||
self._edge = None
|
||||
super().mouseReleaseEvent(event)
|
||||
@@ -213,4 +213,4 @@ class LineItem(QtWidgets.QGraphicsLineItem, DrawingItem):
|
||||
|
||||
# locked objects don't need cursors
|
||||
if not self.locked():
|
||||
self._graphics_view.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self._graphics_view.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
|
||||
@@ -21,7 +21,7 @@ Link items are graphical representation of a link on the QGraphicsScene
|
||||
"""
|
||||
|
||||
import math
|
||||
from ..qt import QtCore, QtGui, QtWidgets, QtSvg, qslot, sip_is_deleted
|
||||
from ..qt import QtCore, QtGui, QtWidgets, QtSvgWidgets, qslot, sip_is_deleted
|
||||
|
||||
from ..packet_capture import PacketCapture
|
||||
from ..dialogs.filter_dialog import FilterDialog
|
||||
@@ -29,11 +29,11 @@ from ..dialogs.style_editor_dialog_link import StyleEditorDialogLink
|
||||
from ..utils.get_icon import get_icon
|
||||
|
||||
|
||||
class SvgIconItem(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):
|
||||
|
||||
@@ -56,7 +56,7 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
|
||||
"""
|
||||
|
||||
_draw_port_labels = False
|
||||
delete_link_item_signal = QtCore.pyqtSignal(str)
|
||||
delete_link_item_signal = QtCore.Signal(str)
|
||||
|
||||
def __init__(self, source_item, source_port, destination_item, destination_port, link=None, adding_flag=False):
|
||||
|
||||
@@ -102,7 +102,7 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
|
||||
self._link = link
|
||||
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()
|
||||
@@ -132,7 +132,7 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
|
||||
def _filterActionSlot(self, *args):
|
||||
dialog = FilterDialog(self._main_window, self._link)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
@qslot
|
||||
def _suspendActionSlot(self, *args):
|
||||
@@ -142,7 +142,7 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
|
||||
def _styleActionSlot(self, *args):
|
||||
style_dialog = StyleEditorDialogLink(self, self._main_window)
|
||||
style_dialog.show()
|
||||
style_dialog.exec_()
|
||||
style_dialog.exec()
|
||||
|
||||
def setLinkStyle(self, link_style):
|
||||
self._link._link_style["color"] = link_style["color"]
|
||||
@@ -239,57 +239,57 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
|
||||
|
||||
if not self._link.capturing():
|
||||
# start capture
|
||||
start_capture_action = QtWidgets.QAction("Start capture", menu)
|
||||
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 = 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 = QtWidgets.QAction("Packet filters", menu)
|
||||
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 = QtWidgets.QAction("Suspend", menu)
|
||||
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 = QtWidgets.QAction("Resume", menu)
|
||||
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 = QtWidgets.QAction("Style", menu)
|
||||
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 = QtGui.QAction("Delete", menu)
|
||||
delete_action.setIcon(get_icon('delete.svg'))
|
||||
delete_action.triggered.connect(self._deleteActionSlot)
|
||||
menu.addAction(delete_action)
|
||||
@@ -302,10 +302,10 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
|
||||
:param: QGraphicsSceneMouseEvent instance
|
||||
"""
|
||||
|
||||
if event.button() == QtCore.Qt.RightButton and self._adding_flag:
|
||||
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.KeyPress, QtCore.Qt.Key_Escape, QtCore.Qt.NoModifier)
|
||||
key = QtGui.QKeyEvent(QtCore.QEvent.Type.KeyPress, QtCore.Qt.Key.Key_Escape, QtCore.Qt.KeyboardModifier.NoModifier)
|
||||
QtWidgets.QApplication.sendEvent(MainWindow.instance(), key)
|
||||
return
|
||||
else:
|
||||
@@ -320,13 +320,13 @@ class LinkItem(QtWidgets.QGraphicsPathItem):
|
||||
|
||||
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):
|
||||
"""
|
||||
@@ -336,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
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import urllib.parse
|
||||
|
||||
from ..qt import QtCore, QtGui, QtWidgets, QtSvg
|
||||
from ..qt import QtCore, QtGui, QtWidgets, QtSvgWidgets
|
||||
from ..qt.qimage_svg_renderer import QImageSvgRenderer
|
||||
from ..controller import Controller
|
||||
|
||||
@@ -27,7 +27,7 @@ import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LogoItem(QtSvg.QGraphicsSvgItem):
|
||||
class LogoItem(QtSvgWidgets.QGraphicsSvgItem):
|
||||
"""
|
||||
Margin for the logo
|
||||
"""
|
||||
@@ -60,8 +60,8 @@ class LogoItem(QtSvg.QGraphicsSvgItem):
|
||||
self.graphicsEffect().setEnabled(False)
|
||||
|
||||
# set graphical settings for this item
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsFocusable)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemSendsGeometryChanges)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsFocusable)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemSendsGeometryChanges)
|
||||
self.setAcceptHoverEvents(True)
|
||||
|
||||
from ..main_window import MainWindow
|
||||
@@ -83,7 +83,7 @@ class LogoItem(QtSvg.QGraphicsSvgItem):
|
||||
self.setZValue(-2)
|
||||
|
||||
def eventFilter(self, source, event):
|
||||
if event.type() == QtCore.QEvent.Paint:
|
||||
if event.type() == QtCore.QEvent.Type.Paint:
|
||||
self.updatePosition()
|
||||
return QtWidgets.QWidget.eventFilter(self, source, event)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ Graphical representation of a node on the QGraphicsScene.
|
||||
|
||||
from ..qt import sip
|
||||
|
||||
from ..qt import QtCore, QtGui, QtWidgets, QtSvg, qslot
|
||||
from ..qt import QtCore, QtGui, QtWidgets, QtSvgWidgets, qslot
|
||||
from ..qt.qimage_svg_renderer import QImageSvgRenderer
|
||||
from .label_item import LabelItem
|
||||
from ..symbol import Symbol
|
||||
@@ -32,7 +32,7 @@ import logging
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
class NodeItem(QtSvgWidgets.QGraphicsSvgItem):
|
||||
|
||||
"""
|
||||
Node for the scene.
|
||||
@@ -51,6 +51,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
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.
|
||||
@@ -59,7 +60,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
# node label
|
||||
self._node_label = None
|
||||
|
||||
self.setPos(QtCore.QPoint(self._node.x(), self._node.y()))
|
||||
self.setPos(QtCore.QPointF(self._node.x(), self._node.y()))
|
||||
|
||||
# Temporary symbol during loading
|
||||
renderer = QImageSvgRenderer(":/icons/reload.svg")
|
||||
@@ -73,10 +74,10 @@ 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
|
||||
@@ -108,6 +109,9 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
if node.initialized():
|
||||
self.createdSlot(node.id())
|
||||
|
||||
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
|
||||
@@ -219,7 +223,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
:param base_node_id: base node identifier (integer)
|
||||
"""
|
||||
|
||||
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()
|
||||
|
||||
@@ -380,7 +384,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
self._node_label.setRotation(label_data.get("rotation", 0))
|
||||
|
||||
if self._node.locked():
|
||||
self._node_label.setFlag(self.ItemIsMovable, False)
|
||||
self._node_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
|
||||
|
||||
if label_data["x"] is None:
|
||||
self._centerLabel()
|
||||
@@ -398,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")
|
||||
@@ -439,7 +443,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
# add some delay before showing the menu
|
||||
# https://github.com/GNS3/gns3-gui/issues/3169
|
||||
QtCore.QThread.msleep(100)
|
||||
menu.exec_(pos)
|
||||
menu.exec(pos)
|
||||
return self._selected_port
|
||||
|
||||
def selectedPortSlot(self, action):
|
||||
@@ -466,7 +470,8 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
:param value: value of the change
|
||||
"""
|
||||
|
||||
if change == QtWidgets.QGraphicsItem.ItemPositionChange and self.isActive() and self._main_window.uiSnapToGridAction.isChecked():
|
||||
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
|
||||
value.setX((grid_size * round((value.x() + mid_x) / grid_size)) - mid_x)
|
||||
@@ -474,7 +479,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
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:
|
||||
@@ -482,7 +487,7 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
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()
|
||||
|
||||
@@ -499,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.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.black)
|
||||
painter.setPen(QtCore.Qt.GlobalColor.black)
|
||||
if self.show_layer:
|
||||
text = str(int(self.zValue())) # Z value
|
||||
elif self._last_error:
|
||||
@@ -528,6 +533,27 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
for link in self._links:
|
||||
link.adjust()
|
||||
|
||||
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
|
||||
@@ -540,13 +566,13 @@ class NodeItem(QtSvg.QGraphicsSvgItem):
|
||||
"""
|
||||
|
||||
if locked is True:
|
||||
self.setFlag(self.ItemIsMovable, False)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
|
||||
if self._node_label:
|
||||
self._node_label.setFlag(self.ItemIsMovable, False)
|
||||
self._node_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, False)
|
||||
else:
|
||||
self.setFlag(self.ItemIsMovable, True)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, True)
|
||||
if self._node_label:
|
||||
self._node_label.setFlag(self.ItemIsMovable, True)
|
||||
self._node_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, True)
|
||||
for link in self._links:
|
||||
link.adjust()
|
||||
self._locked = locked
|
||||
|
||||
@@ -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,7 +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)
|
||||
|
||||
@@ -52,14 +52,14 @@ class SerialLinkItem(LinkItem):
|
||||
|
||||
try:
|
||||
if self._hovered:
|
||||
self.setPen(QtGui.QPen(QtCore.Qt.red, self._link._link_style["width"] + 1, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
|
||||
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"], self._link._link_style["type"], QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
|
||||
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.red, self._pen_width + 1, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
|
||||
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.darkRed, self._pen_width, QtCore.Qt.SolidLine, QtCore.Qt.RoundCap, QtCore.Qt.RoundJoin))
|
||||
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)
|
||||
@@ -122,17 +122,17 @@ class SerialLinkItem(LinkItem):
|
||||
# source point color
|
||||
if self._link.suspended() or self._source_port.status() == Port.suspended:
|
||||
# link or port is suspended
|
||||
shape = QtCore.Qt.RoundCap
|
||||
color = QtCore.Qt.yellow
|
||||
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
|
||||
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, shape, 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:
|
||||
@@ -142,28 +142,28 @@ class SerialLinkItem(LinkItem):
|
||||
self._source_port.setLabel(source_port_label)
|
||||
|
||||
if self._draw_port_labels:
|
||||
source_port_label.setFlag(source_port_label.ItemIsMovable, not self._source_item.locked())
|
||||
source_port_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, not self._source_item.locked())
|
||||
source_port_label.show()
|
||||
else:
|
||||
source_port_label.hide()
|
||||
|
||||
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.NoPen:
|
||||
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._link.suspended() or self._destination_port.status() == Port.suspended:
|
||||
# link or port is suspended
|
||||
color = QtCore.Qt.yellow
|
||||
shape = QtCore.Qt.RoundCap
|
||||
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
|
||||
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()
|
||||
|
||||
@@ -174,12 +174,12 @@ class SerialLinkItem(LinkItem):
|
||||
self._destination_port.setLabel(destination_port_label)
|
||||
|
||||
if self._draw_port_labels:
|
||||
destination_port_label.setFlag(destination_port_label.ItemIsMovable, not self._destination_item.locked())
|
||||
destination_port_label.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, not self._destination_item.locked())
|
||||
destination_port_label.show()
|
||||
else:
|
||||
destination_port_label.hide()
|
||||
|
||||
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.NoPen:
|
||||
if self._settings["draw_link_status_points"] and self.pen().style() != QtCore.Qt.PenStyle.NoPen:
|
||||
painter.drawPoint(self.destination_point)
|
||||
|
||||
self._drawSymbol()
|
||||
|
||||
@@ -44,7 +44,7 @@ class ShapeItem(DrawingItem):
|
||||
|
||||
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)
|
||||
@@ -61,21 +61,21 @@ class ShapeItem(DrawingItem):
|
||||
"""
|
||||
|
||||
self.update()
|
||||
self._originally_movable = self.flags() & QtWidgets.QGraphicsItem.ItemIsMovable
|
||||
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)
|
||||
|
||||
@@ -87,7 +87,7 @@ class ShapeItem(DrawingItem):
|
||||
"""
|
||||
|
||||
self.update()
|
||||
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, self._originally_movable)
|
||||
self.setFlag(QtWidgets.QGraphicsItem.GraphicsItemFlag.ItemIsMovable, self._originally_movable)
|
||||
self._edge = None
|
||||
QtWidgets.QGraphicsItem.mouseReleaseEvent(self, event)
|
||||
|
||||
@@ -150,15 +150,15 @@ class ShapeItem(DrawingItem):
|
||||
# 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):
|
||||
"""
|
||||
@@ -169,11 +169,14 @@ class ShapeItem(DrawingItem):
|
||||
|
||||
# locked objects don't need cursors
|
||||
if not self.locked():
|
||||
self._graphics_view.setCursor(QtCore.Qt.ArrowCursor)
|
||||
self._graphics_view.setCursor(QtCore.Qt.CursorShape.ArrowCursor)
|
||||
|
||||
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()))
|
||||
@@ -181,7 +184,7 @@ 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):
|
||||
pen = self._penFromSVGElement(svg[0])
|
||||
|
||||
@@ -62,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):
|
||||
@@ -85,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()
|
||||
@@ -132,7 +132,7 @@ class TextItem(QtWidgets.QGraphicsTextItem, DrawingItem):
|
||||
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
|
||||
|
||||
23
gns3/link.py
23
gns3/link.py
@@ -23,7 +23,7 @@ import re
|
||||
from .qt import sip
|
||||
import uuid
|
||||
|
||||
from .qt import QtCore
|
||||
from .qt import QtCore, QtNetwork
|
||||
from .controller import Controller
|
||||
|
||||
|
||||
@@ -78,19 +78,27 @@ class Link(QtCore.QObject):
|
||||
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
|
||||
self._filters = {}
|
||||
self._suspend = False
|
||||
self._nodes = []
|
||||
|
||||
# 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
|
||||
|
||||
self._nodes = []
|
||||
self._link_style = {}
|
||||
# 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:
|
||||
@@ -111,18 +119,21 @@ class Link(QtCore.QObject):
|
||||
# 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.QFile.WriteOnly)
|
||||
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.QFile.WriteOnly)
|
||||
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)
|
||||
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._response_stream = None
|
||||
|
||||
@@ -93,7 +93,12 @@ class LocalConfig(QtCore.QObject):
|
||||
if sys.platform.startswith("win"):
|
||||
old_config_path = os.path.join(os.path.expandvars("%APPDATA%"), "GNS3", filename)
|
||||
else:
|
||||
old_config_path = os.path.join(os.path.expanduser("~"), ".config", "GNS3", filename)
|
||||
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):
|
||||
@@ -143,8 +148,13 @@ class LocalConfig(QtCore.QObject):
|
||||
appdata = os.path.expandvars("%APPDATA%")
|
||||
path = os.path.join(appdata, "GNS3", version)
|
||||
else:
|
||||
home = os.path.expanduser("~")
|
||||
path = os.path.join(home, ".config", "GNS3", version)
|
||||
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)
|
||||
@@ -190,7 +200,7 @@ class LocalConfig(QtCore.QObject):
|
||||
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_()
|
||||
app.exec()
|
||||
sys.exit(1)
|
||||
|
||||
if "version" not in self._settings or parse_version(self._settings["version"]) < parse_version("1.4.0alpha1"):
|
||||
@@ -394,14 +404,6 @@ class LocalConfig(QtCore.QObject):
|
||||
from gns3.settings import GENERAL_SETTINGS
|
||||
return self.loadSectionSettings("MainWindow", GENERAL_SETTINGS)["experimental_features"]
|
||||
|
||||
def hdpi(self):
|
||||
"""
|
||||
:returns: Boolean. True if hdpi is allowed
|
||||
"""
|
||||
|
||||
from gns3.settings import GENERAL_SETTINGS
|
||||
return self.loadSectionSettings("MainWindow", GENERAL_SETTINGS)["hdpi"]
|
||||
|
||||
def multiProfiles(self):
|
||||
"""
|
||||
:returns: Boolean. True if multi_profiles is enabled
|
||||
@@ -483,7 +485,7 @@ 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:
|
||||
@@ -498,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:
|
||||
|
||||
@@ -51,9 +51,9 @@ 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__()
|
||||
@@ -171,9 +171,9 @@ class LocalServer(QtCore.QObject):
|
||||
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.Yes,
|
||||
QtWidgets.QMessageBox.No)
|
||||
if proceed == QtWidgets.QMessageBox.Yes:
|
||||
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
|
||||
@@ -190,10 +190,14 @@ class LocalServer(QtCore.QObject):
|
||||
self.parent(),
|
||||
"uBridge",
|
||||
"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.Yes,
|
||||
QtWidgets.QMessageBox.No)
|
||||
if proceed == QtWidgets.QMessageBox.Yes:
|
||||
sudo(["chown", "root:admin", path], ["chmod", "4750", path])
|
||||
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
|
||||
@@ -358,7 +362,7 @@ 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)
|
||||
@@ -478,11 +482,15 @@ class LocalServer(QtCore.QObject):
|
||||
try:
|
||||
if sys.platform.startswith("win"):
|
||||
# use the string on Windows
|
||||
self._local_server_process = subprocess.Popen(command, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP, stderr=subprocess.PIPE)
|
||||
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, stderr=subprocess.PIPE)
|
||||
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
|
||||
@@ -552,7 +560,7 @@ 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
|
||||
@@ -575,10 +583,10 @@ class LocalServer(QtCore.QObject):
|
||||
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
|
||||
|
||||
59
gns3/main.py
59
gns3/main.py
@@ -30,23 +30,12 @@ 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, QtWidgets
|
||||
@@ -60,12 +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():
|
||||
"""
|
||||
@@ -135,6 +124,13 @@ def main():
|
||||
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
|
||||
@@ -145,6 +141,7 @@ def main():
|
||||
frozen_dirs = [
|
||||
frozen_dir,
|
||||
os.path.normpath(os.path.join(frozen_dir, 'dynamips')),
|
||||
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'))
|
||||
]
|
||||
@@ -154,6 +151,7 @@ def main():
|
||||
if options.project:
|
||||
os.chdir(frozen_dir)
|
||||
|
||||
|
||||
def exceptionHook(exception, value, tb):
|
||||
|
||||
if exception == KeyboardInterrupt:
|
||||
@@ -185,15 +183,12 @@ def main():
|
||||
# catch exceptions to write them in a file
|
||||
sys.excepthook = exceptionHook
|
||||
|
||||
# we only support Python 3 version >= 3.4
|
||||
if sys.version_info < (3, 4):
|
||||
raise SystemExit("Python 3.4 or higher is required")
|
||||
# we only support Python 3 version >= 3.9
|
||||
if sys.version_info < (3, 9):
|
||||
raise SystemExit("Python 3.9 or higher is required")
|
||||
|
||||
if parse_version(QtCore.QT_VERSION_STR) < parse_version("5.5.0"):
|
||||
raise SystemExit("Requirement is PyQt5 version 5.5.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)
|
||||
@@ -207,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:
|
||||
@@ -220,20 +215,27 @@ 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, hdpi=local_config.hdpi())
|
||||
app = Application(sys.argv)
|
||||
|
||||
if local_config.multiProfiles() and not options.profile:
|
||||
profile_select = ProfileSelectDialog()
|
||||
profile_select.show()
|
||||
if profile_select.exec_():
|
||||
if profile_select.exec():
|
||||
options.profile = profile_select.profile()
|
||||
else:
|
||||
sys.exit(0)
|
||||
@@ -259,6 +261,7 @@ def main():
|
||||
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)
|
||||
@@ -270,7 +273,7 @@ def main():
|
||||
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_()
|
||||
app.exec()
|
||||
sys.exit(1)
|
||||
|
||||
global mainwindow
|
||||
@@ -293,7 +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)
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ from .topology import Topology
|
||||
from .http_client import HTTPClient
|
||||
from .progress import Progress
|
||||
from .update_manager import UpdateManager
|
||||
from .utils.analytics import AnalyticsClient
|
||||
from .dialogs.appliance_wizard import ApplianceWizard
|
||||
from .dialogs.new_template_wizard import NewTemplateWizard
|
||||
from .dialogs.notif_dialog import NotifDialog, NotifDialogHandler
|
||||
@@ -70,7 +69,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
"""
|
||||
|
||||
# signal to tell the view if the user is adding a link or not
|
||||
adding_link_signal = QtCore.pyqtSignal(bool)
|
||||
adding_link_signal = QtCore.Signal(bool)
|
||||
|
||||
# Signal of settings updates
|
||||
settings_updated_signal = QtCore.Signal()
|
||||
@@ -133,11 +132,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self._local_config_timer = QtCore.QTimer(self)
|
||||
self._local_config_timer.timeout.connect(local_config.checkConfigChanged)
|
||||
self._local_config_timer.start(1000) # milliseconds
|
||||
self._analytics_client = AnalyticsClient()
|
||||
self._template_manager = TemplateManager().instance()
|
||||
self._appliance_manager = ApplianceManager().instance()
|
||||
|
||||
# restore the geometry and state of the main window.
|
||||
self._save_gui_state_geometry = True
|
||||
self.restoreGeometry(QtCore.QByteArray().fromBase64(self._settings["geometry"].encode()))
|
||||
self.restoreState(QtCore.QByteArray().fromBase64(self._settings["state"].encode()))
|
||||
|
||||
@@ -155,17 +154,17 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.uiNodesDockWidget.setVisible(False)
|
||||
|
||||
# default directories for QFileDialog
|
||||
self._import_configs_from_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.DocumentsLocation)
|
||||
self._export_configs_to_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.DocumentsLocation)
|
||||
self._screenshots_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.PicturesLocation)
|
||||
self._pictures_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.PicturesLocation)
|
||||
self._appliance_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.DownloadLocation)
|
||||
self._portable_project_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.DownloadLocation)
|
||||
self._import_configs_from_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.DocumentsLocation)
|
||||
self._export_configs_to_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.DocumentsLocation)
|
||||
self._screenshots_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.PicturesLocation)
|
||||
self._pictures_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.PicturesLocation)
|
||||
self._appliance_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.DownloadLocation)
|
||||
self._portable_project_dir = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.StandardLocation.DownloadLocation)
|
||||
self._project_dir = None
|
||||
|
||||
# add recent file actions to the File menu
|
||||
for i in range(0, self._maxrecent_files):
|
||||
action = QtWidgets.QAction(self.uiFileMenu)
|
||||
action = QtGui.QAction(self.uiFileMenu)
|
||||
action.setVisible(False)
|
||||
action.triggered.connect(self.openRecentFileSlot)
|
||||
self.recent_file_actions.append(action)
|
||||
@@ -176,7 +175,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
# add recent projects to the File menu
|
||||
for i in range(0, self._maxrecent_files):
|
||||
action = QtWidgets.QAction(self.uiFileMenu)
|
||||
action = QtGui.QAction(self.uiFileMenu)
|
||||
action.setVisible(False)
|
||||
action.triggered.connect(self.openRecentProjectSlot)
|
||||
self.recent_project_actions.append(action)
|
||||
@@ -195,6 +194,12 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
self.setWindowTitle("[*] GNS3")
|
||||
|
||||
# detect if the SVG module is correctly installed
|
||||
supported_image_formats = [fmt.data().decode('utf-8') for fmt in QtGui.QImageReader().supportedImageFormats()]
|
||||
log.debug("Supported image formats: %s", ", ".join(supported_image_formats))
|
||||
if "svg" not in supported_image_formats:
|
||||
log.warning("SVG image format is not supported, is the Qt SVG module installed?")
|
||||
|
||||
# load initial stuff once the event loop isn't busy
|
||||
self.run_later(0, self.startupLoading)
|
||||
|
||||
@@ -234,6 +239,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.uiShowGridAction.triggered.connect(self._showGridActionSlot)
|
||||
self.uiSnapToGridAction.triggered.connect(self._snapToGridActionSlot)
|
||||
self.uiLockAllAction.triggered.connect(self._lockActionSlot)
|
||||
self.uiResetGUIStateAction.triggered.connect(self._resetGUIState)
|
||||
self.uiResetDocksAction.triggered.connect(self._resetDocksSlot)
|
||||
|
||||
# tool menu connections
|
||||
@@ -246,6 +252,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.uiReloadAllAction.triggered.connect(self._reloadAllActionSlot)
|
||||
self.uiAuxConsoleAllAction.triggered.connect(self._auxConsoleAllActionSlot)
|
||||
self.uiConsoleAllAction.triggered.connect(self._consoleAllActionSlot)
|
||||
self.uiResetConsoleAllAction.triggered.connect(self._consoleResetAllActionSlot)
|
||||
|
||||
# device menu is contextual and is build on-the-fly
|
||||
self.uiDeviceMenu.aboutToShow.connect(self._deviceMenuActionSlot)
|
||||
@@ -267,6 +274,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.uiExportDebugInformationAction.triggered.connect(self._exportDebugInformationSlot)
|
||||
self.uiDoctorAction.triggered.connect(self._doctorSlot)
|
||||
self.uiAcademyAction.triggered.connect(self._academyActionSlot)
|
||||
self.uiShortcutsAction.triggered.connect(self._shortcutsActionSlot)
|
||||
|
||||
# browsers tool bar connections
|
||||
self.uiBrowseRoutersAction.triggered.connect(self._browseRoutersActionSlot)
|
||||
@@ -313,6 +321,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
style = new_settings.get("style")
|
||||
if style and new_settings["style"] != self._settings["style"]:
|
||||
self._setStyle(style)
|
||||
QtWidgets.QMessageBox.information(
|
||||
self,
|
||||
"Interface style",
|
||||
"Please restart the application to fully apply the {} style.".format(style)
|
||||
)
|
||||
|
||||
self._settings.update(new_settings)
|
||||
# save the settings
|
||||
@@ -367,6 +380,18 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
item.updateNode()
|
||||
item.update()
|
||||
|
||||
def _resetGUIState(self):
|
||||
"""
|
||||
Reset the GUI state.
|
||||
"""
|
||||
|
||||
self._save_gui_state_geometry = False
|
||||
self.close()
|
||||
if hasattr(sys, "frozen"):
|
||||
QtCore.QProcess.startDetached(os.path.abspath(sys.executable), sys.argv)
|
||||
else:
|
||||
QtWidgets.QMessageBox.information(self, "GUI state","The GUI state has been reset, please restart the application")
|
||||
|
||||
def _resetDocksSlot(self):
|
||||
"""
|
||||
Reset the dock widgets.
|
||||
@@ -377,13 +402,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.uiConsoleDockWidget.setFloating(False)
|
||||
self.uiNodesDockWidget.setFloating(False)
|
||||
|
||||
def analyticsClient(self):
|
||||
"""
|
||||
Return the analytics client
|
||||
"""
|
||||
|
||||
return self._analytics_client
|
||||
|
||||
def _newProjectActionSlot(self):
|
||||
"""
|
||||
Slot called to create a new project.
|
||||
@@ -395,7 +413,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
self._project_dialog = ProjectDialog(self)
|
||||
self._project_dialog.show()
|
||||
create_new_project = self._project_dialog.exec_()
|
||||
create_new_project = self._project_dialog.exec()
|
||||
|
||||
if create_new_project:
|
||||
Topology.instance().createLoadProject(self._project_dialog.getProjectSettings())
|
||||
@@ -409,7 +427,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
dialog = NewTemplateWizard(self)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
@qslot
|
||||
def openApplianceActionSlot(self, *args):
|
||||
@@ -421,7 +439,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
if not os.path.exists(self._appliance_dir):
|
||||
directory = Topology.instance().projectsDirPath()
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Import appliance", directory,
|
||||
"All files (*.*);;GNS3 Appliance (*.gns3appliance *.gns3a)",
|
||||
"All files (*);;GNS3 Appliance (*.gns3appliance *.gns3a)",
|
||||
"GNS3 Appliance (*.gns3appliance *.gns3a)")
|
||||
if path:
|
||||
self.loadPath(path)
|
||||
@@ -440,7 +458,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
if self._project_dir is None or not os.path.exists(self._project_dir):
|
||||
directory = Topology.instance().projectsDirPath()
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Open project", directory,
|
||||
"All files (*.*);;GNS3 Project (*.gns3);;GNS3 Portable Project (*.gns3project *.gns3p);;NET files (*.net)",
|
||||
"All files (*);;GNS3 Project (*.gns3);;GNS3 Portable Project (*.gns3project *.gns3p);;NET files (*.net)",
|
||||
"GNS3 Project (*.gns3)")
|
||||
if path:
|
||||
self.loadPath(path)
|
||||
@@ -504,7 +522,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
QtWidgets.QMessageBox.critical(self, "Appliance", "Error while importing appliance {}: {}".format(path, str(e)))
|
||||
return
|
||||
self._appliance_wizard.show()
|
||||
self._appliance_wizard.exec_()
|
||||
self._appliance_wizard.exec()
|
||||
elif path.endswith(".gns3"):
|
||||
if Controller.instance().isRemote():
|
||||
QtWidgets.QMessageBox.critical(self, "Open project", "Cannot open a .gns3 file on a remote server, please use a portable project (.gns3p) instead")
|
||||
@@ -581,7 +599,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
Exports all configs to a directory.
|
||||
"""
|
||||
|
||||
path = QtWidgets.QFileDialog.getExistingDirectory(self, "Export directory", self._export_configs_to_dir, QtWidgets.QFileDialog.ShowDirsOnly)
|
||||
path = QtWidgets.QFileDialog.getExistingDirectory(self, "Export directory", self._export_configs_to_dir, QtWidgets.QFileDialog.Option.ShowDirsOnly)
|
||||
if path:
|
||||
self._export_configs_to_dir = os.path.dirname(path)
|
||||
for module in MODULES:
|
||||
@@ -594,7 +612,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
Imports all configs from a directory.
|
||||
"""
|
||||
|
||||
path = QtWidgets.QFileDialog.getExistingDirectory(self, "Import directory", self._import_configs_from_dir, QtWidgets.QFileDialog.ShowDirsOnly)
|
||||
path = QtWidgets.QFileDialog.getExistingDirectory(self, "Import directory", self._import_configs_from_dir, QtWidgets.QFileDialog.Option.ShowDirsOnly)
|
||||
if path:
|
||||
self._import_configs_from_dir = os.path.dirname(path)
|
||||
for module in MODULES:
|
||||
@@ -612,12 +630,12 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
scene = self.uiGraphicsView.scene()
|
||||
scene.clearSelection()
|
||||
source = scene.itemsBoundingRect().adjusted(-20.0, -20.0, 20.0, 20.0)
|
||||
image = QtGui.QImage(source.size().toSize(), QtGui.QImage.Format_RGB32)
|
||||
image.fill(QtCore.Qt.white)
|
||||
image = QtGui.QImage(source.size().toSize(), QtGui.QImage.Format.Format_RGB32)
|
||||
image.fill(QtCore.Qt.GlobalColor.white)
|
||||
painter = QtGui.QPainter(image)
|
||||
painter.setRenderHint(QtGui.QPainter.Antialiasing, True)
|
||||
painter.setRenderHint(QtGui.QPainter.TextAntialiasing, True)
|
||||
painter.setRenderHint(QtGui.QPainter.SmoothPixmapTransform, True)
|
||||
painter.setRenderHint(QtGui.QPainter.RenderHint.Antialiasing, True)
|
||||
painter.setRenderHint(QtGui.QPainter.RenderHint.TextAntialiasing, True)
|
||||
painter.setRenderHint(QtGui.QPainter.RenderHint.SmoothPixmapTransform, True)
|
||||
scene.render(painter, source=source)
|
||||
painter.end()
|
||||
# TODO: quality option
|
||||
@@ -707,7 +725,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
dialog = SnapshotsDialog(self, project)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
def _selectAllActionSlot(self):
|
||||
"""
|
||||
@@ -732,12 +750,12 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
Slot to switch to full screen.
|
||||
"""
|
||||
|
||||
if not self.windowState() & QtCore.Qt.WindowFullScreen:
|
||||
if not self.windowState() & QtCore.Qt.WindowState.WindowFullScreen:
|
||||
# switch to full screen
|
||||
self.setWindowState(self.windowState() | QtCore.Qt.WindowFullScreen)
|
||||
self.setWindowState(self.windowState() | QtCore.Qt.WindowState.WindowFullScreen)
|
||||
else:
|
||||
# switch back to normal
|
||||
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowFullScreen)
|
||||
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowState.WindowFullScreen)
|
||||
|
||||
def _zoomInActionSlot(self):
|
||||
"""
|
||||
@@ -773,7 +791,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
view = self.uiGraphicsView
|
||||
bounding_rect = view.scene().itemsBoundingRect().adjusted(-20.0, -20.0, 20.0, 20.0)
|
||||
view.ensureVisible(bounding_rect)
|
||||
view.fitInView(bounding_rect, QtCore.Qt.KeepAspectRatio)
|
||||
view.fitInView(bounding_rect, QtCore.Qt.AspectRatioMode.KeepAspectRatio)
|
||||
|
||||
def _showLayersActionSlot(self):
|
||||
"""
|
||||
@@ -816,9 +834,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
"""
|
||||
|
||||
reply = QtWidgets.QMessageBox.question(self, "Confirm Start All", "Are you sure you want to start all devices?",
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
||||
QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No)
|
||||
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
if reply == QtWidgets.QMessageBox.StandardButton.No:
|
||||
return
|
||||
|
||||
project = Topology.instance().project()
|
||||
@@ -831,9 +849,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
"""
|
||||
|
||||
reply = QtWidgets.QMessageBox.question(self, "Confirm Suspend All", "Are you sure you want to suspend all devices?",
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
||||
QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No)
|
||||
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
if reply == QtWidgets.QMessageBox.StandardButton.No:
|
||||
return
|
||||
|
||||
project = Topology.instance().project()
|
||||
@@ -846,9 +864,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
"""
|
||||
|
||||
reply = QtWidgets.QMessageBox.question(self, "Confirm Stop All", "Are you sure you want to stop all devices?",
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
||||
QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No)
|
||||
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
if reply == QtWidgets.QMessageBox.StandardButton.No:
|
||||
return
|
||||
|
||||
project = Topology.instance().project()
|
||||
@@ -861,15 +879,24 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
"""
|
||||
|
||||
reply = QtWidgets.QMessageBox.question(self, "Confirm Reload All", "Are you sure you want to reload all devices?",
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
||||
QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No)
|
||||
|
||||
if reply == QtWidgets.QMessageBox.No:
|
||||
if reply == QtWidgets.QMessageBox.StandardButton.No:
|
||||
return
|
||||
|
||||
project = Topology.instance().project()
|
||||
if project is not None:
|
||||
project.reload_all_nodes()
|
||||
|
||||
def _consoleResetAllActionSlot(self):
|
||||
"""
|
||||
Slot called when reset all console connections.
|
||||
"""
|
||||
|
||||
project = Topology.instance().project()
|
||||
if project is not None:
|
||||
project.reset_console_all_nodes()
|
||||
|
||||
def _deviceMenuActionSlot(self):
|
||||
"""
|
||||
Slot to contextually show the device menu.
|
||||
@@ -904,7 +931,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
Slot called when inserting an image on the scene.
|
||||
"""
|
||||
# supported image file formats
|
||||
file_formats = "Image files (*.svg *.bmp *.jpeg *.jpg *.gif *.pbm *.pgm *.png *.ppm *.xbm *.xpm);;All files (*.*)"
|
||||
file_formats = "Image files (*.svg *.bmp *.jpeg *.jpg *.gif *.pbm *.pgm *.png *.ppm *.xbm *.xpm);;All files (*)"
|
||||
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Image", self._pictures_dir, file_formats)
|
||||
if not path:
|
||||
@@ -960,10 +987,19 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
with Progress.instance().context(min_duration=0):
|
||||
setup_wizard = SetupWizard(self)
|
||||
setup_wizard.show()
|
||||
res = setup_wizard.exec_()
|
||||
res = setup_wizard.exec()
|
||||
# start and connect to the local server if needed
|
||||
LocalServer.instance().localServerAutoStartIfRequired()
|
||||
|
||||
def _shortcutsActionSlot(self):
|
||||
|
||||
shortcuts_text = ""
|
||||
for action in self.findChildren(QtGui.QAction):
|
||||
shortcut = action.shortcut().toString()
|
||||
if shortcut:
|
||||
shortcuts_text += f"{action.toolTip()}: {shortcut}\n"
|
||||
QtWidgets.QMessageBox.information(self, "Shortcuts", shortcuts_text)
|
||||
|
||||
def _aboutQtActionSlot(self):
|
||||
"""
|
||||
Slot to display the Qt About dialog.
|
||||
@@ -978,7 +1014,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
dialog = AboutDialog(self)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
def _exportDebugInformationSlot(self):
|
||||
"""
|
||||
@@ -987,7 +1023,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
dialog = ExportDebugDialog(self, Topology.instance().project())
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
def _doctorSlot(self):
|
||||
"""
|
||||
@@ -996,7 +1032,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
dialog = DoctorDialog(self)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
def _academyActionSlot(self):
|
||||
"""
|
||||
@@ -1086,7 +1122,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
dialog = PreferencesDialog(self)
|
||||
#dialog.restoreGeometry(QtCore.QByteArray().fromBase64(self._settings["preferences_dialog_geometry"].encode()))
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
#self._settings["preferences_dialog_geometry"] = bytes(dialog.saveGeometry().toBase64()).decode()
|
||||
#self.setSettings(self._settings)
|
||||
|
||||
@@ -1109,9 +1145,13 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
key = event.key()
|
||||
# if the user is adding a link and press Escape, then cancel the link addition.
|
||||
if self.uiAddLinkAction.isChecked() and key == QtCore.Qt.Key_Escape:
|
||||
if self.uiAddLinkAction.isChecked() and key == QtCore.Qt.Key.Key_Escape:
|
||||
self.uiAddLinkAction.setChecked(False)
|
||||
self._addLinkActionSlot()
|
||||
elif key == QtCore.Qt.Key.Key_C and (event.modifiers() & QtCore.Qt.KeyboardModifier.ControlModifier):
|
||||
status_bar_message = self.uiStatusBar.currentMessage()
|
||||
if status_bar_message:
|
||||
QtWidgets.QApplication.clipboard().setText(status_bar_message)
|
||||
else:
|
||||
super().keyPressEvent(event)
|
||||
|
||||
@@ -1124,8 +1164,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
if Topology.instance().project():
|
||||
reply = QtWidgets.QMessageBox.question(self, "Confirm Exit", "Are you sure you want to exit GNS3?",
|
||||
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:
|
||||
event.ignore()
|
||||
return
|
||||
|
||||
@@ -1134,8 +1174,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
progress.setCancelButtonText("Force quit")
|
||||
|
||||
log.debug("Close the Main Window")
|
||||
self._analytics_client.sendScreenView("Main Window", session_start=False)
|
||||
|
||||
self._finish_application_closing(close_windows=False)
|
||||
event.accept()
|
||||
self.uiConsoleTextEdit.closeIO()
|
||||
@@ -1150,8 +1188,12 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
log.debug("_finish_application_closing")
|
||||
|
||||
self._settings["geometry"] = bytes(self.saveGeometry().toBase64()).decode()
|
||||
self._settings["state"] = bytes(self.saveState().toBase64()).decode()
|
||||
if self._save_gui_state_geometry:
|
||||
self._settings["geometry"] = bytes(self.saveGeometry().toBase64()).decode()
|
||||
self._settings["state"] = bytes(self.saveState().toBase64()).decode()
|
||||
else:
|
||||
self._settings["geometry"] = ""
|
||||
self._settings["state"] = ""
|
||||
self.setSettings(self._settings)
|
||||
|
||||
Controller.instance().stopListenNotifications()
|
||||
@@ -1185,8 +1227,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
|
||||
if not LocalConfig.instance().isMainGui():
|
||||
reply = QtWidgets.QMessageBox.warning(self, "GNS3", "Another GNS3 GUI is already running. Continue?",
|
||||
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:
|
||||
sys.exit(1)
|
||||
return
|
||||
|
||||
@@ -1224,7 +1266,6 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
Controller.instance().connected_signal.connect(self._controllerConnectedSlot)
|
||||
Controller.instance().project_list_updated_signal.connect(self.updateRecentProjectActions)
|
||||
|
||||
self._analytics_client.sendScreenView("Main Window")
|
||||
self.uiGraphicsView.setEnabled(False)
|
||||
|
||||
# show the setup wizard
|
||||
@@ -1419,7 +1460,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
if not os.path.exists(directory):
|
||||
directory = Topology.instance().projectsDirPath()
|
||||
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Open portable project", directory,
|
||||
"All files (*.*);;GNS3 Portable Project (*.gns3project *.gns3p)",
|
||||
"All files (*);;GNS3 Portable Project (*.gns3project *.gns3p)",
|
||||
"GNS3 Portable Project (*.gns3project *.gns3p)")
|
||||
if path:
|
||||
Topology.instance().importProject(path)
|
||||
@@ -1430,7 +1471,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
return
|
||||
dialog = EditProjectDialog(self)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
def _deleteProjectActionSlot(self):
|
||||
if Topology.instance().project() is None:
|
||||
@@ -1439,8 +1480,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self,
|
||||
"GNS3",
|
||||
"The project will be deleted from disk. All files will be removed including the project subdirectories. Continue?",
|
||||
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:
|
||||
Topology.instance().deleteProject()
|
||||
|
||||
def _setStyle(self, style_name):
|
||||
@@ -1455,6 +1496,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
style.setCharcoalStyle()
|
||||
elif style_name == "Classic":
|
||||
style.setClassicStyle()
|
||||
elif style_name == "Dark":
|
||||
style.setDarkStyle()
|
||||
else:
|
||||
style.setLegacyStyle()
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class CloudWizard(VMWizard, Ui_CloudNodeWizard):
|
||||
|
||||
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):
|
||||
|
||||
@@ -38,7 +38,7 @@ class EthernetHubWizard(VMWizard, Ui_EthernetHubWizard):
|
||||
|
||||
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):
|
||||
|
||||
@@ -38,7 +38,7 @@ class EthernetSwitchWizard(VMWizard, Ui_EthernetSwitchWizard):
|
||||
|
||||
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):
|
||||
|
||||
@@ -73,7 +73,7 @@ class Nat(Node):
|
||||
:returns: symbol path (or resource).
|
||||
"""
|
||||
|
||||
return ":/symbols/cloud.svg"
|
||||
return ":/symbols/nat.svg"
|
||||
|
||||
@staticmethod
|
||||
def categories():
|
||||
|
||||
@@ -43,7 +43,7 @@ class ATMSwitchConfigurationPage(QtWidgets.QWidget, Ui_atmSwitchConfigPageWidget
|
||||
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)
|
||||
|
||||
@@ -364,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
|
||||
@@ -377,7 +377,7 @@ 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))
|
||||
|
||||
@@ -107,7 +107,7 @@ class CloudPreferencesPage(QtWidgets.QWidget, Ui_CloudPreferencesPageWidget):
|
||||
self.uiEditCloudNodePushButton.setEnabled(single_selected)
|
||||
|
||||
if single_selected:
|
||||
key = selection[0].data(0, QtCore.Qt.UserRole)
|
||||
key = selection[0].data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
cloud_node = self._cloud_nodes[key]
|
||||
self._refreshInfo(cloud_node)
|
||||
else:
|
||||
@@ -120,7 +120,7 @@ class CloudPreferencesPage(QtWidgets.QWidget, Ui_CloudPreferencesPageWidget):
|
||||
|
||||
wizard = CloudWizard(self._cloud_nodes, parent=self)
|
||||
wizard.show()
|
||||
if wizard.exec_():
|
||||
if wizard.exec():
|
||||
new_cloud_settings = wizard.getSettings()
|
||||
key = "{server}:{name}".format(server=new_cloud_settings["compute_id"], name=new_cloud_settings["name"])
|
||||
self._cloud_nodes[key] = CLOUD_SETTINGS.copy()
|
||||
@@ -130,7 +130,7 @@ class CloudPreferencesPage(QtWidgets.QWidget, Ui_CloudPreferencesPageWidget):
|
||||
item.setText(0, self._cloud_nodes[key]["name"])
|
||||
Controller.instance().getSymbolIcon(self._cloud_nodes[key]["symbol"], qpartial(self._setItemIcon, item))
|
||||
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, key)
|
||||
self._items.append(item)
|
||||
self.uiCloudNodesTreeWidget.setCurrentItem(item)
|
||||
|
||||
@@ -141,11 +141,11 @@ class CloudPreferencesPage(QtWidgets.QWidget, Ui_CloudPreferencesPageWidget):
|
||||
|
||||
item = self.uiCloudNodesTreeWidget.currentItem()
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
key = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
cloud_node = self._cloud_nodes[key]
|
||||
dialog = ConfigurationDialog(cloud_node["name"], cloud_node, CloudConfigurationPage(), parent=self)
|
||||
dialog.show()
|
||||
if dialog.exec_():
|
||||
if dialog.exec():
|
||||
# update the icon
|
||||
Controller.instance().getSymbolIcon(cloud_node["symbol"], qpartial(self._setItemIcon, item))
|
||||
if cloud_node["name"] != item.text(0):
|
||||
@@ -158,7 +158,7 @@ class CloudPreferencesPage(QtWidgets.QWidget, Ui_CloudPreferencesPageWidget):
|
||||
self._cloud_nodes[new_key] = self._cloud_nodes[key]
|
||||
del self._cloud_nodes[key]
|
||||
item.setText(0, cloud_node["name"])
|
||||
item.setData(0, QtCore.Qt.UserRole, new_key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, new_key)
|
||||
self._refreshInfo(cloud_node)
|
||||
|
||||
def _deleteCloudNodeSlot(self):
|
||||
@@ -168,7 +168,7 @@ class CloudPreferencesPage(QtWidgets.QWidget, Ui_CloudPreferencesPageWidget):
|
||||
|
||||
for item in self.uiCloudNodesTreeWidget.selectedItems():
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
key = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
del self._cloud_nodes[key]
|
||||
self.uiCloudNodesTreeWidget.takeTopLevelItem(self.uiCloudNodesTreeWidget.indexOfTopLevelItem(item))
|
||||
|
||||
@@ -192,12 +192,12 @@ class CloudPreferencesPage(QtWidgets.QWidget, Ui_CloudPreferencesPageWidget):
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiCloudNodesTreeWidget)
|
||||
item.setText(0, cloud_node["name"])
|
||||
Controller.instance().getSymbolIcon(cloud_node["symbol"], qpartial(self._setItemIcon, item))
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, key)
|
||||
self._items.append(item)
|
||||
|
||||
if self._items:
|
||||
self.uiCloudNodesTreeWidget.setCurrentItem(self._items[0])
|
||||
self.uiCloudNodesTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
|
||||
self.uiCloudNodesTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
self.uiCloudNodesTreeWidget.setMaximumWidth(self.uiCloudNodesTreeWidget.sizeHintForColumn(0) + 20)
|
||||
|
||||
def _setItemIcon(self, item, icon):
|
||||
|
||||
@@ -52,7 +52,7 @@ class EthernetHubConfigurationPage(QtWidgets.QWidget, Ui_ethernetHubConfigPageWi
|
||||
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))
|
||||
|
||||
@@ -104,7 +104,7 @@ class EthernetHubPreferencesPage(QtWidgets.QWidget, Ui_EthernetHubPreferencesPag
|
||||
self.uiEditEthernetHubPushButton.setEnabled(single_selected)
|
||||
|
||||
if single_selected:
|
||||
key = selection[0].data(0, QtCore.Qt.UserRole)
|
||||
key = selection[0].data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
ethernet_hub = self._ethernet_hubs[key]
|
||||
self._refreshInfo(ethernet_hub)
|
||||
else:
|
||||
@@ -117,7 +117,7 @@ class EthernetHubPreferencesPage(QtWidgets.QWidget, Ui_EthernetHubPreferencesPag
|
||||
|
||||
wizard = EthernetHubWizard(self._ethernet_hubs, parent=self)
|
||||
wizard.show()
|
||||
if wizard.exec_():
|
||||
if wizard.exec():
|
||||
new_ethernet_hub_settings = wizard.getSettings()
|
||||
key = "{server}:{name}".format(server=new_ethernet_hub_settings["compute_id"], name=new_ethernet_hub_settings["name"])
|
||||
self._ethernet_hubs[key] = ETHERNET_HUB_SETTINGS.copy()
|
||||
@@ -126,7 +126,7 @@ class EthernetHubPreferencesPage(QtWidgets.QWidget, Ui_EthernetHubPreferencesPag
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiEthernetHubsTreeWidget)
|
||||
item.setText(0, self._ethernet_hubs[key]["name"])
|
||||
Controller.instance().getSymbolIcon(self._ethernet_hubs[key]["symbol"], qpartial(self._setItemIcon, item))
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, key)
|
||||
self._items.append(item)
|
||||
self.uiEthernetHubsTreeWidget.setCurrentItem(item)
|
||||
|
||||
@@ -137,11 +137,11 @@ class EthernetHubPreferencesPage(QtWidgets.QWidget, Ui_EthernetHubPreferencesPag
|
||||
|
||||
item = self.uiEthernetHubsTreeWidget.currentItem()
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
key = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
ethernet_hub = self._ethernet_hubs[key]
|
||||
dialog = ConfigurationDialog(ethernet_hub["name"], ethernet_hub, EthernetHubConfigurationPage(), parent=self)
|
||||
dialog.show()
|
||||
if dialog.exec_():
|
||||
if dialog.exec():
|
||||
# update the icon
|
||||
Controller.instance().getSymbolIcon(ethernet_hub["symbol"], qpartial(self._setItemIcon, item))
|
||||
if ethernet_hub["name"] != item.text(0):
|
||||
@@ -154,7 +154,7 @@ class EthernetHubPreferencesPage(QtWidgets.QWidget, Ui_EthernetHubPreferencesPag
|
||||
self._ethernet_hubs[new_key] = self._ethernet_hubs[key]
|
||||
del self._ethernet_hubs[key]
|
||||
item.setText(0, ethernet_hub["name"])
|
||||
item.setData(0, QtCore.Qt.UserRole, new_key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, new_key)
|
||||
self._refreshInfo(ethernet_hub)
|
||||
|
||||
def _deleteEthernetHubSlot(self):
|
||||
@@ -164,7 +164,7 @@ class EthernetHubPreferencesPage(QtWidgets.QWidget, Ui_EthernetHubPreferencesPag
|
||||
|
||||
for item in self.uiEthernetHubsTreeWidget.selectedItems():
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
key = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
del self._ethernet_hubs[key]
|
||||
self.uiEthernetHubsTreeWidget.takeTopLevelItem(self.uiEthernetHubsTreeWidget.indexOfTopLevelItem(item))
|
||||
|
||||
@@ -188,12 +188,12 @@ class EthernetHubPreferencesPage(QtWidgets.QWidget, Ui_EthernetHubPreferencesPag
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiEthernetHubsTreeWidget)
|
||||
item.setText(0, ethernet_hub["name"])
|
||||
Controller.instance().getSymbolIcon(ethernet_hub["symbol"], qpartial(self._setItemIcon, item))
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, key)
|
||||
self._items.append(item)
|
||||
|
||||
if self._items:
|
||||
self.uiEthernetHubsTreeWidget.setCurrentItem(self._items[0])
|
||||
self.uiEthernetHubsTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
|
||||
self.uiEthernetHubsTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
self.uiEthernetHubsTreeWidget.setMaximumWidth(self.uiEthernetHubsTreeWidget.sizeHintForColumn(0) + 20)
|
||||
|
||||
def _setItemIcon(self, item, icon):
|
||||
|
||||
@@ -51,7 +51,7 @@ class EthernetSwitchConfigurationPage(QtWidgets.QWidget, Ui_ethernetSwitchConfig
|
||||
self.uiPortTypeComboBox.currentIndexChanged.connect(self._typeSelectionChangedSlot)
|
||||
|
||||
# enable sorting
|
||||
self.uiPortsTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
|
||||
self.uiPortsTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
self.uiPortsTreeWidget.setSortingEnabled(True)
|
||||
|
||||
self.uiSymbolToolButton.clicked.connect(self._symbolBrowserSlot)
|
||||
@@ -64,7 +64,7 @@ class EthernetSwitchConfigurationPage(QtWidgets.QWidget, Ui_ethernetSwitchConfig
|
||||
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))
|
||||
@@ -131,7 +131,7 @@ class EthernetSwitchConfigurationPage(QtWidgets.QWidget, Ui_ethernetSwitchConfig
|
||||
|
||||
if port in self._ports:
|
||||
# update a given entry in the tree widget
|
||||
item = self.uiPortsTreeWidget.findItems(str(port), QtCore.Qt.MatchFixedString)[0]
|
||||
item = self.uiPortsTreeWidget.findItems(str(port), QtCore.Qt.MatchFlag.MatchFixedString)[0]
|
||||
item.setText(1, str(vlan))
|
||||
item.setText(2, port_type)
|
||||
item.setText(3, port_ethertype)
|
||||
|
||||
@@ -109,7 +109,7 @@ class EthernetSwitchPreferencesPage(QtWidgets.QWidget, Ui_EthernetSwitchPreferen
|
||||
self.uiEditEthernetSwitchPushButton.setEnabled(single_selected)
|
||||
|
||||
if single_selected:
|
||||
key = selection[0].data(0, QtCore.Qt.UserRole)
|
||||
key = selection[0].data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
ethernet_switch = self._ethernet_switches[key]
|
||||
self._refreshInfo(ethernet_switch)
|
||||
else:
|
||||
@@ -122,7 +122,7 @@ class EthernetSwitchPreferencesPage(QtWidgets.QWidget, Ui_EthernetSwitchPreferen
|
||||
|
||||
wizard = EthernetSwitchWizard(self._ethernet_switches, parent=self)
|
||||
wizard.show()
|
||||
if wizard.exec_():
|
||||
if wizard.exec():
|
||||
new_ethernet_switch_settings = wizard.getSettings()
|
||||
key = "{server}:{name}".format(server=new_ethernet_switch_settings["compute_id"], name=new_ethernet_switch_settings["name"])
|
||||
self._ethernet_switches[key] = ETHERNET_SWITCH_SETTINGS.copy()
|
||||
@@ -132,7 +132,7 @@ class EthernetSwitchPreferencesPage(QtWidgets.QWidget, Ui_EthernetSwitchPreferen
|
||||
item.setText(0, self._ethernet_switches[key]["name"])
|
||||
Controller.instance().getSymbolIcon(self._ethernet_switches[key]["symbol"], qpartial(self._setItemIcon, item))
|
||||
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, key)
|
||||
self._items.append(item)
|
||||
self.uiEthernetSwitchesTreeWidget.setCurrentItem(item)
|
||||
|
||||
@@ -143,11 +143,11 @@ class EthernetSwitchPreferencesPage(QtWidgets.QWidget, Ui_EthernetSwitchPreferen
|
||||
|
||||
item = self.uiEthernetSwitchesTreeWidget.currentItem()
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
key = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
ethernet_switch = self._ethernet_switches[key]
|
||||
dialog = ConfigurationDialog(ethernet_switch["name"], ethernet_switch, EthernetSwitchConfigurationPage(), parent=self)
|
||||
dialog.show()
|
||||
if dialog.exec_():
|
||||
if dialog.exec():
|
||||
# update the icon
|
||||
Controller.instance().getSymbolIcon(ethernet_switch["symbol"], qpartial(self._setItemIcon, item))
|
||||
if ethernet_switch["name"] != item.text(0):
|
||||
@@ -160,7 +160,7 @@ class EthernetSwitchPreferencesPage(QtWidgets.QWidget, Ui_EthernetSwitchPreferen
|
||||
self._ethernet_switches[new_key] = self._ethernet_switches[key]
|
||||
del self._ethernet_switches[key]
|
||||
item.setText(0, ethernet_switch["name"])
|
||||
item.setData(0, QtCore.Qt.UserRole, new_key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, new_key)
|
||||
self._refreshInfo(ethernet_switch)
|
||||
|
||||
def _deleteEthernetSwitchSlot(self):
|
||||
@@ -169,7 +169,7 @@ class EthernetSwitchPreferencesPage(QtWidgets.QWidget, Ui_EthernetSwitchPreferen
|
||||
"""
|
||||
for item in self.uiEthernetSwitchesTreeWidget.selectedItems():
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
key = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
del self._ethernet_switches[key]
|
||||
self.uiEthernetSwitchesTreeWidget.takeTopLevelItem(self.uiEthernetSwitchesTreeWidget.indexOfTopLevelItem(item))
|
||||
|
||||
@@ -193,12 +193,12 @@ class EthernetSwitchPreferencesPage(QtWidgets.QWidget, Ui_EthernetSwitchPreferen
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiEthernetSwitchesTreeWidget)
|
||||
item.setText(0, ethernet_switch["name"])
|
||||
Controller.instance().getSymbolIcon(ethernet_switch["symbol"], qpartial(self._setItemIcon, item))
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, key)
|
||||
self._items.append(item)
|
||||
|
||||
if self._items:
|
||||
self.uiEthernetSwitchesTreeWidget.setCurrentItem(self._items[0])
|
||||
self.uiEthernetSwitchesTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
|
||||
self.uiEthernetSwitchesTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
self.uiEthernetSwitchesTreeWidget.setMaximumWidth(self.uiEthernetSwitchesTreeWidget.sizeHintForColumn(0) + 20)
|
||||
|
||||
def _setItemIcon(self, item, icon):
|
||||
|
||||
@@ -42,7 +42,7 @@ class FrameRelaySwitchConfigurationPage(QtWidgets.QWidget, Ui_frameRelaySwitchCo
|
||||
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):
|
||||
|
||||
@@ -1,39 +1,40 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/atm_switch_configuration_page.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.5.1
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_atmSwitchConfigPageWidget(object):
|
||||
def setupUi(self, atmSwitchConfigPageWidget):
|
||||
atmSwitchConfigPageWidget.setObjectName("atmSwitchConfigPageWidget")
|
||||
atmSwitchConfigPageWidget.resize(459, 430)
|
||||
atmSwitchConfigPageWidget.resize(540, 553)
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(atmSwitchConfigPageWidget)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiGeneralGroupBox = QtWidgets.QGroupBox(atmSwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox = QtWidgets.QGroupBox(parent=atmSwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox.setObjectName("uiGeneralGroupBox")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiGeneralGroupBox)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiNameLabel = QtWidgets.QLabel(parent=self.uiGeneralGroupBox)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(parent=self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
self.uiVPICheckBox = QtWidgets.QCheckBox(self.uiGeneralGroupBox)
|
||||
self.uiVPICheckBox = QtWidgets.QCheckBox(parent=self.uiGeneralGroupBox)
|
||||
self.uiVPICheckBox.setObjectName("uiVPICheckBox")
|
||||
self.gridLayout.addWidget(self.uiVPICheckBox, 1, 0, 1, 2)
|
||||
self.gridLayout_2.addWidget(self.uiGeneralGroupBox, 0, 0, 1, 3)
|
||||
self.uiMappingGroupBox = QtWidgets.QGroupBox(atmSwitchConfigPageWidget)
|
||||
self.uiMappingGroupBox = QtWidgets.QGroupBox(parent=atmSwitchConfigPageWidget)
|
||||
self.uiMappingGroupBox.setObjectName("uiMappingGroupBox")
|
||||
self.vboxlayout = QtWidgets.QVBoxLayout(self.uiMappingGroupBox)
|
||||
self.vboxlayout.setObjectName("vboxlayout")
|
||||
self.uiMappingTreeWidget = QtWidgets.QTreeWidget(self.uiMappingGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
self.uiMappingTreeWidget = QtWidgets.QTreeWidget(parent=self.uiMappingGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiMappingTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
@@ -42,17 +43,17 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiMappingTreeWidget.setObjectName("uiMappingTreeWidget")
|
||||
self.vboxlayout.addWidget(self.uiMappingTreeWidget)
|
||||
self.gridLayout_2.addWidget(self.uiMappingGroupBox, 0, 3, 3, 1)
|
||||
self.uiAddPushButton = QtWidgets.QPushButton(atmSwitchConfigPageWidget)
|
||||
self.uiAddPushButton = QtWidgets.QPushButton(parent=atmSwitchConfigPageWidget)
|
||||
self.uiAddPushButton.setObjectName("uiAddPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiAddPushButton, 3, 0, 1, 1)
|
||||
self.uiDeletePushButton = QtWidgets.QPushButton(atmSwitchConfigPageWidget)
|
||||
self.uiDeletePushButton = QtWidgets.QPushButton(parent=atmSwitchConfigPageWidget)
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
self.uiDeletePushButton.setObjectName("uiDeletePushButton")
|
||||
self.gridLayout_2.addWidget(self.uiDeletePushButton, 3, 1, 1, 1)
|
||||
spacerItem = QtWidgets.QSpacerItem(213, 31, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(213, 31, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem, 4, 2, 1, 2)
|
||||
self.uiSourceGroupBox = QtWidgets.QGroupBox(atmSwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
self.uiSourceGroupBox = QtWidgets.QGroupBox(parent=atmSwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourceGroupBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -60,11 +61,11 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiSourceGroupBox.setObjectName("uiSourceGroupBox")
|
||||
self.gridlayout = QtWidgets.QGridLayout(self.uiSourceGroupBox)
|
||||
self.gridlayout.setObjectName("gridlayout")
|
||||
self.uiSourcePortLabel = QtWidgets.QLabel(self.uiSourceGroupBox)
|
||||
self.uiSourcePortLabel = QtWidgets.QLabel(parent=self.uiSourceGroupBox)
|
||||
self.uiSourcePortLabel.setObjectName("uiSourcePortLabel")
|
||||
self.gridlayout.addWidget(self.uiSourcePortLabel, 0, 0, 1, 1)
|
||||
self.uiSourcePortSpinBox = QtWidgets.QSpinBox(self.uiSourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiSourcePortSpinBox = QtWidgets.QSpinBox(parent=self.uiSourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourcePortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -74,12 +75,12 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiSourcePortSpinBox.setProperty("value", 1)
|
||||
self.uiSourcePortSpinBox.setObjectName("uiSourcePortSpinBox")
|
||||
self.gridlayout.addWidget(self.uiSourcePortSpinBox, 0, 1, 1, 1)
|
||||
self.uiSourceVPILabel = QtWidgets.QLabel(self.uiSourceGroupBox)
|
||||
self.uiSourceVPILabel = QtWidgets.QLabel(parent=self.uiSourceGroupBox)
|
||||
self.uiSourceVPILabel.setObjectName("uiSourceVPILabel")
|
||||
self.gridlayout.addWidget(self.uiSourceVPILabel, 1, 0, 1, 1)
|
||||
self.uiSourceVPISpinBox = QtWidgets.QSpinBox(self.uiSourceGroupBox)
|
||||
self.uiSourceVPISpinBox = QtWidgets.QSpinBox(parent=self.uiSourceGroupBox)
|
||||
self.uiSourceVPISpinBox.setEnabled(True)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourceVPISpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -88,11 +89,11 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiSourceVPISpinBox.setProperty("value", 0)
|
||||
self.uiSourceVPISpinBox.setObjectName("uiSourceVPISpinBox")
|
||||
self.gridlayout.addWidget(self.uiSourceVPISpinBox, 1, 1, 1, 1)
|
||||
self.uiSourceVCILabel = QtWidgets.QLabel(self.uiSourceGroupBox)
|
||||
self.uiSourceVCILabel = QtWidgets.QLabel(parent=self.uiSourceGroupBox)
|
||||
self.uiSourceVCILabel.setObjectName("uiSourceVCILabel")
|
||||
self.gridlayout.addWidget(self.uiSourceVCILabel, 2, 0, 1, 1)
|
||||
self.uiSourceVCISpinBox = QtWidgets.QSpinBox(self.uiSourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiSourceVCISpinBox = QtWidgets.QSpinBox(parent=self.uiSourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourceVCISpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -102,8 +103,8 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiSourceVCISpinBox.setObjectName("uiSourceVCISpinBox")
|
||||
self.gridlayout.addWidget(self.uiSourceVCISpinBox, 2, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiSourceGroupBox, 1, 0, 1, 3)
|
||||
self.uiDestinationGroupBox = QtWidgets.QGroupBox(atmSwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
self.uiDestinationGroupBox = QtWidgets.QGroupBox(parent=atmSwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationGroupBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -111,11 +112,11 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiDestinationGroupBox.setObjectName("uiDestinationGroupBox")
|
||||
self.gridlayout1 = QtWidgets.QGridLayout(self.uiDestinationGroupBox)
|
||||
self.gridlayout1.setObjectName("gridlayout1")
|
||||
self.uiDestinationPortLabel = QtWidgets.QLabel(self.uiDestinationGroupBox)
|
||||
self.uiDestinationPortLabel = QtWidgets.QLabel(parent=self.uiDestinationGroupBox)
|
||||
self.uiDestinationPortLabel.setObjectName("uiDestinationPortLabel")
|
||||
self.gridlayout1.addWidget(self.uiDestinationPortLabel, 0, 0, 1, 1)
|
||||
self.uiDestinationPortSpinBox = QtWidgets.QSpinBox(self.uiDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiDestinationPortSpinBox = QtWidgets.QSpinBox(parent=self.uiDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationPortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -125,12 +126,12 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiDestinationPortSpinBox.setProperty("value", 10)
|
||||
self.uiDestinationPortSpinBox.setObjectName("uiDestinationPortSpinBox")
|
||||
self.gridlayout1.addWidget(self.uiDestinationPortSpinBox, 0, 1, 1, 1)
|
||||
self.uiDestinationVPILabel = QtWidgets.QLabel(self.uiDestinationGroupBox)
|
||||
self.uiDestinationVPILabel = QtWidgets.QLabel(parent=self.uiDestinationGroupBox)
|
||||
self.uiDestinationVPILabel.setObjectName("uiDestinationVPILabel")
|
||||
self.gridlayout1.addWidget(self.uiDestinationVPILabel, 1, 0, 1, 1)
|
||||
self.uiDestinationVPISpinBox = QtWidgets.QSpinBox(self.uiDestinationGroupBox)
|
||||
self.uiDestinationVPISpinBox = QtWidgets.QSpinBox(parent=self.uiDestinationGroupBox)
|
||||
self.uiDestinationVPISpinBox.setEnabled(True)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationVPISpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -139,11 +140,11 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiDestinationVPISpinBox.setProperty("value", 0)
|
||||
self.uiDestinationVPISpinBox.setObjectName("uiDestinationVPISpinBox")
|
||||
self.gridlayout1.addWidget(self.uiDestinationVPISpinBox, 1, 1, 1, 1)
|
||||
self.uiDestinationVCILabel = QtWidgets.QLabel(self.uiDestinationGroupBox)
|
||||
self.uiDestinationVCILabel = QtWidgets.QLabel(parent=self.uiDestinationGroupBox)
|
||||
self.uiDestinationVCILabel.setObjectName("uiDestinationVCILabel")
|
||||
self.gridlayout1.addWidget(self.uiDestinationVCILabel, 2, 0, 1, 1)
|
||||
self.uiDestinationVCISpinBox = QtWidgets.QSpinBox(self.uiDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiDestinationVCISpinBox = QtWidgets.QSpinBox(parent=self.uiDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationVCISpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -185,4 +186,3 @@ class Ui_atmSwitchConfigPageWidget(object):
|
||||
self.uiDestinationPortLabel.setText(_translate("atmSwitchConfigPageWidget", "Port:"))
|
||||
self.uiDestinationVPILabel.setText(_translate("atmSwitchConfigPageWidget", "VPI:"))
|
||||
self.uiDestinationVCILabel.setText(_translate("atmSwitchConfigPageWidget", "VCI:"))
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/builtin_preferences_page.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.9.1
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_BuiltinPreferencesPageWidget(object):
|
||||
def setupUi(self, BuiltinPreferencesPageWidget):
|
||||
@@ -14,28 +15,28 @@ class Ui_BuiltinPreferencesPageWidget(object):
|
||||
BuiltinPreferencesPageWidget.resize(456, 385)
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(BuiltinPreferencesPageWidget)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiTabWidget = QtWidgets.QTabWidget(BuiltinPreferencesPageWidget)
|
||||
self.uiTabWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.uiTabWidget = QtWidgets.QTabWidget(parent=BuiltinPreferencesPageWidget)
|
||||
self.uiTabWidget.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.uiTabWidget.setObjectName("uiTabWidget")
|
||||
self.uiServerSettingsTabWidget = QtWidgets.QWidget()
|
||||
self.uiServerSettingsTabWidget.setObjectName("uiServerSettingsTabWidget")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiServerSettingsTabWidget)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.label = QtWidgets.QLabel(self.uiServerSettingsTabWidget)
|
||||
self.label = QtWidgets.QLabel(parent=self.uiServerSettingsTabWidget)
|
||||
self.label.setObjectName("label")
|
||||
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
|
||||
self.uiNATInterfaceComboBox = QtWidgets.QComboBox(self.uiServerSettingsTabWidget)
|
||||
self.uiNATInterfaceComboBox = QtWidgets.QComboBox(parent=self.uiServerSettingsTabWidget)
|
||||
self.uiNATInterfaceComboBox.setObjectName("uiNATInterfaceComboBox")
|
||||
self.gridLayout.addWidget(self.uiNATInterfaceComboBox, 1, 0, 1, 1)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
self.gridLayout.addItem(spacerItem, 2, 0, 1, 1)
|
||||
self.uiTabWidget.addTab(self.uiServerSettingsTabWidget, "")
|
||||
self.verticalLayout.addWidget(self.uiTabWidget)
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
spacerItem1 = QtWidgets.QSpacerItem(254, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(254, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem1)
|
||||
self.uiRestoreDefaultsPushButton = QtWidgets.QPushButton(BuiltinPreferencesPageWidget)
|
||||
self.uiRestoreDefaultsPushButton = QtWidgets.QPushButton(parent=BuiltinPreferencesPageWidget)
|
||||
self.uiRestoreDefaultsPushButton.setObjectName("uiRestoreDefaultsPushButton")
|
||||
self.horizontalLayout_2.addWidget(self.uiRestoreDefaultsPushButton)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||
@@ -50,4 +51,3 @@ class Ui_BuiltinPreferencesPageWidget(object):
|
||||
self.label.setText(_translate("BuiltinPreferencesPageWidget", "Default NAT interface:"))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiServerSettingsTabWidget), _translate("BuiltinPreferencesPageWidget", "Local settings"))
|
||||
self.uiRestoreDefaultsPushButton.setText(_translate("BuiltinPreferencesPageWidget", "Restore defaults"))
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/cloud_configuration_page.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.11.3
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_cloudConfigPageWidget(object):
|
||||
def setupUi(self, cloudConfigPageWidget):
|
||||
@@ -14,44 +15,44 @@ class Ui_cloudConfigPageWidget(object):
|
||||
cloudConfigPageWidget.resize(979, 564)
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(cloudConfigPageWidget)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiTabWidget = QtWidgets.QTabWidget(cloudConfigPageWidget)
|
||||
self.uiTabWidget = QtWidgets.QTabWidget(parent=cloudConfigPageWidget)
|
||||
self.uiTabWidget.setObjectName("uiTabWidget")
|
||||
self.EthernetTab = QtWidgets.QWidget()
|
||||
self.EthernetTab.setObjectName("EthernetTab")
|
||||
self.gridLayout_3 = QtWidgets.QGridLayout(self.EthernetTab)
|
||||
self.gridLayout_3.setObjectName("gridLayout_3")
|
||||
self.uiEthernetComboBox = QtWidgets.QComboBox(self.EthernetTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiEthernetComboBox = QtWidgets.QComboBox(parent=self.EthernetTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiEthernetComboBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiEthernetComboBox.setSizePolicy(sizePolicy)
|
||||
self.uiEthernetComboBox.setInsertPolicy(QtWidgets.QComboBox.InsertAlphabetically)
|
||||
self.uiEthernetComboBox.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||
self.uiEthernetComboBox.setInsertPolicy(QtWidgets.QComboBox.InsertPolicy.InsertAlphabetically)
|
||||
self.uiEthernetComboBox.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents)
|
||||
self.uiEthernetComboBox.setObjectName("uiEthernetComboBox")
|
||||
self.gridLayout_3.addWidget(self.uiEthernetComboBox, 0, 0, 1, 1)
|
||||
self.uiAddEthernetPushButton = QtWidgets.QPushButton(self.EthernetTab)
|
||||
self.uiAddEthernetPushButton = QtWidgets.QPushButton(parent=self.EthernetTab)
|
||||
self.uiAddEthernetPushButton.setObjectName("uiAddEthernetPushButton")
|
||||
self.gridLayout_3.addWidget(self.uiAddEthernetPushButton, 0, 2, 1, 1)
|
||||
self.uiAddAllEthernetPushButton = QtWidgets.QPushButton(self.EthernetTab)
|
||||
self.uiAddAllEthernetPushButton = QtWidgets.QPushButton(parent=self.EthernetTab)
|
||||
self.uiAddAllEthernetPushButton.setObjectName("uiAddAllEthernetPushButton")
|
||||
self.gridLayout_3.addWidget(self.uiAddAllEthernetPushButton, 0, 3, 1, 1)
|
||||
self.uiDeleteEthernetPushButton = QtWidgets.QPushButton(self.EthernetTab)
|
||||
self.uiDeleteEthernetPushButton = QtWidgets.QPushButton(parent=self.EthernetTab)
|
||||
self.uiDeleteEthernetPushButton.setEnabled(False)
|
||||
self.uiDeleteEthernetPushButton.setObjectName("uiDeleteEthernetPushButton")
|
||||
self.gridLayout_3.addWidget(self.uiDeleteEthernetPushButton, 0, 5, 1, 1)
|
||||
self.uiEthernetListWidget = QtWidgets.QListWidget(self.EthernetTab)
|
||||
self.uiEthernetListWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
self.uiEthernetListWidget = QtWidgets.QListWidget(parent=self.EthernetTab)
|
||||
self.uiEthernetListWidget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.uiEthernetListWidget.setObjectName("uiEthernetListWidget")
|
||||
self.gridLayout_3.addWidget(self.uiEthernetListWidget, 1, 0, 1, 6)
|
||||
self.uiEthernetWarningPushButton = QtWidgets.QPushButton(self.EthernetTab)
|
||||
self.uiEthernetWarningPushButton = QtWidgets.QPushButton(parent=self.EthernetTab)
|
||||
self.uiEthernetWarningPushButton.setText("")
|
||||
self.uiEthernetWarningPushButton.setObjectName("uiEthernetWarningPushButton")
|
||||
self.gridLayout_3.addWidget(self.uiEthernetWarningPushButton, 0, 1, 1, 1)
|
||||
self.uiShowSpecialInterfacesCheckBox = QtWidgets.QCheckBox(self.EthernetTab)
|
||||
self.uiShowSpecialInterfacesCheckBox = QtWidgets.QCheckBox(parent=self.EthernetTab)
|
||||
self.uiShowSpecialInterfacesCheckBox.setObjectName("uiShowSpecialInterfacesCheckBox")
|
||||
self.gridLayout_3.addWidget(self.uiShowSpecialInterfacesCheckBox, 2, 0, 1, 2)
|
||||
self.uiRefreshEthernetPushButton = QtWidgets.QPushButton(self.EthernetTab)
|
||||
self.uiRefreshEthernetPushButton = QtWidgets.QPushButton(parent=self.EthernetTab)
|
||||
self.uiRefreshEthernetPushButton.setObjectName("uiRefreshEthernetPushButton")
|
||||
self.gridLayout_3.addWidget(self.uiRefreshEthernetPushButton, 0, 4, 1, 1)
|
||||
self.uiEthernetListWidget.raise_()
|
||||
@@ -67,39 +68,39 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.TAPTab.setObjectName("TAPTab")
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(self.TAPTab)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiDeleteTAPPushButton = QtWidgets.QPushButton(self.TAPTab)
|
||||
self.uiDeleteTAPPushButton = QtWidgets.QPushButton(parent=self.TAPTab)
|
||||
self.uiDeleteTAPPushButton.setEnabled(False)
|
||||
self.uiDeleteTAPPushButton.setObjectName("uiDeleteTAPPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiDeleteTAPPushButton, 1, 5, 1, 1)
|
||||
self.uiTAPListWidget = QtWidgets.QListWidget(self.TAPTab)
|
||||
self.uiTAPListWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
self.uiTAPListWidget = QtWidgets.QListWidget(parent=self.TAPTab)
|
||||
self.uiTAPListWidget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.uiTAPListWidget.setObjectName("uiTAPListWidget")
|
||||
self.gridLayout_2.addWidget(self.uiTAPListWidget, 2, 0, 1, 6)
|
||||
self.uiTAPLineEdit = QtWidgets.QLineEdit(self.TAPTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiTAPLineEdit = QtWidgets.QLineEdit(parent=self.TAPTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiTAPLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiTAPLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiTAPLineEdit.setObjectName("uiTAPLineEdit")
|
||||
self.gridLayout_2.addWidget(self.uiTAPLineEdit, 1, 1, 1, 1)
|
||||
self.uiAddTAPPushButton = QtWidgets.QPushButton(self.TAPTab)
|
||||
self.uiAddTAPPushButton = QtWidgets.QPushButton(parent=self.TAPTab)
|
||||
self.uiAddTAPPushButton.setObjectName("uiAddTAPPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiAddTAPPushButton, 1, 2, 1, 1)
|
||||
self.uiTAPComboBox = QtWidgets.QComboBox(self.TAPTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiTAPComboBox = QtWidgets.QComboBox(parent=self.TAPTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiTAPComboBox.sizePolicy().hasHeightForWidth())
|
||||
self.uiTAPComboBox.setSizePolicy(sizePolicy)
|
||||
self.uiTAPComboBox.setInsertPolicy(QtWidgets.QComboBox.InsertAlphabetically)
|
||||
self.uiTAPComboBox.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
|
||||
self.uiTAPComboBox.setInsertPolicy(QtWidgets.QComboBox.InsertPolicy.InsertAlphabetically)
|
||||
self.uiTAPComboBox.setSizeAdjustPolicy(QtWidgets.QComboBox.SizeAdjustPolicy.AdjustToContents)
|
||||
self.uiTAPComboBox.setObjectName("uiTAPComboBox")
|
||||
self.gridLayout_2.addWidget(self.uiTAPComboBox, 0, 1, 1, 5)
|
||||
self.uiAddAllTAPPushButton = QtWidgets.QPushButton(self.TAPTab)
|
||||
self.uiAddAllTAPPushButton = QtWidgets.QPushButton(parent=self.TAPTab)
|
||||
self.uiAddAllTAPPushButton.setObjectName("uiAddAllTAPPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiAddAllTAPPushButton, 1, 3, 1, 1)
|
||||
self.uiRefreshTAPPushButton = QtWidgets.QPushButton(self.TAPTab)
|
||||
self.uiRefreshTAPPushButton = QtWidgets.QPushButton(parent=self.TAPTab)
|
||||
self.uiRefreshTAPPushButton.setObjectName("uiRefreshTAPPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiRefreshTAPPushButton, 1, 4, 1, 1)
|
||||
self.uiTabWidget.addTab(self.TAPTab, "")
|
||||
@@ -107,8 +108,8 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.UDPTab.setObjectName("UDPTab")
|
||||
self.gridLayout_5 = QtWidgets.QGridLayout(self.UDPTab)
|
||||
self.gridLayout_5.setObjectName("gridLayout_5")
|
||||
self.uiUDPTunnelSettingsGroupBox = QtWidgets.QGroupBox(self.UDPTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
|
||||
self.uiUDPTunnelSettingsGroupBox = QtWidgets.QGroupBox(parent=self.UDPTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiUDPTunnelSettingsGroupBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -116,8 +117,8 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.uiUDPTunnelSettingsGroupBox.setObjectName("uiUDPTunnelSettingsGroupBox")
|
||||
self.gridLayout_4 = QtWidgets.QGridLayout(self.uiUDPTunnelSettingsGroupBox)
|
||||
self.gridLayout_4.setObjectName("gridLayout_4")
|
||||
self.uiRemoteHostLineEdit = QtWidgets.QLineEdit(self.uiUDPTunnelSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiRemoteHostLineEdit = QtWidgets.QLineEdit(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiRemoteHostLineEdit.sizePolicy().hasHeightForWidth())
|
||||
@@ -125,23 +126,23 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.uiRemoteHostLineEdit.setMinimumSize(QtCore.QSize(80, 0))
|
||||
self.uiRemoteHostLineEdit.setObjectName("uiRemoteHostLineEdit")
|
||||
self.gridLayout_4.addWidget(self.uiRemoteHostLineEdit, 2, 1, 1, 1)
|
||||
self.uiRemotePortLabel = QtWidgets.QLabel(self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiRemotePortLabel = QtWidgets.QLabel(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiRemotePortLabel.setObjectName("uiRemotePortLabel")
|
||||
self.gridLayout_4.addWidget(self.uiRemotePortLabel, 3, 0, 1, 1)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.uiAddUDPPushButton = QtWidgets.QPushButton(self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiAddUDPPushButton = QtWidgets.QPushButton(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiAddUDPPushButton.setObjectName("uiAddUDPPushButton")
|
||||
self.horizontalLayout.addWidget(self.uiAddUDPPushButton)
|
||||
self.uiDeleteUDPPushButton = QtWidgets.QPushButton(self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiDeleteUDPPushButton = QtWidgets.QPushButton(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiDeleteUDPPushButton.setEnabled(False)
|
||||
self.uiDeleteUDPPushButton.setObjectName("uiDeleteUDPPushButton")
|
||||
self.horizontalLayout.addWidget(self.uiDeleteUDPPushButton)
|
||||
spacerItem = QtWidgets.QSpacerItem(50, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
spacerItem = QtWidgets.QSpacerItem(50, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
||||
self.horizontalLayout.addItem(spacerItem)
|
||||
self.gridLayout_4.addLayout(self.horizontalLayout, 4, 0, 1, 2)
|
||||
self.uiRemotePortSpinBox = QtWidgets.QSpinBox(self.uiUDPTunnelSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiRemotePortSpinBox = QtWidgets.QSpinBox(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiRemotePortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -150,19 +151,19 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.uiRemotePortSpinBox.setProperty("value", 20000)
|
||||
self.uiRemotePortSpinBox.setObjectName("uiRemotePortSpinBox")
|
||||
self.gridLayout_4.addWidget(self.uiRemotePortSpinBox, 3, 1, 1, 1)
|
||||
self.uiUDPNameLineEdit = QtWidgets.QLineEdit(self.uiUDPTunnelSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiUDPNameLineEdit = QtWidgets.QLineEdit(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiUDPNameLineEdit.sizePolicy().hasHeightForWidth())
|
||||
self.uiUDPNameLineEdit.setSizePolicy(sizePolicy)
|
||||
self.uiUDPNameLineEdit.setObjectName("uiUDPNameLineEdit")
|
||||
self.gridLayout_4.addWidget(self.uiUDPNameLineEdit, 0, 1, 1, 1)
|
||||
self.uiRemoteHostLabel = QtWidgets.QLabel(self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiRemoteHostLabel = QtWidgets.QLabel(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiRemoteHostLabel.setObjectName("uiRemoteHostLabel")
|
||||
self.gridLayout_4.addWidget(self.uiRemoteHostLabel, 2, 0, 1, 1)
|
||||
self.uiLocalPortSpinBox = QtWidgets.QSpinBox(self.uiUDPTunnelSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiLocalPortSpinBox = QtWidgets.QSpinBox(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiLocalPortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -171,17 +172,17 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.uiLocalPortSpinBox.setProperty("value", 30000)
|
||||
self.uiLocalPortSpinBox.setObjectName("uiLocalPortSpinBox")
|
||||
self.gridLayout_4.addWidget(self.uiLocalPortSpinBox, 1, 1, 1, 1)
|
||||
self.uiLocalPortLabel = QtWidgets.QLabel(self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiLocalPortLabel = QtWidgets.QLabel(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiLocalPortLabel.setObjectName("uiLocalPortLabel")
|
||||
self.gridLayout_4.addWidget(self.uiLocalPortLabel, 1, 0, 1, 1)
|
||||
self.uiUDPNameLabel = QtWidgets.QLabel(self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiUDPNameLabel = QtWidgets.QLabel(parent=self.uiUDPTunnelSettingsGroupBox)
|
||||
self.uiUDPNameLabel.setObjectName("uiUDPNameLabel")
|
||||
self.gridLayout_4.addWidget(self.uiUDPNameLabel, 0, 0, 1, 1)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(20, 10, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
self.gridLayout_4.addItem(spacerItem1, 5, 0, 1, 1)
|
||||
self.gridLayout_5.addWidget(self.uiUDPTunnelSettingsGroupBox, 0, 0, 1, 1)
|
||||
self.uiUDPTunnelsGroupBox = QtWidgets.QGroupBox(self.UDPTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
self.uiUDPTunnelsGroupBox = QtWidgets.QGroupBox(parent=self.UDPTab)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiUDPTunnelsGroupBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -189,8 +190,8 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.uiUDPTunnelsGroupBox.setObjectName("uiUDPTunnelsGroupBox")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.uiUDPTunnelsGroupBox)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.uiUDPTreeWidget = QtWidgets.QTreeWidget(self.uiUDPTunnelsGroupBox)
|
||||
self.uiUDPTreeWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
self.uiUDPTreeWidget = QtWidgets.QTreeWidget(parent=self.uiUDPTunnelsGroupBox)
|
||||
self.uiUDPTreeWidget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.uiUDPTreeWidget.setObjectName("uiUDPTreeWidget")
|
||||
self.verticalLayout_2.addWidget(self.uiUDPTreeWidget)
|
||||
self.gridLayout_5.addWidget(self.uiUDPTunnelsGroupBox, 0, 1, 1, 1)
|
||||
@@ -199,64 +200,64 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.MiscTab.setObjectName("MiscTab")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.MiscTab)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiConsolePortSpinBox = QtWidgets.QSpinBox(self.MiscTab)
|
||||
self.uiConsolePortSpinBox = QtWidgets.QSpinBox(parent=self.MiscTab)
|
||||
self.uiConsolePortSpinBox.setMinimum(1)
|
||||
self.uiConsolePortSpinBox.setMaximum(65535)
|
||||
self.uiConsolePortSpinBox.setProperty("value", 23)
|
||||
self.uiConsolePortSpinBox.setObjectName("uiConsolePortSpinBox")
|
||||
self.gridLayout.addWidget(self.uiConsolePortSpinBox, 3, 2, 1, 1)
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.MiscTab)
|
||||
self.uiNameLabel = QtWidgets.QLabel(parent=self.MiscTab)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.MiscTab)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(parent=self.MiscTab)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 2, 1, 1)
|
||||
self.uiConsoleHostLabel = QtWidgets.QLabel(self.MiscTab)
|
||||
self.uiConsoleHostLabel = QtWidgets.QLabel(parent=self.MiscTab)
|
||||
self.uiConsoleHostLabel.setObjectName("uiConsoleHostLabel")
|
||||
self.gridLayout.addWidget(self.uiConsoleHostLabel, 2, 0, 1, 1)
|
||||
self.uiConsoleHostLineEdit = QtWidgets.QLineEdit(self.MiscTab)
|
||||
self.uiConsoleHostLineEdit = QtWidgets.QLineEdit(parent=self.MiscTab)
|
||||
self.uiConsoleHostLineEdit.setObjectName("uiConsoleHostLineEdit")
|
||||
self.gridLayout.addWidget(self.uiConsoleHostLineEdit, 2, 2, 1, 1)
|
||||
self.labeluiConsolePortLabel = QtWidgets.QLabel(self.MiscTab)
|
||||
self.labeluiConsolePortLabel = QtWidgets.QLabel(parent=self.MiscTab)
|
||||
self.labeluiConsolePortLabel.setObjectName("labeluiConsolePortLabel")
|
||||
self.gridLayout.addWidget(self.labeluiConsolePortLabel, 3, 0, 1, 1)
|
||||
self.uiConsoleHttpPathLabel = QtWidgets.QLabel(self.MiscTab)
|
||||
self.uiConsoleHttpPathLabel = QtWidgets.QLabel(parent=self.MiscTab)
|
||||
self.uiConsoleHttpPathLabel.setObjectName("uiConsoleHttpPathLabel")
|
||||
self.gridLayout.addWidget(self.uiConsoleHttpPathLabel, 5, 0, 1, 1)
|
||||
self.uiConsoleHttpPathLineEdit = QtWidgets.QLineEdit(self.MiscTab)
|
||||
self.uiConsoleHttpPathLineEdit = QtWidgets.QLineEdit(parent=self.MiscTab)
|
||||
self.uiConsoleHttpPathLineEdit.setObjectName("uiConsoleHttpPathLineEdit")
|
||||
self.gridLayout.addWidget(self.uiConsoleHttpPathLineEdit, 5, 2, 1, 1)
|
||||
self.uiDefaultNameFormatLabel = QtWidgets.QLabel(self.MiscTab)
|
||||
self.uiDefaultNameFormatLabel = QtWidgets.QLabel(parent=self.MiscTab)
|
||||
self.uiDefaultNameFormatLabel.setObjectName("uiDefaultNameFormatLabel")
|
||||
self.gridLayout.addWidget(self.uiDefaultNameFormatLabel, 6, 0, 1, 1)
|
||||
self.uiDefaultNameFormatLineEdit = QtWidgets.QLineEdit(self.MiscTab)
|
||||
self.uiDefaultNameFormatLineEdit = QtWidgets.QLineEdit(parent=self.MiscTab)
|
||||
self.uiDefaultNameFormatLineEdit.setObjectName("uiDefaultNameFormatLineEdit")
|
||||
self.gridLayout.addWidget(self.uiDefaultNameFormatLineEdit, 6, 2, 1, 1)
|
||||
self.uiSymbolLabel = QtWidgets.QLabel(self.MiscTab)
|
||||
self.uiSymbolLabel = QtWidgets.QLabel(parent=self.MiscTab)
|
||||
self.uiSymbolLabel.setObjectName("uiSymbolLabel")
|
||||
self.gridLayout.addWidget(self.uiSymbolLabel, 7, 0, 1, 1)
|
||||
spacerItem2 = QtWidgets.QSpacerItem(20, 399, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem2 = QtWidgets.QSpacerItem(20, 399, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
self.gridLayout.addItem(spacerItem2, 9, 0, 1, 3)
|
||||
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
|
||||
self.uiSymbolLineEdit = QtWidgets.QLineEdit(self.MiscTab)
|
||||
self.uiSymbolLineEdit = QtWidgets.QLineEdit(parent=self.MiscTab)
|
||||
self.uiSymbolLineEdit.setObjectName("uiSymbolLineEdit")
|
||||
self.horizontalLayout_7.addWidget(self.uiSymbolLineEdit)
|
||||
self.uiSymbolToolButton = QtWidgets.QToolButton(self.MiscTab)
|
||||
self.uiSymbolToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
|
||||
self.uiSymbolToolButton = QtWidgets.QToolButton(parent=self.MiscTab)
|
||||
self.uiSymbolToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonStyle.ToolButtonTextOnly)
|
||||
self.uiSymbolToolButton.setObjectName("uiSymbolToolButton")
|
||||
self.horizontalLayout_7.addWidget(self.uiSymbolToolButton)
|
||||
self.gridLayout.addLayout(self.horizontalLayout_7, 7, 2, 1, 1)
|
||||
self.uiCategoryLabel = QtWidgets.QLabel(self.MiscTab)
|
||||
self.uiCategoryLabel = QtWidgets.QLabel(parent=self.MiscTab)
|
||||
self.uiCategoryLabel.setObjectName("uiCategoryLabel")
|
||||
self.gridLayout.addWidget(self.uiCategoryLabel, 8, 0, 1, 1)
|
||||
self.uiCategoryComboBox = QtWidgets.QComboBox(self.MiscTab)
|
||||
self.uiCategoryComboBox = QtWidgets.QComboBox(parent=self.MiscTab)
|
||||
self.uiCategoryComboBox.setObjectName("uiCategoryComboBox")
|
||||
self.gridLayout.addWidget(self.uiCategoryComboBox, 8, 2, 1, 1)
|
||||
self.uiConsoleTypeLabel = QtWidgets.QLabel(self.MiscTab)
|
||||
self.uiConsoleTypeLabel = QtWidgets.QLabel(parent=self.MiscTab)
|
||||
self.uiConsoleTypeLabel.setObjectName("uiConsoleTypeLabel")
|
||||
self.gridLayout.addWidget(self.uiConsoleTypeLabel, 1, 0, 1, 1)
|
||||
self.uiConsoleTypeComboBox = QtWidgets.QComboBox(self.MiscTab)
|
||||
self.uiConsoleTypeComboBox = QtWidgets.QComboBox(parent=self.MiscTab)
|
||||
self.uiConsoleTypeComboBox.setObjectName("uiConsoleTypeComboBox")
|
||||
self.uiConsoleTypeComboBox.addItem("")
|
||||
self.uiConsoleTypeComboBox.addItem("")
|
||||
@@ -335,4 +336,3 @@ class Ui_cloudConfigPageWidget(object):
|
||||
self.uiConsoleTypeComboBox.setItemText(4, _translate("cloudConfigPageWidget", "https"))
|
||||
self.uiConsoleTypeComboBox.setItemText(5, _translate("cloudConfigPageWidget", "none"))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.MiscTab), _translate("cloudConfigPageWidget", "Misc."))
|
||||
|
||||
|
||||
@@ -38,13 +38,6 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/cloud_preferences_page.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.9
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_CloudPreferencesPageWidget(object):
|
||||
def setupUi(self, CloudPreferencesPageWidget):
|
||||
@@ -15,34 +16,29 @@ class Ui_CloudPreferencesPageWidget(object):
|
||||
CloudPreferencesPageWidget.setAccessibleDescription("")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(CloudPreferencesPageWidget)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.splitter = QtWidgets.QSplitter(CloudPreferencesPageWidget)
|
||||
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.splitter = QtWidgets.QSplitter(parent=CloudPreferencesPageWidget)
|
||||
self.splitter.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||
self.splitter.setObjectName("splitter")
|
||||
self.uiCloudNodesTreeWidget = QtWidgets.QTreeWidget(self.splitter)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||
self.uiCloudNodesTreeWidget = QtWidgets.QTreeWidget(parent=self.splitter)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiCloudNodesTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiCloudNodesTreeWidget.setSizePolicy(sizePolicy)
|
||||
self.uiCloudNodesTreeWidget.setMaximumSize(QtCore.QSize(160, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(11)
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.uiCloudNodesTreeWidget.setFont(font)
|
||||
self.uiCloudNodesTreeWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
self.uiCloudNodesTreeWidget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.uiCloudNodesTreeWidget.setIconSize(QtCore.QSize(32, 32))
|
||||
self.uiCloudNodesTreeWidget.setRootIsDecorated(False)
|
||||
self.uiCloudNodesTreeWidget.setObjectName("uiCloudNodesTreeWidget")
|
||||
self.uiCloudNodesTreeWidget.headerItem().setText(0, "1")
|
||||
self.uiCloudNodesTreeWidget.header().setVisible(False)
|
||||
self.layoutWidget = QtWidgets.QWidget(self.splitter)
|
||||
self.layoutWidget = QtWidgets.QWidget(parent=self.splitter)
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiCloudNodeInfoTreeWidget = QtWidgets.QTreeWidget(self.layoutWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
|
||||
self.uiCloudNodeInfoTreeWidget = QtWidgets.QTreeWidget(parent=self.layoutWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiCloudNodeInfoTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
@@ -54,14 +50,14 @@ class Ui_CloudPreferencesPageWidget(object):
|
||||
self.verticalLayout.addWidget(self.uiCloudNodeInfoTreeWidget)
|
||||
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
|
||||
self.uiNewCloudNodePushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.uiNewCloudNodePushButton = QtWidgets.QPushButton(parent=self.layoutWidget)
|
||||
self.uiNewCloudNodePushButton.setObjectName("uiNewCloudNodePushButton")
|
||||
self.horizontalLayout_5.addWidget(self.uiNewCloudNodePushButton)
|
||||
self.uiEditCloudNodePushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.uiEditCloudNodePushButton = QtWidgets.QPushButton(parent=self.layoutWidget)
|
||||
self.uiEditCloudNodePushButton.setEnabled(False)
|
||||
self.uiEditCloudNodePushButton.setObjectName("uiEditCloudNodePushButton")
|
||||
self.horizontalLayout_5.addWidget(self.uiEditCloudNodePushButton)
|
||||
self.uiDeleteCloudNodePushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.uiDeleteCloudNodePushButton = QtWidgets.QPushButton(parent=self.layoutWidget)
|
||||
self.uiDeleteCloudNodePushButton.setEnabled(False)
|
||||
self.uiDeleteCloudNodePushButton.setObjectName("uiDeleteCloudNodePushButton")
|
||||
self.horizontalLayout_5.addWidget(self.uiDeleteCloudNodePushButton)
|
||||
@@ -81,4 +77,3 @@ class Ui_CloudPreferencesPageWidget(object):
|
||||
self.uiNewCloudNodePushButton.setText(_translate("CloudPreferencesPageWidget", "&New"))
|
||||
self.uiEditCloudNodePushButton.setText(_translate("CloudPreferencesPageWidget", "&Edit"))
|
||||
self.uiDeleteCloudNodePushButton.setText(_translate("CloudPreferencesPageWidget", "&Delete"))
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/cloud_wizard.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.9
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_CloudNodeWizard(object):
|
||||
def setupUi(self, CloudNodeWizard):
|
||||
@@ -17,31 +18,31 @@ class Ui_CloudNodeWizard(object):
|
||||
self.uiServerWizardPage.setObjectName("uiServerWizardPage")
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(self.uiServerWizardPage)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiServerTypeGroupBox = QtWidgets.QGroupBox(self.uiServerWizardPage)
|
||||
self.uiServerTypeGroupBox = QtWidgets.QGroupBox(parent=self.uiServerWizardPage)
|
||||
self.uiServerTypeGroupBox.setObjectName("uiServerTypeGroupBox")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.uiServerTypeGroupBox)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiRemoteRadioButton = QtWidgets.QRadioButton(self.uiServerTypeGroupBox)
|
||||
self.uiRemoteRadioButton = QtWidgets.QRadioButton(parent=self.uiServerTypeGroupBox)
|
||||
self.uiRemoteRadioButton.setChecked(True)
|
||||
self.uiRemoteRadioButton.setObjectName("uiRemoteRadioButton")
|
||||
self.verticalLayout.addWidget(self.uiRemoteRadioButton)
|
||||
self.uiVMRadioButton = QtWidgets.QRadioButton(self.uiServerTypeGroupBox)
|
||||
self.uiVMRadioButton = QtWidgets.QRadioButton(parent=self.uiServerTypeGroupBox)
|
||||
self.uiVMRadioButton.setObjectName("uiVMRadioButton")
|
||||
self.verticalLayout.addWidget(self.uiVMRadioButton)
|
||||
self.uiLocalRadioButton = QtWidgets.QRadioButton(self.uiServerTypeGroupBox)
|
||||
self.uiLocalRadioButton = QtWidgets.QRadioButton(parent=self.uiServerTypeGroupBox)
|
||||
self.uiLocalRadioButton.setObjectName("uiLocalRadioButton")
|
||||
self.verticalLayout.addWidget(self.uiLocalRadioButton)
|
||||
self.gridLayout_2.addWidget(self.uiServerTypeGroupBox, 0, 0, 1, 1)
|
||||
self.uiRemoteServersGroupBox = QtWidgets.QGroupBox(self.uiServerWizardPage)
|
||||
self.uiRemoteServersGroupBox = QtWidgets.QGroupBox(parent=self.uiServerWizardPage)
|
||||
self.uiRemoteServersGroupBox.setObjectName("uiRemoteServersGroupBox")
|
||||
self.gridLayout_7 = QtWidgets.QGridLayout(self.uiRemoteServersGroupBox)
|
||||
self.gridLayout_7.setObjectName("gridLayout_7")
|
||||
self.uiRemoteServersLabel = QtWidgets.QLabel(self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersLabel = QtWidgets.QLabel(parent=self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersLabel.setObjectName("uiRemoteServersLabel")
|
||||
self.gridLayout_7.addWidget(self.uiRemoteServersLabel, 0, 0, 1, 1)
|
||||
self.uiRemoteServersComboBox = QtWidgets.QComboBox(self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersComboBox = QtWidgets.QComboBox(parent=self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersComboBox.setEnabled(False)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiRemoteServersComboBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -54,10 +55,10 @@ class Ui_CloudNodeWizard(object):
|
||||
self.uiNameWizardPage.setObjectName("uiNameWizardPage")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiNameWizardPage)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiNameWizardPage)
|
||||
self.uiNameLabel = QtWidgets.QLabel(parent=self.uiNameWizardPage)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiNameWizardPage)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(parent=self.uiNameWizardPage)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
CloudNodeWizard.addPage(self.uiNameWizardPage)
|
||||
@@ -79,4 +80,3 @@ class Ui_CloudNodeWizard(object):
|
||||
self.uiNameWizardPage.setTitle(_translate("CloudNodeWizard", "Name"))
|
||||
self.uiNameWizardPage.setSubTitle(_translate("CloudNodeWizard", "Please choose a descriptive name for the new cloud node."))
|
||||
self.uiNameLabel.setText(_translate("CloudNodeWizard", "Name:"))
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/ethernet_hub_configuration_page.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.11.3
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_ethernetHubConfigPageWidget(object):
|
||||
def setupUi(self, ethernetHubConfigPageWidget):
|
||||
@@ -14,8 +15,8 @@ class Ui_ethernetHubConfigPageWidget(object):
|
||||
ethernetHubConfigPageWidget.resize(591, 352)
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(ethernetHubConfigPageWidget)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiSettingsGroupBox = QtWidgets.QGroupBox(ethernetHubConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
self.uiSettingsGroupBox = QtWidgets.QGroupBox(parent=ethernetHubConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSettingsGroupBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -23,39 +24,39 @@ class Ui_ethernetHubConfigPageWidget(object):
|
||||
self.uiSettingsGroupBox.setObjectName("uiSettingsGroupBox")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiSettingsGroupBox)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiSettingsGroupBox)
|
||||
self.uiNameLabel = QtWidgets.QLabel(parent=self.uiSettingsGroupBox)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiDefaultNameFormatLabel = QtWidgets.QLabel(self.uiSettingsGroupBox)
|
||||
self.uiDefaultNameFormatLabel = QtWidgets.QLabel(parent=self.uiSettingsGroupBox)
|
||||
self.uiDefaultNameFormatLabel.setObjectName("uiDefaultNameFormatLabel")
|
||||
self.gridLayout.addWidget(self.uiDefaultNameFormatLabel, 1, 0, 1, 2)
|
||||
self.uiDefaultNameFormatLineEdit = QtWidgets.QLineEdit(self.uiSettingsGroupBox)
|
||||
self.uiDefaultNameFormatLineEdit = QtWidgets.QLineEdit(parent=self.uiSettingsGroupBox)
|
||||
self.uiDefaultNameFormatLineEdit.setObjectName("uiDefaultNameFormatLineEdit")
|
||||
self.gridLayout.addWidget(self.uiDefaultNameFormatLineEdit, 1, 2, 1, 1)
|
||||
self.uiSymbolLabel = QtWidgets.QLabel(self.uiSettingsGroupBox)
|
||||
self.uiSymbolLabel = QtWidgets.QLabel(parent=self.uiSettingsGroupBox)
|
||||
self.uiSymbolLabel.setObjectName("uiSymbolLabel")
|
||||
self.gridLayout.addWidget(self.uiSymbolLabel, 2, 0, 1, 2)
|
||||
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
|
||||
self.uiSymbolLineEdit = QtWidgets.QLineEdit(self.uiSettingsGroupBox)
|
||||
self.uiSymbolLineEdit = QtWidgets.QLineEdit(parent=self.uiSettingsGroupBox)
|
||||
self.uiSymbolLineEdit.setObjectName("uiSymbolLineEdit")
|
||||
self.horizontalLayout_7.addWidget(self.uiSymbolLineEdit)
|
||||
self.uiSymbolToolButton = QtWidgets.QToolButton(self.uiSettingsGroupBox)
|
||||
self.uiSymbolToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
|
||||
self.uiSymbolToolButton = QtWidgets.QToolButton(parent=self.uiSettingsGroupBox)
|
||||
self.uiSymbolToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonStyle.ToolButtonTextOnly)
|
||||
self.uiSymbolToolButton.setObjectName("uiSymbolToolButton")
|
||||
self.horizontalLayout_7.addWidget(self.uiSymbolToolButton)
|
||||
self.gridLayout.addLayout(self.horizontalLayout_7, 2, 2, 1, 1)
|
||||
self.uiCategoryLabel = QtWidgets.QLabel(self.uiSettingsGroupBox)
|
||||
self.uiCategoryLabel = QtWidgets.QLabel(parent=self.uiSettingsGroupBox)
|
||||
self.uiCategoryLabel.setObjectName("uiCategoryLabel")
|
||||
self.gridLayout.addWidget(self.uiCategoryLabel, 3, 0, 1, 2)
|
||||
self.uiCategoryComboBox = QtWidgets.QComboBox(self.uiSettingsGroupBox)
|
||||
self.uiCategoryComboBox = QtWidgets.QComboBox(parent=self.uiSettingsGroupBox)
|
||||
self.uiCategoryComboBox.setObjectName("uiCategoryComboBox")
|
||||
self.gridLayout.addWidget(self.uiCategoryComboBox, 3, 2, 1, 1)
|
||||
self.uiPortsLabel = QtWidgets.QLabel(self.uiSettingsGroupBox)
|
||||
self.uiPortsLabel = QtWidgets.QLabel(parent=self.uiSettingsGroupBox)
|
||||
self.uiPortsLabel.setObjectName("uiPortsLabel")
|
||||
self.gridLayout.addWidget(self.uiPortsLabel, 4, 0, 1, 1)
|
||||
self.uiPortsSpinBox = QtWidgets.QSpinBox(self.uiSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiPortsSpinBox = QtWidgets.QSpinBox(parent=self.uiSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiPortsSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -65,9 +66,9 @@ class Ui_ethernetHubConfigPageWidget(object):
|
||||
self.uiPortsSpinBox.setProperty("value", 1)
|
||||
self.uiPortsSpinBox.setObjectName("uiPortsSpinBox")
|
||||
self.gridLayout.addWidget(self.uiPortsSpinBox, 4, 2, 1, 1)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 71, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 71, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
self.gridLayout.addItem(spacerItem, 5, 2, 1, 1)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiSettingsGroupBox)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(parent=self.uiSettingsGroupBox)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 2, 1, 1)
|
||||
self.verticalLayout.addWidget(self.uiSettingsGroupBox)
|
||||
@@ -85,4 +86,3 @@ class Ui_ethernetHubConfigPageWidget(object):
|
||||
self.uiSymbolToolButton.setText(_translate("ethernetHubConfigPageWidget", "&Browse..."))
|
||||
self.uiCategoryLabel.setText(_translate("ethernetHubConfigPageWidget", "Category:"))
|
||||
self.uiPortsLabel.setText(_translate("ethernetHubConfigPageWidget", "Number of ports:"))
|
||||
|
||||
|
||||
@@ -38,13 +38,6 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/ethernet_hub_preferences_page.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.9
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_EthernetHubPreferencesPageWidget(object):
|
||||
def setupUi(self, EthernetHubPreferencesPageWidget):
|
||||
@@ -15,34 +16,29 @@ class Ui_EthernetHubPreferencesPageWidget(object):
|
||||
EthernetHubPreferencesPageWidget.setAccessibleDescription("")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(EthernetHubPreferencesPageWidget)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.splitter = QtWidgets.QSplitter(EthernetHubPreferencesPageWidget)
|
||||
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.splitter = QtWidgets.QSplitter(parent=EthernetHubPreferencesPageWidget)
|
||||
self.splitter.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||
self.splitter.setObjectName("splitter")
|
||||
self.uiEthernetHubsTreeWidget = QtWidgets.QTreeWidget(self.splitter)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||
self.uiEthernetHubsTreeWidget = QtWidgets.QTreeWidget(parent=self.splitter)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiEthernetHubsTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiEthernetHubsTreeWidget.setSizePolicy(sizePolicy)
|
||||
self.uiEthernetHubsTreeWidget.setMaximumSize(QtCore.QSize(160, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(11)
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.uiEthernetHubsTreeWidget.setFont(font)
|
||||
self.uiEthernetHubsTreeWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
self.uiEthernetHubsTreeWidget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.uiEthernetHubsTreeWidget.setIconSize(QtCore.QSize(32, 32))
|
||||
self.uiEthernetHubsTreeWidget.setRootIsDecorated(False)
|
||||
self.uiEthernetHubsTreeWidget.setObjectName("uiEthernetHubsTreeWidget")
|
||||
self.uiEthernetHubsTreeWidget.headerItem().setText(0, "1")
|
||||
self.uiEthernetHubsTreeWidget.header().setVisible(False)
|
||||
self.layoutWidget = QtWidgets.QWidget(self.splitter)
|
||||
self.layoutWidget = QtWidgets.QWidget(parent=self.splitter)
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiEthernetHubInfoTreeWidget = QtWidgets.QTreeWidget(self.layoutWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
|
||||
self.uiEthernetHubInfoTreeWidget = QtWidgets.QTreeWidget(parent=self.layoutWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiEthernetHubInfoTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
@@ -54,14 +50,14 @@ class Ui_EthernetHubPreferencesPageWidget(object):
|
||||
self.verticalLayout.addWidget(self.uiEthernetHubInfoTreeWidget)
|
||||
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
|
||||
self.uiNewEthernetHubPushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.uiNewEthernetHubPushButton = QtWidgets.QPushButton(parent=self.layoutWidget)
|
||||
self.uiNewEthernetHubPushButton.setObjectName("uiNewEthernetHubPushButton")
|
||||
self.horizontalLayout_5.addWidget(self.uiNewEthernetHubPushButton)
|
||||
self.uiEditEthernetHubPushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.uiEditEthernetHubPushButton = QtWidgets.QPushButton(parent=self.layoutWidget)
|
||||
self.uiEditEthernetHubPushButton.setEnabled(False)
|
||||
self.uiEditEthernetHubPushButton.setObjectName("uiEditEthernetHubPushButton")
|
||||
self.horizontalLayout_5.addWidget(self.uiEditEthernetHubPushButton)
|
||||
self.uiDeleteEthernetHubPushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.uiDeleteEthernetHubPushButton = QtWidgets.QPushButton(parent=self.layoutWidget)
|
||||
self.uiDeleteEthernetHubPushButton.setEnabled(False)
|
||||
self.uiDeleteEthernetHubPushButton.setObjectName("uiDeleteEthernetHubPushButton")
|
||||
self.horizontalLayout_5.addWidget(self.uiDeleteEthernetHubPushButton)
|
||||
@@ -81,4 +77,3 @@ class Ui_EthernetHubPreferencesPageWidget(object):
|
||||
self.uiNewEthernetHubPushButton.setText(_translate("EthernetHubPreferencesPageWidget", "&New"))
|
||||
self.uiEditEthernetHubPushButton.setText(_translate("EthernetHubPreferencesPageWidget", "&Edit"))
|
||||
self.uiDeleteEthernetHubPushButton.setText(_translate("EthernetHubPreferencesPageWidget", "&Delete"))
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/ethernet_hub_wizard.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.9
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_EthernetHubWizard(object):
|
||||
def setupUi(self, EthernetHubWizard):
|
||||
@@ -17,31 +18,31 @@ class Ui_EthernetHubWizard(object):
|
||||
self.uiServerWizardPage.setObjectName("uiServerWizardPage")
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(self.uiServerWizardPage)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiServerTypeGroupBox = QtWidgets.QGroupBox(self.uiServerWizardPage)
|
||||
self.uiServerTypeGroupBox = QtWidgets.QGroupBox(parent=self.uiServerWizardPage)
|
||||
self.uiServerTypeGroupBox.setObjectName("uiServerTypeGroupBox")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.uiServerTypeGroupBox)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiRemoteRadioButton = QtWidgets.QRadioButton(self.uiServerTypeGroupBox)
|
||||
self.uiRemoteRadioButton = QtWidgets.QRadioButton(parent=self.uiServerTypeGroupBox)
|
||||
self.uiRemoteRadioButton.setChecked(True)
|
||||
self.uiRemoteRadioButton.setObjectName("uiRemoteRadioButton")
|
||||
self.verticalLayout.addWidget(self.uiRemoteRadioButton)
|
||||
self.uiVMRadioButton = QtWidgets.QRadioButton(self.uiServerTypeGroupBox)
|
||||
self.uiVMRadioButton = QtWidgets.QRadioButton(parent=self.uiServerTypeGroupBox)
|
||||
self.uiVMRadioButton.setObjectName("uiVMRadioButton")
|
||||
self.verticalLayout.addWidget(self.uiVMRadioButton)
|
||||
self.uiLocalRadioButton = QtWidgets.QRadioButton(self.uiServerTypeGroupBox)
|
||||
self.uiLocalRadioButton = QtWidgets.QRadioButton(parent=self.uiServerTypeGroupBox)
|
||||
self.uiLocalRadioButton.setObjectName("uiLocalRadioButton")
|
||||
self.verticalLayout.addWidget(self.uiLocalRadioButton)
|
||||
self.gridLayout_2.addWidget(self.uiServerTypeGroupBox, 0, 0, 1, 1)
|
||||
self.uiRemoteServersGroupBox = QtWidgets.QGroupBox(self.uiServerWizardPage)
|
||||
self.uiRemoteServersGroupBox = QtWidgets.QGroupBox(parent=self.uiServerWizardPage)
|
||||
self.uiRemoteServersGroupBox.setObjectName("uiRemoteServersGroupBox")
|
||||
self.gridLayout_7 = QtWidgets.QGridLayout(self.uiRemoteServersGroupBox)
|
||||
self.gridLayout_7.setObjectName("gridLayout_7")
|
||||
self.uiRemoteServersLabel = QtWidgets.QLabel(self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersLabel = QtWidgets.QLabel(parent=self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersLabel.setObjectName("uiRemoteServersLabel")
|
||||
self.gridLayout_7.addWidget(self.uiRemoteServersLabel, 0, 0, 1, 1)
|
||||
self.uiRemoteServersComboBox = QtWidgets.QComboBox(self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersComboBox = QtWidgets.QComboBox(parent=self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersComboBox.setEnabled(False)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiRemoteServersComboBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -54,17 +55,17 @@ class Ui_EthernetHubWizard(object):
|
||||
self.uiNameWizardPage.setObjectName("uiNameWizardPage")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiNameWizardPage)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiNameWizardPage)
|
||||
self.uiNameLabel = QtWidgets.QLabel(parent=self.uiNameWizardPage)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiNameWizardPage)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(parent=self.uiNameWizardPage)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
self.uiPortsLabel = QtWidgets.QLabel(self.uiNameWizardPage)
|
||||
self.uiPortsLabel = QtWidgets.QLabel(parent=self.uiNameWizardPage)
|
||||
self.uiPortsLabel.setObjectName("uiPortsLabel")
|
||||
self.gridLayout.addWidget(self.uiPortsLabel, 1, 0, 1, 1)
|
||||
self.uiPortsSpinBox = QtWidgets.QSpinBox(self.uiNameWizardPage)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiPortsSpinBox = QtWidgets.QSpinBox(parent=self.uiNameWizardPage)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiPortsSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -94,4 +95,3 @@ class Ui_EthernetHubWizard(object):
|
||||
self.uiNameWizardPage.setSubTitle(_translate("EthernetHubWizard", "Please choose a descriptive name for the new Ethernet hub."))
|
||||
self.uiNameLabel.setText(_translate("EthernetHubWizard", "Name:"))
|
||||
self.uiPortsLabel.setText(_translate("EthernetHubWizard", "Number of ports:"))
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/ethernet_switch_configuration_page.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.11.3
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
def setupUi(self, ethernetSwitchConfigPageWidget):
|
||||
@@ -14,52 +15,52 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
ethernetSwitchConfigPageWidget.resize(708, 653)
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(ethernetSwitchConfigPageWidget)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiGeneralGroupBox = QtWidgets.QGroupBox(ethernetSwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox = QtWidgets.QGroupBox(parent=ethernetSwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox.setObjectName("uiGeneralGroupBox")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiGeneralGroupBox)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiNameLabel = QtWidgets.QLabel(parent=self.uiGeneralGroupBox)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(parent=self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
self.uiDefaultNameFormatLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiDefaultNameFormatLabel = QtWidgets.QLabel(parent=self.uiGeneralGroupBox)
|
||||
self.uiDefaultNameFormatLabel.setObjectName("uiDefaultNameFormatLabel")
|
||||
self.gridLayout.addWidget(self.uiDefaultNameFormatLabel, 1, 0, 1, 1)
|
||||
self.uiDefaultNameFormatLineEdit = QtWidgets.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiDefaultNameFormatLineEdit = QtWidgets.QLineEdit(parent=self.uiGeneralGroupBox)
|
||||
self.uiDefaultNameFormatLineEdit.setObjectName("uiDefaultNameFormatLineEdit")
|
||||
self.gridLayout.addWidget(self.uiDefaultNameFormatLineEdit, 1, 1, 1, 1)
|
||||
self.uiSymbolLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiSymbolLabel = QtWidgets.QLabel(parent=self.uiGeneralGroupBox)
|
||||
self.uiSymbolLabel.setObjectName("uiSymbolLabel")
|
||||
self.gridLayout.addWidget(self.uiSymbolLabel, 2, 0, 1, 1)
|
||||
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
|
||||
self.uiSymbolLineEdit = QtWidgets.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiSymbolLineEdit = QtWidgets.QLineEdit(parent=self.uiGeneralGroupBox)
|
||||
self.uiSymbolLineEdit.setObjectName("uiSymbolLineEdit")
|
||||
self.horizontalLayout_7.addWidget(self.uiSymbolLineEdit)
|
||||
self.uiSymbolToolButton = QtWidgets.QToolButton(self.uiGeneralGroupBox)
|
||||
self.uiSymbolToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextOnly)
|
||||
self.uiSymbolToolButton = QtWidgets.QToolButton(parent=self.uiGeneralGroupBox)
|
||||
self.uiSymbolToolButton.setToolButtonStyle(QtCore.Qt.ToolButtonStyle.ToolButtonTextOnly)
|
||||
self.uiSymbolToolButton.setObjectName("uiSymbolToolButton")
|
||||
self.horizontalLayout_7.addWidget(self.uiSymbolToolButton)
|
||||
self.gridLayout.addLayout(self.horizontalLayout_7, 2, 1, 1, 1)
|
||||
self.uiCategoryLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiCategoryLabel = QtWidgets.QLabel(parent=self.uiGeneralGroupBox)
|
||||
self.uiCategoryLabel.setObjectName("uiCategoryLabel")
|
||||
self.gridLayout.addWidget(self.uiCategoryLabel, 3, 0, 1, 1)
|
||||
self.uiCategoryComboBox = QtWidgets.QComboBox(self.uiGeneralGroupBox)
|
||||
self.uiCategoryComboBox = QtWidgets.QComboBox(parent=self.uiGeneralGroupBox)
|
||||
self.uiCategoryComboBox.setObjectName("uiCategoryComboBox")
|
||||
self.gridLayout.addWidget(self.uiCategoryComboBox, 3, 1, 1, 1)
|
||||
self.uiConsoleTypeLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiConsoleTypeLabel = QtWidgets.QLabel(parent=self.uiGeneralGroupBox)
|
||||
self.uiConsoleTypeLabel.setObjectName("uiConsoleTypeLabel")
|
||||
self.gridLayout.addWidget(self.uiConsoleTypeLabel, 4, 0, 1, 1)
|
||||
self.uiConsoleTypeComboBox = QtWidgets.QComboBox(self.uiGeneralGroupBox)
|
||||
self.uiConsoleTypeComboBox = QtWidgets.QComboBox(parent=self.uiGeneralGroupBox)
|
||||
self.uiConsoleTypeComboBox.setObjectName("uiConsoleTypeComboBox")
|
||||
self.uiConsoleTypeComboBox.addItem("")
|
||||
self.uiConsoleTypeComboBox.addItem("")
|
||||
self.gridLayout.addWidget(self.uiConsoleTypeComboBox, 4, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiGeneralGroupBox, 0, 0, 1, 2)
|
||||
self.uiEthernetSwitchSettingsGroupBox = QtWidgets.QGroupBox(ethernetSwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
self.uiEthernetSwitchSettingsGroupBox = QtWidgets.QGroupBox(parent=ethernetSwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiEthernetSwitchSettingsGroupBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -67,11 +68,11 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
self.uiEthernetSwitchSettingsGroupBox.setObjectName("uiEthernetSwitchSettingsGroupBox")
|
||||
self.gridlayout = QtWidgets.QGridLayout(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.gridlayout.setObjectName("gridlayout")
|
||||
self.label = QtWidgets.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label = QtWidgets.QLabel(parent=self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label.setObjectName("label")
|
||||
self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
|
||||
self.uiPortSpinBox = QtWidgets.QSpinBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiPortSpinBox = QtWidgets.QSpinBox(parent=self.uiEthernetSwitchSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiPortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -81,11 +82,11 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
self.uiPortSpinBox.setProperty("value", 0)
|
||||
self.uiPortSpinBox.setObjectName("uiPortSpinBox")
|
||||
self.gridlayout.addWidget(self.uiPortSpinBox, 0, 1, 1, 1)
|
||||
self.label_3 = QtWidgets.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_3 = QtWidgets.QLabel(parent=self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.gridlayout.addWidget(self.label_3, 1, 0, 1, 1)
|
||||
self.uiVlanSpinBox = QtWidgets.QSpinBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiVlanSpinBox = QtWidgets.QSpinBox(parent=self.uiEthernetSwitchSettingsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiVlanSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -95,19 +96,19 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
self.uiVlanSpinBox.setProperty("value", 1)
|
||||
self.uiVlanSpinBox.setObjectName("uiVlanSpinBox")
|
||||
self.gridlayout.addWidget(self.uiVlanSpinBox, 1, 1, 1, 1)
|
||||
self.label_2 = QtWidgets.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_2 = QtWidgets.QLabel(parent=self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_2.setObjectName("label_2")
|
||||
self.gridlayout.addWidget(self.label_2, 2, 0, 1, 1)
|
||||
self.label_4 = QtWidgets.QLabel(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_4 = QtWidgets.QLabel(parent=self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.gridlayout.addWidget(self.label_4, 3, 0, 1, 1)
|
||||
self.uiPortTypeComboBox = QtWidgets.QComboBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.uiPortTypeComboBox = QtWidgets.QComboBox(parent=self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.uiPortTypeComboBox.setObjectName("uiPortTypeComboBox")
|
||||
self.uiPortTypeComboBox.addItem("")
|
||||
self.uiPortTypeComboBox.addItem("")
|
||||
self.uiPortTypeComboBox.addItem("")
|
||||
self.gridlayout.addWidget(self.uiPortTypeComboBox, 2, 1, 1, 1)
|
||||
self.uiPortEtherTypeComboBox = QtWidgets.QComboBox(self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.uiPortEtherTypeComboBox = QtWidgets.QComboBox(parent=self.uiEthernetSwitchSettingsGroupBox)
|
||||
self.uiPortEtherTypeComboBox.setEnabled(False)
|
||||
self.uiPortEtherTypeComboBox.setObjectName("uiPortEtherTypeComboBox")
|
||||
self.uiPortEtherTypeComboBox.addItem("")
|
||||
@@ -116,12 +117,12 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
self.uiPortEtherTypeComboBox.addItem("")
|
||||
self.gridlayout.addWidget(self.uiPortEtherTypeComboBox, 3, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiEthernetSwitchSettingsGroupBox, 1, 0, 1, 1)
|
||||
self.uiEthernetSwitchPortsGroupBox = QtWidgets.QGroupBox(ethernetSwitchConfigPageWidget)
|
||||
self.uiEthernetSwitchPortsGroupBox = QtWidgets.QGroupBox(parent=ethernetSwitchConfigPageWidget)
|
||||
self.uiEthernetSwitchPortsGroupBox.setObjectName("uiEthernetSwitchPortsGroupBox")
|
||||
self.vboxlayout = QtWidgets.QVBoxLayout(self.uiEthernetSwitchPortsGroupBox)
|
||||
self.vboxlayout.setObjectName("vboxlayout")
|
||||
self.uiPortsTreeWidget = QtWidgets.QTreeWidget(self.uiEthernetSwitchPortsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
self.uiPortsTreeWidget = QtWidgets.QTreeWidget(parent=self.uiEthernetSwitchPortsGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiPortsTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
@@ -132,17 +133,17 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
self.gridLayout_2.addWidget(self.uiEthernetSwitchPortsGroupBox, 1, 1, 2, 1)
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName("horizontalLayout")
|
||||
self.uiAddPushButton = QtWidgets.QPushButton(ethernetSwitchConfigPageWidget)
|
||||
self.uiAddPushButton = QtWidgets.QPushButton(parent=ethernetSwitchConfigPageWidget)
|
||||
self.uiAddPushButton.setObjectName("uiAddPushButton")
|
||||
self.horizontalLayout.addWidget(self.uiAddPushButton)
|
||||
self.uiDeletePushButton = QtWidgets.QPushButton(ethernetSwitchConfigPageWidget)
|
||||
self.uiDeletePushButton = QtWidgets.QPushButton(parent=ethernetSwitchConfigPageWidget)
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
self.uiDeletePushButton.setObjectName("uiDeletePushButton")
|
||||
self.horizontalLayout.addWidget(self.uiDeletePushButton)
|
||||
self.gridLayout_2.addLayout(self.horizontalLayout, 2, 0, 1, 1)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 71, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 71, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem, 3, 0, 1, 1)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem1, 3, 1, 1, 1)
|
||||
|
||||
self.retranslateUi(ethernetSwitchConfigPageWidget)
|
||||
@@ -184,4 +185,3 @@ class Ui_ethernetSwitchConfigPageWidget(object):
|
||||
self.uiPortsTreeWidget.headerItem().setText(3, _translate("ethernetSwitchConfigPageWidget", "EtherType"))
|
||||
self.uiAddPushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Add"))
|
||||
self.uiDeletePushButton.setText(_translate("ethernetSwitchConfigPageWidget", "&Delete"))
|
||||
|
||||
|
||||
@@ -35,13 +35,6 @@
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>11</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/ethernet_switch_preferences_page.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.9
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_EthernetSwitchPreferencesPageWidget(object):
|
||||
def setupUi(self, EthernetSwitchPreferencesPageWidget):
|
||||
@@ -14,34 +15,29 @@ class Ui_EthernetSwitchPreferencesPageWidget(object):
|
||||
EthernetSwitchPreferencesPageWidget.resize(546, 455)
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(EthernetSwitchPreferencesPageWidget)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.splitter = QtWidgets.QSplitter(EthernetSwitchPreferencesPageWidget)
|
||||
self.splitter.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.splitter = QtWidgets.QSplitter(parent=EthernetSwitchPreferencesPageWidget)
|
||||
self.splitter.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||
self.splitter.setObjectName("splitter")
|
||||
self.uiEthernetSwitchesTreeWidget = QtWidgets.QTreeWidget(self.splitter)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
|
||||
self.uiEthernetSwitchesTreeWidget = QtWidgets.QTreeWidget(parent=self.splitter)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Preferred, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiEthernetSwitchesTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
self.uiEthernetSwitchesTreeWidget.setSizePolicy(sizePolicy)
|
||||
self.uiEthernetSwitchesTreeWidget.setMaximumSize(QtCore.QSize(160, 16777215))
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(11)
|
||||
font.setBold(True)
|
||||
font.setWeight(75)
|
||||
self.uiEthernetSwitchesTreeWidget.setFont(font)
|
||||
self.uiEthernetSwitchesTreeWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
|
||||
self.uiEthernetSwitchesTreeWidget.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
|
||||
self.uiEthernetSwitchesTreeWidget.setIconSize(QtCore.QSize(32, 32))
|
||||
self.uiEthernetSwitchesTreeWidget.setRootIsDecorated(False)
|
||||
self.uiEthernetSwitchesTreeWidget.setObjectName("uiEthernetSwitchesTreeWidget")
|
||||
self.uiEthernetSwitchesTreeWidget.headerItem().setText(0, "1")
|
||||
self.uiEthernetSwitchesTreeWidget.header().setVisible(False)
|
||||
self.layoutWidget = QtWidgets.QWidget(self.splitter)
|
||||
self.layoutWidget = QtWidgets.QWidget(parent=self.splitter)
|
||||
self.layoutWidget.setObjectName("layoutWidget")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiEthernetSwitchInfoTreeWidget = QtWidgets.QTreeWidget(self.layoutWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding)
|
||||
self.uiEthernetSwitchInfoTreeWidget = QtWidgets.QTreeWidget(parent=self.layoutWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiEthernetSwitchInfoTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
@@ -53,14 +49,14 @@ class Ui_EthernetSwitchPreferencesPageWidget(object):
|
||||
self.verticalLayout.addWidget(self.uiEthernetSwitchInfoTreeWidget)
|
||||
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
|
||||
self.uiNewEthernetSwitchPushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.uiNewEthernetSwitchPushButton = QtWidgets.QPushButton(parent=self.layoutWidget)
|
||||
self.uiNewEthernetSwitchPushButton.setObjectName("uiNewEthernetSwitchPushButton")
|
||||
self.horizontalLayout_5.addWidget(self.uiNewEthernetSwitchPushButton)
|
||||
self.uiEditEthernetSwitchPushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.uiEditEthernetSwitchPushButton = QtWidgets.QPushButton(parent=self.layoutWidget)
|
||||
self.uiEditEthernetSwitchPushButton.setEnabled(False)
|
||||
self.uiEditEthernetSwitchPushButton.setObjectName("uiEditEthernetSwitchPushButton")
|
||||
self.horizontalLayout_5.addWidget(self.uiEditEthernetSwitchPushButton)
|
||||
self.uiDeleteEthernetSwitchPushButton = QtWidgets.QPushButton(self.layoutWidget)
|
||||
self.uiDeleteEthernetSwitchPushButton = QtWidgets.QPushButton(parent=self.layoutWidget)
|
||||
self.uiDeleteEthernetSwitchPushButton.setEnabled(False)
|
||||
self.uiDeleteEthernetSwitchPushButton.setObjectName("uiDeleteEthernetSwitchPushButton")
|
||||
self.horizontalLayout_5.addWidget(self.uiDeleteEthernetSwitchPushButton)
|
||||
@@ -80,4 +76,3 @@ class Ui_EthernetSwitchPreferencesPageWidget(object):
|
||||
self.uiNewEthernetSwitchPushButton.setText(_translate("EthernetSwitchPreferencesPageWidget", "&New"))
|
||||
self.uiEditEthernetSwitchPushButton.setText(_translate("EthernetSwitchPreferencesPageWidget", "&Edit"))
|
||||
self.uiDeleteEthernetSwitchPushButton.setText(_translate("EthernetSwitchPreferencesPageWidget", "&Delete"))
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/ethernet_switch_wizard.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.9
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_EthernetSwitchWizard(object):
|
||||
def setupUi(self, EthernetSwitchWizard):
|
||||
@@ -17,31 +18,31 @@ class Ui_EthernetSwitchWizard(object):
|
||||
self.uiServerWizardPage.setObjectName("uiServerWizardPage")
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(self.uiServerWizardPage)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiServerTypeGroupBox = QtWidgets.QGroupBox(self.uiServerWizardPage)
|
||||
self.uiServerTypeGroupBox = QtWidgets.QGroupBox(parent=self.uiServerWizardPage)
|
||||
self.uiServerTypeGroupBox.setObjectName("uiServerTypeGroupBox")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.uiServerTypeGroupBox)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiRemoteRadioButton = QtWidgets.QRadioButton(self.uiServerTypeGroupBox)
|
||||
self.uiRemoteRadioButton = QtWidgets.QRadioButton(parent=self.uiServerTypeGroupBox)
|
||||
self.uiRemoteRadioButton.setChecked(True)
|
||||
self.uiRemoteRadioButton.setObjectName("uiRemoteRadioButton")
|
||||
self.verticalLayout.addWidget(self.uiRemoteRadioButton)
|
||||
self.uiVMRadioButton = QtWidgets.QRadioButton(self.uiServerTypeGroupBox)
|
||||
self.uiVMRadioButton = QtWidgets.QRadioButton(parent=self.uiServerTypeGroupBox)
|
||||
self.uiVMRadioButton.setObjectName("uiVMRadioButton")
|
||||
self.verticalLayout.addWidget(self.uiVMRadioButton)
|
||||
self.uiLocalRadioButton = QtWidgets.QRadioButton(self.uiServerTypeGroupBox)
|
||||
self.uiLocalRadioButton = QtWidgets.QRadioButton(parent=self.uiServerTypeGroupBox)
|
||||
self.uiLocalRadioButton.setObjectName("uiLocalRadioButton")
|
||||
self.verticalLayout.addWidget(self.uiLocalRadioButton)
|
||||
self.gridLayout_2.addWidget(self.uiServerTypeGroupBox, 0, 0, 1, 1)
|
||||
self.uiRemoteServersGroupBox = QtWidgets.QGroupBox(self.uiServerWizardPage)
|
||||
self.uiRemoteServersGroupBox = QtWidgets.QGroupBox(parent=self.uiServerWizardPage)
|
||||
self.uiRemoteServersGroupBox.setObjectName("uiRemoteServersGroupBox")
|
||||
self.gridLayout_7 = QtWidgets.QGridLayout(self.uiRemoteServersGroupBox)
|
||||
self.gridLayout_7.setObjectName("gridLayout_7")
|
||||
self.uiRemoteServersLabel = QtWidgets.QLabel(self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersLabel = QtWidgets.QLabel(parent=self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersLabel.setObjectName("uiRemoteServersLabel")
|
||||
self.gridLayout_7.addWidget(self.uiRemoteServersLabel, 0, 0, 1, 1)
|
||||
self.uiRemoteServersComboBox = QtWidgets.QComboBox(self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersComboBox = QtWidgets.QComboBox(parent=self.uiRemoteServersGroupBox)
|
||||
self.uiRemoteServersComboBox.setEnabled(False)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiRemoteServersComboBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -54,14 +55,14 @@ class Ui_EthernetSwitchWizard(object):
|
||||
self.uiNameWizardPage.setObjectName("uiNameWizardPage")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiNameWizardPage)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiNameWizardPage)
|
||||
self.uiNameLabel = QtWidgets.QLabel(parent=self.uiNameWizardPage)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiPortsLabel = QtWidgets.QLabel(self.uiNameWizardPage)
|
||||
self.uiPortsLabel = QtWidgets.QLabel(parent=self.uiNameWizardPage)
|
||||
self.uiPortsLabel.setObjectName("uiPortsLabel")
|
||||
self.gridLayout.addWidget(self.uiPortsLabel, 1, 0, 1, 2)
|
||||
self.uiPortsSpinBox = QtWidgets.QSpinBox(self.uiNameWizardPage)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiPortsSpinBox = QtWidgets.QSpinBox(parent=self.uiNameWizardPage)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiPortsSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -71,7 +72,7 @@ class Ui_EthernetSwitchWizard(object):
|
||||
self.uiPortsSpinBox.setProperty("value", 8)
|
||||
self.uiPortsSpinBox.setObjectName("uiPortsSpinBox")
|
||||
self.gridLayout.addWidget(self.uiPortsSpinBox, 1, 2, 1, 1)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiNameWizardPage)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(parent=self.uiNameWizardPage)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 2, 1, 1)
|
||||
EthernetSwitchWizard.addPage(self.uiNameWizardPage)
|
||||
@@ -94,4 +95,3 @@ class Ui_EthernetSwitchWizard(object):
|
||||
self.uiNameWizardPage.setSubTitle(_translate("EthernetSwitchWizard", "Please choose a descriptive name for the new Ethernet switch."))
|
||||
self.uiNameLabel.setText(_translate("EthernetSwitchWizard", "Name:"))
|
||||
self.uiPortsLabel.setText(_translate("EthernetSwitchWizard", "Number of ports:"))
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/dominik/projects/gns3-gui/gns3/modules/builtin/ui/frame_relay_switch_configuration_page.ui'
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/builtin/ui/frame_relay_switch_configuration_page.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.8.2
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
def setupUi(self, frameRelaySwitchConfigPageWidget):
|
||||
@@ -14,23 +15,23 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
frameRelaySwitchConfigPageWidget.resize(499, 414)
|
||||
self.gridLayout_2 = QtWidgets.QGridLayout(frameRelaySwitchConfigPageWidget)
|
||||
self.gridLayout_2.setObjectName("gridLayout_2")
|
||||
self.uiGeneralGroupBox = QtWidgets.QGroupBox(frameRelaySwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox = QtWidgets.QGroupBox(parent=frameRelaySwitchConfigPageWidget)
|
||||
self.uiGeneralGroupBox.setObjectName("uiGeneralGroupBox")
|
||||
self.gridLayout = QtWidgets.QGridLayout(self.uiGeneralGroupBox)
|
||||
self.gridLayout.setObjectName("gridLayout")
|
||||
self.uiNameLabel = QtWidgets.QLabel(self.uiGeneralGroupBox)
|
||||
self.uiNameLabel = QtWidgets.QLabel(parent=self.uiGeneralGroupBox)
|
||||
self.uiNameLabel.setObjectName("uiNameLabel")
|
||||
self.gridLayout.addWidget(self.uiNameLabel, 0, 0, 1, 1)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit = QtWidgets.QLineEdit(parent=self.uiGeneralGroupBox)
|
||||
self.uiNameLineEdit.setObjectName("uiNameLineEdit")
|
||||
self.gridLayout.addWidget(self.uiNameLineEdit, 0, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiGeneralGroupBox, 0, 0, 1, 2)
|
||||
self.uiFrameRelayMappingGroupBox = QtWidgets.QGroupBox(frameRelaySwitchConfigPageWidget)
|
||||
self.uiFrameRelayMappingGroupBox = QtWidgets.QGroupBox(parent=frameRelaySwitchConfigPageWidget)
|
||||
self.uiFrameRelayMappingGroupBox.setObjectName("uiFrameRelayMappingGroupBox")
|
||||
self.vboxlayout = QtWidgets.QVBoxLayout(self.uiFrameRelayMappingGroupBox)
|
||||
self.vboxlayout.setObjectName("vboxlayout")
|
||||
self.uiMappingTreeWidget = QtWidgets.QTreeWidget(self.uiFrameRelayMappingGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
|
||||
self.uiMappingTreeWidget = QtWidgets.QTreeWidget(parent=self.uiFrameRelayMappingGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiMappingTreeWidget.sizePolicy().hasHeightForWidth())
|
||||
@@ -39,8 +40,8 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
self.uiMappingTreeWidget.setObjectName("uiMappingTreeWidget")
|
||||
self.vboxlayout.addWidget(self.uiMappingTreeWidget)
|
||||
self.gridLayout_2.addWidget(self.uiFrameRelayMappingGroupBox, 0, 2, 4, 1)
|
||||
self.uiFrameRelaySourceGroupBox = QtWidgets.QGroupBox(frameRelaySwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
self.uiFrameRelaySourceGroupBox = QtWidgets.QGroupBox(parent=frameRelaySwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiFrameRelaySourceGroupBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -48,11 +49,11 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
self.uiFrameRelaySourceGroupBox.setObjectName("uiFrameRelaySourceGroupBox")
|
||||
self.gridlayout = QtWidgets.QGridLayout(self.uiFrameRelaySourceGroupBox)
|
||||
self.gridlayout.setObjectName("gridlayout")
|
||||
self.uiSourcePortLabel = QtWidgets.QLabel(self.uiFrameRelaySourceGroupBox)
|
||||
self.uiSourcePortLabel = QtWidgets.QLabel(parent=self.uiFrameRelaySourceGroupBox)
|
||||
self.uiSourcePortLabel.setObjectName("uiSourcePortLabel")
|
||||
self.gridlayout.addWidget(self.uiSourcePortLabel, 0, 0, 1, 1)
|
||||
self.uiSourcePortSpinBox = QtWidgets.QSpinBox(self.uiFrameRelaySourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiSourcePortSpinBox = QtWidgets.QSpinBox(parent=self.uiFrameRelaySourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourcePortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -62,11 +63,11 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
self.uiSourcePortSpinBox.setProperty("value", 1)
|
||||
self.uiSourcePortSpinBox.setObjectName("uiSourcePortSpinBox")
|
||||
self.gridlayout.addWidget(self.uiSourcePortSpinBox, 0, 1, 1, 1)
|
||||
self.uiSourceDLCILabel = QtWidgets.QLabel(self.uiFrameRelaySourceGroupBox)
|
||||
self.uiSourceDLCILabel = QtWidgets.QLabel(parent=self.uiFrameRelaySourceGroupBox)
|
||||
self.uiSourceDLCILabel.setObjectName("uiSourceDLCILabel")
|
||||
self.gridlayout.addWidget(self.uiSourceDLCILabel, 1, 0, 1, 1)
|
||||
self.uiSourceDLCISpinBox = QtWidgets.QSpinBox(self.uiFrameRelaySourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiSourceDLCISpinBox = QtWidgets.QSpinBox(parent=self.uiFrameRelaySourceGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiSourceDLCISpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -76,8 +77,8 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
self.uiSourceDLCISpinBox.setObjectName("uiSourceDLCISpinBox")
|
||||
self.gridlayout.addWidget(self.uiSourceDLCISpinBox, 1, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiFrameRelaySourceGroupBox, 1, 0, 1, 2)
|
||||
self.uiFrameRelayDestinationGroupBox = QtWidgets.QGroupBox(frameRelaySwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
||||
self.uiFrameRelayDestinationGroupBox = QtWidgets.QGroupBox(parent=frameRelaySwitchConfigPageWidget)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Preferred)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiFrameRelayDestinationGroupBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -85,11 +86,11 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
self.uiFrameRelayDestinationGroupBox.setObjectName("uiFrameRelayDestinationGroupBox")
|
||||
self.gridlayout1 = QtWidgets.QGridLayout(self.uiFrameRelayDestinationGroupBox)
|
||||
self.gridlayout1.setObjectName("gridlayout1")
|
||||
self.uiDestinationPortLabel = QtWidgets.QLabel(self.uiFrameRelayDestinationGroupBox)
|
||||
self.uiDestinationPortLabel = QtWidgets.QLabel(parent=self.uiFrameRelayDestinationGroupBox)
|
||||
self.uiDestinationPortLabel.setObjectName("uiDestinationPortLabel")
|
||||
self.gridlayout1.addWidget(self.uiDestinationPortLabel, 0, 0, 1, 1)
|
||||
self.uiDestinationPortSpinBox = QtWidgets.QSpinBox(self.uiFrameRelayDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiDestinationPortSpinBox = QtWidgets.QSpinBox(parent=self.uiFrameRelayDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationPortSpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -99,11 +100,11 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
self.uiDestinationPortSpinBox.setProperty("value", 10)
|
||||
self.uiDestinationPortSpinBox.setObjectName("uiDestinationPortSpinBox")
|
||||
self.gridlayout1.addWidget(self.uiDestinationPortSpinBox, 0, 1, 1, 1)
|
||||
self.uiDestinationDLCILabel = QtWidgets.QLabel(self.uiFrameRelayDestinationGroupBox)
|
||||
self.uiDestinationDLCILabel = QtWidgets.QLabel(parent=self.uiFrameRelayDestinationGroupBox)
|
||||
self.uiDestinationDLCILabel.setObjectName("uiDestinationDLCILabel")
|
||||
self.gridlayout1.addWidget(self.uiDestinationDLCILabel, 1, 0, 1, 1)
|
||||
self.uiDestinationDLCISpinBox = QtWidgets.QSpinBox(self.uiFrameRelayDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
|
||||
self.uiDestinationDLCISpinBox = QtWidgets.QSpinBox(parent=self.uiFrameRelayDestinationGroupBox)
|
||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.uiDestinationDLCISpinBox.sizePolicy().hasHeightForWidth())
|
||||
@@ -113,14 +114,14 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
self.uiDestinationDLCISpinBox.setObjectName("uiDestinationDLCISpinBox")
|
||||
self.gridlayout1.addWidget(self.uiDestinationDLCISpinBox, 1, 1, 1, 1)
|
||||
self.gridLayout_2.addWidget(self.uiFrameRelayDestinationGroupBox, 2, 0, 1, 2)
|
||||
self.uiAddPushButton = QtWidgets.QPushButton(frameRelaySwitchConfigPageWidget)
|
||||
self.uiAddPushButton = QtWidgets.QPushButton(parent=frameRelaySwitchConfigPageWidget)
|
||||
self.uiAddPushButton.setObjectName("uiAddPushButton")
|
||||
self.gridLayout_2.addWidget(self.uiAddPushButton, 3, 0, 1, 1)
|
||||
self.uiDeletePushButton = QtWidgets.QPushButton(frameRelaySwitchConfigPageWidget)
|
||||
self.uiDeletePushButton = QtWidgets.QPushButton(parent=frameRelaySwitchConfigPageWidget)
|
||||
self.uiDeletePushButton.setEnabled(False)
|
||||
self.uiDeletePushButton.setObjectName("uiDeletePushButton")
|
||||
self.gridLayout_2.addWidget(self.uiDeletePushButton, 3, 1, 1, 1)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
self.gridLayout_2.addItem(spacerItem, 4, 2, 1, 1)
|
||||
|
||||
self.retranslateUi(frameRelaySwitchConfigPageWidget)
|
||||
@@ -148,4 +149,3 @@ class Ui_frameRelaySwitchConfigPageWidget(object):
|
||||
self.uiDestinationDLCILabel.setText(_translate("frameRelaySwitchConfigPageWidget", "DLCI:"))
|
||||
self.uiAddPushButton.setText(_translate("frameRelaySwitchConfigPageWidget", "&Add"))
|
||||
self.uiDeletePushButton.setText(_translate("frameRelaySwitchConfigPageWidget", "&Delete"))
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class DockerVMWizard(VMWizard, Ui_DockerVMWizard):
|
||||
|
||||
super().__init__(docker_containers, parent)
|
||||
self._docker_containers = docker_containers
|
||||
self.setPixmap(QtWidgets.QWizard.LogoPixmap, QtGui.QPixmap(":/icons/docker.png"))
|
||||
self.setPixmap(QtWidgets.QWizard.WizardPixmap.LogoPixmap, QtGui.QPixmap(":/icons/docker.png"))
|
||||
|
||||
self.uiNewImageRadioButton.setChecked(True)
|
||||
self._existingImageRadioButtonToggledSlot(False)
|
||||
|
||||
@@ -42,6 +42,7 @@ class DockerVM(Node):
|
||||
docker_vm_settings = {"image": "",
|
||||
"usage": "",
|
||||
"adapters": DOCKER_CONTAINER_SETTINGS["adapters"],
|
||||
"mac_address": DOCKER_CONTAINER_SETTINGS["mac_address"],
|
||||
"custom_adapters": DOCKER_CONTAINER_SETTINGS["custom_adapters"],
|
||||
"start_command": DOCKER_CONTAINER_SETTINGS["start_command"],
|
||||
"environment": DOCKER_CONTAINER_SETTINGS["environment"],
|
||||
@@ -88,6 +89,9 @@ class DockerVM(Node):
|
||||
port_name=port.name(),
|
||||
port_description=port.description())
|
||||
|
||||
if port.macAddress():
|
||||
port_info += " MAC address is {mac_address}\n".format(mac_address=port.macAddress())
|
||||
|
||||
usage = "\n" + self._settings.get("usage")
|
||||
return info + port_info + usage
|
||||
|
||||
@@ -116,6 +120,18 @@ class DockerVM(Node):
|
||||
from .pages.docker_vm_configuration_page import DockerVMConfigurationPage
|
||||
return DockerVMConfigurationPage
|
||||
|
||||
@staticmethod
|
||||
def validateHostname(hostname):
|
||||
"""
|
||||
Checks if the hostname is valid.
|
||||
|
||||
:param hostname: hostname to check
|
||||
|
||||
:returns: boolean
|
||||
"""
|
||||
|
||||
return DockerVM.isValidRfc1123Hostname(hostname)
|
||||
|
||||
@staticmethod
|
||||
def defaultSymbol():
|
||||
"""
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
Configuration page for Docker images.
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
from gns3.qt import QtWidgets
|
||||
from gns3.node import Node
|
||||
from gns3.dialogs.custom_adapters_configuration_dialog import CustomAdaptersConfigurationDialog
|
||||
@@ -57,7 +59,7 @@ class DockerVMConfigurationPage(QtWidgets.QWidget, Ui_dockerVMConfigPageWidget):
|
||||
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))
|
||||
@@ -69,17 +71,27 @@ class DockerVMConfigurationPage(QtWidgets.QWidget, Ui_dockerVMConfigPageWidget):
|
||||
|
||||
if self._node:
|
||||
adapters = self._settings["adapters"]
|
||||
base_mac_address = self._settings["mac_address"]
|
||||
else:
|
||||
adapters = self.uiAdapterSpinBox.value()
|
||||
mac = self.uiMacAddrLineEdit.text()
|
||||
if mac != ":::::":
|
||||
if not re.search(r"""^([0-9a-fA-F]{2}[:]){5}[0-9a-fA-F]{2}$""", mac):
|
||||
QtWidgets.QMessageBox.critical(self, "MAC address", "Invalid MAC address (format required: hh:hh:hh:hh:hh:hh)")
|
||||
return
|
||||
else:
|
||||
base_mac_address = mac
|
||||
else:
|
||||
base_mac_address = ""
|
||||
|
||||
ports = []
|
||||
for adapter_number in range(0, adapters):
|
||||
port_name = "eth{}".format(adapter_number)
|
||||
ports.append(port_name)
|
||||
|
||||
dialog = CustomAdaptersConfigurationDialog(ports, self._custom_adapters, parent=self)
|
||||
dialog = CustomAdaptersConfigurationDialog(ports, self._custom_adapters, "TAP", {"TAP": "Default"}, base_mac_address, parent=self)
|
||||
dialog.show()
|
||||
dialog.exec_()
|
||||
dialog.exec()
|
||||
|
||||
def loadSettings(self, settings, node=None, group=False):
|
||||
"""
|
||||
@@ -150,6 +162,13 @@ class DockerVMConfigurationPage(QtWidgets.QWidget, Ui_dockerVMConfigPageWidget):
|
||||
self.uiSymbolLineEdit.hide()
|
||||
self.uiSymbolToolButton.hide()
|
||||
|
||||
# load the MAC address setting
|
||||
self.uiMacAddrLineEdit.setInputMask("HH:HH:HH:HH:HH:HH;_")
|
||||
if settings["mac_address"]:
|
||||
self.uiMacAddrLineEdit.setText(settings["mac_address"])
|
||||
else:
|
||||
self.uiMacAddrLineEdit.clear()
|
||||
|
||||
self.uiUsageTextEdit.setPlainText(settings["usage"])
|
||||
|
||||
def _networkConfigEditSlot(self):
|
||||
@@ -199,6 +218,18 @@ class DockerVMConfigurationPage(QtWidgets.QWidget, Ui_dockerVMConfigPageWidget):
|
||||
else:
|
||||
settings["name"] = name
|
||||
|
||||
# check and save the MAC address
|
||||
mac = self.uiMacAddrLineEdit.text()
|
||||
if mac != ":::::":
|
||||
if not re.search(r"""^([0-9a-fA-F]{2}[:]){5}[0-9a-fA-F]{2}$""", mac):
|
||||
QtWidgets.QMessageBox.critical(self, "MAC address", "Invalid MAC address (format required: hh:hh:hh:hh:hh:hh)")
|
||||
if node:
|
||||
raise ConfigurationError()
|
||||
else:
|
||||
settings["mac_address"] = mac
|
||||
else:
|
||||
settings["mac_address"] = None
|
||||
|
||||
if not node:
|
||||
# these are template settings
|
||||
settings["category"] = self.uiCategoryComboBox.itemData(self.uiCategoryComboBox.currentIndex())
|
||||
|
||||
@@ -116,7 +116,7 @@ class DockerVMPreferencesPage(QtWidgets.QWidget, Ui_DockerVMPreferencesPageWidge
|
||||
self.uiCopyDockerVMPushButton.setEnabled(single_selected)
|
||||
|
||||
if single_selected:
|
||||
key = selection[0].data(0, QtCore.Qt.UserRole)
|
||||
key = selection[0].data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
docker_container = self._docker_containers[key]
|
||||
self._refreshInfo(docker_container)
|
||||
else:
|
||||
@@ -128,7 +128,7 @@ class DockerVMPreferencesPage(QtWidgets.QWidget, Ui_DockerVMPreferencesPageWidge
|
||||
"""
|
||||
wizard = DockerVMWizard(self._docker_containers, parent=self)
|
||||
wizard.show()
|
||||
if wizard.exec_():
|
||||
if wizard.exec():
|
||||
new_image_settings = wizard.getSettings()
|
||||
key = "{server}:{name}".format(server=new_image_settings["compute_id"], name=new_image_settings["name"])
|
||||
self._docker_containers[key] = DOCKER_CONTAINER_SETTINGS.copy()
|
||||
@@ -137,7 +137,7 @@ class DockerVMPreferencesPage(QtWidgets.QWidget, Ui_DockerVMPreferencesPageWidge
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiDockerVMsTreeWidget)
|
||||
item.setText(0, self._docker_containers[key]["name"])
|
||||
Controller.instance().getSymbolIcon(self._docker_containers[key]["symbol"], qpartial(self._setItemIcon, item))
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, key)
|
||||
self._items.append(item)
|
||||
self.uiDockerVMsTreeWidget.setCurrentItem(item)
|
||||
|
||||
@@ -148,9 +148,9 @@ class DockerVMPreferencesPage(QtWidgets.QWidget, Ui_DockerVMPreferencesPageWidge
|
||||
|
||||
item = self.uiDockerVMsTreeWidget.currentItem()
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
key = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
copied_containers_settings = copy.deepcopy(self._docker_containers[key])
|
||||
new_name, ok = QtWidgets.QInputDialog.getText(self, "Copy Docker template", "Template name:", QtWidgets.QLineEdit.Normal, "Copy of {}".format(copied_containers_settings["name"]))
|
||||
new_name, ok = QtWidgets.QInputDialog.getText(self, "Copy Docker template", "Template name:", QtWidgets.QLineEdit.EchoMode.Normal, "Copy of {}".format(copied_containers_settings["name"]))
|
||||
if ok:
|
||||
key = "{server}:{name}".format(server=copied_containers_settings["compute_id"], name=new_name)
|
||||
if key in self._docker_containers:
|
||||
@@ -164,7 +164,7 @@ class DockerVMPreferencesPage(QtWidgets.QWidget, Ui_DockerVMPreferencesPageWidge
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiDockerVMsTreeWidget)
|
||||
item.setText(0, self._docker_containers[key]["name"])
|
||||
Controller.instance().getSymbolIcon(self._docker_containers[key]["symbol"], qpartial(self._setItemIcon, item))
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, key)
|
||||
self._items.append(item)
|
||||
self.uiDockerVMsTreeWidget.setCurrentItem(item)
|
||||
|
||||
@@ -175,11 +175,11 @@ class DockerVMPreferencesPage(QtWidgets.QWidget, Ui_DockerVMPreferencesPageWidge
|
||||
|
||||
item = self.uiDockerVMsTreeWidget.currentItem()
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
key = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
docker_container = self._docker_containers[key]
|
||||
dialog = ConfigurationDialog(docker_container["name"], docker_container, DockerVMConfigurationPage(), parent=self)
|
||||
dialog.show()
|
||||
if dialog.exec_():
|
||||
if dialog.exec():
|
||||
# update the icon
|
||||
Controller.instance().getSymbolIcon(docker_container["symbol"], qpartial(self._setItemIcon, item))
|
||||
if docker_container["name"] != item.text(0):
|
||||
@@ -192,7 +192,7 @@ class DockerVMPreferencesPage(QtWidgets.QWidget, Ui_DockerVMPreferencesPageWidge
|
||||
self._docker_containers[new_key] = self._docker_containers[key]
|
||||
del self._docker_containers[key]
|
||||
item.setText(0, docker_container["name"])
|
||||
item.setData(0, QtCore.Qt.UserRole, new_key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, new_key)
|
||||
self._refreshInfo(docker_container)
|
||||
|
||||
def _dockerImageDeleteSlot(self):
|
||||
@@ -202,7 +202,7 @@ class DockerVMPreferencesPage(QtWidgets.QWidget, Ui_DockerVMPreferencesPageWidge
|
||||
|
||||
for item in self.uiDockerVMsTreeWidget.selectedItems():
|
||||
if item:
|
||||
key = item.data(0, QtCore.Qt.UserRole)
|
||||
key = item.data(0, QtCore.Qt.ItemDataRole.UserRole)
|
||||
del self._docker_containers[key]
|
||||
self.uiDockerVMsTreeWidget.takeTopLevelItem(self.uiDockerVMsTreeWidget.indexOfTopLevelItem(item))
|
||||
|
||||
@@ -226,12 +226,12 @@ class DockerVMPreferencesPage(QtWidgets.QWidget, Ui_DockerVMPreferencesPageWidge
|
||||
item = QtWidgets.QTreeWidgetItem(self.uiDockerVMsTreeWidget)
|
||||
item.setText(0, docker_container["name"])
|
||||
Controller.instance().getSymbolIcon(docker_container["symbol"], qpartial(self._setItemIcon, item))
|
||||
item.setData(0, QtCore.Qt.UserRole, key)
|
||||
item.setData(0, QtCore.Qt.ItemDataRole.UserRole, key)
|
||||
self._items.append(item)
|
||||
|
||||
if self._items:
|
||||
self.uiDockerVMsTreeWidget.setCurrentItem(self._items[0])
|
||||
self.uiDockerVMsTreeWidget.sortByColumn(0, QtCore.Qt.AscendingOrder)
|
||||
self.uiDockerVMsTreeWidget.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder)
|
||||
self.uiDockerVMsTreeWidget.setMaximumWidth(self.uiDockerVMsTreeWidget.sizeHintForColumn(0) + 10)
|
||||
|
||||
def savePreferences(self):
|
||||
|
||||
@@ -35,6 +35,7 @@ DOCKER_CONTAINER_SETTINGS = {
|
||||
"name": "",
|
||||
"image": "",
|
||||
"adapters": 1,
|
||||
"mac_address": "",
|
||||
"custom_adapters": [],
|
||||
"environment": "",
|
||||
"console_type": "telnet",
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/grossmj/PycharmProjects/gns3-gui/gns3/modules/docker/ui/docker_preferences_page.ui'
|
||||
#
|
||||
# Created: Wed Dec 7 21:29:40 2016
|
||||
# by: PyQt5 UI code generator 5.2.1
|
||||
# Created by: PyQt6 UI code generator 6.10.1
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_DockerPreferencesPageWidget(object):
|
||||
def setupUi(self, DockerPreferencesPageWidget):
|
||||
@@ -15,23 +15,23 @@ class Ui_DockerPreferencesPageWidget(object):
|
||||
DockerPreferencesPageWidget.resize(330, 200)
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(DockerPreferencesPageWidget)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.uiTabWidget = QtWidgets.QTabWidget(DockerPreferencesPageWidget)
|
||||
self.uiTabWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||
self.uiTabWidget = QtWidgets.QTabWidget(parent=DockerPreferencesPageWidget)
|
||||
self.uiTabWidget.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.uiTabWidget.setObjectName("uiTabWidget")
|
||||
self.uiServerSettingsTabWidget = QtWidgets.QWidget()
|
||||
self.uiServerSettingsTabWidget.setObjectName("uiServerSettingsTabWidget")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.uiServerSettingsTabWidget)
|
||||
self.verticalLayout_2.setContentsMargins(10, 10, 10, 10)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
|
||||
spacerItem = QtWidgets.QSpacerItem(20, 5, QtWidgets.QSizePolicy.Policy.Minimum, QtWidgets.QSizePolicy.Policy.Expanding)
|
||||
self.verticalLayout_2.addItem(spacerItem)
|
||||
self.uiTabWidget.addTab(self.uiServerSettingsTabWidget, "")
|
||||
self.verticalLayout.addWidget(self.uiTabWidget)
|
||||
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
|
||||
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
|
||||
spacerItem1 = QtWidgets.QSpacerItem(254, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
|
||||
spacerItem1 = QtWidgets.QSpacerItem(254, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem1)
|
||||
self.uiRestoreDefaultsPushButton = QtWidgets.QPushButton(DockerPreferencesPageWidget)
|
||||
self.uiRestoreDefaultsPushButton = QtWidgets.QPushButton(parent=DockerPreferencesPageWidget)
|
||||
self.uiRestoreDefaultsPushButton.setObjectName("uiRestoreDefaultsPushButton")
|
||||
self.horizontalLayout_2.addWidget(self.uiRestoreDefaultsPushButton)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout_2)
|
||||
@@ -45,4 +45,3 @@ class Ui_DockerPreferencesPageWidget(object):
|
||||
DockerPreferencesPageWidget.setWindowTitle(_translate("DockerPreferencesPageWidget", "Docker"))
|
||||
self.uiTabWidget.setTabText(self.uiTabWidget.indexOf(self.uiServerSettingsTabWidget), _translate("DockerPreferencesPageWidget", "Local settings"))
|
||||
self.uiRestoreDefaultsPushButton.setText(_translate("DockerPreferencesPageWidget", "Restore defaults"))
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user