├── .gitattributes
├── .github
└── workflows
│ ├── codeql-analysis.yml
│ ├── package.yml
│ └── python-linting.yml
├── .gitignore
├── LICENSE
├── README.md
├── classes.py
├── interfaces
├── __init__.py
├── help.md
├── interface_add.py
├── interface_help.py
├── interface_solve.py
├── msgbox_binary.py
├── msgbox_binary.ui
├── msgbox_intersection.py
├── msgbox_intersection.ui
├── msgbox_point.py
├── msgbox_point.ui
├── msgbox_point_on_line.py
├── msgbox_point_on_line.ui
├── ui_add.py
├── ui_add.ui
├── ui_help.py
├── ui_help.ui
├── ui_solve.py
├── ui_solve.ui
└── utils.py
├── main.py
├── read.py
└── requirements.txt
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | ---
2 | # For most projects, this workflow file will not need changing; you simply need
3 | # to commit it to your repository.
4 | #
5 | # You may wish to alter this file to override the set of languages analyzed,
6 | # or to provide custom queries or build logic.
7 | #
8 | # ******** NOTE ********
9 | # We have attempted to detect the languages in your repository. Please check
10 | # the `language` matrix defined below to confirm you have the correct set of
11 | # supported CodeQL languages.
12 | #
13 | name: "CodeQL"
14 |
15 | on:
16 | push:
17 | pull_request:
18 | schedule:
19 | - cron: '0 0 * * *'
20 |
21 | jobs:
22 | analyze:
23 | name: Analyze
24 | runs-on: ubuntu-latest
25 | permissions:
26 | actions: read
27 | contents: read
28 | security-events: write
29 |
30 | strategy:
31 | fail-fast: false
32 | matrix:
33 | language: ['python']
34 | # CodeQL supports ['cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby']
35 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
36 |
37 | steps:
38 | - name: Checkout repository
39 | uses: actions/checkout@v3
40 |
41 | # Initializes the CodeQL tools for scanning.
42 | - name: Initialize CodeQL
43 | uses: github/codeql-action/init@v2
44 | with:
45 | languages: ${{ matrix.language }}
46 | # If you wish to specify custom queries, you can do so here or in a config file.
47 | # By default, queries listed here will override any specified in a config file.
48 | # Prefix the list here with "+" to use these queries and those in the config file.
49 |
50 | # 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
51 | # queries: security-extended,security-and-quality
52 |
53 |
54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55 | # If this step fails, then you should remove it and run the build manually (see below)
56 | - name: Autobuild
57 | uses: github/codeql-action/autobuild@v2
58 |
59 | # ℹ️ Command-line programs to run using the OS shell.
60 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
61 |
62 | # If the Autobuild fails above, remove it and uncomment the following three lines.
63 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
64 |
65 | # - run: |
66 | # echo "Run, Build Application using script"
67 | # ./location_of_script_within_repo/buildscript.sh
68 |
69 | - name: Perform CodeQL Analysis
70 | uses: github/codeql-action/analyze@v2
--------------------------------------------------------------------------------
/.github/workflows/package.yml:
--------------------------------------------------------------------------------
1 | name: 打包几何计算器
2 |
3 | on:
4 | workflow_dispatch:
5 | inputs:
6 | version:
7 | description: '版本'
8 | required: true
9 | disable_console:
10 | description: '禁用控制台'
11 | required: true
12 | default: true
13 |
14 | jobs:
15 | build:
16 | strategy:
17 | fail-fast: false
18 | matrix:
19 | os: [ macos-latest, ubuntu-latest, windows-latest ]
20 | architecture: [ 'x64', 'x86' ]
21 |
22 | runs-on: ${{ matrix.os }}
23 |
24 | steps:
25 | - name: Check-out repository
26 | uses: actions/checkout@v3
27 |
28 | - name: Setup Python
29 | uses: actions/setup-python@v4
30 | with:
31 | python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
32 | architecture: ${{ matrix.architecture }} # optional x64 or x86. Defaults to x64 if not specified
33 | cache: 'pip'
34 | cache-dependency-path: |
35 | **/requirements*.txt
36 |
37 | - name: Install Dependencies
38 | run: |
39 | pip install -r requirements.txt
40 |
41 | - name: Build Executable
42 | uses: Nuitka/Nuitka-Action@main
43 | with:
44 | nuitka-version: main
45 | script-name: main.py
46 | standalone: true
47 | enable-plugins: pyqt6,matplotlib
48 | disable-plugins: options-nanny
49 | include-data-files: interfaces/help.md=interfaces/help.md
50 | output-file: GeometryCalculator
51 | disable-console: ${{ github.event.inputs.disable_console }}
52 | company-name: 几何计算器开发组
53 | product-name: 几何计算器
54 | file-version: ${{ github.event.inputs.version }}
55 | product-version: ${{ github.event.inputs.version }}
56 | file-description: 几何计算器
57 | copyright: "Copyright 几何计算器开发组. All right reserved."
58 | macos-create-app-bundle: ${{ github.event.inputs.disable_console }}
59 |
60 | - name: Upload Artifacts
61 | uses: actions/upload-artifact@v3
62 | with:
63 | name: GeometryCalculator-v${{ github.event.inputs.version }}-${{ runner.os }}-${{ matrix.architecture }}
64 | path: |
65 | build/main.dist/*
66 |
--------------------------------------------------------------------------------
/.github/workflows/python-linting.yml:
--------------------------------------------------------------------------------
1 | ---
2 | # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
3 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
4 |
5 | name: Python package
6 |
7 | on: [push, pull_request]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ${{ matrix.operating-system }}-latest
13 | strategy:
14 | fail-fast: false
15 | matrix:
16 | operating-system: [ubuntu]
17 | python-version: ["3.8", "3.9", "3.10", "3.11"]
18 |
19 | steps:
20 | - uses: actions/checkout@v3
21 | - name: Set up Python ${{ matrix.python-version }}
22 | uses: actions/setup-python@v3
23 | with:
24 | python-version: ${{ matrix.python-version }}
25 | - name: Install dependencies
26 | run: |
27 | python -m pip install --upgrade pip
28 | python -m pip install flake8
29 | if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30 | - name: Lint with flake8
31 | run: |
32 | # stop the build if there are Python syntax errors or undefined names
33 | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34 | # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35 | flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | share/python-wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 | MANIFEST
28 |
29 | # PyInstaller
30 | # Usually these files are written by a python script from a template
31 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
32 | *.manifest
33 | *.spec
34 |
35 | # Installer logs
36 | pip-log.txt
37 | pip-delete-this-directory.txt
38 |
39 | # Unit test / coverage reports
40 | htmlcov/
41 | .tox/
42 | .nox/
43 | .coverage
44 | .coverage.*
45 | .cache
46 | nosetests.xml
47 | coverage.xml
48 | *.cover
49 | *.py,cover
50 | .hypothesis/
51 | .pytest_cache/
52 | cover/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | .pybuilder/
76 | target/
77 |
78 | # Jupyter Notebook
79 | .ipynb_checkpoints
80 |
81 | # IPython
82 | profile_default/
83 | ipython_config.py
84 |
85 | # pyenv
86 | # For a library or package, you might want to ignore these files since the code is
87 | # intended to run in multiple environments; otherwise, check them in:
88 | # .python-version
89 |
90 | # pipenv
91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
94 | # install all needed dependencies.
95 | #Pipfile.lock
96 |
97 | # poetry
98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99 | # This is especially recommended for binary packages to ensure reproducibility, and is more
100 | # commonly ignored for libraries.
101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102 | #poetry.lock
103 |
104 | # pdm
105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106 | #pdm.lock
107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108 | # in version control.
109 | # https://pdm.fming.dev/#use-with-ide
110 | .pdm.toml
111 |
112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113 | __pypackages__/
114 |
115 | # Celery stuff
116 | celerybeat-schedule
117 | celerybeat.pid
118 |
119 | # SageMath parsed files
120 | *.sage.py
121 |
122 | # Environments
123 | .env
124 | .venv
125 | env/
126 | venv/
127 | ENV/
128 | env.bak/
129 | venv.bak/
130 |
131 | # Spyder project settings
132 | .spyderproject
133 | .spyproject
134 |
135 | # Rope project settings
136 | .ropeproject
137 |
138 | # mkdocs documentation
139 | /site
140 |
141 | # mypy
142 | .mypy_cache/
143 | .dmypy.json
144 | dmypy.json
145 |
146 | # Pyre type checker
147 | .pyre/
148 |
149 | # pytype static type analyzer
150 | .pytype/
151 |
152 | # Cython debug symbols
153 | cython_debug/
154 |
155 | # PyCharm
156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158 | # and can be added to the global gitignore or merged into this file. For a more nuclear
159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160 | #.idea/
161 |
162 | temp.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 该仓库已废弃
2 |
3 | 新仓库:[几何计算器 2](https://github.com/zhdbk3/GeometryCalculator)
4 |
5 | # 几何计算器
6 | 用解析几何的思想,求解几何计算题
7 | > 万物皆数。 ——毕达哥拉斯
8 |
9 | > 啊对对对,我们都是初二的学生,用几何的方法做,你是初三的学生,用建系的高级方法做,我们的方法哪有建系快啊 :sweat_smile:
10 | > ——我们的数学老师
11 | ---
12 | ## 作者
13 | [MC着火的冰块](https://space.bilibili.com/551409211)
14 |
15 | ---
16 | ## 目前支持的条件
17 | - 平行
18 | - 垂直
19 | - 任意等式
20 | ---
21 | ## v1.1更新内容
22 | - 使用LaTeX显示结果,更加直观
23 | - 点的未知数命名方式由`xA`转为`x_A`,以适配LaTeX的下标
24 | - 更加人性化的点和条件显示方式
25 | - 条件方程不再统一移项为左右等于0
26 | - 支持删除已添加的点或条件
27 | - 启用高分辨率缩放
28 |
--------------------------------------------------------------------------------
/classes.py:
--------------------------------------------------------------------------------
1 | import sympy
2 |
3 |
4 | class Point:
5 | def __init__(self, name: str, x=None, y=None):
6 | """
7 | 点
8 | :param name: 名字
9 | :param x: 横坐标,None代表未知数
10 | :param y: 纵坐标,None代表未知数
11 | """
12 | self.name = name
13 | if x is None:
14 | x = sympy.Symbol(f'x_{self.name}')
15 | if y is None:
16 | y = sympy.Symbol(f'y_{self.name}')
17 | self.x = x
18 | self.y = y
19 |
20 | def coordinate(self) -> tuple:
21 | """
22 | 获取该点的坐标
23 | :return: 元组,点的坐标
24 | """
25 | return self.x, self.y
26 |
27 | def __str__(self):
28 | return f'{self.name}{self.coordinate()}'
29 |
30 |
31 | class Line:
32 | def __init__(self, p1: Point, p2: Point):
33 | """
34 | 线段/射线/直线
35 | :param p1: 线上一点
36 | :param p2: 线上另一点
37 | """
38 | self.p1 = p1
39 | self.p2 = p2
40 |
41 | @property
42 | def abc(self) -> tuple:
43 | """
44 | 直线的一般式(ax + by + c = 0)方程的a,b,c
45 | :return: 元组(a, b, c)
46 | """
47 | # 已知直线上两点求直线的一般式方程
48 | # 已知直线上的两点P1(X1,Y1) P2(X2,Y2), P1 P2两点不重合。则直线的一般式方程AX+BY+C=0中,A B C分别等于:
49 | # A = Y2 - Y1
50 | # B = X1 - X2
51 | # C = X2*Y1 - X1*Y2
52 | x1, y1 = self.p1.coordinate()
53 | x2, y2 = self.p2.coordinate()
54 | a = y2 - y1
55 | b = x1 - x2
56 | c = x2 * y1 - x1 * y2
57 | return a, b, c
58 |
59 |
60 | class Intersection(Point):
61 | def __init__(self, name: str, l1: Line, l2: Line):
62 | """
63 | 两条线的交点
64 | :param name: 名字
65 | :param l1: 一条线
66 | :param l2: 另一条线
67 | """
68 | # 两直线交点的计算公式:
69 | # 直线一:A1x+B1y+C1=0,
70 | # 直线二:A2x+B2y+C2=0,
71 | # 则两直线交点计算方法为:
72 | # x=(B1C2-B2C1)/(B2A1-B1A2) 。
73 | # y=(A1C2-C1A2)/(B1A2-A1B2)。
74 | a1, b1, c1 = l1.abc
75 | a2, b2, c2 = l2.abc
76 | x = (b1 * c2 - b2 * c1) / (b2 * a1 - b1 * a2)
77 | y = (a1 * c2 - c1 * a2) / (b1 * a2 - a1 * b2)
78 | super().__init__(name, x, y)
79 |
80 |
81 | class PointOnLine(Point):
82 | def __init__(self, name: str, x, l: Line):
83 | """
84 | 线上的点
85 | :param name: 名字
86 | :param x: 横坐标,None代表未知数
87 | :param l: 点所在的线
88 | """
89 | a, b, c = l.abc
90 | # 特殊情况:竖线
91 | if b == 0:
92 | # ax + c = 0
93 | # x = -c / a
94 | x = -c / a
95 | super().__init__(name, x, None)
96 | return
97 | # ax + by + c = 0
98 | # by = -ax - c
99 | # y = (-ax - c) / b
100 | if x is None:
101 | x = sympy.Symbol(f'x_{name}')
102 | y = (-a * x - c) / b
103 | super().__init__(name, x, y)
104 |
105 |
106 | def distance(p1: Point, p2: Point):
107 | """
108 | 获取两点间距离
109 | :param p1: 一点
110 | :param p2: 另一点
111 | :return: 距离
112 | """
113 | return sympy.sqrt((p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2)
114 |
115 |
116 | class Angle:
117 | def __init__(self, p1: Point, vertex: Point, p2: Point):
118 | """
119 | 角
120 | :param p1: 一边上的点
121 | :param vertex: 顶点
122 | :param p2: 另一边上的点
123 | """
124 | self.p1 = p1
125 | self.vertex = vertex
126 | self.p2 = p2
127 | self.val = self._get_value()
128 |
129 | def _get_value(self):
130 | """
131 | 计算这个角的角度
132 | :return: 角度的表达式
133 | """
134 | # 已知三点坐标:A (X1,Y1) B (X2,Y2) C (X3,Y3)
135 | # AB向量:(X2-X1,Y2-Y1)
136 | # AC向量:(X3-X1,Y3-Y1)
137 | # BC向量:(X3-X2,Y3-Y2)
138 | # COS∠A=[(X2-X1)(X3-X1)+(Y2-Y1)(Y3-Y1)]/|AB||AC|
139 | # 其中:|AB|=[(X2-X1)^2+(Y2-Y1)^2]^0.5
140 | # |AC|=[(X3-X1)^2+(Y3-Y1)^2]^0.5
141 | # ∠A = Arccos {[(X2-X1)(X3-X1)+(Y2-Y1)(Y3-Y1)]/|AB||AC|}
142 | return sympy.acos(((self.p1.x - self.vertex.x) * (self.p2.x - self.vertex.x) + (self.p1.y - self.vertex.y) * (
143 | self.p2.y - self.vertex.y)) / (distance(self.p1, self.vertex) * distance(self.p2, self.vertex)))
144 |
145 |
146 | if __name__ == '__main__':
147 | from sympy import Integer
148 |
149 | p1 = Point('A', Integer(1), Integer(0))
150 | p2 = Point('B', Integer(1), Integer(1))
151 | l = Line(p1, p2)
152 | print(l.abc)
153 | p3 = PointOnLine('C', None, l)
154 | print(p3)
155 |
--------------------------------------------------------------------------------
/interfaces/__init__.py:
--------------------------------------------------------------------------------
1 | from .interface_add import InterfaceAdd
2 | from .interface_solve import InterfaceSolve
3 | from .interface_help import InterfaceHelp
4 |
--------------------------------------------------------------------------------
/interfaces/help.md:
--------------------------------------------------------------------------------
1 | # 帮助
2 |
3 | ---
4 | ## 分数与无理数
5 | 我们建议您尽量不使用浮点数,因为它不仅有精度丢失问题,还会在运算中带来危险
6 | - 使用`/`代表分数线,如`1/3`
7 | - `sqrt()`代表平方根,如`sqrt(2)`
8 | - 输入`pi`,程序会自动将其变成`π`
9 |
10 | 程序可以识别并处理它们
11 |
12 | ---
13 | ## 表达式的书写
14 | - 一律使用英文符号
15 | - 程序会自动把`角`变成`∠`,`度`变成`°`,`pi`变成`π`
16 | - 默认使用弧度制,要输入角度请不要忘了带上`°`
17 | - 不要省略乘号`*`
18 | - 乘方运算符为`**`
19 | - 不支持角的单个字母的简写
20 | - 支持`sin` `cos` `tan`,可以`sin∠ABC`,但是不能`sinB`
21 | - 括号统一使用小括号`()`
22 | - 其他符合python语法的
--------------------------------------------------------------------------------
/interfaces/interface_add.py:
--------------------------------------------------------------------------------
1 | import pickle
2 |
3 | from PyQt6.QtWidgets import QWidget, QAbstractItemView, QHeaderView, QMainWindow, QFileDialog
4 | from qfluentwidgets import MessageBoxBase
5 | from sympy import sqrt, Eq
6 |
7 | from .ui_add import Ui_Add
8 | from .msgbox_point import Ui_MsgBoxPoint
9 | from .msgbox_intersection import Ui_MsgBoxIntersection
10 | from .msgbox_point_on_line import Ui_MsgBoxPointOnLine
11 | from .msgbox_binary import Ui_MsgBoxBinary
12 | from classes import *
13 | import read
14 |
15 | # 给ide代码补全用
16 | if __name__ == '__main__':
17 | import main
18 |
19 |
20 | class InterfaceAdd(QMainWindow, Ui_Add):
21 | def __init__(self, parent=None):
22 | super().__init__(parent=parent)
23 | self.setupUi(self)
24 | # 必须给子界面设置全局唯一的对象名
25 | self.setObjectName(self.__class__.__name__)
26 |
27 | self.w: "main.Window" = parent
28 |
29 | # 连接信号与槽
30 | self.connect()
31 |
32 | self.point_cnt = 0
33 | self.condition_cnt = 0
34 |
35 | @staticmethod
36 | def init_tableview(tableview):
37 | tableview.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
38 | tableview.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Fixed)
39 | tableview.setBorderVisible(True)
40 | tableview.setBorderRadius(8)
41 | tableview.setWordWrap(False)
42 |
43 | def connect(self):
44 | """连接信号与槽"""
45 | # 创建点
46 | self.PushButton_point.clicked.connect(self.add_point)
47 | self.PushButton_intersection.clicked.connect(self.add_intersection)
48 | self.PushButton_point_on_line.clicked.connect(self.add_point_on_line)
49 | self.ListWidget_points.setColumnCount(3)
50 | self.ListWidget_points.setHorizontalHeaderLabels(['点', '横坐标 x', '纵坐标 y'])
51 | self.init_tableview(self.ListWidget_points)
52 | # 条件
53 | self.PushButton_parallel.clicked.connect(self.add_parallel)
54 | self.PushButton_vertical.clicked.connect(self.add_vertical)
55 | self.PushButton_eq.clicked.connect(self.add_eq)
56 | self.ListWidget_conditions.setColumnCount(2)
57 | self.ListWidget_conditions.setHorizontalHeaderLabels(['条件', '方程'])
58 | self.init_tableview(self.ListWidget_conditions)
59 | # 删除点/条件
60 | self.PushButton_delete.clicked.connect(self.delete)
61 | # 文件操作
62 | self.action_save.triggered.connect(self.save)
63 | self.action_open.triggered.connect(self.open_file)
64 |
65 | def add_point_and_show(self, point: Point):
66 | """
67 | 执行预化简(如果开了的话),添加点并显示
68 | :param point: 点的对象
69 | :return:
70 | """
71 | self.w.question.add_point(point)
72 |
73 | def add_condition_and_show(self, eq: Eq, text: str):
74 | """
75 | 添加条件并显示
76 | :param eq: 条件的方程
77 | :param text: 条件的文本
78 | :return:
79 | """
80 | # 预化简
81 | self.w.question.add_condition(eq, text)
82 |
83 | def add_point(self):
84 | """添加点"""
85 | w = MsgBoxPoint(self.w)
86 | if w.exec():
87 | # 读取输入的内容
88 | name = w.wid.LineEdit_name.text()
89 | try:
90 | x = read.to_expr(w.wid.LineEdit_x.text(), self.w.question.points)
91 | except:
92 | x = None
93 | try:
94 | y = read.to_expr(w.wid.LineEdit_y.text(), self.w.question.points)
95 | except:
96 | y = None
97 | # 创建点并添加
98 | point = Point(name, x, y)
99 | self.add_point_and_show(point)
100 |
101 | def add_intersection(self):
102 | """添加交点"""
103 | w = MsgBoxIntersection(self.w)
104 | if w.exec():
105 | # 读取输入的内容
106 | name = w.wid.LineEdit_name.text()
107 | l1 = read.to_line_object(w.wid.LineEdit_l1.text(), self.w.question.points)
108 | l2 = read.to_line_object(w.wid.LineEdit_l2.text(), self.w.question.points)
109 | # 创建点并添加
110 | point = Intersection(name, l1, l2)
111 | self.add_point_and_show(point)
112 |
113 | def add_point_on_line(self):
114 | """添加线上的点"""
115 | w = MsgBoxPointOnLine(self.w)
116 | if w.exec():
117 | # 读取输入的内容
118 | name = w.wid.LineEdit_name.text()
119 | l = read.to_line_object(w.wid.LineEdit_l.text(), self.w.question.points)
120 | try:
121 | x = read.to_expr(w.wid.LineEdit_x.text(), self.w.question.points)
122 | except:
123 | x = None
124 | # 创建点并添加
125 | point = PointOnLine(name, x, l)
126 | self.add_point_and_show(point)
127 |
128 | def add_parallel(self):
129 | """平行"""
130 | w = MsgBoxLinePositionRelationship(self.w, '//')
131 | if w.exec():
132 | # 读取输入的内容
133 | l1 = read.to_line_object(w.wid.LineEdit_1.text(), self.w.question.points)
134 | l2 = read.to_line_object(w.wid.LineEdit_2.text(), self.w.question.points)
135 | # 平行斜率相等
136 | eq = Eq(l1.k, l2.k)
137 | self.add_condition_and_show(eq, f'{w.wid.LineEdit_1.text()}//{w.wid.LineEdit_2.text()}')
138 |
139 | def add_vertical(self):
140 | """垂直"""
141 | w = MsgBoxLinePositionRelationship(self.w, '⊥')
142 | if w.exec():
143 | # 读取输入的内容
144 | l1 = read.to_line_object(w.wid.LineEdit_1.text(), self.w.question.points)
145 | l2 = read.to_line_object(w.wid.LineEdit_2.text(), self.w.question.points)
146 | # 垂直则斜率积为-1
147 | eq = Eq(l1.k * l2.k, -1)
148 | self.add_condition_and_show(eq, f'{w.wid.LineEdit_1.text()}⊥{w.wid.LineEdit_2.text()}')
149 |
150 | def add_eq(self):
151 | """等式"""
152 | w = MsgBoxEq(self.w)
153 | if w.exec():
154 | # 读取输入的内容
155 | left = read.to_expr(w.wid.LineEdit_1.text(), self.w.question.points)
156 | right = read.to_expr(w.wid.LineEdit_2.text(), self.w.question.points)
157 | # 两边相等
158 | eq = Eq(left, right)
159 | self.add_condition_and_show(eq, f'{w.wid.LineEdit_1.text()}={w.wid.LineEdit_2.text()}')
160 |
161 | def delete(self):
162 | """删除点/条件的槽函数"""
163 | self.w.question.delete()
164 |
165 | def save(self):
166 | """保存题目至本地"""
167 | path = QFileDialog.getSaveFileName(self.w, '保存题目', None, 'Python序列化文件(*.pickle)')[0]
168 | if len(path) == 0:
169 | return
170 | with open(path, mode='wb') as f:
171 | pickle.dump(self.w.question, f)
172 |
173 | def open_file(self):
174 | """打开题目"""
175 | path = QFileDialog.getOpenFileName(self.w, '保存题目', None, 'Python序列化文件(*.pickle)')[0]
176 | if len(path) == 0:
177 | return
178 | with open(path, mode='rb') as f:
179 | self.w.question = pickle.load(f)
180 | self.w.question.w = self.w
181 | self.w.question.update_tableview()
182 |
183 |
184 | def get_widget(Ui):
185 | """
186 | 将ui类转换为widget对象供消息框使用
187 | :param Ui: ui类
188 | :return: 一个widget
189 | """
190 |
191 | class Widget(QWidget, Ui):
192 | def __init__(self):
193 | super().__init__()
194 | self.setupUi(self)
195 |
196 | widget = Widget()
197 | return widget
198 |
199 |
200 | def is_number(s: str) -> bool:
201 | """
202 | 检查字符串是否是合法的数字,包括小数、负数、分数、无理数
203 | :param s: 字符串
204 | :return: 是数字则为True,不是为False
205 | """
206 | try:
207 | eval(s)
208 | except:
209 | return False
210 | else:
211 | return True
212 |
213 |
214 | class MsgBoxPoint(MessageBoxBase):
215 | def __init__(self, parent):
216 | super().__init__(parent=parent)
217 | self.wid: Ui_MsgBoxPoint = get_widget(Ui_MsgBoxPoint)
218 | self.viewLayout.addWidget(self.wid)
219 | # 初始禁用确定按钮
220 | self.yesButton.setEnabled(False)
221 | # 文本改动时检查
222 | self.wid.LineEdit_name.textChanged.connect(self._check)
223 | self.wid.LineEdit_x.textChanged.connect(self._check)
224 | self.wid.LineEdit_y.textChanged.connect(self._check)
225 |
226 | def _check(self):
227 | """检查输入是否合法,若合法则开放确定按钮"""
228 | name = self.wid.LineEdit_name.text()
229 | name_ok = len(name) == 1 and name.isupper()
230 | x = self.wid.LineEdit_x.text()
231 | x_ok = len(x) == 0 or is_number(x)
232 | y = self.wid.LineEdit_y.text()
233 | y_ok = len(y) == 0 or is_number(y)
234 | self.yesButton.setEnabled(name_ok and x_ok and y_ok)
235 |
236 |
237 | class MsgBoxIntersection(MessageBoxBase):
238 | def __init__(self, parent):
239 | super().__init__(parent=parent)
240 | self.wid: Ui_MsgBoxIntersection = get_widget(Ui_MsgBoxIntersection)
241 | self.viewLayout.addWidget(self.wid)
242 | # 初始禁用确定按钮
243 | self.yesButton.setEnabled(False)
244 | # 文本改动时检查
245 | self.wid.LineEdit_name.textChanged.connect(self._check)
246 | self.wid.LineEdit_l1.textChanged.connect(self._check)
247 | self.wid.LineEdit_l2.textChanged.connect(self._check)
248 |
249 | def _check(self):
250 | """检查输入是否合法,若合法则开放确定按钮"""
251 | name = self.wid.LineEdit_name.text()
252 | name_ok = len(name) == 1 and name.isupper()
253 | l1 = self.wid.LineEdit_l1.text()
254 | l1_ok = len(l1) == 2 and l1.isupper()
255 | l2 = self.wid.LineEdit_l2.text()
256 | l2_ok = len(l2) == 2 and l2.isupper()
257 | self.yesButton.setEnabled(name_ok and l1_ok and l2_ok)
258 |
259 |
260 | class MsgBoxPointOnLine(MessageBoxBase):
261 | def __init__(self, parent):
262 | super().__init__(parent=parent)
263 | self.wid: Ui_MsgBoxPointOnLine = get_widget(Ui_MsgBoxPointOnLine)
264 | self.viewLayout.addWidget(self.wid)
265 | # 初始禁用确定按钮
266 | self.yesButton.setEnabled(False)
267 | # 文本改动时检查
268 | self.wid.LineEdit_name.textChanged.connect(self._check)
269 | self.wid.LineEdit_l.textChanged.connect(self._check)
270 | self.wid.LineEdit_x.textChanged.connect(self._check)
271 |
272 | def _check(self):
273 | """检查输入是否合法,若合法则开放确定按钮"""
274 | name = self.wid.LineEdit_name.text()
275 | name_ok = len(name) == 1 and name.isupper()
276 | l = self.wid.LineEdit_l.text()
277 | l_ok = len(l) == 2 and l.isupper()
278 | x = self.wid.LineEdit_x.text()
279 | x_ok = len(x) == 0 or is_number(x)
280 | self.yesButton.setEnabled(name_ok and l_ok and x_ok)
281 |
282 |
283 | class MsgBoxLinePositionRelationship(MessageBoxBase):
284 | def __init__(self, parent, relationship: str):
285 | """
286 | 平行和相等的消息框的共同的类
287 | :param parent: w
288 | :param relationship: 中间显示的符号
289 | """
290 | super().__init__(parent=parent)
291 | # 所有二元的条件共用这一个ui
292 | self.wid: Ui_MsgBoxBinary = get_widget(Ui_MsgBoxBinary)
293 | self.viewLayout.addWidget(self.wid)
294 | self.wid.SubtitleLabel_symbol.setText(relationship)
295 | # 初始禁用确定按钮
296 | self.yesButton.setEnabled(False)
297 | # 文本改动时检查
298 | self.wid.LineEdit_1.textChanged.connect(self._check)
299 | self.wid.LineEdit_2.textChanged.connect(self._check)
300 |
301 | def _check(self):
302 | """检查输入是否合法,若合法则开放确定按钮"""
303 | l1 = self.wid.LineEdit_1.text()
304 | l1_ok = len(l1) == 2 and l1.isupper()
305 | l2 = self.wid.LineEdit_2.text()
306 | l2_ok = len(l2) == 2 and l2.isupper()
307 | self.yesButton.setEnabled(l1_ok and l2_ok)
308 |
309 |
310 | class MsgBoxEq(MessageBoxBase):
311 | def __init__(self, parent):
312 | super().__init__(parent=parent)
313 | self.wid: Ui_MsgBoxBinary = get_widget(Ui_MsgBoxBinary)
314 | self.viewLayout.addWidget(self.wid)
315 | self.wid.SubtitleLabel_symbol.setText('=')
316 | # 输入时转化字符串
317 | self.wid.LineEdit_1.textChanged.connect(self._replace)
318 | self.wid.LineEdit_2.textChanged.connect(self._replace)
319 |
320 | def _replace(self):
321 | self.wid.LineEdit_1.setText(self._replace_one(self.wid.LineEdit_1.text()))
322 | self.wid.LineEdit_2.setText(self._replace_one(self.wid.LineEdit_2.text()))
323 |
324 | @staticmethod
325 | def _replace_one(s: str):
326 | """
327 | 让字符串更漂亮
328 | :param s: 角AOB 90度 pi
329 | :return: ∠AOB 90° π
330 | """
331 | return s.replace('角', '∠').replace('度', '°').replace('pi', 'π')
332 |
--------------------------------------------------------------------------------
/interfaces/interface_help.py:
--------------------------------------------------------------------------------
1 | from PyQt6.QtWidgets import QWidget
2 | from qfluentwidgets import FluentIcon
3 |
4 | from .ui_help import Ui_Help
5 |
6 | if __name__ == '__main__':
7 | import main
8 |
9 |
10 | class InterfaceHelp(QWidget, Ui_Help):
11 | def __init__(self, parent):
12 | super().__init__(parent=parent)
13 | self.setupUi(self)
14 | # 必须给子界面设置全局唯一的对象名
15 | self.setObjectName(self.__class__.__name__)
16 |
17 | self.w: "main.Window" = parent
18 |
19 | # 给按钮添加图标
20 | self.HyperlinkButton_author.setIcon(FluentIcon.LINK)
21 | self.HyperlinkButton_github.setIcon(FluentIcon.GITHUB)
22 |
23 | # 设置markdown
24 | with open('interfaces/help.md', encoding='utf-8') as f:
25 | md = f.read()
26 | self.TextEdit_help.setMarkdown(md)
27 |
--------------------------------------------------------------------------------
/interfaces/interface_solve.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 | from PyQt6.QtCore import QThread, pyqtSignal
4 | from PyQt6.QtWidgets import QWidget
5 | import sympy
6 |
7 | from .ui_solve import Ui_Solve
8 | from .utils import tex2img
9 | import read
10 |
11 | if __name__ == '__main__':
12 | import main
13 |
14 |
15 | class InterfaceSolve(QWidget, Ui_Solve):
16 | def __init__(self, parent):
17 | super().__init__(parent=parent)
18 | self.setupUi(self)
19 | # 必须给子界面设置全局唯一的对象名
20 | self.setObjectName(self.__class__.__name__)
21 |
22 | self.w: "main.Window" = parent
23 |
24 | # 初始关闭进度条
25 | self.IndeterminateProgressBar.stop()
26 |
27 | # 求解的子线程
28 | self.thread_solve = ThreadSolve(self.w)
29 | # 计时器子线程
30 | self.thread_timer = ThreadTimer()
31 |
32 | # 连接信号与槽
33 | self.connect()
34 |
35 | def connect(self):
36 | """连接信号与槽"""
37 | self.LineEdit_want.textChanged.connect(self._replace) # 输入
38 | self.PrimaryPushButton_solve.clicked.connect(self.solve) # 开始计算
39 | self.thread_timer.sig_set_text.connect(self.SubtitleLabel_timer.setText) # 计时器
40 | # 开始后
41 | self.thread_solve.started.connect(lambda: self.set_enabled(False)) # 禁用组件
42 | self.thread_solve.started.connect(self.thread_timer.start) # 计时器,启动!(划掉)打开计时器
43 | self.thread_solve.started.connect(lambda: self.SubtitleLabel_state.setText('计算中,请耐心等待...')) # 显示状态
44 | self.thread_solve.started.connect(self.IndeterminateProgressBar.start) # 开启进度条
45 | # 完成后
46 | self.thread_solve.finished.connect(lambda: self.set_enabled(True)) # 启用组件
47 | self.thread_solve.finished.connect(self.show_result) # 显示结果
48 | self.thread_solve.finished.connect(self.thread_timer.turn_off) # 关闭计时器
49 | self.thread_solve.finished.connect(lambda: self.SubtitleLabel_state.setText('所有可能的结果如下')) # 显示状态
50 | self.thread_solve.finished.connect(self.IndeterminateProgressBar.stop) # 停止进度条
51 |
52 | def set_enabled(self, enabled: bool):
53 | """设置所有互动组件的可用/禁用"""
54 | self.PrimaryPushButton_solve.setEnabled(enabled)
55 | self.LineEdit_want.setEnabled(enabled)
56 | self.w.ui_add.PushButton_point.setEnabled(enabled)
57 | self.w.ui_add.PushButton_intersection.setEnabled(enabled)
58 | self.w.ui_add.PushButton_point_on_line.setEnabled(enabled)
59 | self.w.ui_add.PushButton_parallel.setEnabled(enabled)
60 | self.w.ui_add.PushButton_vertical.setEnabled(enabled)
61 | self.w.ui_add.PushButton_eq.setEnabled(enabled)
62 | self.w.ui_add.CheckBox_pre_simplify.setEnabled(enabled)
63 |
64 | def solve(self):
65 | """开始计算"""
66 | # 读取要求的值
67 | expr = read.to_expr(self.LineEdit_want.text(), self.w.question.points)
68 | a = sympy.Symbol('a') # 要求的符号
69 | self.w.question.conditions['tmp'] = a - expr
70 | # 开子线程求解
71 | self.thread_solve.a = a
72 | self.thread_solve.start()
73 |
74 | def show_result(self):
75 | formula = ''
76 | for i in self.thread_solve.result:
77 | formula = formula + sympy.latex(i) + ','
78 | formula = formula.rstrip(',')
79 | self.LargeTitleLabel_result.setPixmap(tex2img(formula))
80 |
81 | def _replace(self):
82 | s = self.LineEdit_want.text()
83 | s = s.replace('角', '∠').replace('度', '°').replace('pi', 'π')
84 | self.LineEdit_want.setText(s)
85 |
86 |
87 | class ThreadSolve(QThread):
88 | def __init__(self, w):
89 | """在多线程中解方程,不让主线程卡死"""
90 | super().__init__()
91 | self.result = None
92 | self.w: "main.Window" = w
93 | self.a = None
94 |
95 | def run(self):
96 | symbols = self.w.question.symbols()
97 | symbols.add(self.a)
98 | self.result = sympy.solve(self.w.question.conditions.values(), symbols, dict=True)
99 | self.result = set([i[self.a] for i in self.result])
100 | # 清理临时变量
101 | del self.w.question.conditions['tmp']
102 |
103 |
104 | class ThreadTimer(QThread):
105 | sig_set_text = pyqtSignal(str)
106 |
107 | def __init__(self):
108 | super().__init__()
109 | self.running = False
110 |
111 | def run(self):
112 | self.running = True
113 | t0 = time.time()
114 | while self.running:
115 | t = time.time() - t0
116 | h = str(int(t // 3600)).zfill(2)
117 | m = str(int(t % 3600 // 60)).zfill(2)
118 | s = str(int(t % 60)).zfill(2)
119 | f = str(int(t % 1 * 100)).zfill(2) # float
120 | self.sig_set_text.emit(f'用时 {h}:{m}:{s}.{f}')
121 | time.sleep(0.01)
122 |
123 | def turn_off(self):
124 | self.running = False
125 |
--------------------------------------------------------------------------------
/interfaces/msgbox_binary.py:
--------------------------------------------------------------------------------
1 | # Form implementation generated from reading ui file 'msgbox_binary.ui'
2 | #
3 | # Created by: PyQt6 UI code generator 6.6.1
4 | #
5 | # WARNING: Any manual changes made to this file will be lost when pyuic6 is
6 | # run again. Do not edit this file unless you know what you are doing.
7 |
8 |
9 | from PyQt6 import QtCore, QtGui, QtWidgets
10 |
11 |
12 | class Ui_MsgBoxBinary(object):
13 | def setupUi(self, MsgBoxBinary):
14 | MsgBoxBinary.setObjectName("MsgBoxBinary")
15 | MsgBoxBinary.resize(300, 51)
16 | self.gridLayout = QtWidgets.QGridLayout(MsgBoxBinary)
17 | self.gridLayout.setObjectName("gridLayout")
18 | self.LineEdit_1 = LineEdit(parent=MsgBoxBinary)
19 | self.LineEdit_1.setObjectName("LineEdit_1")
20 | self.gridLayout.addWidget(self.LineEdit_1, 0, 0, 1, 1)
21 | self.SubtitleLabel_symbol = SubtitleLabel(parent=MsgBoxBinary)
22 | self.SubtitleLabel_symbol.setObjectName("SubtitleLabel_symbol")
23 | self.gridLayout.addWidget(self.SubtitleLabel_symbol, 0, 1, 1, 1)
24 | self.LineEdit_2 = LineEdit(parent=MsgBoxBinary)
25 | self.LineEdit_2.setObjectName("LineEdit_2")
26 | self.gridLayout.addWidget(self.LineEdit_2, 0, 2, 1, 1)
27 |
28 | self.retranslateUi(MsgBoxBinary)
29 | QtCore.QMetaObject.connectSlotsByName(MsgBoxBinary)
30 |
31 | def retranslateUi(self, MsgBoxBinary):
32 | _translate = QtCore.QCoreApplication.translate
33 | MsgBoxBinary.setWindowTitle(_translate("MsgBoxBinary", "Form"))
34 | self.SubtitleLabel_symbol.setText(_translate("MsgBoxBinary", "?"))
35 | from qfluentwidgets import LineEdit, SubtitleLabel
36 |
--------------------------------------------------------------------------------
/interfaces/msgbox_binary.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MsgBoxBinary
4 |
5 |
6 |
7 | 0
8 | 0
9 | 300
10 | 51
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
20 | -
21 |
22 |
23 | ?
24 |
25 |
26 |
27 | -
28 |
29 |
30 |
31 |
32 |
33 |
34 | SubtitleLabel
35 | QLabel
36 |
37 |
38 |
39 | LineEdit
40 | QLineEdit
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/interfaces/msgbox_intersection.py:
--------------------------------------------------------------------------------
1 | # Form implementation generated from reading ui file 'msgbox_intersection.ui'
2 | #
3 | # Created by: PyQt6 UI code generator 6.6.1
4 | #
5 | # WARNING: Any manual changes made to this file will be lost when pyuic6 is
6 | # run again. Do not edit this file unless you know what you are doing.
7 |
8 |
9 | from PyQt6 import QtCore, QtGui, QtWidgets
10 |
11 |
12 | class Ui_MsgBoxIntersection(object):
13 | def setupUi(self, MsgBoxIntersection):
14 | MsgBoxIntersection.setObjectName("MsgBoxIntersection")
15 | MsgBoxIntersection.resize(200, 94)
16 | self.gridLayout_3 = QtWidgets.QGridLayout(MsgBoxIntersection)
17 | self.gridLayout_3.setObjectName("gridLayout_3")
18 | self.gridLayout = QtWidgets.QGridLayout()
19 | self.gridLayout.setObjectName("gridLayout")
20 | self.LineEdit_l1 = LineEdit(parent=MsgBoxIntersection)
21 | self.LineEdit_l1.setObjectName("LineEdit_l1")
22 | self.gridLayout.addWidget(self.LineEdit_l1, 0, 0, 1, 1)
23 | self.StrongBodyLabel = StrongBodyLabel(parent=MsgBoxIntersection)
24 | self.StrongBodyLabel.setObjectName("StrongBodyLabel")
25 | self.gridLayout.addWidget(self.StrongBodyLabel, 0, 1, 1, 1)
26 | self.LineEdit_l2 = LineEdit(parent=MsgBoxIntersection)
27 | self.LineEdit_l2.setObjectName("LineEdit_l2")
28 | self.gridLayout.addWidget(self.LineEdit_l2, 0, 2, 1, 1)
29 | self.gridLayout_3.addLayout(self.gridLayout, 0, 0, 1, 1)
30 | self.gridLayout_2 = QtWidgets.QGridLayout()
31 | self.gridLayout_2.setObjectName("gridLayout_2")
32 | self.StrongBodyLabel_2 = StrongBodyLabel(parent=MsgBoxIntersection)
33 | self.StrongBodyLabel_2.setObjectName("StrongBodyLabel_2")
34 | self.gridLayout_2.addWidget(self.StrongBodyLabel_2, 0, 0, 1, 1)
35 | self.LineEdit_name = LineEdit(parent=MsgBoxIntersection)
36 | self.LineEdit_name.setObjectName("LineEdit_name")
37 | self.gridLayout_2.addWidget(self.LineEdit_name, 0, 1, 1, 1)
38 | self.gridLayout_3.addLayout(self.gridLayout_2, 1, 0, 1, 1)
39 |
40 | self.retranslateUi(MsgBoxIntersection)
41 | QtCore.QMetaObject.connectSlotsByName(MsgBoxIntersection)
42 |
43 | def retranslateUi(self, MsgBoxIntersection):
44 | _translate = QtCore.QCoreApplication.translate
45 | MsgBoxIntersection.setWindowTitle(_translate("MsgBoxIntersection", "Form"))
46 | self.LineEdit_l1.setPlaceholderText(_translate("MsgBoxIntersection", "线名"))
47 | self.StrongBodyLabel.setText(_translate("MsgBoxIntersection", "与"))
48 | self.LineEdit_l2.setPlaceholderText(_translate("MsgBoxIntersection", "线名"))
49 | self.StrongBodyLabel_2.setText(_translate("MsgBoxIntersection", "交于点"))
50 | self.LineEdit_name.setPlaceholderText(_translate("MsgBoxIntersection", "仅一个大写字母"))
51 | from qfluentwidgets import LineEdit, StrongBodyLabel
52 |
--------------------------------------------------------------------------------
/interfaces/msgbox_intersection.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MsgBoxIntersection
4 |
5 |
6 |
7 | 0
8 | 0
9 | 200
10 | 94
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
-
20 |
21 |
22 | 线名
23 |
24 |
25 |
26 | -
27 |
28 |
29 | 与
30 |
31 |
32 |
33 | -
34 |
35 |
36 | 线名
37 |
38 |
39 |
40 |
41 |
42 | -
43 |
44 |
-
45 |
46 |
47 | 交于点
48 |
49 |
50 |
51 | -
52 |
53 |
54 | 仅一个大写字母
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | StrongBodyLabel
65 | QLabel
66 |
67 |
68 |
69 | LineEdit
70 | QLineEdit
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/interfaces/msgbox_point.py:
--------------------------------------------------------------------------------
1 | # Form implementation generated from reading ui file 'msgbox_point.ui'
2 | #
3 | # Created by: PyQt6 UI code generator 6.6.1
4 | #
5 | # WARNING: Any manual changes made to this file will be lost when pyuic6 is
6 | # run again. Do not edit this file unless you know what you are doing.
7 |
8 |
9 | from PyQt6 import QtCore, QtGui, QtWidgets
10 |
11 |
12 | class Ui_MsgBoxPoint(object):
13 | def setupUi(self, MsgBoxPoint):
14 | MsgBoxPoint.setObjectName("MsgBoxPoint")
15 | MsgBoxPoint.resize(200, 129)
16 | self.gridLayout = QtWidgets.QGridLayout(MsgBoxPoint)
17 | self.gridLayout.setObjectName("gridLayout")
18 | self.StrongBodyLabel = StrongBodyLabel(parent=MsgBoxPoint)
19 | self.StrongBodyLabel.setObjectName("StrongBodyLabel")
20 | self.gridLayout.addWidget(self.StrongBodyLabel, 0, 0, 1, 1)
21 | self.LineEdit_name = LineEdit(parent=MsgBoxPoint)
22 | self.LineEdit_name.setObjectName("LineEdit_name")
23 | self.gridLayout.addWidget(self.LineEdit_name, 0, 1, 1, 1)
24 | self.StrongBodyLabel_2 = StrongBodyLabel(parent=MsgBoxPoint)
25 | self.StrongBodyLabel_2.setObjectName("StrongBodyLabel_2")
26 | self.gridLayout.addWidget(self.StrongBodyLabel_2, 1, 0, 1, 1)
27 | self.LineEdit_x = LineEdit(parent=MsgBoxPoint)
28 | self.LineEdit_x.setObjectName("LineEdit_x")
29 | self.gridLayout.addWidget(self.LineEdit_x, 1, 1, 1, 1)
30 | self.StrongBodyLabel_3 = StrongBodyLabel(parent=MsgBoxPoint)
31 | self.StrongBodyLabel_3.setObjectName("StrongBodyLabel_3")
32 | self.gridLayout.addWidget(self.StrongBodyLabel_3, 2, 0, 1, 1)
33 | self.LineEdit_y = LineEdit(parent=MsgBoxPoint)
34 | self.LineEdit_y.setObjectName("LineEdit_y")
35 | self.gridLayout.addWidget(self.LineEdit_y, 2, 1, 1, 1)
36 |
37 | self.retranslateUi(MsgBoxPoint)
38 | QtCore.QMetaObject.connectSlotsByName(MsgBoxPoint)
39 |
40 | def retranslateUi(self, MsgBoxPoint):
41 | _translate = QtCore.QCoreApplication.translate
42 | MsgBoxPoint.setWindowTitle(_translate("MsgBoxPoint", "Form"))
43 | self.StrongBodyLabel.setText(_translate("MsgBoxPoint", "名字"))
44 | self.LineEdit_name.setPlaceholderText(_translate("MsgBoxPoint", "仅一个大写字母"))
45 | self.StrongBodyLabel_2.setText(_translate("MsgBoxPoint", "横坐标"))
46 | self.LineEdit_x.setPlaceholderText(_translate("MsgBoxPoint", "留空为设未知数"))
47 | self.StrongBodyLabel_3.setText(_translate("MsgBoxPoint", "纵坐标"))
48 | self.LineEdit_y.setPlaceholderText(_translate("MsgBoxPoint", "留空为设未知数"))
49 | from qfluentwidgets import LineEdit, StrongBodyLabel
50 |
--------------------------------------------------------------------------------
/interfaces/msgbox_point.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MsgBoxPoint
4 |
5 |
6 |
7 | 0
8 | 0
9 | 200
10 | 129
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
20 | 名字
21 |
22 |
23 |
24 | -
25 |
26 |
27 | 仅一个大写字母
28 |
29 |
30 |
31 | -
32 |
33 |
34 | 横坐标
35 |
36 |
37 |
38 | -
39 |
40 |
41 | 留空为设未知数
42 |
43 |
44 |
45 | -
46 |
47 |
48 | 纵坐标
49 |
50 |
51 |
52 | -
53 |
54 |
55 | 留空为设未知数
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 | StrongBodyLabel
64 | QLabel
65 |
66 |
67 |
68 | LineEdit
69 | QLineEdit
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/interfaces/msgbox_point_on_line.py:
--------------------------------------------------------------------------------
1 | # Form implementation generated from reading ui file 'msgbox_point_on_line.ui'
2 | #
3 | # Created by: PyQt6 UI code generator 6.6.1
4 | #
5 | # WARNING: Any manual changes made to this file will be lost when pyuic6 is
6 | # run again. Do not edit this file unless you know what you are doing.
7 |
8 |
9 | from PyQt6 import QtCore, QtGui, QtWidgets
10 |
11 |
12 | class Ui_MsgBoxPointOnLine(object):
13 | def setupUi(self, MsgBoxPointOnLine):
14 | MsgBoxPointOnLine.setObjectName("MsgBoxPointOnLine")
15 | MsgBoxPointOnLine.resize(200, 135)
16 | self.gridLayout_4 = QtWidgets.QGridLayout(MsgBoxPointOnLine)
17 | self.gridLayout_4.setObjectName("gridLayout_4")
18 | self.gridLayout = QtWidgets.QGridLayout()
19 | self.gridLayout.setObjectName("gridLayout")
20 | self.StrongBodyLabel = StrongBodyLabel(parent=MsgBoxPointOnLine)
21 | self.StrongBodyLabel.setObjectName("StrongBodyLabel")
22 | self.gridLayout.addWidget(self.StrongBodyLabel, 0, 0, 1, 1)
23 | self.LineEdit_name = LineEdit(parent=MsgBoxPointOnLine)
24 | self.LineEdit_name.setObjectName("LineEdit_name")
25 | self.gridLayout.addWidget(self.LineEdit_name, 0, 1, 1, 1)
26 | self.gridLayout_4.addLayout(self.gridLayout, 0, 0, 1, 1)
27 | self.gridLayout_2 = QtWidgets.QGridLayout()
28 | self.gridLayout_2.setObjectName("gridLayout_2")
29 | self.StrongBodyLabel_2 = StrongBodyLabel(parent=MsgBoxPointOnLine)
30 | self.StrongBodyLabel_2.setObjectName("StrongBodyLabel_2")
31 | self.gridLayout_2.addWidget(self.StrongBodyLabel_2, 0, 0, 1, 1)
32 | self.LineEdit_l = LineEdit(parent=MsgBoxPointOnLine)
33 | self.LineEdit_l.setObjectName("LineEdit_l")
34 | self.gridLayout_2.addWidget(self.LineEdit_l, 0, 1, 1, 1)
35 | self.StrongBodyLabel_3 = StrongBodyLabel(parent=MsgBoxPointOnLine)
36 | self.StrongBodyLabel_3.setObjectName("StrongBodyLabel_3")
37 | self.gridLayout_2.addWidget(self.StrongBodyLabel_3, 0, 2, 1, 1)
38 | self.gridLayout_4.addLayout(self.gridLayout_2, 1, 0, 1, 1)
39 | self.gridLayout_3 = QtWidgets.QGridLayout()
40 | self.gridLayout_3.setObjectName("gridLayout_3")
41 | self.StrongBodyLabel_4 = StrongBodyLabel(parent=MsgBoxPointOnLine)
42 | self.StrongBodyLabel_4.setObjectName("StrongBodyLabel_4")
43 | self.gridLayout_3.addWidget(self.StrongBodyLabel_4, 0, 0, 1, 1)
44 | self.LineEdit_x = LineEdit(parent=MsgBoxPointOnLine)
45 | self.LineEdit_x.setObjectName("LineEdit_x")
46 | self.gridLayout_3.addWidget(self.LineEdit_x, 0, 1, 1, 1)
47 | self.gridLayout_4.addLayout(self.gridLayout_3, 2, 0, 1, 1)
48 |
49 | self.retranslateUi(MsgBoxPointOnLine)
50 | QtCore.QMetaObject.connectSlotsByName(MsgBoxPointOnLine)
51 |
52 | def retranslateUi(self, MsgBoxPointOnLine):
53 | _translate = QtCore.QCoreApplication.translate
54 | MsgBoxPointOnLine.setWindowTitle(_translate("MsgBoxPointOnLine", "Form"))
55 | self.StrongBodyLabel.setText(_translate("MsgBoxPointOnLine", "点"))
56 | self.LineEdit_name.setPlaceholderText(_translate("MsgBoxPointOnLine", "仅一个大写字母"))
57 | self.StrongBodyLabel_2.setText(_translate("MsgBoxPointOnLine", "在线"))
58 | self.LineEdit_l.setPlaceholderText(_translate("MsgBoxPointOnLine", "线名"))
59 | self.StrongBodyLabel_3.setText(_translate("MsgBoxPointOnLine", "上"))
60 | self.StrongBodyLabel_4.setText(_translate("MsgBoxPointOnLine", "横坐标"))
61 | self.LineEdit_x.setPlaceholderText(_translate("MsgBoxPointOnLine", "留空为设未知数"))
62 | from qfluentwidgets import LineEdit, StrongBodyLabel
63 |
--------------------------------------------------------------------------------
/interfaces/msgbox_point_on_line.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | MsgBoxPointOnLine
4 |
5 |
6 |
7 | 0
8 | 0
9 | 200
10 | 135
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
-
20 |
21 |
22 | 点
23 |
24 |
25 |
26 | -
27 |
28 |
29 | 仅一个大写字母
30 |
31 |
32 |
33 |
34 |
35 | -
36 |
37 |
-
38 |
39 |
40 | 在线
41 |
42 |
43 |
44 | -
45 |
46 |
47 | 线名
48 |
49 |
50 |
51 | -
52 |
53 |
54 | 上
55 |
56 |
57 |
58 |
59 |
60 | -
61 |
62 |
-
63 |
64 |
65 | 横坐标
66 |
67 |
68 |
69 | -
70 |
71 |
72 | 留空为设未知数
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | StrongBodyLabel
83 | QLabel
84 |
85 |
86 |
87 | LineEdit
88 | QLineEdit
89 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/interfaces/ui_add.py:
--------------------------------------------------------------------------------
1 | # Form implementation generated from reading ui file 'ui_add.ui'
2 | #
3 | # Created by: PyQt6 UI code generator 6.6.1
4 | #
5 | # WARNING: Any manual changes made to this file will be lost when pyuic6 is
6 | # run again. Do not edit this file unless you know what you are doing.
7 |
8 |
9 | from PyQt6 import QtCore, QtGui, QtWidgets
10 |
11 |
12 | class Ui_Add(object):
13 | def setupUi(self, Add):
14 | Add.setObjectName("Add")
15 | Add.resize(800, 600)
16 | self.centralwidget = QtWidgets.QWidget(parent=Add)
17 | self.centralwidget.setObjectName("centralwidget")
18 | self.gridLayout_6 = QtWidgets.QGridLayout(self.centralwidget)
19 | self.gridLayout_6.setObjectName("gridLayout_6")
20 | self.gridLayout_2 = QtWidgets.QGridLayout()
21 | self.gridLayout_2.setObjectName("gridLayout_2")
22 | self.PushButton_intersection = PushButton(parent=self.centralwidget)
23 | self.PushButton_intersection.setObjectName("PushButton_intersection")
24 | self.gridLayout_2.addWidget(self.PushButton_intersection, 2, 0, 1, 1)
25 | self.PushButton_point_on_line = PushButton(parent=self.centralwidget)
26 | self.PushButton_point_on_line.setObjectName("PushButton_point_on_line")
27 | self.gridLayout_2.addWidget(self.PushButton_point_on_line, 3, 0, 1, 1)
28 | self.PushButton_point = PushButton(parent=self.centralwidget)
29 | self.PushButton_point.setObjectName("PushButton_point")
30 | self.gridLayout_2.addWidget(self.PushButton_point, 1, 0, 1, 1)
31 | self.CardWidget = CardWidget(parent=self.centralwidget)
32 | self.CardWidget.setObjectName("CardWidget")
33 | self.gridLayout = QtWidgets.QGridLayout(self.CardWidget)
34 | self.gridLayout.setObjectName("gridLayout")
35 | self.ListWidget_points = TableWidget(parent=self.CardWidget)
36 | self.ListWidget_points.setObjectName("ListWidget_points")
37 | self.ListWidget_points.setColumnCount(0)
38 | self.ListWidget_points.setRowCount(0)
39 | self.gridLayout.addWidget(self.ListWidget_points, 0, 0, 1, 1)
40 | self.gridLayout_2.addWidget(self.CardWidget, 5, 0, 1, 1)
41 | self.TitleLabel = TitleLabel(parent=self.centralwidget)
42 | self.TitleLabel.setObjectName("TitleLabel")
43 | self.gridLayout_2.addWidget(self.TitleLabel, 0, 0, 1, 1)
44 | self.SubtitleLabel = SubtitleLabel(parent=self.centralwidget)
45 | self.SubtitleLabel.setObjectName("SubtitleLabel")
46 | self.gridLayout_2.addWidget(self.SubtitleLabel, 4, 0, 1, 1)
47 | self.gridLayout_6.addLayout(self.gridLayout_2, 0, 0, 1, 1)
48 | self.gridLayout_4 = QtWidgets.QGridLayout()
49 | self.gridLayout_4.setObjectName("gridLayout_4")
50 | self.TitleLabel_2 = TitleLabel(parent=self.centralwidget)
51 | self.TitleLabel_2.setObjectName("TitleLabel_2")
52 | self.gridLayout_4.addWidget(self.TitleLabel_2, 0, 0, 1, 1)
53 | spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
54 | self.gridLayout_4.addItem(spacerItem, 0, 1, 1, 1)
55 | self.PushButton_parallel = PushButton(parent=self.centralwidget)
56 | self.PushButton_parallel.setObjectName("PushButton_parallel")
57 | self.gridLayout_4.addWidget(self.PushButton_parallel, 1, 0, 1, 3)
58 | self.PushButton_vertical = PushButton(parent=self.centralwidget)
59 | self.PushButton_vertical.setObjectName("PushButton_vertical")
60 | self.gridLayout_4.addWidget(self.PushButton_vertical, 2, 0, 1, 3)
61 | self.PushButton_eq = PushButton(parent=self.centralwidget)
62 | self.PushButton_eq.setObjectName("PushButton_eq")
63 | self.gridLayout_4.addWidget(self.PushButton_eq, 3, 0, 1, 3)
64 | self.SubtitleLabel_2 = SubtitleLabel(parent=self.centralwidget)
65 | self.SubtitleLabel_2.setObjectName("SubtitleLabel_2")
66 | self.gridLayout_4.addWidget(self.SubtitleLabel_2, 4, 0, 1, 3)
67 | self.CardWidget_2 = CardWidget(parent=self.centralwidget)
68 | self.CardWidget_2.setObjectName("CardWidget_2")
69 | self.gridLayout_3 = QtWidgets.QGridLayout(self.CardWidget_2)
70 | self.gridLayout_3.setObjectName("gridLayout_3")
71 | self.ListWidget_conditions = TableWidget(parent=self.CardWidget_2)
72 | self.ListWidget_conditions.setObjectName("ListWidget_conditions")
73 | self.ListWidget_conditions.setColumnCount(0)
74 | self.ListWidget_conditions.setRowCount(0)
75 | self.gridLayout_3.addWidget(self.ListWidget_conditions, 0, 0, 1, 1)
76 | self.gridLayout_4.addWidget(self.CardWidget_2, 5, 0, 1, 3)
77 | self.CheckBox_pre_simplify = CheckBox(parent=self.centralwidget)
78 | self.CheckBox_pre_simplify.setChecked(True)
79 | self.CheckBox_pre_simplify.setObjectName("CheckBox_pre_simplify")
80 | self.gridLayout_4.addWidget(self.CheckBox_pre_simplify, 0, 2, 1, 1)
81 | self.gridLayout_6.addLayout(self.gridLayout_4, 0, 1, 1, 1)
82 | self.gridLayout_5 = QtWidgets.QGridLayout()
83 | self.gridLayout_5.setObjectName("gridLayout_5")
84 | self.BodyLabel = BodyLabel(parent=self.centralwidget)
85 | self.BodyLabel.setObjectName("BodyLabel")
86 | self.gridLayout_5.addWidget(self.BodyLabel, 0, 0, 1, 1)
87 | self.LineEdit_delete = LineEdit(parent=self.centralwidget)
88 | self.LineEdit_delete.setObjectName("LineEdit_delete")
89 | self.gridLayout_5.addWidget(self.LineEdit_delete, 0, 1, 1, 1)
90 | self.PushButton_delete = PushButton(parent=self.centralwidget)
91 | self.PushButton_delete.setStyleSheet("PushButton, ToolButton, ToggleButton, ToggleToolButton {\n"
92 | " color: red;\n"
93 | " background: rgba(255, 255, 255, 0.7);\n"
94 | " border: 1px solid rgba(0, 0, 0, 0.073);\n"
95 | " border-bottom: 1px solid rgba(0, 0, 0, 0.183);\n"
96 | " border-radius: 5px;\n"
97 | " /* font: 14px \'Segoe UI\', \'Microsoft YaHei\'; */\n"
98 | " padding: 5px 12px 6px 12px;\n"
99 | " outline: none;\n"
100 | "}\n"
101 | "\n"
102 | "ToolButton {\n"
103 | " padding: 5px 9px 6px 8px;\n"
104 | "}\n"
105 | "\n"
106 | "PushButton[hasIcon=false] {\n"
107 | " padding: 5px 12px 6px 12px;\n"
108 | "}\n"
109 | "\n"
110 | "PushButton[hasIcon=true] {\n"
111 | " padding: 5px 12px 6px 36px;\n"
112 | "}\n"
113 | "\n"
114 | "DropDownToolButton, PrimaryDropDownToolButton {\n"
115 | " padding: 5px 31px 6px 8px;\n"
116 | "}\n"
117 | "\n"
118 | "DropDownPushButton[hasIcon=false],\n"
119 | "PrimaryDropDownPushButton[hasIcon=false] {\n"
120 | " padding: 5px 31px 6px 12px;\n"
121 | "}\n"
122 | "\n"
123 | "DropDownPushButton[hasIcon=true],\n"
124 | "PrimaryDropDownPushButton[hasIcon=true] {\n"
125 | " padding: 5px 31px 6px 36px;\n"
126 | "}\n"
127 | "\n"
128 | "PushButton:hover, ToolButton:hover, ToggleButton:hover, ToggleToolButton:hover {\n"
129 | " background: rgba(249, 249, 249, 0.5);\n"
130 | "}\n"
131 | "\n"
132 | "PushButton:pressed, ToolButton:pressed, ToggleButton:pressed, ToggleToolButton:pressed {\n"
133 | " color: rgba(0, 0, 0, 0.63);\n"
134 | " background: rgba(249, 249, 249, 0.3);\n"
135 | " border-bottom: 1px solid rgba(0, 0, 0, 0.073);\n"
136 | "}\n"
137 | "\n"
138 | "PushButton:disabled, ToolButton:disabled, ToggleButton:disabled, ToggleToolButton:disabled {\n"
139 | " color: rgba(0, 0, 0, 0.36);\n"
140 | " background: rgba(249, 249, 249, 0.3);\n"
141 | " border: 1px solid rgba(0, 0, 0, 0.06);\n"
142 | " border-bottom: 1px solid rgba(0, 0, 0, 0.06);\n"
143 | "}\n"
144 | "\n"
145 | "\n"
146 | "PrimaryPushButton,\n"
147 | "PrimaryToolButton,\n"
148 | "ToggleButton:checked,\n"
149 | "ToggleToolButton:checked {\n"
150 | " color: white;\n"
151 | " background-color: #009faa;\n"
152 | " border: 1px solid #00a7b3;\n"
153 | " border-bottom: 1px solid #007780;\n"
154 | "}\n"
155 | "\n"
156 | "PrimaryPushButton:hover,\n"
157 | "PrimaryToolButton:hover,\n"
158 | "ToggleButton:checked:hover,\n"
159 | "ToggleToolButton:checked:hover {\n"
160 | " background-color: #00a7b3;\n"
161 | " border: 1px solid #2daab3;\n"
162 | " border-bottom: 1px solid #007780;\n"
163 | "}\n"
164 | "\n"
165 | "PrimaryPushButton:pressed,\n"
166 | "PrimaryToolButton:pressed,\n"
167 | "ToggleButton:checked:pressed,\n"
168 | "ToggleToolButton:checked:pressed {\n"
169 | " color: rgba(255, 255, 255, 0.63);\n"
170 | " background-color: #3eabb3;\n"
171 | " border: 1px solid #3eabb3;\n"
172 | "}\n"
173 | "\n"
174 | "PrimaryPushButton:disabled,\n"
175 | "PrimaryToolButton:disabled,\n"
176 | "ToggleButton:checked:disabled,\n"
177 | "ToggleToolButton:checked:disabled {\n"
178 | " color: rgba(255, 255, 255, 0.9);\n"
179 | " background-color: rgb(205, 205, 205);\n"
180 | " border: 1px solid rgb(205, 205, 205);\n"
181 | "}\n"
182 | "\n"
183 | "SplitDropButton,\n"
184 | "PrimarySplitDropButton {\n"
185 | " border-left: none;\n"
186 | " border-top-left-radius: 0;\n"
187 | " border-bottom-left-radius: 0;\n"
188 | "}\n"
189 | "\n"
190 | "#splitPushButton,\n"
191 | "#splitToolButton,\n"
192 | "#primarySplitPushButton,\n"
193 | "#primarySplitToolButton {\n"
194 | " border-top-right-radius: 0;\n"
195 | " border-bottom-right-radius: 0;\n"
196 | "}\n"
197 | "\n"
198 | "#splitPushButton:pressed,\n"
199 | "#splitToolButton:pressed,\n"
200 | "SplitDropButton:pressed {\n"
201 | " border-bottom: 1px solid rgba(0, 0, 0, 0.183);\n"
202 | "}\n"
203 | "\n"
204 | "PrimarySplitDropButton:pressed {\n"
205 | " border-bottom: 1px solid #007780;\n"
206 | "}\n"
207 | "\n"
208 | "#primarySplitPushButton, #primarySplitToolButton {\n"
209 | " border-right: 1px solid #3eabb3;\n"
210 | "}\n"
211 | "\n"
212 | "#primarySplitPushButton:pressed, #primarySplitToolButton:pressed {\n"
213 | " border-bottom: 1px solid #007780;\n"
214 | "}\n"
215 | "\n"
216 | "HyperlinkButton {\n"
217 | " /* font: 14px \'Segoe UI\', \'Microsoft YaHei\'; */\n"
218 | " padding: 6px 12px 6px 12px;\n"
219 | " color: #009faa;\n"
220 | " border: none;\n"
221 | " border-radius: 6px;\n"
222 | " background-color: transparent;\n"
223 | "}\n"
224 | "\n"
225 | "HyperlinkButton[hasIcon=false] {\n"
226 | " padding: 6px 12px 6px 12px;\n"
227 | "}\n"
228 | "\n"
229 | "HyperlinkButton[hasIcon=true] {\n"
230 | " padding: 6px 12px 6px 36px;\n"
231 | "}\n"
232 | "\n"
233 | "HyperlinkButton:hover {\n"
234 | " color: #009faa;\n"
235 | " background-color: rgba(0, 0, 0, 10);\n"
236 | " border: none;\n"
237 | "}\n"
238 | "\n"
239 | "HyperlinkButton:pressed {\n"
240 | " color: #009faa;\n"
241 | " background-color: rgba(0, 0, 0, 6);\n"
242 | " border: none;\n"
243 | "}\n"
244 | "\n"
245 | "HyperlinkButton:disabled {\n"
246 | " color: rgba(0, 0, 0, 0.43);\n"
247 | " background-color: transparent;\n"
248 | " border: none;\n"
249 | "}\n"
250 | "\n"
251 | "\n"
252 | "RadioButton {\n"
253 | " min-height: 24px;\n"
254 | " max-height: 24px;\n"
255 | " background-color: transparent;\n"
256 | " font: 14px \'Segoe UI\', \'Microsoft YaHei\', \'PingFang SC\';\n"
257 | " color: black;\n"
258 | "}\n"
259 | "\n"
260 | "RadioButton::indicator {\n"
261 | " width: 18px;\n"
262 | " height: 18px;\n"
263 | " border-radius: 11px;\n"
264 | " border: 2px solid #999999;\n"
265 | " background-color: rgba(0, 0, 0, 5);\n"
266 | " margin-right: 4px;\n"
267 | "}\n"
268 | "\n"
269 | "RadioButton::indicator:hover {\n"
270 | " background-color: rgba(0, 0, 0, 0);\n"
271 | "}\n"
272 | "\n"
273 | "RadioButton::indicator:pressed {\n"
274 | " border: 2px solid #bbbbbb;\n"
275 | " background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,\n"
276 | " stop:0 rgb(255, 255, 255),\n"
277 | " stop:0.5 rgb(255, 255, 255),\n"
278 | " stop:0.6 rgb(225, 224, 223),\n"
279 | " stop:1 rgb(225, 224, 223));\n"
280 | "}\n"
281 | "\n"
282 | "RadioButton::indicator:checked {\n"
283 | " height: 22px;\n"
284 | " width: 22px;\n"
285 | " border: none;\n"
286 | " border-radius: 11px;\n"
287 | " background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,\n"
288 | " stop:0 rgb(255, 255, 255),\n"
289 | " stop:0.5 rgb(255, 255, 255),\n"
290 | " stop:0.6 #009faa,\n"
291 | " stop:1 #009faa);\n"
292 | "}\n"
293 | "\n"
294 | "RadioButton::indicator:checked:hover {\n"
295 | " background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,\n"
296 | " stop:0 rgb(255, 255, 255),\n"
297 | " stop:0.6 rgb(255, 255, 255),\n"
298 | " stop:0.7 #009faa,\n"
299 | " stop:1 #009faa);\n"
300 | "}\n"
301 | "\n"
302 | "RadioButton::indicator:checked:pressed {\n"
303 | " background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,\n"
304 | " stop:0 rgb(255, 255, 255),\n"
305 | " stop:0.5 rgb(255, 255, 255),\n"
306 | " stop:0.6 #009faa,\n"
307 | " stop:1 #009faa);\n"
308 | "}\n"
309 | "\n"
310 | "RadioButton:disabled {\n"
311 | " color: rgba(0, 0, 0, 110);\n"
312 | "}\n"
313 | "\n"
314 | "RadioButton::indicator:disabled {\n"
315 | " border: 2px solid #bbbbbb;\n"
316 | " background-color: transparent;\n"
317 | "}\n"
318 | "\n"
319 | "RadioButton::indicator:disabled:checked {\n"
320 | " border: none;\n"
321 | " background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,\n"
322 | " stop:0 rgb(255, 255, 255),\n"
323 | " stop:0.5 rgb(255, 255, 255),\n"
324 | " stop:0.6 rgba(0, 0, 0, 0.2169),\n"
325 | " stop:1 rgba(0, 0, 0, 0.2169));\n"
326 | "}\n"
327 | "\n"
328 | "TransparentToolButton,\n"
329 | "TransparentToggleToolButton,\n"
330 | "TransparentDropDownToolButton,\n"
331 | "TransparentPushButton,\n"
332 | "TransparentDropDownPushButton,\n"
333 | "TransparentTogglePushButton {\n"
334 | " background-color: transparent;\n"
335 | " border: none;\n"
336 | " border-radius: 5px;\n"
337 | " margin: 0;\n"
338 | "}\n"
339 | "\n"
340 | "TransparentToolButton:hover,\n"
341 | "TransparentToggleToolButton:hover,\n"
342 | "TransparentDropDownToolButton:hover,\n"
343 | "TransparentPushButton:hover,\n"
344 | "TransparentDropDownPushButton:hover,\n"
345 | "TransparentTogglePushButton:hover {\n"
346 | " background-color: rgba(0, 0, 0, 9);\n"
347 | " border: none;\n"
348 | "}\n"
349 | "\n"
350 | "TransparentToolButton:pressed,\n"
351 | "TransparentToggleToolButton:pressed,\n"
352 | "TransparentDropDownToolButton:pressed,\n"
353 | "TransparentPushButton:pressed,\n"
354 | "TransparentDropDownPushButton:pressed,\n"
355 | "TransparentTogglePushButton:pressed {\n"
356 | " background-color: rgba(0, 0, 0, 6);\n"
357 | " border: none;\n"
358 | "}\n"
359 | "\n"
360 | "TransparentToolButton:disabled,\n"
361 | "TransparentToggleToolButton:disabled,\n"
362 | "TransparentDropDownToolButton:disabled,\n"
363 | "TransprentPushButton:disabled,\n"
364 | "TransparentDropDownPushButton:disabled,\n"
365 | "TransprentTogglePushButton:disabled {\n"
366 | " background-color: transparent;\n"
367 | " border: none;\n"
368 | "}\n"
369 | "\n"
370 | "\n"
371 | "PillPushButton,\n"
372 | "PillPushButton:hover,\n"
373 | "PillPushButton:pressed,\n"
374 | "PillPushButton:disabled,\n"
375 | "PillPushButton:checked,\n"
376 | "PillPushButton:checked:hover,\n"
377 | "PillPushButton:checked:pressed,\n"
378 | "PillPushButton:disabled:checked,\n"
379 | "PillToolButton,\n"
380 | "PillToolButton:hover,\n"
381 | "PillToolButton:pressed,\n"
382 | "PillToolButton:disabled,\n"
383 | "PillToolButton:checked,\n"
384 | "PillToolButton:checked:hover,\n"
385 | "PillToolButton:checked:pressed,\n"
386 | "PillToolButton:disabled:checked {\n"
387 | " background-color: transparent;\n"
388 | " border: none;\n"
389 | "}\n"
390 | "")
391 | self.PushButton_delete.setObjectName("PushButton_delete")
392 | self.gridLayout_5.addWidget(self.PushButton_delete, 0, 2, 1, 1)
393 | self.gridLayout_6.addLayout(self.gridLayout_5, 1, 0, 1, 2)
394 | Add.setCentralWidget(self.centralwidget)
395 | self.menubar = QtWidgets.QMenuBar(parent=Add)
396 | self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
397 | self.menubar.setObjectName("menubar")
398 | self.menu = QtWidgets.QMenu(parent=self.menubar)
399 | self.menu.setObjectName("menu")
400 | Add.setMenuBar(self.menubar)
401 | self.action_save = QtGui.QAction(parent=Add)
402 | self.action_save.setObjectName("action_save")
403 | self.action_open = QtGui.QAction(parent=Add)
404 | self.action_open.setObjectName("action_open")
405 | self.menu.addAction(self.action_save)
406 | self.menu.addAction(self.action_open)
407 | self.menubar.addAction(self.menu.menuAction())
408 |
409 | self.retranslateUi(Add)
410 | QtCore.QMetaObject.connectSlotsByName(Add)
411 |
412 | def retranslateUi(self, Add):
413 | _translate = QtCore.QCoreApplication.translate
414 | Add.setWindowTitle(_translate("Add", "MainWindow"))
415 | self.PushButton_intersection.setText(_translate("Add", "添加交点"))
416 | self.PushButton_point_on_line.setText(_translate("Add", "添加线上的点"))
417 | self.PushButton_point.setText(_translate("Add", "添加点"))
418 | self.TitleLabel.setText(_translate("Add", "创建点"))
419 | self.SubtitleLabel.setText(_translate("Add", "已有的点:"))
420 | self.TitleLabel_2.setText(_translate("Add", "条件"))
421 | self.PushButton_parallel.setText(_translate("Add", "平行"))
422 | self.PushButton_vertical.setText(_translate("Add", "垂直"))
423 | self.PushButton_eq.setText(_translate("Add", "等式"))
424 | self.SubtitleLabel_2.setText(_translate("Add", "已有的条件(方程):"))
425 | self.CheckBox_pre_simplify.setText(_translate("Add", "预化简"))
426 | self.BodyLabel.setText(_translate("Add", "删除点/条件"))
427 | self.PushButton_delete.setText(_translate("Add", "确认"))
428 | self.menu.setTitle(_translate("Add", "文件"))
429 | self.action_save.setText(_translate("Add", "保存"))
430 | self.action_open.setText(_translate("Add", "打开"))
431 | from qfluentwidgets import BodyLabel, CardWidget, CheckBox, LineEdit, PushButton, SubtitleLabel, TableWidget, TitleLabel
432 |
--------------------------------------------------------------------------------
/interfaces/ui_add.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Add
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 600
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 | -
19 |
20 |
-
21 |
22 |
23 | 添加交点
24 |
25 |
26 |
27 | -
28 |
29 |
30 | 添加线上的点
31 |
32 |
33 |
34 | -
35 |
36 |
37 | 添加点
38 |
39 |
40 |
41 | -
42 |
43 |
44 |
-
45 |
46 |
47 |
48 |
49 |
50 | -
51 |
52 |
53 | 创建点
54 |
55 |
56 |
57 | -
58 |
59 |
60 | 已有的点:
61 |
62 |
63 |
64 |
65 |
66 | -
67 |
68 |
-
69 |
70 |
71 | 条件
72 |
73 |
74 |
75 | -
76 |
77 |
78 | Qt::Horizontal
79 |
80 |
81 |
82 | 40
83 | 20
84 |
85 |
86 |
87 |
88 | -
89 |
90 |
91 | 平行
92 |
93 |
94 |
95 | -
96 |
97 |
98 | 垂直
99 |
100 |
101 |
102 | -
103 |
104 |
105 | 等式
106 |
107 |
108 |
109 | -
110 |
111 |
112 | 已有的条件(方程):
113 |
114 |
115 |
116 | -
117 |
118 |
119 |
-
120 |
121 |
122 |
123 |
124 |
125 | -
126 |
127 |
128 | 预化简
129 |
130 |
131 | true
132 |
133 |
134 |
135 |
136 |
137 | -
138 |
139 |
-
140 |
141 |
142 | 删除点/条件
143 |
144 |
145 |
146 | -
147 |
148 |
149 | -
150 |
151 |
152 | PushButton, ToolButton, ToggleButton, ToggleToolButton {
153 | color: red;
154 | background: rgba(255, 255, 255, 0.7);
155 | border: 1px solid rgba(0, 0, 0, 0.073);
156 | border-bottom: 1px solid rgba(0, 0, 0, 0.183);
157 | border-radius: 5px;
158 | /* font: 14px 'Segoe UI', 'Microsoft YaHei'; */
159 | padding: 5px 12px 6px 12px;
160 | outline: none;
161 | }
162 |
163 | ToolButton {
164 | padding: 5px 9px 6px 8px;
165 | }
166 |
167 | PushButton[hasIcon=false] {
168 | padding: 5px 12px 6px 12px;
169 | }
170 |
171 | PushButton[hasIcon=true] {
172 | padding: 5px 12px 6px 36px;
173 | }
174 |
175 | DropDownToolButton, PrimaryDropDownToolButton {
176 | padding: 5px 31px 6px 8px;
177 | }
178 |
179 | DropDownPushButton[hasIcon=false],
180 | PrimaryDropDownPushButton[hasIcon=false] {
181 | padding: 5px 31px 6px 12px;
182 | }
183 |
184 | DropDownPushButton[hasIcon=true],
185 | PrimaryDropDownPushButton[hasIcon=true] {
186 | padding: 5px 31px 6px 36px;
187 | }
188 |
189 | PushButton:hover, ToolButton:hover, ToggleButton:hover, ToggleToolButton:hover {
190 | background: rgba(249, 249, 249, 0.5);
191 | }
192 |
193 | PushButton:pressed, ToolButton:pressed, ToggleButton:pressed, ToggleToolButton:pressed {
194 | color: rgba(0, 0, 0, 0.63);
195 | background: rgba(249, 249, 249, 0.3);
196 | border-bottom: 1px solid rgba(0, 0, 0, 0.073);
197 | }
198 |
199 | PushButton:disabled, ToolButton:disabled, ToggleButton:disabled, ToggleToolButton:disabled {
200 | color: rgba(0, 0, 0, 0.36);
201 | background: rgba(249, 249, 249, 0.3);
202 | border: 1px solid rgba(0, 0, 0, 0.06);
203 | border-bottom: 1px solid rgba(0, 0, 0, 0.06);
204 | }
205 |
206 |
207 | PrimaryPushButton,
208 | PrimaryToolButton,
209 | ToggleButton:checked,
210 | ToggleToolButton:checked {
211 | color: white;
212 | background-color: #009faa;
213 | border: 1px solid #00a7b3;
214 | border-bottom: 1px solid #007780;
215 | }
216 |
217 | PrimaryPushButton:hover,
218 | PrimaryToolButton:hover,
219 | ToggleButton:checked:hover,
220 | ToggleToolButton:checked:hover {
221 | background-color: #00a7b3;
222 | border: 1px solid #2daab3;
223 | border-bottom: 1px solid #007780;
224 | }
225 |
226 | PrimaryPushButton:pressed,
227 | PrimaryToolButton:pressed,
228 | ToggleButton:checked:pressed,
229 | ToggleToolButton:checked:pressed {
230 | color: rgba(255, 255, 255, 0.63);
231 | background-color: #3eabb3;
232 | border: 1px solid #3eabb3;
233 | }
234 |
235 | PrimaryPushButton:disabled,
236 | PrimaryToolButton:disabled,
237 | ToggleButton:checked:disabled,
238 | ToggleToolButton:checked:disabled {
239 | color: rgba(255, 255, 255, 0.9);
240 | background-color: rgb(205, 205, 205);
241 | border: 1px solid rgb(205, 205, 205);
242 | }
243 |
244 | SplitDropButton,
245 | PrimarySplitDropButton {
246 | border-left: none;
247 | border-top-left-radius: 0;
248 | border-bottom-left-radius: 0;
249 | }
250 |
251 | #splitPushButton,
252 | #splitToolButton,
253 | #primarySplitPushButton,
254 | #primarySplitToolButton {
255 | border-top-right-radius: 0;
256 | border-bottom-right-radius: 0;
257 | }
258 |
259 | #splitPushButton:pressed,
260 | #splitToolButton:pressed,
261 | SplitDropButton:pressed {
262 | border-bottom: 1px solid rgba(0, 0, 0, 0.183);
263 | }
264 |
265 | PrimarySplitDropButton:pressed {
266 | border-bottom: 1px solid #007780;
267 | }
268 |
269 | #primarySplitPushButton, #primarySplitToolButton {
270 | border-right: 1px solid #3eabb3;
271 | }
272 |
273 | #primarySplitPushButton:pressed, #primarySplitToolButton:pressed {
274 | border-bottom: 1px solid #007780;
275 | }
276 |
277 | HyperlinkButton {
278 | /* font: 14px 'Segoe UI', 'Microsoft YaHei'; */
279 | padding: 6px 12px 6px 12px;
280 | color: #009faa;
281 | border: none;
282 | border-radius: 6px;
283 | background-color: transparent;
284 | }
285 |
286 | HyperlinkButton[hasIcon=false] {
287 | padding: 6px 12px 6px 12px;
288 | }
289 |
290 | HyperlinkButton[hasIcon=true] {
291 | padding: 6px 12px 6px 36px;
292 | }
293 |
294 | HyperlinkButton:hover {
295 | color: #009faa;
296 | background-color: rgba(0, 0, 0, 10);
297 | border: none;
298 | }
299 |
300 | HyperlinkButton:pressed {
301 | color: #009faa;
302 | background-color: rgba(0, 0, 0, 6);
303 | border: none;
304 | }
305 |
306 | HyperlinkButton:disabled {
307 | color: rgba(0, 0, 0, 0.43);
308 | background-color: transparent;
309 | border: none;
310 | }
311 |
312 |
313 | RadioButton {
314 | min-height: 24px;
315 | max-height: 24px;
316 | background-color: transparent;
317 | font: 14px 'Segoe UI', 'Microsoft YaHei', 'PingFang SC';
318 | color: black;
319 | }
320 |
321 | RadioButton::indicator {
322 | width: 18px;
323 | height: 18px;
324 | border-radius: 11px;
325 | border: 2px solid #999999;
326 | background-color: rgba(0, 0, 0, 5);
327 | margin-right: 4px;
328 | }
329 |
330 | RadioButton::indicator:hover {
331 | background-color: rgba(0, 0, 0, 0);
332 | }
333 |
334 | RadioButton::indicator:pressed {
335 | border: 2px solid #bbbbbb;
336 | background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
337 | stop:0 rgb(255, 255, 255),
338 | stop:0.5 rgb(255, 255, 255),
339 | stop:0.6 rgb(225, 224, 223),
340 | stop:1 rgb(225, 224, 223));
341 | }
342 |
343 | RadioButton::indicator:checked {
344 | height: 22px;
345 | width: 22px;
346 | border: none;
347 | border-radius: 11px;
348 | background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
349 | stop:0 rgb(255, 255, 255),
350 | stop:0.5 rgb(255, 255, 255),
351 | stop:0.6 #009faa,
352 | stop:1 #009faa);
353 | }
354 |
355 | RadioButton::indicator:checked:hover {
356 | background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
357 | stop:0 rgb(255, 255, 255),
358 | stop:0.6 rgb(255, 255, 255),
359 | stop:0.7 #009faa,
360 | stop:1 #009faa);
361 | }
362 |
363 | RadioButton::indicator:checked:pressed {
364 | background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
365 | stop:0 rgb(255, 255, 255),
366 | stop:0.5 rgb(255, 255, 255),
367 | stop:0.6 #009faa,
368 | stop:1 #009faa);
369 | }
370 |
371 | RadioButton:disabled {
372 | color: rgba(0, 0, 0, 110);
373 | }
374 |
375 | RadioButton::indicator:disabled {
376 | border: 2px solid #bbbbbb;
377 | background-color: transparent;
378 | }
379 |
380 | RadioButton::indicator:disabled:checked {
381 | border: none;
382 | background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.5, fx:0.5, fy:0.5,
383 | stop:0 rgb(255, 255, 255),
384 | stop:0.5 rgb(255, 255, 255),
385 | stop:0.6 rgba(0, 0, 0, 0.2169),
386 | stop:1 rgba(0, 0, 0, 0.2169));
387 | }
388 |
389 | TransparentToolButton,
390 | TransparentToggleToolButton,
391 | TransparentDropDownToolButton,
392 | TransparentPushButton,
393 | TransparentDropDownPushButton,
394 | TransparentTogglePushButton {
395 | background-color: transparent;
396 | border: none;
397 | border-radius: 5px;
398 | margin: 0;
399 | }
400 |
401 | TransparentToolButton:hover,
402 | TransparentToggleToolButton:hover,
403 | TransparentDropDownToolButton:hover,
404 | TransparentPushButton:hover,
405 | TransparentDropDownPushButton:hover,
406 | TransparentTogglePushButton:hover {
407 | background-color: rgba(0, 0, 0, 9);
408 | border: none;
409 | }
410 |
411 | TransparentToolButton:pressed,
412 | TransparentToggleToolButton:pressed,
413 | TransparentDropDownToolButton:pressed,
414 | TransparentPushButton:pressed,
415 | TransparentDropDownPushButton:pressed,
416 | TransparentTogglePushButton:pressed {
417 | background-color: rgba(0, 0, 0, 6);
418 | border: none;
419 | }
420 |
421 | TransparentToolButton:disabled,
422 | TransparentToggleToolButton:disabled,
423 | TransparentDropDownToolButton:disabled,
424 | TransprentPushButton:disabled,
425 | TransparentDropDownPushButton:disabled,
426 | TransprentTogglePushButton:disabled {
427 | background-color: transparent;
428 | border: none;
429 | }
430 |
431 |
432 | PillPushButton,
433 | PillPushButton:hover,
434 | PillPushButton:pressed,
435 | PillPushButton:disabled,
436 | PillPushButton:checked,
437 | PillPushButton:checked:hover,
438 | PillPushButton:checked:pressed,
439 | PillPushButton:disabled:checked,
440 | PillToolButton,
441 | PillToolButton:hover,
442 | PillToolButton:pressed,
443 | PillToolButton:disabled,
444 | PillToolButton:checked,
445 | PillToolButton:checked:hover,
446 | PillToolButton:checked:pressed,
447 | PillToolButton:disabled:checked {
448 | background-color: transparent;
449 | border: none;
450 | }
451 |
452 |
453 |
454 | 确认
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
480 |
481 |
482 | 保存
483 |
484 |
485 |
486 |
487 | 打开
488 |
489 |
490 |
491 |
492 |
493 | CheckBox
494 | QCheckBox
495 |
496 |
497 |
498 | PushButton
499 | QPushButton
500 |
501 |
502 |
503 | CardWidget
504 | QFrame
505 |
506 | 1
507 |
508 |
509 | BodyLabel
510 | QLabel
511 |
512 |
513 |
514 | SubtitleLabel
515 | QLabel
516 |
517 |
518 |
519 | TitleLabel
520 | QLabel
521 |
522 |
523 |
524 | LineEdit
525 | QLineEdit
526 |
527 |
528 |
529 | TableWidget
530 | QTableWidget
531 |
532 |
533 |
534 |
535 |
536 |
537 |
--------------------------------------------------------------------------------
/interfaces/ui_help.py:
--------------------------------------------------------------------------------
1 | # Form implementation generated from reading ui file 'ui_help.ui'
2 | #
3 | # Created by: PyQt6 UI code generator 6.6.1
4 | #
5 | # WARNING: Any manual changes made to this file will be lost when pyuic6 is
6 | # run again. Do not edit this file unless you know what you are doing.
7 |
8 |
9 | from PyQt6 import QtCore, QtGui, QtWidgets
10 |
11 |
12 | class Ui_Help(object):
13 | def setupUi(self, Help):
14 | Help.setObjectName("Help")
15 | Help.resize(800, 600)
16 | self.gridLayout_2 = QtWidgets.QGridLayout(Help)
17 | self.gridLayout_2.setObjectName("gridLayout_2")
18 | self.TextEdit_help = TextEdit(parent=Help)
19 | self.TextEdit_help.setReadOnly(True)
20 | self.TextEdit_help.setObjectName("TextEdit_help")
21 | self.gridLayout_2.addWidget(self.TextEdit_help, 0, 0, 1, 1)
22 | self.gridLayout = QtWidgets.QGridLayout()
23 | self.gridLayout.setObjectName("gridLayout")
24 | self.HyperlinkButton_author = HyperlinkButton(parent=Help)
25 | self.HyperlinkButton_author.setUrl(QtCore.QUrl("https://space.bilibili.com/551409211"))
26 | self.HyperlinkButton_author.setObjectName("HyperlinkButton_author")
27 | self.gridLayout.addWidget(self.HyperlinkButton_author, 0, 0, 1, 1)
28 | self.HyperlinkButton_github = HyperlinkButton(parent=Help)
29 | self.HyperlinkButton_github.setUrl(QtCore.QUrl("https://github.com/zhdbk/GeometryCalculator"))
30 | self.HyperlinkButton_github.setObjectName("HyperlinkButton_github")
31 | self.gridLayout.addWidget(self.HyperlinkButton_github, 0, 1, 1, 1)
32 | self.gridLayout_2.addLayout(self.gridLayout, 1, 0, 1, 1)
33 |
34 | self.retranslateUi(Help)
35 | QtCore.QMetaObject.connectSlotsByName(Help)
36 |
37 | def retranslateUi(self, Help):
38 | _translate = QtCore.QCoreApplication.translate
39 | Help.setWindowTitle(_translate("Help", "Form"))
40 | self.HyperlinkButton_author.setText(_translate("Help", "作者:MC着火的冰块"))
41 | self.HyperlinkButton_github.setText(_translate("Help", "github"))
42 | from qfluentwidgets import HyperlinkButton, TextEdit
43 |
--------------------------------------------------------------------------------
/interfaces/ui_help.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Help
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 600
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
20 | true
21 |
22 |
23 |
24 | -
25 |
26 |
-
27 |
28 |
29 | 作者:MC着火的冰块
30 |
31 |
32 |
33 | https://space.bilibili.com/551409211
34 |
35 |
36 |
37 |
38 | -
39 |
40 |
41 | github
42 |
43 |
44 |
45 | https://github.com/zhdbk/GeometryCalculator
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | HyperlinkButton
57 | PushButton
58 |
59 |
60 |
61 | PushButton
62 | QPushButton
63 |
64 |
65 |
66 | TextEdit
67 | QTextEdit
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/interfaces/ui_solve.py:
--------------------------------------------------------------------------------
1 | # Form implementation generated from reading ui file '.\interfaces\ui_solve.ui'
2 | #
3 | # Created by: PyQt6 UI code generator 6.6.1
4 | #
5 | # WARNING: Any manual changes made to this file will be lost when pyuic6 is
6 | # run again. Do not edit this file unless you know what you are doing.
7 |
8 |
9 | from PyQt6 import QtCore, QtGui, QtWidgets
10 |
11 |
12 | class Ui_Solve(object):
13 | def setupUi(self, Solve):
14 | Solve.setObjectName("Solve")
15 | Solve.resize(800, 600)
16 | self.gridLayout_4 = QtWidgets.QGridLayout(Solve)
17 | self.gridLayout_4.setObjectName("gridLayout_4")
18 | self.gridLayout = QtWidgets.QGridLayout()
19 | self.gridLayout.setObjectName("gridLayout")
20 | self.SubtitleLabel = SubtitleLabel(parent=Solve)
21 | self.SubtitleLabel.setObjectName("SubtitleLabel")
22 | self.gridLayout.addWidget(self.SubtitleLabel, 0, 0, 1, 1)
23 | self.LineEdit_want = LineEdit(parent=Solve)
24 | self.LineEdit_want.setObjectName("LineEdit_want")
25 | self.gridLayout.addWidget(self.LineEdit_want, 0, 1, 1, 1)
26 | self.PrimaryPushButton_solve = PrimaryPushButton(parent=Solve)
27 | self.PrimaryPushButton_solve.setObjectName("PrimaryPushButton_solve")
28 | self.gridLayout.addWidget(self.PrimaryPushButton_solve, 0, 2, 1, 1)
29 | self.gridLayout_4.addLayout(self.gridLayout, 1, 0, 1, 1)
30 | self.gridLayout_2 = QtWidgets.QGridLayout()
31 | self.gridLayout_2.setObjectName("gridLayout_2")
32 | self.SubtitleLabel_timer = SubtitleLabel(parent=Solve)
33 | self.SubtitleLabel_timer.setObjectName("SubtitleLabel_timer")
34 | self.gridLayout_2.addWidget(self.SubtitleLabel_timer, 0, 0, 1, 1)
35 | self.IndeterminateProgressBar = IndeterminateProgressBar(parent=Solve)
36 | self.IndeterminateProgressBar.setObjectName("IndeterminateProgressBar")
37 | self.gridLayout_2.addWidget(self.IndeterminateProgressBar, 0, 1, 1, 1)
38 | self.gridLayout_4.addLayout(self.gridLayout_2, 2, 0, 1, 1)
39 | self.TitleLabel = TitleLabel(parent=Solve)
40 | self.TitleLabel.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
41 | self.TitleLabel.setObjectName("TitleLabel")
42 | self.gridLayout_4.addWidget(self.TitleLabel, 0, 0, 1, 1)
43 | self.SubtitleLabel_state = SubtitleLabel(parent=Solve)
44 | self.SubtitleLabel_state.setObjectName("SubtitleLabel_state")
45 | self.gridLayout_4.addWidget(self.SubtitleLabel_state, 3, 0, 1, 1)
46 | self.SmoothScrollArea = SmoothScrollArea(parent=Solve)
47 | self.SmoothScrollArea.setWidgetResizable(True)
48 | self.SmoothScrollArea.setObjectName("SmoothScrollArea")
49 | self.scrollAreaWidgetContents = QtWidgets.QWidget()
50 | self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 780, 428))
51 | self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
52 | self.gridLayout_3 = QtWidgets.QGridLayout(self.scrollAreaWidgetContents)
53 | self.gridLayout_3.setContentsMargins(0, 0, 0, 0)
54 | self.gridLayout_3.setObjectName("gridLayout_3")
55 | self.LargeTitleLabel_result = LargeTitleLabel(parent=self.scrollAreaWidgetContents)
56 | self.LargeTitleLabel_result.setText("")
57 | self.LargeTitleLabel_result.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
58 | self.LargeTitleLabel_result.setObjectName("LargeTitleLabel_result")
59 | self.gridLayout_3.addWidget(self.LargeTitleLabel_result, 0, 0, 1, 1)
60 | self.SmoothScrollArea.setWidget(self.scrollAreaWidgetContents)
61 | self.gridLayout_4.addWidget(self.SmoothScrollArea, 4, 0, 1, 1)
62 |
63 | self.retranslateUi(Solve)
64 | QtCore.QMetaObject.connectSlotsByName(Solve)
65 |
66 | def retranslateUi(self, Solve):
67 | _translate = QtCore.QCoreApplication.translate
68 | Solve.setWindowTitle(_translate("Solve", "Form"))
69 | self.SubtitleLabel.setText(_translate("Solve", "求"))
70 | self.PrimaryPushButton_solve.setText(_translate("Solve", "开始计算"))
71 | self.SubtitleLabel_timer.setText(_translate("Solve", "用时 00:00:00.00"))
72 | self.TitleLabel.setText(_translate("Solve", "求解"))
73 | self.SubtitleLabel_state.setText(_translate("Solve", "未计算"))
74 | from qfluentwidgets import IndeterminateProgressBar, LargeTitleLabel, LineEdit, PrimaryPushButton, SmoothScrollArea, SubtitleLabel, TitleLabel
75 |
--------------------------------------------------------------------------------
/interfaces/ui_solve.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Solve
4 |
5 |
6 |
7 | 0
8 | 0
9 | 800
10 | 600
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
-
20 |
21 |
22 | 求
23 |
24 |
25 |
26 | -
27 |
28 |
29 | -
30 |
31 |
32 | 开始计算
33 |
34 |
35 |
36 |
37 |
38 | -
39 |
40 |
-
41 |
42 |
43 | 用时 00:00:00.00
44 |
45 |
46 |
47 | -
48 |
49 |
50 |
51 |
52 | -
53 |
54 |
55 | 求解
56 |
57 |
58 | Qt::AlignCenter
59 |
60 |
61 |
62 | -
63 |
64 |
65 | 未计算
66 |
67 |
68 |
69 | -
70 |
71 |
72 | true
73 |
74 |
75 |
76 |
77 | 0
78 | 0
79 | 780
80 | 428
81 |
82 |
83 |
84 |
-
85 |
86 |
87 |
88 |
89 |
90 | Qt::AlignCenter
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | PushButton
103 | QPushButton
104 |
105 |
106 |
107 | PrimaryPushButton
108 | PushButton
109 |
110 |
111 |
112 | SmoothScrollArea
113 | QScrollArea
114 |
115 | 1
116 |
117 |
118 | SubtitleLabel
119 | QLabel
120 |
121 |
122 |
123 | TitleLabel
124 | QLabel
125 |
126 |
127 |
128 | LargeTitleLabel
129 | QLabel
130 |
131 |
132 |
133 | IndeterminateProgressBar
134 | QProgressBar
135 |
136 |
137 |
138 | LineEdit
139 | QLineEdit
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/interfaces/utils.py:
--------------------------------------------------------------------------------
1 | from PyQt6.QtGui import QPixmap
2 | import matplotlib.pyplot as plt
3 |
4 |
5 | def tex2img(formula):
6 | plt.rc('mathtext', fontset='cm')
7 | fig = plt.figure(figsize=(0.01, 0.01))
8 | fig.text(10, 10, r'${}$'.format(formula), fontsize=12)
9 |
10 | fig.savefig('temp.png', dpi=300, transparent=True, format='png',
11 | bbox_inches='tight', pad_inches=0.1)
12 | plt.close(fig)
13 |
14 | return QPixmap('./temp.png')
15 |
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from typing import Dict, Set
3 |
4 | from PyQt6.QtCore import Qt
5 | from PyQt6.QtWidgets import QApplication, QTableWidgetItem
6 | from qfluentwidgets import FluentWindow, FluentTranslator, FluentIcon, NavigationItemPosition, MessageBox
7 | import sympy
8 | from sympy import Eq, Symbol
9 |
10 | import interfaces
11 | from classes import Point
12 |
13 | __version__ = '1.2'
14 |
15 |
16 | class Question:
17 | def __init__(self, parent: "Window"):
18 | """
19 | 存储一个问题的所有信息
20 | :param parent: w
21 | """
22 | self.w = parent
23 | # 点的字典,键为名字,值为点的对象
24 | self.points: Dict[str, Point] = {}
25 | # 所有条件的字典,键为文字表述,值为sympy.Eq对象
26 | self.conditions: Dict[str, Eq] = {}
27 |
28 | def symbols(self) -> Set[Symbol]:
29 | """获取所有要用的符号"""
30 | result = set()
31 | for i in self.points.values():
32 | if isinstance(i.x, Symbol):
33 | result.add(i.x)
34 | if isinstance(i.y, Symbol):
35 | result.add(i.y)
36 | return result
37 |
38 | def add_point(self, point: Point):
39 | """
40 | 执行预化简(如果开了的话),添加点并显示
41 | :param point: 点的对象
42 | :return:
43 | """
44 | # 预化简
45 | if self.w.ui_add.CheckBox_pre_simplify.isChecked():
46 | point.x = sympy.simplify(point.x)
47 | point.y = sympy.simplify(point.y)
48 | # 添加点
49 | self.points[point.name] = point
50 | self.update_tableview()
51 |
52 | def add_condition(self, eq: Eq, text: str):
53 | """
54 | 添加条件并显示
55 | :param eq: 条件的方程
56 | :param text: 条件的文本
57 | :return:
58 | """
59 | # 预化简
60 | if self.w.ui_add.CheckBox_pre_simplify.isChecked():
61 | eq = sympy.simplify(eq)
62 | self.conditions[text] = eq
63 | self.update_tableview()
64 |
65 | def update_tableview(self):
66 | """更新tableview"""
67 | # 点
68 | point_cnt = len(self.points)
69 | self.w.ui_add.ListWidget_points.setRowCount(point_cnt)
70 | i = 0
71 | for name, point in self.points.items():
72 | self.w.ui_add.ListWidget_points.setItem(i, 0, QTableWidgetItem(name))
73 | self.w.ui_add.ListWidget_points.setItem(i, 1, QTableWidgetItem(str(point.x)))
74 | self.w.ui_add.ListWidget_points.setItem(i, 2, QTableWidgetItem(str(point.y)))
75 | self.w.ui_add.ListWidget_points.resizeColumnsToContents()
76 | i += 1
77 | # 条件
78 | condition_cnt = len(self.conditions)
79 | self.w.ui_add.ListWidget_conditions.setRowCount(condition_cnt)
80 | i = 0
81 | for text, eq in self.conditions.items():
82 | self.w.ui_add.ListWidget_conditions.setItem(i, 0, QTableWidgetItem(text))
83 | self.w.ui_add.ListWidget_conditions.setItem(i, 1, QTableWidgetItem(f'{eq.lhs} = {eq.rhs}'))
84 | self.w.ui_add.ListWidget_conditions.resizeColumnsToContents()
85 | i += 1
86 |
87 | def delete(self):
88 | """删除点/条件"""
89 | to_del = self.w.ui_add.LineEdit_delete.text()
90 | # 删除点
91 | if to_del in self.points.keys():
92 | del self.w.question.points[to_del]
93 | # 删除条件
94 | elif to_del in self.conditions.keys():
95 | del self.conditions[to_del]
96 | self.update_tableview()
97 |
98 | def __getstate__(self):
99 | return self.points, self.conditions
100 |
101 | def __setstate__(self, state):
102 | self.points, self.conditions = state
103 |
104 |
105 | class Window(FluentWindow):
106 | def __init__(self):
107 | super().__init__()
108 | self.setWindowTitle(f'几何计算器 {__version__}')
109 | self.resize(800, 600)
110 |
111 | # 目前的题目
112 | self.question = Question(self)
113 |
114 | # 添加子界面
115 | self.ui_add = interfaces.InterfaceAdd(self)
116 | self.addSubInterface(self.ui_add, FluentIcon.ADD, '添加点和条件')
117 | self.ui_solve = interfaces.InterfaceSolve(self)
118 | self.addSubInterface(self.ui_solve, FluentIcon.EDIT, '求解')
119 | self.ui_help = interfaces.InterfaceHelp(self)
120 | self.addSubInterface(self.ui_help, FluentIcon.HELP, '帮助与关于', NavigationItemPosition.BOTTOM)
121 |
122 | # 报错不崩溃
123 | # sys.excepthook = self.error
124 |
125 | def error(self, etype: type, value: Exception, tb):
126 | """处理报错的函数"""
127 | w = MessageBox('错误', f'{etype.__name__}: {value}', self)
128 | w.exec()
129 |
130 |
131 | if __name__ == '__main__':
132 | # 启用高分辨率缩放 enable hidpi scale
133 | QApplication.setHighDpiScaleFactorRoundingPolicy(Qt.HighDpiScaleFactorRoundingPolicy.Ceil)
134 | app = QApplication(sys.argv)
135 | # 国际化
136 | # 为啥translator不生效啊,我不理解啊啊啊啊啊
137 | translator = FluentTranslator()
138 | app.installTranslator(translator)
139 | w = Window()
140 | w.show()
141 | sys.exit(app.exec())
142 |
--------------------------------------------------------------------------------
/read.py:
--------------------------------------------------------------------------------
1 | import re
2 |
3 | from sympy import rad, pi, Integer, sqrt, sin, cos, tan
4 |
5 | from classes import *
6 |
7 |
8 | def to_line_object(s: str, points: dict) -> Line:
9 | """
10 | 读取线名转化为线的对象
11 | :param s: 名字,长度为2
12 | :param points: 点的字典
13 | :return: 线的对象
14 | """
15 | p1 = points[s[0]]
16 | p2 = points[s[1]]
17 | return Line(p1, p2)
18 |
19 |
20 | def to_expr(s, points: dict):
21 | """
22 | 将字符串转化为表达式
23 | :param s: 用户输入的字符串
24 | :param points: 点的字典
25 | :return: 表达式
26 | """
27 | # 处理线段
28 | pattern = r'\b([A-Z])([A-Z])\b'
29 | repl = r"distance(points['\1'], points['\2'])"
30 | s = re.sub(pattern, repl, s)
31 | # 三角函数
32 | pattern = r'\b(sin|cos|tan)(∠[A-Z]{3})'
33 | repl = r'\1(\2)'
34 | s = re.sub(pattern, repl, s)
35 | # 处理角
36 | pattern = r'∠([A-Z])([A-Z])([A-Z])\b'
37 | repl = r"Angle(points['\1'], points['\2'], points['\3']).val"
38 | s = re.sub(pattern, repl, s)
39 | # 角度制转弧度制
40 | pattern = r'\b(\d+)°'
41 | repl = r'rad(\1)'
42 | s = re.sub(pattern, repl, s)
43 | # π转pi
44 | s = s.replace('π', 'pi')
45 | # 处理整数与分数
46 | pattern = r'\b(\d+)\b'
47 | repl = r'Integer(\1)'
48 | s = re.sub(pattern, repl, s)
49 | return eval(s)
50 |
51 |
52 | if __name__ == '__main__':
53 | print(to_expr('1/3', {}))
54 | print(to_expr('tan∠AOB', {'A': Point('A', 5, 5), 'O': Point('O', 0, 0), 'B': Point('B', 5, 0)}))
55 | print(to_expr('sqrt(2)', {}))
56 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | sympy
2 | PyQt6
3 | PyQt6-Fluent-Widgets
4 | matplotlib
--------------------------------------------------------------------------------