├── .gitattributes ├── .github ├── dependabot.yml └── workflows │ ├── linux-ubuntu.yml │ ├── mirror.yml │ └── windows.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README-zh_CN.md ├── README.md ├── common ├── __init__.py ├── clock_tree.py ├── coder.py ├── contributors.py ├── i18n_type.py ├── icon.py ├── ip.py ├── package.py ├── project.py ├── repository.py ├── settings.py ├── signal_bus.py ├── style.py ├── summary.py └── value_hub.py ├── csp.py ├── dialogs ├── __init__.py └── package_install_dialog.py ├── jinja2 └── csp_project_helper.py ├── plugins └── keil.py ├── requirements.txt ├── resource ├── database │ ├── clock │ │ └── geehy │ │ │ ├── apm32f103.svg │ │ │ └── apm32f103.yml │ ├── ip │ │ └── geehy │ │ │ ├── apm32f103_crc.yml │ │ │ ├── apm32f103_gpio.yml │ │ │ ├── apm32f103_iwdt.yml │ │ │ ├── apm32f103_rcm.yml │ │ │ ├── apm32f103_uart.yml │ │ │ ├── apm32f103_usart.yml │ │ │ └── apm32f103_wwdt.yml │ ├── repository.yml │ ├── schema │ │ ├── clock_tree.yml │ │ ├── contributors.yml │ │ ├── ip.yml │ │ ├── package_description.yml │ │ ├── package_index.yml │ │ ├── project.yml │ │ ├── repository.yml │ │ └── summary.yml │ └── summary │ │ ├── geehy │ │ └── apm32f103zet6.yml │ │ └── stmicroelectronics │ │ ├── stm32f407zet6.yml │ │ ├── stm32f407zet6tr.yml │ │ ├── stm32f407zet7.yml │ │ ├── stm32f407zgt6.yml │ │ ├── stm32f407zgt6j.yml │ │ ├── stm32f407zgt6tr.yml │ │ ├── stm32f407zgt7.yml │ │ └── stm32h750xbh6.yml ├── fonts │ └── JetBrains Mono │ │ ├── JetBrainsMono-Bold-Italic.ttf │ │ ├── JetBrainsMono-Bold.ttf │ │ ├── JetBrainsMono-ExtraBold-Italic.ttf │ │ ├── JetBrainsMono-ExtraBold.ttf │ │ ├── JetBrainsMono-Italic.ttf │ │ ├── JetBrainsMono-Medium-Italic.ttf │ │ ├── JetBrainsMono-Medium.ttf │ │ └── JetBrainsMono-Regular.ttf ├── i18n │ └── csplink.zh_CN.ts ├── images │ ├── icon │ │ ├── material │ │ │ ├── c.svg │ │ │ ├── file.svg │ │ │ ├── folder-base-open.svg │ │ │ ├── folder-base.svg │ │ │ ├── folder-dist-open.svg │ │ │ ├── folder-dist.svg │ │ │ ├── folder-lib-open.svg │ │ │ ├── folder-lib.svg │ │ │ ├── folder-packages-open.svg │ │ │ ├── folder-packages.svg │ │ │ └── h.svg │ │ ├── readme.txt │ │ └── remix │ │ │ ├── black │ │ │ ├── ai-generate.svg │ │ │ ├── book-shelf-line.svg │ │ │ ├── box-3-line.svg │ │ │ ├── checkbox-multiple-line.svg │ │ │ ├── close-large-line.svg │ │ │ ├── code-line.svg │ │ │ ├── cpu-line.svg │ │ │ ├── database-2-line.svg │ │ │ ├── equalizer-line.svg │ │ │ ├── feedback-line.svg │ │ │ ├── folder-6-line.svg │ │ │ ├── folder-transfer-line.svg │ │ │ ├── github-fill.svg │ │ │ ├── global-line.svg │ │ │ ├── hammer-line.svg │ │ │ ├── information-line.svg │ │ │ ├── install-line.svg │ │ │ ├── landscape-line.svg │ │ │ ├── list-settings-line.svg │ │ │ ├── money-cny-circle-line.svg │ │ │ ├── more-line.svg │ │ │ ├── numbers-line.svg │ │ │ ├── paint-brush-line.svg │ │ │ ├── palette-line.svg │ │ │ ├── picture-in-picture-line.svg │ │ │ ├── question-line.svg │ │ │ ├── refresh-line.svg │ │ │ ├── settings-line.svg │ │ │ ├── speed-up-line.svg │ │ │ ├── stack-line.svg │ │ │ ├── time-line.svg │ │ │ ├── tools-line.svg │ │ │ ├── uninstall-line.svg │ │ │ ├── zoom-in-line.svg │ │ │ └── zoom-out-line.svg │ │ │ └── white │ │ │ ├── ai-generate.svg │ │ │ ├── book-shelf-line.svg │ │ │ ├── box-3-line.svg │ │ │ ├── checkbox-multiple-line.svg │ │ │ ├── close-large-line.svg │ │ │ ├── code-line.svg │ │ │ ├── cpu-line.svg │ │ │ ├── database-2-line.svg │ │ │ ├── equalizer-line.svg │ │ │ ├── feedback-line.svg │ │ │ ├── folder-6-line.svg │ │ │ ├── folder-transfer-line.svg │ │ │ ├── github-fill.svg │ │ │ ├── global-line.svg │ │ │ ├── hammer-line.svg │ │ │ ├── information-line.svg │ │ │ ├── install-line.svg │ │ │ ├── landscape-line.svg │ │ │ ├── list-settings-line.svg │ │ │ ├── money-cny-circle-line.svg │ │ │ ├── more-line.svg │ │ │ ├── numbers-line.svg │ │ │ ├── paint-brush-line.svg │ │ │ ├── palette-line.svg │ │ │ ├── picture-in-picture-line.svg │ │ │ ├── question-line.svg │ │ │ ├── refresh-line.svg │ │ │ ├── settings-line.svg │ │ │ ├── speed-up-line.svg │ │ │ ├── stack-line.svg │ │ │ ├── time-line.svg │ │ │ ├── tools-line.svg │ │ │ ├── uninstall-line.svg │ │ │ ├── zoom-in-line.svg │ │ │ └── zoom-out-line.svg │ ├── logo.128.ico │ ├── logo.16.ico │ ├── logo.32.ico │ ├── logo.48.ico │ ├── logo.64.ico │ ├── logo.ico │ ├── logo.original.svg │ ├── logo.png │ ├── logo.svg │ └── packages │ │ ├── LQFP144.png │ │ ├── LQFP48.png │ │ ├── LQFP64.png │ │ └── unknown.png ├── style │ ├── dark │ │ ├── clock_tree_view.qss │ │ ├── code_view.qss │ │ ├── new_project_window.qss │ │ ├── package_view.qss │ │ ├── plain_text_edit_code.qss │ │ ├── plain_text_edit_logger.qss │ │ ├── setting_view.qss │ │ ├── soc_view.qss │ │ └── widget_base_manager.qss │ ├── light │ │ ├── clock_tree_view.qss │ │ ├── code_view.qss │ │ ├── new_project_window.qss │ │ ├── package_view.qss │ │ ├── plain_text_edit_code.qss │ │ ├── plain_text_edit_logger.qss │ │ ├── setting_view.qss │ │ ├── soc_view.qss │ │ └── widget_base_manager.qss │ └── templates │ │ └── clock_tree_view.qss.j2 └── templates │ ├── csp-file-base.c.j2 │ ├── csp-file-base.cmake.j2 │ ├── csp-file-base.h.j2 │ ├── csp-file-base.main.c.j2 │ └── csp-file-base.xmake.lua.j2 ├── tests ├── __init__.py └── common │ ├── __init__.py │ ├── resource │ ├── package │ │ ├── test.7z │ │ └── test.csppdsc │ └── project │ │ └── APM32F103ZET6.csp │ ├── tc_clock_tree.py │ ├── tc_contributors.py │ ├── tc_ip.py │ ├── tc_package.py │ ├── tc_project.py │ ├── tc_repository.py │ └── tc_summary.py ├── tools ├── __init__.py ├── contributors.py ├── csp2filter.py ├── deploy.sh ├── drawio_tool │ ├── __init__.py │ └── drawio.py ├── find_lower_camel.py ├── lrelease.py ├── lupdate.py ├── pyuic.py └── schema.py ├── unit-test.py ├── utils ├── __init__.py ├── converters.py └── express.py ├── view ├── __init__.py ├── clock_tree_view.py ├── code_view.py ├── package_view.py ├── setting_view.py ├── soc_view.py └── ui │ ├── clock_tree_view.ui │ ├── clock_tree_view_ui.py │ ├── code_view.ui │ ├── code_view_ui.py │ ├── package_view.ui │ ├── package_view_ui.py │ ├── setting_view.ui │ └── setting_view_ui.py ├── widget ├── __init__.py ├── clock_tree │ ├── __init__.py │ ├── base_clock_tree_widget.py │ ├── enum_clock_tree_widget.py │ ├── float_clock_tree_widget.py │ ├── integer_clock_tree_widget.py │ ├── number_clock_tree_widget.py │ └── radio_clock_tree_widget.py ├── graphics_item_chip_body.py ├── graphics_item_pin.py ├── graphics_view_pan_zoom.py ├── highlighter │ ├── __init__.py │ ├── base_highlighter.py │ └── c_highlighter.py ├── list_contributors.py ├── packages │ ├── __init__.py │ └── lqfp.py ├── plain_text_edit_code.py ├── plain_text_edit_logger.py ├── plain_text_edit_readonly.py ├── settings │ ├── __init__.py │ ├── combo_box_property_setting_card.py │ ├── line_edit_property_setting_card.py │ ├── switch_property_setting_card.py │ └── tool_button_property_setting_card.py ├── stacked_widget.py ├── tab_widget.py ├── tree_module.py ├── widget_base_manager.py ├── widget_control_dashboard.py ├── widget_control_manager.py └── widget_mode_manager.py ├── win-installer.nsi └── window ├── __init__.py ├── main_window.py ├── new_project_window.py ├── startup_window.py └── ui ├── new_project_view.ui ├── new_project_view_ui.py ├── startup_view.ui └── startup_view_ui.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Per default everything gets normalized and gets LF line endings on checkout. 2 | * text eol=lf 3 | 4 | # These will always have CRLF line endings on checkout. 5 | *.bat text eol=crlf 6 | 7 | # These are binary so should never be modified by git. 8 | *.png binary 9 | *.jpg binary 10 | *.pdf binary 11 | *.ttf binary 12 | *.ico binary 13 | *.7z binary 14 | 15 | # These should also not be modified by git. 16 | *.svg -text 17 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Set update schedule for GitHub Actions 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | # Check for updates to GitHub Actions every weekday 8 | interval: "daily" 9 | -------------------------------------------------------------------------------- /.github/workflows/mirror.yml: -------------------------------------------------------------------------------- 1 | # Licensed under the GNU General Public License v. 3 (the "License") 2 | # You may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # https://www.gnu.org/licenses/gpl-3.0.html 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # 13 | # Copyright (C) 2022-2024 xqyjlj 14 | # 15 | # @author xqyjlj 16 | # @file mirror.yml 17 | # 18 | # Change Logs: 19 | # Date Author Notes 20 | # ------------ ---------- ----------------------------------------------- 21 | # 2024-11-04 xqyjlj initial version 22 | # 23 | 24 | name: mirror 25 | 26 | on: 27 | push: 28 | branches: 29 | - master 30 | - dev 31 | tags: 32 | - "*" 33 | - "**" 34 | 35 | concurrency: 36 | group: ${{ github.workflow }}-${{ github.ref }} 37 | cancel-in-progress: true 38 | 39 | jobs: 40 | mirror: 41 | name: 💕 mirror to another location 42 | runs-on: ubuntu-latest 43 | if: github.repository_owner == 'csplink' 44 | steps: 45 | - name: 💕 mirror 46 | uses: csplink/action_git_mirror/@master 47 | with: 48 | ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # vscode 2 | .vscode 3 | 4 | # clion, pycharm 5 | .idea 6 | 7 | # python 8 | __pycache__ 9 | 10 | #project 11 | csplink.config 12 | repository 13 | repository.index 14 | *.log 15 | 16 | # qt 17 | *.qm 18 | 19 | # other 20 | *.bak 21 | build 22 | build-* 23 | 24 | # csplink 25 | resource/contributors 26 | resource/repository 27 | resource/packages 28 | resource/database/schema/*.json 29 | 30 | # nuitka-scons 31 | *.dist 32 | *.onefile-build 33 | *.build 34 | *.exe 35 | 36 | # draw.io 37 | *.bkp 38 | *.drawio 39 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog ([中文](#中文)) 2 | 3 | ## v0.0.6 4 | 5 | - 🐞 fix: Add executable permissions for each component under Linux 6 | - 🐞 fix: Fix the problem that the relative path of the project cannot be indexed 7 | - 🐞 fix: Fix the problem that the package path is empty but the current path is returned 8 | - ✨ feat: Improve the error message of the generated code 9 | 10 | ## v0.0.5 11 | 12 | - 🐞 fix: fix the problem that jinja2 function cannot be found after packaging 13 | 14 | ## v0.0.4 15 | 16 | - Improve install log output, add verbose option 17 | - Add uninstall, list commands 18 | 19 | ## v0.0.3 20 | 21 | - Added Windows installer 22 | - Fixed relative path issues 23 | - Removed package version restrictions 24 | 25 | ## v0.0.2 26 | 27 | - Add csp install command 28 | - Add release artifacts 29 | 30 | ## v0.0.1 31 | 32 | - Added APM32F103ZET6 support 33 | - Added GPIO, clock tree support 34 | 35 |

36 | 37 | # 更新日志 38 | 39 | ## v0.0.6 40 | 41 | - 🐞 fix: 添加各组件在 linux 下的可执行权限 42 | - 🐞 fix: 修复 project 相对路径无法索引的问题 43 | - 🐞 fix: 修复 package 路径为空但返回当前路径的问题 44 | - ✨ feat: 完善生成代码的报错信息 45 | 46 | ## v0.0.5 47 | 48 | - 🐞 fix: 修复打包后 jinja2 函数无法找到的问题 49 | 50 | ## v0.0.4 51 | 52 | - 完善安装日志输出,添加 verbose 选项 53 | - 添加 uninstall, list 命令 54 | 55 | ## v0.0.3 56 | 57 | - 添加 windows 安装程序 58 | - 修复相对路径问题 59 | - 移除软件包版本限制 60 | 61 | ## v0.0.2 62 | 63 | - 添加 csp install 命令 64 | - 添加 release 产物 65 | 66 | ## v0.0.1 67 | 68 | - 添加 APM32F103ZET6 支持 69 | - 添加 GPIO,时钟树 支持 70 | -------------------------------------------------------------------------------- /common/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-01 xqyjlj initial version 25 | # 26 | 27 | from .clock_tree import ClockTree, CLOCK_TREE, ClockTreeType 28 | from .coder import Coder, CoderCmd 29 | from .contributors import Contributor, ContributorType 30 | from .icon import Icon 31 | from .ip import Ip, IP, IpType 32 | from .package import Package, PACKAGE, PackageDescriptionType, PackageCmd 33 | from .project import Project, PROJECT 34 | from .repository import Repository, RepositoryType, RepositorySocType 35 | from .settings import Settings, SETTINGS 36 | from .signal_bus import SignalBus, SIGNAL_BUS 37 | from .style import Style 38 | from .summary import Summary, SummaryType, SUMMARY 39 | from .value_hub import ValueHub, VALUE_HUB 40 | 41 | # fmt: off 42 | __all__ = [ 43 | "ClockTree", "CLOCK_TREE", "ClockTreeType", 44 | "Coder", "CoderCmd", 45 | "Contributor", "ContributorType", 46 | "Icon", 47 | "Ip", "IP", "IpType", 48 | "Package", "PACKAGE", "PackageDescriptionType", "PackageCmd", 49 | "Project", "PROJECT", 50 | "Repository", "RepositoryType", "RepositorySocType", 51 | "Settings", "SETTINGS", 52 | "SignalBus", "SIGNAL_BUS", 53 | "Style", 54 | "Summary", "SummaryType", "SUMMARY", 55 | "ValueHub", "VALUE_HUB", 56 | ] 57 | # fmt: on 58 | -------------------------------------------------------------------------------- /common/i18n_type.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file i18n_type.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-11-11 xqyjlj initial version 25 | # 26 | 27 | import json 28 | 29 | 30 | class I18nType: 31 | def __init__(self, data: dict): 32 | self.__data = data 33 | 34 | def __str__(self) -> str: 35 | return json.dumps(self.__data, indent=2, ensure_ascii=False) 36 | 37 | @property 38 | def origin(self) -> dict: 39 | return self.__data 40 | 41 | def get(self, local: str) -> str: 42 | default = self.__data.get("en", "unknown") 43 | if local == "en": 44 | return default 45 | return self.__data.get(local, default) 46 | -------------------------------------------------------------------------------- /common/icon.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file icon.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-06-23 xqyjlj initial version 25 | # 26 | 27 | import os 28 | from enum import Enum 29 | 30 | from qfluentwidgets import getIconColor, Theme, FluentIconBase 31 | 32 | from .settings import SETTINGS 33 | 34 | 35 | class Icon(FluentIconBase, Enum): 36 | """Custom icons""" 37 | 38 | M_C = "material/c" 39 | M_FILE = "material/file" 40 | M_FOLDER_BASE = "material/folder-base" 41 | M_FOLDER_BASE_OPEN = "material/folder-base-open" 42 | M_FOLDER_DIST = "material/folder-dist" 43 | M_FOLDER_DIST_OPEN = "material/folder-dist-open" 44 | M_FOLDER_LIB = "material/folder-lib" 45 | M_FOLDER_LIB_OPEN = "material/folder-lib-open" 46 | M_FOLDER_PACKAGES = "material/folder-packages" 47 | M_FOLDER_PACKAGES_OPEN = "material/folder-packages-open" 48 | M_H = "material/h" 49 | # ------------------------------------------------------------------------------------------------------------------ 50 | AI_GENERATE = "ai-generate" 51 | BOOK_SHELF = "book-shelf-line" 52 | BOX = "box-3-line" 53 | CHECKBOX_MULTIPLE = "checkbox-multiple-line" 54 | CLOSE_LARGE = "close-large-line" 55 | CODE = "code-line" 56 | CPU = "cpu-line" 57 | DATABASE_2 = "database-2-line" 58 | EQUALIZER = "equalizer-line" 59 | FEEDBACK = "feedback-line" 60 | FOLDER = "folder-6-line" 61 | FOLDER_TRANSFER = "folder-transfer-line" 62 | GITHUB = "github-fill" 63 | GLOBAL = "global-line" 64 | HAMMER = "hammer-line" 65 | INFORMATION = "information-line" 66 | INSTALL = "install-line" 67 | LANDSCAPE = "landscape-line" 68 | LIST_SETTINGS = "list-settings-line" 69 | MONEY = "money-cny-circle-line" 70 | MORE = "more-line" 71 | NUMBERS = "numbers-line" 72 | PAINT = "paint-brush-line" 73 | PALETTE = "palette-line" 74 | PICTURE_IN_PICTURE = "picture-in-picture-line" 75 | QUESTION = "question-line" 76 | REFRESH = "refresh-line" 77 | SETTING = "settings-line" 78 | SPEED_UP = "speed-up-line" 79 | STACK = "stack-line" 80 | TIME = "time-line" 81 | TOOLS = "tools-line" 82 | UNINSTALL = "uninstall-line" 83 | ZOOM_IN = "zoom-in-line" 84 | ZOOM_OUT = "zoom-out-line" 85 | 86 | def path(self, theme=Theme.AUTO): 87 | if self.value.startswith("material/"): 88 | return os.path.join(SETTINGS.ICON_FOLDER, f"{self.value}.svg") 89 | return os.path.join( 90 | SETTINGS.ICON_FOLDER, "remix", getIconColor(theme), f"{self.value}.svg" 91 | ) 92 | -------------------------------------------------------------------------------- /common/signal_bus.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file signal_bus.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-09-11 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import QObject, Signal 28 | 29 | 30 | class SignalBus(QObject): 31 | """Signal bus""" 32 | 33 | package_updated = Signal() 34 | navigation_requested = Signal(str, str) 35 | update_pin_triggered = Signal(str) 36 | highlight_pin_triggered = Signal(list) 37 | 38 | 39 | SIGNAL_BUS = SignalBus() 40 | -------------------------------------------------------------------------------- /common/style.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file style.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-06-22 xqyjlj initial version 25 | # 26 | 27 | import os 28 | from enum import Enum 29 | 30 | from qfluentwidgets import StyleSheetBase, Theme, qconfig 31 | 32 | from .settings import SETTINGS 33 | 34 | 35 | class Style(StyleSheetBase, Enum): 36 | """Style sheet""" 37 | 38 | CLOCK_TREE_VIEW = "clock_tree_view" 39 | CODE_VIEW = "code_view" 40 | WIDGET_BASE_MANAGER = "widget_base_manager" 41 | NEW_PROJECT_WINDOW = "new_project_window" 42 | PACKAGE_VIEW = "package_view" 43 | PLAIN_TEXT_EDIT_CODE = "plain_text_edit_code" 44 | PLAIN_TEXT_EDIT_LOGGER = "plain_text_edit_logger" 45 | SETTING_VIEW = "setting_view" 46 | SOC_VIEW = "soc_view" 47 | 48 | # ------------------------------------------------------------------------------------------------------------------ 49 | 50 | T_CLOCK_TREE_VIEW = "templates/clock_tree_view" 51 | 52 | def path(self, theme=Theme.AUTO): 53 | if self.value.startswith("templates/"): 54 | return os.path.join(SETTINGS.STYLE_FOLDER, f"{self.value}.qss") 55 | theme = qconfig.theme if theme == Theme.AUTO else theme 56 | return os.path.join( 57 | SETTINGS.STYLE_FOLDER, theme.value.lower(), f"{self.value}.qss" 58 | ) 59 | -------------------------------------------------------------------------------- /dialogs/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-01 xqyjlj initial version 25 | # 26 | 27 | from .package_install_dialog import PackageInstallDialog 28 | 29 | # fmt: off 30 | __all__ = ["PackageInstallDialog"] 31 | # fmt: on 32 | -------------------------------------------------------------------------------- /jinja2/csp_project_helper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2024-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file csp_project_helper.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-12-27 xqyjlj initial version 25 | # 26 | 27 | 28 | def get(project: dict, path: str, default=None): 29 | item = project 30 | keys = path.split("/") 31 | for key in keys: 32 | if key not in item: 33 | return default 34 | item = item[key] 35 | return item 36 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | PySide6~=6.8.2 2 | numpy==1.26.4 3 | PySide6-Fluent-Widgets[full]==1.7.5 4 | jinja2~=3.1.4 5 | pyyaml~=6.0.2 6 | jsonschema~=4.23.0 7 | requests~=2.32.3 8 | filetype~=1.2.0 9 | py7zr~=0.22.0 10 | loguru~=0.7.2 11 | attrs~=24.2.0 12 | simpleeval~=1.0.3 13 | packaging~=24.1 14 | tqdm~=4.67.1 15 | -------------------------------------------------------------------------------- /resource/database/ip/geehy/apm32f103_crc.yml: -------------------------------------------------------------------------------- 1 | # Licensed under the GNU General Public License v. 3 (the "License") 2 | # You may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # https://www.gnu.org/licenses/gpl-3.0.html 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # 13 | # Copyright (C) 2025-2025 csplink 14 | # 15 | # @author csplink 16 | # @file apm32f103_crc.yml 17 | # 18 | # Change Logs: 19 | # Date Author Notes 20 | # ------------ ---------- ----------------------------------------------- 21 | # 2025-03-03 csplink initial version 22 | # 23 | 24 | parameters: 25 | geehy.crc_enabled_t: 26 | type: enum 27 | values: 28 | geehy.crc_disabled: 29 | comment: 30 | zh_CN: 关闭 31 | en: Disable 32 | geehy.crc_enabled: 33 | comment: 34 | zh_CN: 使能 35 | en: Enable 36 | default: geehy.crc_disabled 37 | display: 38 | zh_CN: CRC 39 | en: CRC 40 | description: 41 | zh_CN: CRC 42 | en: CRC 43 | visible: true 44 | readonly: false 45 | controls: 46 | geehy.crc_enabled_t: {} 47 | modes: {} 48 | activated: (${INSTANCE}.geehy.crc_enabled_t != 'geehy.crc_disabled') 49 | -------------------------------------------------------------------------------- /resource/database/ip/geehy/apm32f103_iwdt.yml: -------------------------------------------------------------------------------- 1 | # Licensed under the GNU General Public License v. 3 (the "License") 2 | # You may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # https://www.gnu.org/licenses/gpl-3.0.html 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # 13 | # Copyright (C) 2025-2025 csplink 14 | # 15 | # @author csplink 16 | # @file apm32f103_iwdt.yml 17 | # 18 | # Change Logs: 19 | # Date Author Notes 20 | # ------------ ---------- ----------------------------------------------- 21 | # 2025-03-03 csplink initial version 22 | # 23 | 24 | parameters: 25 | geehy.iwdt_prescaler_t: 26 | type: enum 27 | values: 28 | geehy.iwdt_prescaler_4: 29 | comment: 30 | zh_CN: "4" 31 | en: "4" 32 | geehy.iwdt_prescaler_8: 33 | comment: 34 | zh_CN: "8" 35 | en: "8" 36 | geehy.iwdt_prescaler_16: 37 | comment: 38 | zh_CN: "16" 39 | en: "16" 40 | geehy.iwdt_prescaler_32: 41 | comment: 42 | zh_CN: "32" 43 | en: "32" 44 | geehy.iwdt_prescaler_64: 45 | comment: 46 | zh_CN: "64" 47 | en: "64" 48 | geehy.iwdt_prescaler_128: 49 | comment: 50 | zh_CN: "128" 51 | en: "128" 52 | geehy.iwdt_prescaler_256: 53 | comment: 54 | zh_CN: "256" 55 | en: "256" 56 | default: geehy.iwdt_prescaler_4 57 | display: 58 | zh_CN: 预分频器 59 | en: Clock prescaler 60 | description: 61 | zh_CN: IWDT 时钟预分频器 62 | en: IWDT counter clock prescaler 63 | visible: true 64 | readonly: false 65 | geehy.iwdt_reload_t: 66 | type: integer 67 | default: 4095 68 | max: 4095 69 | min: 0 70 | display: 71 | zh_CN: 重装载值 72 | en: Down-counter reload value 73 | description: 74 | zh_CN: IWDT 自动重装载值(向下计数) 75 | en: IWDT down-counter reload value 76 | visible: true 77 | readonly: false 78 | geehy.iwdt_enabled_t: 79 | type: enum 80 | values: 81 | geehy.iwdt_disabled: 82 | comment: 83 | zh_CN: 关闭 84 | en: Disable 85 | geehy.iwdt_enabled: 86 | comment: 87 | zh_CN: 使能 88 | en: Enable 89 | default: geehy.iwdt_disabled 90 | display: 91 | zh_CN: IWDT 92 | en: IWDT 93 | description: 94 | zh_CN: IWDT 95 | en: IWDT 96 | visible: true 97 | readonly: false 98 | controls: 99 | geehy.iwdt_enabled_t: {} 100 | modes: 101 | - condition: (${INSTANCE}.geehy.iwdt_enabled_t == 'geehy.iwdt_enabled') 102 | content: 103 | geehy.iwdt_prescaler_t: {} 104 | geehy.iwdt_reload_t: {} 105 | activated: (${INSTANCE}.geehy.iwdt_enabled_t != 'geehy.iwdt_disabled') 106 | -------------------------------------------------------------------------------- /resource/database/schema/clock_tree.yml: -------------------------------------------------------------------------------- 1 | # Licensed under the GNU General Public License v. 3 (the "License") 2 | # You may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # https://www.gnu.org/licenses/gpl-3.0.html 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # 13 | # Copyright (C) 2022-2024 xqyjlj 14 | # 15 | # @author xqyjlj 16 | # @file clock_tree.yml 17 | # 18 | # Change Logs: 19 | # Date Author Notes 20 | # ------------ ---------- ----------------------------------------------- 21 | # 2024-10-28 xqyjlj initial version 22 | # 23 | 24 | $schema: "http://json-schema.org/draft-07/schema#" 25 | type: object 26 | properties: 27 | elements: 28 | type: object 29 | additionalProperties: false 30 | patternProperties: 31 | ".*": 32 | type: [object, "null"] #TODO: null 33 | properties: 34 | refParameter: 35 | type: string 36 | pattern: "^[A-Za-z0-9_.+-]+:[A-Za-z0-9_.+-]+$" 37 | type: 38 | enum: [divisor, multiplexed, multiple] 39 | enable: 40 | type: [string, boolean] 41 | output: 42 | type: array 43 | items: 44 | type: string 45 | pattern: "^[A-Za-z0-9_.+-]+$" 46 | input: 47 | $ref: "#/properties/elements/patternProperties/.*/properties/output" 48 | z: 49 | type: integer 50 | required: [refParameter] 51 | i18n: 52 | type: object 53 | additionalProperties: false 54 | patternProperties: 55 | "^\\$\\(.*\\)$": 56 | $ref: "#/properties/$language$" 57 | $language$: 58 | type: object 59 | properties: 60 | en: 61 | type: string 62 | required: [en] 63 | 64 | required: [elements] 65 | -------------------------------------------------------------------------------- /resource/database/schema/contributors.yml: -------------------------------------------------------------------------------- 1 | # Licensed under the GNU General Public License v. 3 (the "License") 2 | # You may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # https://www.gnu.org/licenses/gpl-3.0.html 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # 13 | # Copyright (C) 2022-2024 xqyjlj 14 | # 15 | # @author xqyjlj 16 | # @file contributors.yml 17 | # 18 | # Change Logs: 19 | # Date Author Notes 20 | # ------------ ---------- ----------------------------------------------- 21 | # 2024-08-31 xqyjlj initial version 22 | # 23 | 24 | $schema: "http://json-schema.org/draft-07/schema#" 25 | type: array 26 | items: 27 | type: object 28 | properties: 29 | avatar: 30 | type: string 31 | pattern: "^avatar/.*$" 32 | contributions: 33 | type: integer 34 | htmlUrl: 35 | type: string 36 | pattern: "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+" 37 | name: 38 | type: string 39 | minLength: 1 40 | required: [avatar, contributions, htmlUrl, name] 41 | -------------------------------------------------------------------------------- /resource/database/schema/package_description.yml: -------------------------------------------------------------------------------- 1 | # Licensed under the GNU General Public License v. 3 (the "License") 2 | # You may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # https://www.gnu.org/licenses/gpl-3.0.html 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # 13 | # Copyright (C) 2022-2024 xqyjlj 14 | # 15 | # @author xqyjlj 16 | # @file package_description.yml 17 | # 18 | # Change Logs: 19 | # Date Author Notes 20 | # ------------ ---------- ----------------------------------------------- 21 | # 2024-07-28 xqyjlj initial version 22 | # 23 | 24 | $schema: "http://json-schema.org/draft-07/schema#" 25 | type: object 26 | properties: 27 | author: 28 | type: object 29 | properties: 30 | name: 31 | type: string 32 | minLength: 1 33 | email: 34 | type: string 35 | minLength: 1 36 | pattern: "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$" 37 | website: 38 | type: object 39 | properties: 40 | blog: 41 | type: string 42 | minLength: 1 43 | pattern: "http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+" 44 | github: 45 | $ref: "#/properties/author/properties/website/properties/blog" 46 | required: [name, email, website] 47 | name: 48 | type: string 49 | minLength: 1 50 | version: 51 | type: string 52 | license: 53 | type: string 54 | minLength: 1 55 | type: 56 | enum: [hal, toolchains] 57 | vendor: 58 | type: string 59 | minLength: 1 60 | url: 61 | type: object 62 | properties: 63 | en: 64 | $ref: "#/properties/author/properties/website/properties/blog" 65 | required: [en] 66 | vendorUrl: 67 | $ref: "#/properties/url" 68 | description: 69 | type: object 70 | properties: 71 | en: 72 | type: string 73 | minLength: 1 74 | required: [en] 75 | support: 76 | $ref: "#/properties/author/properties/email" 77 | required: 78 | - author 79 | - name 80 | - version 81 | - license 82 | - type 83 | - vendor 84 | - url 85 | - vendorUrl 86 | - description 87 | - support 88 | -------------------------------------------------------------------------------- /resource/database/schema/package_index.yml: -------------------------------------------------------------------------------- 1 | # Licensed under the GNU General Public License v. 3 (the "License") 2 | # You may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # https://www.gnu.org/licenses/gpl-3.0.html 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # 13 | # Copyright (C) 2022-2024 xqyjlj 14 | # 15 | # @author xqyjlj 16 | # @file package_index.yml 17 | # 18 | # Change Logs: 19 | # Date Author Notes 20 | # ------------ ---------- ----------------------------------------------- 21 | # 2024-07-28 xqyjlj initial version 22 | # 23 | 24 | $schema: "http://json-schema.org/draft-07/schema#" 25 | type: [object, "null"] 26 | properties: 27 | hal: 28 | type: object 29 | additionalProperties: false 30 | patternProperties: 31 | "^[A-Za-z0-9_-]+$": 32 | type: object 33 | additionalProperties: false 34 | patternProperties: 35 | ".*": 36 | type: string 37 | toolchains: 38 | $ref: "#/properties/hal" 39 | -------------------------------------------------------------------------------- /resource/database/schema/project.yml: -------------------------------------------------------------------------------- 1 | # Licensed under the GNU General Public License v. 3 (the "License") 2 | # You may not use this file except in compliance with the License. 3 | # You may obtain a copy of the License at 4 | # 5 | # https://www.gnu.org/licenses/gpl-3.0.html 6 | # 7 | # Unless required by applicable law or agreed to in writing, software 8 | # distributed under the License is distributed on an "AS IS" BASIS, 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | # See the License for the specific language governing permissions and 11 | # limitations under the License. 12 | # 13 | # Copyright (C) 2022-2024 xqyjlj 14 | # 15 | # @author xqyjlj 16 | # @file project.yml 17 | # 18 | # Change Logs: 19 | # Date Author Notes 20 | # ------------ ---------- ----------------------------------------------- 21 | # 2024-06-29 xqyjlj initial version 22 | # 23 | 24 | $schema: "http://json-schema.org/draft-07/schema#" 25 | type: object 26 | properties: 27 | version: 28 | type: string 29 | pattern: "^(?:v|V)?\\d+\\.\\d+\\.\\d+$" 30 | name: 31 | type: string 32 | minLength: 1 33 | vendor: 34 | type: string 35 | minLength: 1 36 | targetChip: 37 | type: string 38 | minLength: 1 39 | configs: 40 | type: object 41 | modules: 42 | type: array 43 | items: 44 | type: string 45 | gen: 46 | type: object 47 | properties: 48 | copyLibrary: 49 | type: boolean 50 | linker: 51 | type: object 52 | properties: 53 | defaultHeapSize: 54 | type: integer 55 | defaultStackSize: 56 | type: integer 57 | useToolchainsPackage: 58 | type: boolean 59 | hal: 60 | type: string 61 | minLength: 1 62 | halVersion: 63 | type: string 64 | builder: 65 | type: string 66 | builderVersion: 67 | type: string 68 | toolchains: 69 | type: string 70 | toolchainsVersion: 71 | type: string 72 | required: [version, name, vendor, targetChip] 73 | -------------------------------------------------------------------------------- /resource/fonts/JetBrains Mono/JetBrainsMono-Bold-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/fonts/JetBrains Mono/JetBrainsMono-Bold-Italic.ttf -------------------------------------------------------------------------------- /resource/fonts/JetBrains Mono/JetBrainsMono-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/fonts/JetBrains Mono/JetBrainsMono-Bold.ttf -------------------------------------------------------------------------------- /resource/fonts/JetBrains Mono/JetBrainsMono-ExtraBold-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/fonts/JetBrains Mono/JetBrainsMono-ExtraBold-Italic.ttf -------------------------------------------------------------------------------- /resource/fonts/JetBrains Mono/JetBrainsMono-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/fonts/JetBrains Mono/JetBrainsMono-ExtraBold.ttf -------------------------------------------------------------------------------- /resource/fonts/JetBrains Mono/JetBrainsMono-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/fonts/JetBrains Mono/JetBrainsMono-Italic.ttf -------------------------------------------------------------------------------- /resource/fonts/JetBrains Mono/JetBrainsMono-Medium-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/fonts/JetBrains Mono/JetBrainsMono-Medium-Italic.ttf -------------------------------------------------------------------------------- /resource/fonts/JetBrains Mono/JetBrainsMono-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/fonts/JetBrains Mono/JetBrainsMono-Medium.ttf -------------------------------------------------------------------------------- /resource/fonts/JetBrains Mono/JetBrainsMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/fonts/JetBrains Mono/JetBrainsMono-Regular.ttf -------------------------------------------------------------------------------- /resource/images/icon/material/c.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /resource/images/icon/material/file.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | -------------------------------------------------------------------------------- /resource/images/icon/material/folder-base-open.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resource/images/icon/material/folder-base.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resource/images/icon/material/folder-dist-open.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resource/images/icon/material/folder-dist.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resource/images/icon/material/folder-lib-open.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /resource/images/icon/material/folder-lib.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /resource/images/icon/material/folder-packages-open.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resource/images/icon/material/folder-packages.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resource/images/icon/material/h.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /resource/images/icon/readme.txt: -------------------------------------------------------------------------------- 1 | download form 2 | https://remixicon.com/: remix 3 | https://github.com/material-extensions/vscode-material-icon-theme.git: material 4 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/ai-generate.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/book-shelf-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/box-3-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/checkbox-multiple-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/close-large-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/code-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/cpu-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/database-2-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/equalizer-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/feedback-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/folder-6-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/folder-transfer-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/github-fill.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/global-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/hammer-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/information-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/install-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/landscape-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/list-settings-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/money-cny-circle-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/more-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/numbers-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/paint-brush-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/palette-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/picture-in-picture-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/question-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/refresh-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/settings-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/speed-up-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/stack-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/time-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/tools-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/uninstall-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/zoom-in-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/black/zoom-out-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/ai-generate.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/book-shelf-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/box-3-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/checkbox-multiple-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/close-large-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/code-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/cpu-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/database-2-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/equalizer-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/feedback-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/folder-6-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/folder-transfer-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/github-fill.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/global-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/hammer-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/information-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/install-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/landscape-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/list-settings-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/money-cny-circle-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/more-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/numbers-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/paint-brush-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/palette-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/picture-in-picture-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/question-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/refresh-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/settings-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/speed-up-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/stack-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/time-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/tools-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/uninstall-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/zoom-in-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/icon/remix/white/zoom-out-line.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /resource/images/logo.128.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/logo.128.ico -------------------------------------------------------------------------------- /resource/images/logo.16.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/logo.16.ico -------------------------------------------------------------------------------- /resource/images/logo.32.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/logo.32.ico -------------------------------------------------------------------------------- /resource/images/logo.48.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/logo.48.ico -------------------------------------------------------------------------------- /resource/images/logo.64.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/logo.64.ico -------------------------------------------------------------------------------- /resource/images/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/logo.ico -------------------------------------------------------------------------------- /resource/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/logo.png -------------------------------------------------------------------------------- /resource/images/packages/LQFP144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/packages/LQFP144.png -------------------------------------------------------------------------------- /resource/images/packages/LQFP48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/packages/LQFP48.png -------------------------------------------------------------------------------- /resource/images/packages/LQFP64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/packages/LQFP64.png -------------------------------------------------------------------------------- /resource/images/packages/unknown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/resource/images/packages/unknown.png -------------------------------------------------------------------------------- /resource/style/dark/clock_tree_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file clock_tree_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | */ 28 | 29 | -------------------------------------------------------------------------------- /resource/style/dark/code_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file code_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | view_code QLabel { 31 | padding-left: 10px; 32 | font: 14px "Segoe UI", "Microsoft YaHei", "PingFang SC"; 33 | color: white; 34 | } 35 | -------------------------------------------------------------------------------- /resource/style/dark/new_project_window.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file new_project_window.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | TextBrowser#readmeTextBrowser { 31 | background-color: transparent; 32 | border: 1px solid rgba(255, 255, 255, 0.08); 33 | border-bottom: 1px solid rgba(255, 255, 255, 0.5442); 34 | border-radius: 5px; 35 | /* font: 14px "Segoe UI", "Microsoft YaHei"; */ 36 | padding: 2px 3px 2px 8px; 37 | color: white; 38 | selection-background-color: --ThemeColorPrimary; 39 | selection-color: black; 40 | } 41 | -------------------------------------------------------------------------------- /resource/style/dark/package_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file package_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | QScrollArea { 31 | border: none; 32 | background: transparent; 33 | } 34 | 35 | QWidget#widgetScroll { 36 | background: transparent; 37 | } 38 | 39 | QLabel#titleLabel { 40 | font: 33px "Microsoft YaHei Light"; 41 | background: transparent; 42 | color: white; 43 | } 44 | 45 | #pathLabel { 46 | font: 11px 'Segoe UI', 'Microsoft YaHei', 'PingFang SC'; 47 | color: rgb(96, 96, 96); 48 | padding: 0; 49 | } 50 | -------------------------------------------------------------------------------- /resource/style/dark/plain_text_edit_code.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file plain_text_edit_code.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | PlainTextEdit { 31 | background-color: transparent; 32 | } 33 | -------------------------------------------------------------------------------- /resource/style/dark/plain_text_edit_logger.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file plain_text_edit_logger.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-12-22 xqyjlj initial version 28 | */ 29 | 30 | PlainTextEdit { 31 | background-color: transparent; 32 | } 33 | -------------------------------------------------------------------------------- /resource/style/dark/setting_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file setting_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | QWidget#widgetScroll { 31 | background-color: transparent; 32 | } 33 | 34 | #settingLabel { 35 | font: 33px "Microsoft YaHei Light"; 36 | background-color: transparent; 37 | color: white; 38 | } 39 | -------------------------------------------------------------------------------- /resource/style/dark/soc_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file soc_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | -------------------------------------------------------------------------------- /resource/style/dark/widget_base_manager.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file widget_base_manager.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | ComboBox { 31 | border: 1px solid rgba(255, 255, 255, 0.053); 32 | border-radius: 5px; 33 | border-top: 1px solid rgba(255, 255, 255, 0.08); 34 | padding: 5px 31px 6px 11px; 35 | /* font: 14px 'Segoe UI', 'Microsoft YaHei', 'PingFang SC'; */ 36 | color: white; 37 | background-color: rgba(30, 30, 30, 1); 38 | text-align: left; 39 | outline: none; 40 | } 41 | 42 | ComboBox:hover { 43 | background-color: rgba(30, 30, 30, 1); 44 | } 45 | 46 | ComboBox:pressed { 47 | background-color: rgba(30, 30, 30, 1); 48 | border-top: 1px solid rgba(255, 255, 255, 0.053); 49 | color: rgba(255, 255, 255, 0.63); 50 | } 51 | 52 | ComboBox:disabled { 53 | color: rgba(255, 255, 255, 0.3628); 54 | background-color: rgba(30, 30, 30, 1); 55 | border: 1px solid rgba(255, 255, 255, 0.053); 56 | border-top: 1px solid rgba(255, 255, 255, 0.053); 57 | } 58 | 59 | ComboBox[isPlaceholderText="true"] { 60 | color: rgba(255, 255, 255, 0.6063); 61 | } 62 | 63 | SpinBox, 64 | DoubleSpinBox { 65 | background-color: rgba(30, 30, 30, 1); 66 | border: 1px solid rgba(255, 255, 255, 0.08); 67 | border-bottom: 1px solid rgba(255, 255, 255, 0.5442); 68 | border-radius: 5px; 69 | /* font: 14px "Segoe UI", "Microsoft YaHei"; */ 70 | padding: 0px 80px 0 10px; 71 | color: white; 72 | selection-background-color: --ThemeColorPrimary; 73 | selection-color: black; 74 | } 75 | -------------------------------------------------------------------------------- /resource/style/light/clock_tree_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file clock_tree_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | */ 28 | 29 | -------------------------------------------------------------------------------- /resource/style/light/code_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file code_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | view_code QLabel { 31 | padding-left: 10px; 32 | font: 14px "Segoe UI", "Microsoft YaHei", "PingFang SC"; 33 | color: black; 34 | } 35 | -------------------------------------------------------------------------------- /resource/style/light/new_project_window.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file new_project_window.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | */ 28 | 29 | TextBrowser#readmeTextBrowser { 30 | color: black; 31 | background-color: transparent; 32 | border: 1px solid rgba(0, 0, 0, 13); 33 | border-bottom: 1px solid rgba(0, 0, 0, 100); 34 | border-radius: 5px; 35 | /* font: 14px "Segoe UI", "Microsoft YaHei"; */ 36 | padding: 0px 10px; 37 | selection-background-color: --ThemeColorLight1; 38 | } 39 | -------------------------------------------------------------------------------- /resource/style/light/package_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file package_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | QScrollArea { 31 | border: none; 32 | background: transparent; 33 | } 34 | 35 | QWidget#widgetScroll { 36 | background: transparent; 37 | } 38 | 39 | #settingLabel { 40 | font: 33px "Microsoft YaHei Light"; 41 | background: transparent; 42 | } 43 | -------------------------------------------------------------------------------- /resource/style/light/plain_text_edit_code.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file plain_text_edit_code.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | PlainTextEdit { 31 | background-color: transparent; 32 | } 33 | -------------------------------------------------------------------------------- /resource/style/light/plain_text_edit_logger.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file plain_text_edit_logger.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-12-22 xqyjlj initial version 28 | */ 29 | 30 | PlainTextEdit { 31 | background-color: transparent; 32 | } 33 | -------------------------------------------------------------------------------- /resource/style/light/setting_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file setting_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | QWidget#widgetScroll { 31 | background-color: transparent; 32 | } 33 | 34 | QLabel#settingLabel { 35 | font: 33px "Microsoft YaHei Light"; 36 | background-color: transparent; 37 | } 38 | -------------------------------------------------------------------------------- /resource/style/light/soc_view.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file soc_view.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | -------------------------------------------------------------------------------- /resource/style/light/widget_base_manager.qss: -------------------------------------------------------------------------------- 1 | /** 2 | * **************************************************************************** 3 | * @author xqyjlj 4 | * @file widget_base_manager.qss 5 | * @brief 6 | * 7 | * **************************************************************************** 8 | * @attention 9 | * Licensed under the GNU General Public License v. 3 (the "License"); 10 | * You may not use this file except in compliance with the License. 11 | * You may obtain a copy of the License at 12 | * 13 | * https://www.gnu.org/licenses/gpl-3.0.html 14 | * 15 | * Unless required by applicable law or agreed to in writing, software 16 | * distributed under the License is distributed on an "AS IS" BASIS, 17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | * See the License for the specific language governing permissions and 19 | * limitations under the License. 20 | * 21 | * Copyright (C) 2024-2024 xqyjlj 22 | * 23 | * **************************************************************************** 24 | * Change Logs: 25 | * Date Author Notes 26 | * ------------ ---------- ----------------------------------------------- 27 | * 2024-10-27 xqyjlj initial version 28 | */ 29 | 30 | ComboBox { 31 | border: 1px solid rgba(255, 255, 255, 0.053); 32 | border-radius: 5px; 33 | border-top: 1px solid rgba(255, 255, 255, 0.08); 34 | padding: 5px 31px 6px 11px; 35 | /* font: 14px 'Segoe UI', 'Microsoft YaHei', 'PingFang SC'; */ 36 | color: white; 37 | background-color: rgba(30, 30, 30, 1); 38 | text-align: left; 39 | outline: none; 40 | } 41 | 42 | ComboBox:hover { 43 | background-color: rgba(30, 30, 30, 1); 44 | } 45 | 46 | ComboBox:pressed { 47 | background-color: rgba(30, 30, 30, 1); 48 | border-top: 1px solid rgba(255, 255, 255, 0.053); 49 | color: rgba(255, 255, 255, 0.63); 50 | } 51 | 52 | ComboBox:disabled { 53 | color: rgba(255, 255, 255, 0.3628); 54 | background-color: rgba(30, 30, 30, 1); 55 | border: 1px solid rgba(255, 255, 255, 0.053); 56 | border-top: 1px solid rgba(255, 255, 255, 0.053); 57 | } 58 | 59 | ComboBox[isPlaceholderText="true"] { 60 | color: rgba(255, 255, 255, 0.6063); 61 | } 62 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-01 xqyjlj initial version 25 | # 26 | -------------------------------------------------------------------------------- /tests/common/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-01 xqyjlj initial version 25 | # 26 | -------------------------------------------------------------------------------- /tests/common/resource/package/test.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/tests/common/resource/package/test.7z -------------------------------------------------------------------------------- /tests/common/resource/package/test.csppdsc: -------------------------------------------------------------------------------- 1 | author: 2 | name: xqyjlj 3 | email: xqyjlj@126.com 4 | website: 5 | blog: https://xqyjlj.github.io/ 6 | github: https://github.com/xqyjlj 7 | name: test 8 | version: 0.0.2 9 | license: Apache-2.0 10 | type: hal 11 | vendor: csplink 12 | vendorUrl: 13 | en: https://csplink.top 14 | zh_CN: https://csplink.top/#/zh-hans/ 15 | description: 16 | en: A fully open source chip configuration software system 17 | zh_CN: A fully open source chip configuration software system 18 | url: 19 | en: https://csplink.top 20 | zh_CN: https://csplink.top/#/zh-hans/ 21 | support: xqyjlj@126.com 22 | -------------------------------------------------------------------------------- /tests/common/tc_contributors.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file tc_contributors.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-10-14 xqyjlj initial version 25 | # 26 | 27 | import unittest 28 | 29 | from common import Contributor 30 | 31 | 32 | class ContributorTest(unittest.TestCase): 33 | 34 | def setUp(self): 35 | pass 36 | 37 | def test_getContributor(self): 38 | contributors = Contributor().get_contributors() 39 | for contributor in contributors: 40 | self.assertGreater(len(contributor.name), 0, msg="load failed.") 41 | self.assertGreater(len(contributor.html_url), 0, msg="load failed.") 42 | self.assertGreater(contributor.contributions, 0, msg="load failed.") 43 | self.assertGreater(len(contributor.avatar), 0, msg="load failed.") 44 | 45 | def tearDown(self): 46 | pass 47 | -------------------------------------------------------------------------------- /tests/common/tc_ip.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file tc_ip.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-11-03 xqyjlj initial version 25 | # 26 | 27 | import unittest 28 | 29 | from common import Repository, SUMMARY, IP, IpType 30 | 31 | 32 | class IpTest(unittest.TestCase): 33 | 34 | def setUp(self): 35 | pass 36 | 37 | def _find_default_condition( 38 | self, conditions: list[IpType.ConditionUnitType] 39 | ) -> IpType.ConditionUnitType | None: 40 | for condition in conditions: 41 | if condition._condition == "default": 42 | return condition 43 | return None 44 | 45 | def test_getIp(self): 46 | repository = Repository() 47 | socs = repository.repository().all_soc() 48 | for soc in socs: 49 | summary = SUMMARY.get_summary(soc.vendor, soc.name) 50 | modules = {} 51 | modules.update(summary.modules.peripherals) 52 | modules.update(summary.modules.middlewares) 53 | for _, group in modules.items(): 54 | for name, module in group.items(): 55 | if len(module.ip) == 0: 56 | continue 57 | ip = IP.get_ip(soc.vendor, name, module.ip) 58 | self.assertGreater(len(ip.parameters), 0, msg="load failed.") 59 | for _, parameter in ip.parameters.items(): 60 | self.assertGreater(len(parameter.type), 0, msg="load failed.") 61 | for _, value in parameter.values.items(): 62 | self.assertGreater( 63 | len(value.comment.origin), 0, msg="load failed." 64 | ) 65 | for _, mode_group in ip.pin_modes.items(): 66 | for _, mode in mode_group.items(): 67 | self.assertGreater(len(mode.values), 0, msg="load failed.") 68 | # check default conditions 69 | if len(ip._parameters_conditions()) > 0: 70 | for name, conditions in ip._parameters_conditions().items(): 71 | self.assertIsNotNone(self._find_default_condition(conditions)) 72 | 73 | def tearDown(self): 74 | pass 75 | -------------------------------------------------------------------------------- /tests/common/tc_project.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | # Licensed under the GNU General Public License v. 3 (the "License") 4 | # You may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.gnu.org/licenses/gpl-3.0.html 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # Copyright (C) 2022-2024 xqyjlj 16 | # 17 | # @author xqyjlj 18 | # @file tc_project.py 19 | # 20 | # Change Logs: 21 | # Date Author Notes 22 | # ------------ ---------- ----------------------------------------------- 23 | # 2024-11-07 xqyjlj initial version 24 | # 25 | import os 26 | import unittest 27 | 28 | from common import PROJECT 29 | 30 | 31 | class ProjectTest(unittest.TestCase): 32 | 33 | def setUp(self): 34 | pass 35 | 36 | def test_project(self): 37 | file = os.path.join( 38 | os.path.dirname(__file__), "resource", "project", "APM32F103ZET6.csp" 39 | ) 40 | PROJECT.set_path(file) 41 | project = PROJECT.project() 42 | self.assertGreater(len(project.name), 0, msg="load failed.") 43 | self.assertGreater(len(project.target_chip), 0, msg="load failed.") 44 | self.assertGreater(len(project.vendor), 0, msg="load failed.") 45 | self.assertGreater(len(project.version), 0, msg="load failed.") 46 | self.assertGreater(len(project.modules), 0, msg="load failed.") 47 | self.assertGreater(len(project.gen.origin), 0, msg="load failed.") 48 | self.assertGreater(len(project.gen.builder), 0, msg="load failed.") 49 | self.assertGreater(len(project.gen.builder_version), 0, msg="load failed.") 50 | self.assertGreater(len(project.gen.hal), 0, msg="load failed.") 51 | self.assertGreater(len(project.gen.hal_version), 0, msg="load failed.") 52 | self.assertGreater(project.gen.linker.default_heap_size, -2, msg="load failed.") 53 | self.assertGreater( 54 | project.gen.linker.default_stack_size, -2, msg="load failed." 55 | ) 56 | self.assertGreater(len(project.gen.toolchains), 0, msg="load failed.") 57 | self.assertGreater(len(project.gen.toolchains_version), 0, msg="load failed.") 58 | # self.assertGreater(project.gen.copyLibrary, 0, msg='load failed.') 59 | # self.assertGreater(project.gen.useToolchainsPackage, 0, msg='load failed.') 60 | self.assertGreater(len(project.configs.origin), 0, msg="load failed.") 61 | 62 | def tearDown(self): 63 | pass 64 | -------------------------------------------------------------------------------- /tools/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-10-21 xqyjlj initial version 25 | # 26 | 27 | from .contributors import Contributors 28 | from .drawio_tool import Drawio 29 | from .lrelease import Lrelease 30 | from .lupdate import Lupdate 31 | from .pyuic import Pyuic 32 | 33 | # fmt: off 34 | __all__ = [ 35 | "Contributors", 36 | "Drawio", 37 | "Lrelease", 38 | "Lupdate", 39 | "Pyuic" 40 | ] 41 | # fmt: on 42 | -------------------------------------------------------------------------------- /tools/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Licensed under the GNU General Public License v. 3 (the "License") 4 | # You may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.gnu.org/licenses/gpl-3.0.html 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # Copyright (C) 2025-2025 xqyjlj 16 | # 17 | # @author xqyjlj 18 | # @file deploy.sh 19 | # 20 | # Change Logs: 21 | # Date Author Notes 22 | # ------------ ---------- ----------------------------------------------- 23 | # 2025-01-10 xqyjlj initial version 24 | # 25 | 26 | script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" 27 | 28 | function deploy { 29 | platform=${1} 30 | path=${2} 31 | 32 | pushd "${script_dir}"/.. 33 | 34 | python tools/lrelease.py 35 | python tools/contributors.py 36 | 37 | common_args="--standalone --disable-console --show-memory --show-progress --assume-yes-for-downloads --output-dir=build --onefile --plugin-enable=pyside6 ./csp.py" 38 | if [ "$platform" = "windows" ]; then 39 | icon_arg="--windows-icon-from-ico=resource/images/logo.48.ico" 40 | elif [ "$platform" = "linux" ]; then 41 | icon_arg="--linux-icon=resource/images/logo.48.ico" 42 | fi 43 | 44 | python -m nuitka ${common_args} ${icon_arg} 45 | 46 | if [ "$platform" = "linux" ]; then 47 | cp -fv build/csp.bin build/csp 48 | fi 49 | 50 | mkdir -pv ${path}/{jinja2,} 51 | cp -rfv resource ${path}/ 52 | cp -fv jinja2/*.py ${path}/jinja2 53 | rm -rfv ${path}/resource/i18n/*.ts 54 | cp -fv build/csp ${path}/ 55 | cp -fv LICENSE ${path}/ 56 | 57 | ${path}/csp --version 58 | rm -rfv ${path}/log 59 | 60 | popd 61 | } 62 | -------------------------------------------------------------------------------- /tools/drawio_tool/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-10-21 xqyjlj initial version 25 | # 26 | 27 | from .drawio import Drawio 28 | 29 | # fmt: off 30 | __all__ = [ 31 | "Drawio", 32 | ] 33 | # fmt: on 34 | -------------------------------------------------------------------------------- /tools/find_lower_camel.py: -------------------------------------------------------------------------------- 1 | import re 2 | import glob 3 | import os 4 | 5 | __root_dir = os.path.join(os.path.dirname(__file__), "..") 6 | 7 | 8 | def camel_to_snake(name: str) -> str: 9 | """ 10 | 将小驼峰命名转换为蛇形命名(保留前缀下划线) 11 | 12 | Args: 13 | name: 输入的小驼峰字符串(允许带前缀下划线,如 __myVar) 14 | 15 | Returns: 16 | 转换后的蛇形字符串(如 __my_var) 17 | 18 | Example: 19 | >>> camel_to_snake("firstName") 20 | "first_name" 21 | >>> camel_to_snake("__myVar123") 22 | "__my_var123" 23 | >>> camel_to_snake("getHTTPResponse") 24 | "get_http_response" 25 | """ 26 | # 分离前缀下划线(保留所有前缀 _) 27 | prefix = name[: len(name) - len(name.lstrip("_"))] 28 | suffix = name.lstrip("_") 29 | 30 | # 核心转换逻辑:在大写字母前加下划线,并转全小写 31 | # 使用正则 (? bool: 38 | """ 39 | 检查指定位置是否在引号包裹范围内(支持转义字符处理) 40 | """ 41 | 42 | start_char = line[start_pos - 1] 43 | end_char = line[start_pos + len(word)] 44 | 45 | if start_char == " " or end_char == " ": 46 | return True 47 | 48 | 49 | def find_lower_camel_in_file(file_path: str): 50 | """ 51 | 从文件中提取所有小驼峰命名(忽略引号包裹的字符串) 52 | 53 | 规则: 54 | 1. 允许任意数量下划线前缀(如 _myVar、__specialCase) 55 | 2. 首字母必须小写(去除前缀后) 56 | 3. 必须包含至少一个大写字母 57 | 4. 不能包含下划线(除前缀外) 58 | 5. 排除全小写的情况 59 | """ 60 | # 候选词正则:匹配可能的前导下划线+小写字母开头的单词 61 | candidate_pattern = re.compile(r"\b_*[a-z]\w*\b") # 宽松匹配候选词 62 | 63 | def is_lower_camel(s: str) -> bool: 64 | # 剥离所有前缀下划线 65 | s_clean = s.lstrip("_") 66 | # 校验规则 67 | return ( 68 | len(s_clean) > 0 69 | and s_clean[0].islower() 70 | and any(c.isupper() for c in s_clean) 71 | and "_" not in s_clean 72 | and s_clean.isalnum() 73 | ) 74 | 75 | # 逐行扫描文件 76 | with open(file_path, "r", encoding="utf-8") as f: 77 | for line_num, line in enumerate(f, 1): 78 | # 查找所有候选词 79 | for match in candidate_pattern.finditer(line): 80 | word = match.group() 81 | start_pos = match.start() 82 | # 排除引号内的内容 83 | if is_inside_quotes(line, start_pos, word): 84 | if is_lower_camel(word): 85 | print( 86 | f"{file_path}:{line_num}: {word} -> {camel_to_snake(word)}" 87 | ) 88 | 89 | 90 | # 使用示例 91 | if __name__ == "__main__": 92 | 93 | py_files = glob.glob(f"{__root_dir}/**/*.py", recursive=True) 94 | for file in py_files: 95 | if not file.endswith("_ui.py"): 96 | find_lower_camel_in_file(file) 97 | # import sys 98 | 99 | # if len(sys.argv) != 2: 100 | # print("Usage: python find_camel.py ") 101 | # sys.exit(1) 102 | # find_lower_camel_in_file(sys.argv[1]) 103 | -------------------------------------------------------------------------------- /tools/lrelease.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file lrelease.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-08-18 xqyjlj initial version 25 | # 26 | 27 | import glob 28 | import os 29 | import platform 30 | import subprocess 31 | import sys 32 | 33 | __languages = ["zh_CN"] 34 | 35 | __root_dir = os.path.join(os.path.dirname(__file__), "..") 36 | 37 | 38 | class Lrelease: 39 | @staticmethod 40 | def run(root: str, languages: list[str]): 41 | if platform.system() == "Windows": 42 | exes = glob.glob( 43 | f"{os.path.dirname(sys.executable)}/**/pyside6-lrelease.exe", 44 | recursive=True, 45 | ) 46 | else: 47 | exes = glob.glob( 48 | f"{os.path.dirname(sys.executable)}/**/pyside6-lrelease", recursive=True 49 | ) 50 | 51 | if len(exes) > 0: 52 | exe = exes[0] 53 | for lang in languages: 54 | ts_file = os.path.join(root, "resource", "i18n", f"csplink.{lang}.ts") 55 | assert os.path.isfile(ts_file), f"{ts_file} is not exists" 56 | qm_file = os.path.join(root, "resource", "i18n", f"csplink.{lang}.qm") 57 | if not os.path.isdir(os.path.dirname(qm_file)): 58 | os.makedirs(os.path.dirname(qm_file)) 59 | subprocess.call([exe, ts_file, "-qm", qm_file]) 60 | else: 61 | print("can not find lrelease") 62 | sys.exit(1) 63 | 64 | 65 | if __name__ == "__main__": 66 | Lrelease.run(__root_dir, __languages) 67 | -------------------------------------------------------------------------------- /tools/lupdate.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file lupdate.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-08-18 xqyjlj initial version 25 | # 26 | 27 | import glob 28 | import os 29 | import platform 30 | import re 31 | import subprocess 32 | import sys 33 | 34 | __languages = ["zh_CN"] 35 | 36 | __root_dir = os.path.join(os.path.dirname(__file__), "..") 37 | 38 | 39 | class Lupdate: 40 | @staticmethod 41 | def run(root: str, languages: list[str]): 42 | if platform.system() == "Windows": 43 | exes = glob.glob( 44 | f"{os.path.dirname(sys.executable)}/**/pyside6-lupdate.exe", 45 | recursive=True, 46 | ) 47 | else: 48 | exes = glob.glob( 49 | f"{os.path.dirname(sys.executable)}/**/pyside6-lupdate", recursive=True 50 | ) 51 | 52 | if len(exes) > 0: 53 | exe = exes[0] 54 | py_files = glob.glob(f"{root}/**/*.py", recursive=True) 55 | ui_files = glob.glob(f"{root}/**/*.ui", recursive=True) 56 | src_files = [] 57 | 58 | for file in py_files: 59 | with open(file, "r", encoding="utf-8") as f: 60 | text = f.read() 61 | if re.search(r'.tr\((["\'])(.*?)\1\)', text) or re.search( 62 | r'QCoreApplication.translate\((["\'])(.*?)\1\)', text 63 | ): 64 | src_files.append(file) 65 | 66 | for file in ui_files: 67 | src_files.append(file) 68 | 69 | for lang in languages: 70 | ts_file = os.path.join(root, "resource", "i18n", f"csplink.{lang}.ts") 71 | if not os.path.isdir(os.path.dirname(ts_file)): 72 | os.makedirs(os.path.dirname(ts_file)) 73 | subprocess.call( 74 | [exe, "-source-language", "en_US", "-target-language", lang] 75 | + src_files 76 | + ["-ts", ts_file] 77 | ) 78 | else: 79 | print("can not find lupdate") 80 | 81 | 82 | if __name__ == "__main__": 83 | Lupdate.run(__root_dir, __languages) 84 | -------------------------------------------------------------------------------- /tools/pyuic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file pyuic.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-09-29 xqyjlj initial version 25 | # 26 | 27 | import glob 28 | import os 29 | import platform 30 | import subprocess 31 | import sys 32 | 33 | from pathlib import Path 34 | 35 | __root_dir = os.path.join(os.path.dirname(__file__), "..") 36 | 37 | 38 | class Pyuic: 39 | @staticmethod 40 | def run(root: str): 41 | if platform.system() == "Windows": 42 | exes = glob.glob( 43 | f"{os.path.dirname(sys.executable)}/**/pyside6-uic.exe", recursive=True 44 | ) 45 | else: 46 | exes = glob.glob( 47 | f"{os.path.dirname(sys.executable)}/**/pyside6-uic", recursive=True 48 | ) 49 | 50 | if len(exes) > 0: 51 | exe = exes[0] 52 | ui_files = glob.glob(f"{root}/**/*.ui", recursive=True) 53 | for ui_file in ui_files: 54 | ui_file = Path(ui_file) 55 | target_file = ui_file.parent / f"{ui_file.stem}_ui.py" 56 | print(f"Updating '{target_file}'...") 57 | subprocess.call([exe, ui_file, "-o", target_file]) 58 | else: 59 | print("can not find pyside6-uic") 60 | 61 | 62 | if __name__ == "__main__": 63 | Pyuic.run(__root_dir) 64 | -------------------------------------------------------------------------------- /tools/schema.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2025-2025 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file schema.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2025-02-09 xqyjlj initial version 25 | # 26 | 27 | import glob 28 | import json 29 | import os 30 | 31 | from pathlib import Path 32 | 33 | import yaml 34 | 35 | __root_dir = os.path.join(os.path.dirname(__file__), "..") 36 | 37 | 38 | class Schema: 39 | @staticmethod 40 | def run(root: str): 41 | files = glob.glob(f"{root}/resource/database/schema/*.yml", recursive=False) 42 | for yaml_file in files: 43 | file = Path(yaml_file) 44 | json_file = file.parent / f"{file.stem}.json" 45 | 46 | with open(yaml_file, "r", encoding="utf-8") as fp: 47 | yaml_data = yaml.safe_load(fp) 48 | 49 | with open(json_file, "w", encoding="utf-8") as fp: 50 | json.dump(yaml_data, fp, indent=4, ensure_ascii=False) 51 | 52 | print(f"Updating {json_file!r}...") 53 | 54 | 55 | if __name__ == "__main__": 56 | Schema.run(__root_dir) 57 | -------------------------------------------------------------------------------- /unit-test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file tester.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-09-13 xqyjlj initial version 25 | # 26 | 27 | import sys 28 | import unittest 29 | 30 | from PySide6.QtWidgets import QApplication 31 | 32 | 33 | def main(folder): 34 | stdout = sys.stdout 35 | sys.stdout = None 36 | 37 | discover = unittest.defaultTestLoader.discover( 38 | start_dir=folder, pattern="tc_*.py", top_level_dir="." 39 | ) 40 | 41 | sys.stdout = stdout 42 | 43 | app = QApplication(sys.argv) 44 | 45 | print( 46 | "find {count} testcases !!!".format(count=discover.countTestCases()), flush=True 47 | ) 48 | 49 | suite = unittest.TestSuite() 50 | suite.addTest(discover) 51 | 52 | runner = unittest.TextTestRunner(verbosity=2) 53 | result = runner.run(suite) 54 | 55 | if len(result.errors) + len(result.failures) != 0: 56 | exit(1) 57 | 58 | 59 | if __name__ == "__main__": 60 | main("./tests") 61 | -------------------------------------------------------------------------------- /utils/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-08-31 xqyjlj initial version 25 | # 26 | 27 | from .converters import Converters 28 | from .express import Express 29 | 30 | # fmt: off 31 | __all__ = [ 32 | "Converters", 33 | "Express", 34 | ] 35 | # fmt: on 36 | -------------------------------------------------------------------------------- /utils/converters.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file converters.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-08-31 xqyjlj initial version 25 | 26 | import re 27 | from functools import reduce 28 | 29 | 30 | class Converters: 31 | 32 | @staticmethod 33 | def ishex(string: str) -> bool: 34 | pattern = r"^0x[0-9A-Fa-f]+$" 35 | return bool(re.match(pattern, string)) 36 | 37 | @staticmethod 38 | def isurl(string: str) -> bool: 39 | pattern = r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+" 40 | return bool(re.match(pattern, string)) 41 | 42 | @staticmethod 43 | def isemail(string: str) -> bool: 44 | pattern = r"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$" 45 | return bool(re.match(pattern, string)) 46 | 47 | @staticmethod 48 | def paths2dict(paths: list[str], separator="/"): 49 | path_dict = {} 50 | for path in paths: 51 | parts = path.strip().split(separator) 52 | 53 | def update_dict(dt, key): 54 | if key not in dt: 55 | dt[key] = {} 56 | return dt[key] 57 | 58 | current_dict = reduce(update_dict, parts[:-1], path_dict) 59 | current_dict[parts[-1]] = "" 60 | return path_dict 61 | -------------------------------------------------------------------------------- /view/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-01 xqyjlj initial version 25 | # 26 | 27 | from .clock_tree_view import ClockTreeView 28 | from .code_view import CodeView 29 | from .package_view import PackageView 30 | from .setting_view import SettingView 31 | from .soc_view import SocView 32 | 33 | # fmt: off 34 | __all__ = [ 35 | "ClockTreeView", 36 | "CodeView", 37 | "PackageView", 38 | "SettingView", 39 | "SocView", 40 | ] 41 | # fmt: on 42 | -------------------------------------------------------------------------------- /view/ui/clock_tree_view.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ClockTreeView 4 | 5 | 6 | 7 | 0 8 | 0 9 | 986 10 | 678 11 | 12 | 13 | 14 | ClockTreeView 15 | 16 | 17 | 18 | 19 | 20 | QFrame::NoFrame 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 20 29 | 30 | 31 | 32 | 33 | Qt::Horizontal 34 | 35 | 36 | 37 | 463 38 | 20 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | ArrowCursor 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | Qt::Horizontal 71 | 72 | 73 | 74 | 462 75 | 20 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | GraphicsViewPanZoom 88 | QGraphicsView 89 |
widget.graphics_view_pan_zoom
90 |
91 | 92 | ToolButton 93 | QToolButton 94 |
qfluentwidgets
95 |
96 |
97 | 98 | 99 |
100 | -------------------------------------------------------------------------------- /view/ui/package_view.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | PackageView 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | PackageView 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | QFrame::StyledPanel 23 | 24 | 25 | QFrame::Raised 26 | 27 | 28 | 29 | 30 | 31 | 32 | 1 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | QFrame::StyledPanel 46 | 47 | 48 | QFrame::Raised 49 | 50 | 51 | 52 | 0 53 | 54 | 55 | 0 56 | 57 | 58 | 0 59 | 60 | 61 | 0 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | SimpleCardWidget 71 | QFrame 72 |
qfluentwidgets
73 | 1 74 |
75 | 76 | TreeWidget 77 | QTreeWidget 78 |
qfluentwidgets
79 |
80 |
81 | 82 | 83 |
84 | -------------------------------------------------------------------------------- /view/ui/package_view_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ################################################################################ 4 | ## Form generated from reading UI file 'package_view.ui' 5 | ## 6 | ## Created by: Qt User Interface Compiler version 6.6.2 7 | ## 8 | ## WARNING! All changes made in this file will be lost when recompiling UI file! 9 | ################################################################################ 10 | 11 | from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, 12 | QMetaObject, QObject, QPoint, QRect, 13 | QSize, QTime, QUrl, Qt) 14 | from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, 15 | QFont, QFontDatabase, QGradient, QIcon, 16 | QImage, QKeySequence, QLinearGradient, QPainter, 17 | QPalette, QPixmap, QRadialGradient, QTransform) 18 | from PySide6.QtWidgets import (QApplication, QFrame, QHBoxLayout, QHeaderView, 19 | QSizePolicy, QTreeWidgetItem, QVBoxLayout, QWidget) 20 | 21 | from qfluentwidgets import (SimpleCardWidget, TreeWidget) 22 | 23 | class Ui_PackageView(object): 24 | def setupUi(self, PackageView): 25 | if not PackageView.objectName(): 26 | PackageView.setObjectName(u"PackageView") 27 | PackageView.resize(400, 300) 28 | self.horizontalLayout_2 = QHBoxLayout(PackageView) 29 | self.horizontalLayout_2.setObjectName(u"horizontalLayout_2") 30 | self.horizontalLayout = QHBoxLayout() 31 | self.horizontalLayout.setObjectName(u"horizontalLayout") 32 | self.packageTreeCard = SimpleCardWidget(PackageView) 33 | self.packageTreeCard.setObjectName(u"packageTreeCard") 34 | self.packageTreeCard.setFrameShape(QFrame.StyledPanel) 35 | self.packageTreeCard.setFrameShadow(QFrame.Raised) 36 | self.packageTreeCardVerticalLayout = QVBoxLayout(self.packageTreeCard) 37 | self.packageTreeCardVerticalLayout.setObjectName(u"packageTreeCardVerticalLayout") 38 | self.packageTree = TreeWidget(self.packageTreeCard) 39 | __qtreewidgetitem = QTreeWidgetItem() 40 | __qtreewidgetitem.setText(0, u"1"); 41 | self.packageTree.setHeaderItem(__qtreewidgetitem) 42 | self.packageTree.setObjectName(u"packageTree") 43 | 44 | self.packageTreeCardVerticalLayout.addWidget(self.packageTree) 45 | 46 | 47 | self.horizontalLayout.addWidget(self.packageTreeCard) 48 | 49 | 50 | self.horizontalLayout_2.addLayout(self.horizontalLayout) 51 | 52 | self.packageInfoCard = SimpleCardWidget(PackageView) 53 | self.packageInfoCard.setObjectName(u"packageInfoCard") 54 | self.packageInfoCard.setFrameShape(QFrame.StyledPanel) 55 | self.packageInfoCard.setFrameShadow(QFrame.Raised) 56 | self.packageInfoCardVerticalLayout = QVBoxLayout(self.packageInfoCard) 57 | self.packageInfoCardVerticalLayout.setObjectName(u"packageInfoCardVerticalLayout") 58 | self.packageInfoCardVerticalLayout.setContentsMargins(0, 0, 0, 0) 59 | 60 | self.horizontalLayout_2.addWidget(self.packageInfoCard) 61 | 62 | 63 | self.retranslateUi(PackageView) 64 | 65 | QMetaObject.connectSlotsByName(PackageView) 66 | # setupUi 67 | 68 | def retranslateUi(self, PackageView): 69 | PackageView.setWindowTitle(QCoreApplication.translate("PackageView", u"PackageView", None)) 70 | # retranslateUi 71 | 72 | -------------------------------------------------------------------------------- /view/ui/setting_view.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SettingView 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | SettingView 15 | 16 | 17 | 18 | 19 | 20 | QFrame::StyledPanel 21 | 22 | 23 | QFrame::Raised 24 | 25 | 26 | 27 | 28 | 29 | 30 | 1 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | QFrame::StyledPanel 42 | 43 | 44 | QFrame::Raised 45 | 46 | 47 | 48 | 0 49 | 50 | 51 | 0 52 | 53 | 54 | 0 55 | 56 | 57 | 0 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | SimpleCardWidget 67 | QFrame 68 |
qfluentwidgets
69 | 1 70 |
71 | 72 | TreeWidget 73 | QTreeWidget 74 |
qfluentwidgets
75 |
76 |
77 | 78 | 79 |
80 | -------------------------------------------------------------------------------- /view/ui/setting_view_ui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ################################################################################ 4 | ## Form generated from reading UI file 'setting_view.ui' 5 | ## 6 | ## Created by: Qt User Interface Compiler version 6.6.2 7 | ## 8 | ## WARNING! All changes made in this file will be lost when recompiling UI file! 9 | ################################################################################ 10 | 11 | from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, 12 | QMetaObject, QObject, QPoint, QRect, 13 | QSize, QTime, QUrl, Qt) 14 | from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor, 15 | QFont, QFontDatabase, QGradient, QIcon, 16 | QImage, QKeySequence, QLinearGradient, QPainter, 17 | QPalette, QPixmap, QRadialGradient, QTransform) 18 | from PySide6.QtWidgets import (QApplication, QFrame, QHBoxLayout, QHeaderView, 19 | QSizePolicy, QTreeWidgetItem, QVBoxLayout, QWidget) 20 | 21 | from qfluentwidgets import (SimpleCardWidget, TreeWidget) 22 | 23 | class Ui_SettingView(object): 24 | def setupUi(self, SettingView): 25 | if not SettingView.objectName(): 26 | SettingView.setObjectName(u"SettingView") 27 | SettingView.resize(400, 300) 28 | self.horizontalLayout = QHBoxLayout(SettingView) 29 | self.horizontalLayout.setObjectName(u"horizontalLayout") 30 | self.settingTreeCard = SimpleCardWidget(SettingView) 31 | self.settingTreeCard.setObjectName(u"settingTreeCard") 32 | self.settingTreeCard.setFrameShape(QFrame.StyledPanel) 33 | self.settingTreeCard.setFrameShadow(QFrame.Raised) 34 | self.verticalLayout_cardWidget_file = QVBoxLayout(self.settingTreeCard) 35 | self.verticalLayout_cardWidget_file.setObjectName(u"verticalLayout_cardWidget_file") 36 | self.settingTree = TreeWidget(self.settingTreeCard) 37 | __qtreewidgetitem = QTreeWidgetItem() 38 | __qtreewidgetitem.setText(0, u"1"); 39 | self.settingTree.setHeaderItem(__qtreewidgetitem) 40 | self.settingTree.setObjectName(u"settingTree") 41 | 42 | self.verticalLayout_cardWidget_file.addWidget(self.settingTree) 43 | 44 | 45 | self.horizontalLayout.addWidget(self.settingTreeCard) 46 | 47 | self.settingStackedWidgetCard = SimpleCardWidget(SettingView) 48 | self.settingStackedWidgetCard.setObjectName(u"settingStackedWidgetCard") 49 | self.settingStackedWidgetCard.setFrameShape(QFrame.StyledPanel) 50 | self.settingStackedWidgetCard.setFrameShadow(QFrame.Raised) 51 | self.settingStackedWidgetCardVerticalLayout = QVBoxLayout(self.settingStackedWidgetCard) 52 | self.settingStackedWidgetCardVerticalLayout.setObjectName(u"settingStackedWidgetCardVerticalLayout") 53 | self.settingStackedWidgetCardVerticalLayout.setContentsMargins(0, 0, 0, 0) 54 | 55 | self.horizontalLayout.addWidget(self.settingStackedWidgetCard) 56 | 57 | 58 | self.retranslateUi(SettingView) 59 | 60 | QMetaObject.connectSlotsByName(SettingView) 61 | # setupUi 62 | 63 | def retranslateUi(self, SettingView): 64 | SettingView.setWindowTitle(QCoreApplication.translate("SettingView", u"SettingView", None)) 65 | # retranslateUi 66 | 67 | -------------------------------------------------------------------------------- /widget/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-01 xqyjlj initial version 25 | # 26 | 27 | from .clock_tree import ( 28 | BaseClockTreeWidget, 29 | EnumClockTreeWidget, 30 | FloatClockTreeWidget, 31 | IntegerClockTreeWidget, 32 | NumberClockTreeWidget, 33 | RadioClockTreeWidget, 34 | ) 35 | from .graphics_item_chip_body import GraphicsItemChipBody 36 | from .graphics_item_pin import GraphicsItemPin 37 | from .graphics_view_pan_zoom import GraphicsViewPanZoom 38 | from .highlighter import BaseHighlighter, CHighlighter 39 | from .list_contributors import ListContributors 40 | from .packages import LQFP 41 | from .plain_text_edit_code import PlainTextEditCode 42 | from .plain_text_edit_logger import PlainTextEditLogger 43 | from .plain_text_edit_readonly import PlainTextEditReadonly 44 | from .settings import ( 45 | ComboBoxPropertySettingCard, 46 | LineEditPropertySettingCard, 47 | SwitchPropertySettingCard, 48 | ToolButtonPropertySettingCard, 49 | ) 50 | from .stacked_widget import StackedWidget 51 | from .tab_widget import TabWidget 52 | from .tree_module import TreeModule 53 | from .widget_control_dashboard import WidgetControlDashboard 54 | from .widget_control_manager import WidgetControlManager 55 | from .widget_mode_manager import WidgetModeManager 56 | 57 | # fmt: off 58 | __all__ = [ 59 | "GraphicsItemChipBody", 60 | "GraphicsItemPin", 61 | "GraphicsViewPanZoom", 62 | "BaseHighlighter", "CHighlighter", 63 | "ListContributors", 64 | "LQFP", 65 | "PlainTextEditCode", 66 | "PlainTextEditLogger", 67 | "PlainTextEditReadonly", 68 | 69 | "ComboBoxPropertySettingCard", "LineEditPropertySettingCard", 70 | "SwitchPropertySettingCard", "ToolButtonPropertySettingCard", 71 | 72 | "BaseClockTreeWidget", "EnumClockTreeWidget", "FloatClockTreeWidget", 73 | "IntegerClockTreeWidget", "NumberClockTreeWidget", "RadioClockTreeWidget", 74 | 75 | "StackedWidget", 76 | "TabWidget", 77 | "TreeModule", 78 | "WidgetControlDashboard", 79 | "WidgetControlManager", 80 | "WidgetModeManager", 81 | ] 82 | # fmt: on 83 | -------------------------------------------------------------------------------- /widget/clock_tree/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-09-10 xqyjlj initial version 25 | # 26 | 27 | from .base_clock_tree_widget import BaseClockTreeWidget 28 | from .enum_clock_tree_widget import EnumClockTreeWidget 29 | from .float_clock_tree_widget import FloatClockTreeWidget 30 | from .integer_clock_tree_widget import IntegerClockTreeWidget 31 | from .number_clock_tree_widget import NumberClockTreeWidget 32 | from .radio_clock_tree_widget import RadioClockTreeWidget 33 | 34 | __all__ = [ 35 | "BaseClockTreeWidget", 36 | "EnumClockTreeWidget", 37 | "FloatClockTreeWidget", 38 | "IntegerClockTreeWidget", 39 | "NumberClockTreeWidget", 40 | "RadioClockTreeWidget", 41 | ] 42 | -------------------------------------------------------------------------------- /widget/clock_tree/float_clock_tree_widget.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file float_clock_tree_widget.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-12-05 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import QRegularExpression 28 | from PySide6.QtGui import QRegularExpressionValidator 29 | from PySide6.QtWidgets import QLineEdit 30 | from jinja2 import Template 31 | 32 | from common import ClockTreeType, IpType 33 | from .number_clock_tree_widget import NumberClockTreeWidget 34 | 35 | 36 | class FloatClockTreeWidget(NumberClockTreeWidget, QLineEdit): 37 | def __init__( 38 | self, 39 | id_: str, 40 | instance: str, 41 | param: str, 42 | element: ClockTreeType.ElementUnitType, 43 | parameter: IpType.ParameterUnitType, 44 | clock_tree: ClockTreeType, 45 | template: Template, 46 | data: dict, 47 | parent=None, 48 | ): 49 | NumberClockTreeWidget.__init__( 50 | self, 51 | id_, 52 | instance, 53 | param, 54 | element, 55 | parameter, 56 | clock_tree, 57 | template, 58 | data, 59 | parent, 60 | ) 61 | self.setObjectName("floatWidget") 62 | self.setValidator( 63 | QRegularExpressionValidator(QRegularExpression(R"(\d+)(\.\d+)?$")) 64 | ) 65 | -------------------------------------------------------------------------------- /widget/clock_tree/integer_clock_tree_widget.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file integer_clock_tree_widget.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-12-05 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import QRegularExpression 28 | from PySide6.QtGui import QRegularExpressionValidator 29 | from PySide6.QtWidgets import QLineEdit 30 | from jinja2 import Template 31 | 32 | from common import ClockTreeType, IpType 33 | from .number_clock_tree_widget import NumberClockTreeWidget 34 | 35 | 36 | class IntegerClockTreeWidget(NumberClockTreeWidget, QLineEdit): 37 | def __init__( 38 | self, 39 | id_: str, 40 | instance: str, 41 | param: str, 42 | element: ClockTreeType.ElementUnitType, 43 | parameter: IpType.ParameterUnitType, 44 | clock_tree: ClockTreeType, 45 | template: Template, 46 | data: dict, 47 | parent=None, 48 | ): 49 | NumberClockTreeWidget.__init__( 50 | self, 51 | id_, 52 | instance, 53 | param, 54 | element, 55 | parameter, 56 | clock_tree, 57 | template, 58 | data, 59 | parent, 60 | ) 61 | self.setObjectName("integerWidget") 62 | self.setValidator(QRegularExpressionValidator(QRegularExpression(R"^\d+$"))) 63 | -------------------------------------------------------------------------------- /widget/clock_tree/radio_clock_tree_widget.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file radio_clock_tree_widget.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-12-05 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtWidgets import QRadioButton 28 | from jinja2 import Template 29 | 30 | from common import ClockTreeType, IpType, PROJECT, SETTINGS 31 | from .base_clock_tree_widget import BaseClockTreeWidget 32 | 33 | 34 | class RadioClockTreeWidget(BaseClockTreeWidget, QRadioButton): 35 | def __init__( 36 | self, 37 | id_: str, 38 | instance: str, 39 | param: str, 40 | element: ClockTreeType.ElementUnitType, 41 | parameter: IpType.ParameterUnitType, 42 | clock_tree: ClockTreeType, 43 | template: Template, 44 | data: dict, 45 | parent=None, 46 | ): 47 | BaseClockTreeWidget.__init__( 48 | self, id_, instance, param, element, parameter, clock_tree, template, data 49 | ) 50 | QRadioButton.__init__(self, parent) 51 | 52 | self.setObjectName("radioWidget") 53 | self.setStyleSheet(self.stylesheet) 54 | 55 | self.toggled.connect(self.__on_toggled) 56 | 57 | def value(self) -> float: 58 | super().value() 59 | if self.isChecked(): 60 | if len(self.inputs()) == 1: 61 | return self.inputs()[self.element.input[0]].value() 62 | return 0 63 | 64 | def setup(self): 65 | super().setup() 66 | selector = PROJECT.project().configs.get( 67 | f"{self.instance}/{self.parameter.group}" 68 | ) 69 | if selector is None: 70 | default = self.parameter.default 71 | if default is not None and default == True: 72 | self.setChecked(True) 73 | else: 74 | if selector == self.param: 75 | self.setChecked(True) 76 | 77 | local = SETTINGS.get(SETTINGS.language).value.name() 78 | self.setToolTip(self.parameter.description.get(local)) 79 | 80 | def flush(self, source: BaseClockTreeWidget): 81 | if self.isChecked(): 82 | super().flush(source) 83 | 84 | def __on_toggled(self, checked: bool): 85 | if checked: 86 | PROJECT.project().configs.set( 87 | f"{self.instance}/{self.parameter.group}", self.param 88 | ) 89 | for id_, widget in self.outputs().items(): 90 | widget.flush(self) 91 | -------------------------------------------------------------------------------- /widget/highlighter/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-27 xqyjlj initial version 25 | # 26 | 27 | from .base_highlighter import BaseHighlighter 28 | from .c_highlighter import CHighlighter 29 | 30 | __all__ = ["BaseHighlighter", "CHighlighter"] 31 | -------------------------------------------------------------------------------- /widget/highlighter/base_highlighter.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file base_highlighter.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-27 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtGui import ( 28 | QSyntaxHighlighter, 29 | QFont, 30 | QColor, 31 | QTextCharFormat, 32 | QTextDocument, 33 | ) 34 | 35 | 36 | class BaseHighlighter(QSyntaxHighlighter): 37 | 38 | @staticmethod 39 | def format(color, style=""): 40 | char_format = QTextCharFormat() 41 | char_format.setForeground(color) 42 | if "bold" in style: 43 | char_format.setFontWeight(QFont.Weight.Bold) 44 | if "italic" in style: 45 | char_format.setFontItalic(True) 46 | 47 | return char_format 48 | 49 | STYLES = { 50 | "keyword": format(QColor("#c678dd"), "bold"), 51 | "operator": format(QColor("#c678dd"), "bold"), 52 | "brace": format(QColor("#d1a075")), 53 | "macro": format(QColor("#c678dd"), "bold"), 54 | "string": format(QColor("#98c379")), 55 | "comment": format(QColor("#7f848e"), "italic"), 56 | "numbers": format(QColor("#d1a075")), 57 | } 58 | 59 | def __init__(self, document: QTextDocument): 60 | super().__init__(document) 61 | -------------------------------------------------------------------------------- /widget/packages/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-01 xqyjlj initial version 25 | # 26 | 27 | from .lqfp import LQFP 28 | 29 | __all__ = ["LQFP"] 30 | -------------------------------------------------------------------------------- /widget/plain_text_edit_logger.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2024-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file plain_text_edit_logger.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-12-21 xqyjlj initial version 25 | # 26 | 27 | import logging 28 | 29 | from PySide6.QtGui import QFont 30 | from loguru import logger 31 | 32 | # noinspection PyProtectedMember 33 | from loguru._handler import Message 34 | 35 | from common import Style 36 | from .plain_text_edit_readonly import PlainTextEditReadonly 37 | 38 | 39 | class PlainTextEditLogger(PlainTextEditReadonly): 40 | def __init__(self, parent=None): 41 | super().__init__(parent) 42 | self.setTabStopDistance(40) 43 | self.setReadOnly(True) 44 | self.setMaximumBlockCount(2000) 45 | 46 | font = QFont() 47 | font.setFamily("JetBrains Mono") 48 | font.setPointSize(9) 49 | font.setWeight(QFont.Weight.Light) 50 | self.setFont(font) 51 | 52 | Style.PLAIN_TEXT_EDIT_LOGGER.apply(self) 53 | 54 | # {level: <8} | {name}:{function}:{line} - {message} 55 | logger.add(self.__callback, level=logging.INFO) # type: ignore 56 | 57 | def __callback(self, message: Message): 58 | time = message.record["time"] 59 | level = message.record["level"].name 60 | msg = message.record["message"] 61 | file = message.record["file"] 62 | line = message.record["line"] 63 | text = ( 64 | f"{time:YYYY-MM-DD HH:mm:ss.SSS} | {level: <8} | {file.name}:{line} | {msg}" 65 | ) 66 | self.appendPlainText(text) 67 | -------------------------------------------------------------------------------- /widget/plain_text_edit_readonly.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2024-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file plain_text_edit_readonly.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-12-22 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import Qt 28 | from PySide6.QtGui import QInputMethodEvent 29 | from qfluentwidgets import PlainTextEdit 30 | 31 | 32 | class PlainTextEditReadonly(PlainTextEdit): 33 | 34 | # region overrides 35 | 36 | def inputMethodEvent(self, event: QInputMethodEvent): 37 | if not (self.textInteractionFlags() & Qt.TextInteractionFlag.TextEditable): 38 | event.ignore() 39 | return 40 | super().inputMethodEvent(event) 41 | 42 | # endregion 43 | -------------------------------------------------------------------------------- /widget/settings/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-09-10 xqyjlj initial version 25 | # 26 | 27 | from .combo_box_property_setting_card import ComboBoxPropertySettingCard 28 | from .line_edit_property_setting_card import LineEditPropertySettingCard 29 | from .switch_property_setting_card import SwitchPropertySettingCard 30 | from .tool_button_property_setting_card import ToolButtonPropertySettingCard 31 | 32 | __all__ = [ 33 | "ComboBoxPropertySettingCard", 34 | "LineEditPropertySettingCard", 35 | "SwitchPropertySettingCard", 36 | "ToolButtonPropertySettingCard", 37 | ] 38 | -------------------------------------------------------------------------------- /widget/settings/combo_box_property_setting_card.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file combo_box_property_setting_card.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-09-10 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import Qt, Signal 28 | from qfluentwidgets import ( 29 | FluentIconBase, 30 | SettingCard, 31 | ComboBox, 32 | IconInfoBadge, 33 | InfoBadgePosition, 34 | ) 35 | 36 | from common import Icon 37 | 38 | 39 | class ComboBoxPropertySettingCard(SettingCard): 40 | current_text_changed = Signal(str) 41 | 42 | def __init__( 43 | self, 44 | icon: FluentIconBase, 45 | title: str, 46 | value: str, 47 | values: list, 48 | content=None, 49 | parent=None, 50 | ): 51 | super().__init__(icon, title, content, parent) 52 | self.combo_box = ComboBox(self) 53 | 54 | for v in values: 55 | self.combo_box.addItem(v) 56 | 57 | self.combo_box.setCurrentText(value) 58 | self.combo_box.currentTextChanged.connect(self.current_text_changed) 59 | 60 | self.badge = IconInfoBadge.error( 61 | icon=Icon.CLOSE_LARGE, 62 | parent=self.combo_box.parent(), 63 | target=self.combo_box, 64 | position=InfoBadgePosition.TOP_RIGHT, 65 | ) 66 | self.badge.hide() 67 | 68 | self.hBoxLayout.addWidget(self.combo_box, 0, Qt.AlignmentFlag.AlignRight) 69 | self.hBoxLayout.addSpacing(16) 70 | 71 | def set_status_info(self, error: bool, message: str): 72 | self.badge.setVisible(error) 73 | if error: 74 | self.combo_box.setToolTip(message) 75 | else: 76 | self.combo_box.setToolTip("") 77 | 78 | def set_source(self, value: str, values: list[str]): 79 | self.combo_box.currentTextChanged.disconnect(self.current_text_changed) 80 | 81 | self.combo_box.clear() 82 | 83 | for v in values: 84 | self.combo_box.addItem(v) 85 | 86 | self.combo_box.currentTextChanged.connect(self.current_text_changed) 87 | 88 | text = self.combo_box.currentText() 89 | self.combo_box.setCurrentText(value) 90 | if text == value: 91 | self.current_text_changed.emit(value) 92 | 93 | def clear(self): 94 | self.combo_box.clear() 95 | self.set_status_info(False, "") 96 | self.setContent("") 97 | -------------------------------------------------------------------------------- /widget/settings/line_edit_property_setting_card.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file line_edit_property_setting_card.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-09-10 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import Qt, QRegularExpression, Signal 28 | from PySide6.QtGui import QRegularExpressionValidator 29 | from qfluentwidgets import ( 30 | FluentIconBase, 31 | SettingCard, 32 | LineEdit, 33 | IconInfoBadge, 34 | InfoBadgePosition, 35 | ) 36 | 37 | from common import Icon 38 | 39 | 40 | # from PySide6.QtWidgets import QWidget 41 | 42 | 43 | class LineEditPropertySettingCard(SettingCard): 44 | text_changed = Signal(str) 45 | 46 | def __init__( 47 | self, 48 | icon: FluentIconBase, 49 | title: str, 50 | value: str, 51 | content=None, 52 | validator=None, 53 | parent=None, 54 | ): 55 | super().__init__(icon, title, content, parent) 56 | self.line_edit = LineEdit(self) 57 | if validator is not None: 58 | self.line_edit.setValidator( 59 | QRegularExpressionValidator(QRegularExpression(validator)) 60 | ) 61 | self.line_edit.setText(value) 62 | self.line_edit.textChanged.connect(self.text_changed) 63 | 64 | self.badge = IconInfoBadge.error( 65 | icon=Icon.CLOSE_LARGE, 66 | parent=self.line_edit.parent(), 67 | target=self.line_edit, 68 | position=InfoBadgePosition.TOP_RIGHT, 69 | ) 70 | self.badge.hide() 71 | 72 | self.hBoxLayout.addWidget(self.line_edit, 0, Qt.AlignmentFlag.AlignRight) 73 | self.hBoxLayout.addSpacing(16) 74 | 75 | def set_status_info(self, error: bool, message: str): 76 | self.badge.setVisible(error) 77 | if error: 78 | self.line_edit.setToolTip(message) 79 | else: 80 | self.line_edit.setToolTip("") 81 | 82 | def clear(self): 83 | self.line_edit.clear() 84 | self.set_status_info(False, "") 85 | self.setContent("") 86 | -------------------------------------------------------------------------------- /widget/settings/switch_property_setting_card.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file switch_property_setting_card.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-09-11 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import Qt, Signal 28 | from qfluentwidgets import ( 29 | FluentIconBase, 30 | SettingCard, 31 | SwitchButton, 32 | IconInfoBadge, 33 | InfoBadgePosition, 34 | IndicatorPosition, 35 | ) 36 | 37 | from common import Icon 38 | 39 | 40 | # from PySide6.QtGui import QRegularExpressionValidator 41 | # from PySide6.QtWidgets import QWidget 42 | 43 | 44 | class SwitchPropertySettingCard(SettingCard): 45 | checked_changed = Signal(bool) 46 | 47 | def __init__( 48 | self, icon: FluentIconBase, title: str, value: bool, content=None, parent=None 49 | ): 50 | super().__init__(icon, title, content, parent) 51 | self.switch_button = SwitchButton(self, indicatorPos=IndicatorPosition.RIGHT) 52 | self.switch_button.setChecked(value) 53 | self.switch_button.checkedChanged.connect(self.checked_changed) 54 | 55 | self.badge = IconInfoBadge.error( 56 | icon=Icon.CLOSE_LARGE, 57 | parent=self.switch_button.parent(), 58 | target=self.switch_button, 59 | position=InfoBadgePosition.TOP_RIGHT, 60 | ) 61 | self.badge.hide() 62 | 63 | self.hBoxLayout.addWidget(self.switch_button, 0, Qt.AlignmentFlag.AlignRight) 64 | self.hBoxLayout.addSpacing(16) 65 | 66 | def set_status_info(self, error: bool, message: str): 67 | self.badge.setVisible(error) 68 | if error: 69 | self.switch_button.setToolTip(message) 70 | else: 71 | self.switch_button.setToolTip("") 72 | 73 | def clear(self): 74 | self.set_status_info(False, "") 75 | self.setContent("") 76 | -------------------------------------------------------------------------------- /widget/settings/tool_button_property_setting_card.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file tool_button_property_setting_card.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-09-11 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import Qt, Signal 28 | from qfluentwidgets import ( 29 | FluentIconBase, 30 | SettingCard, 31 | TransparentToolButton, 32 | IconInfoBadge, 33 | InfoBadgePosition, 34 | ) 35 | 36 | from common import Icon 37 | 38 | 39 | # from PySide6.QtGui import QRegularExpressionValidator 40 | # from PySide6.QtWidgets import QWidget 41 | 42 | 43 | class ToolButtonPropertySettingCard(SettingCard): 44 | clicked = Signal() 45 | 46 | def __init__( 47 | self, 48 | icon: FluentIconBase, 49 | title: str, 50 | btn_icon: FluentIconBase, 51 | content=None, 52 | parent=None, 53 | ): 54 | super().__init__(icon, title, content, parent) 55 | self.tool_button = TransparentToolButton(btn_icon, self) 56 | self.tool_button.clicked.connect(self.clicked) 57 | 58 | self.badge = IconInfoBadge.error( 59 | icon=Icon.CLOSE_LARGE, 60 | parent=self.tool_button.parent(), 61 | target=self.tool_button, 62 | position=InfoBadgePosition.TOP_RIGHT, 63 | ) 64 | self.badge.hide() 65 | 66 | self.hBoxLayout.addWidget(self.tool_button, 0, Qt.AlignmentFlag.AlignRight) 67 | self.hBoxLayout.addSpacing(16) 68 | 69 | def set_status_info(self, error: bool, message: str): 70 | self.badge.setVisible(error) 71 | if error: 72 | self.setToolTip(message) 73 | else: 74 | self.setToolTip("") 75 | 76 | def clear(self): 77 | self.set_status_info(False, "") 78 | self.setContent("") 79 | -------------------------------------------------------------------------------- /widget/stacked_widget.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*-\ 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file stacked_widget.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-10-06 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import Qt, Signal 28 | from PySide6.QtWidgets import QFrame, QHBoxLayout, QStackedWidget, QWidget 29 | 30 | 31 | class StackedWidget(QFrame): 32 | current_changed = Signal(int) 33 | currentChanged = current_changed 34 | 35 | def __init__(self, parent=None): 36 | super().__init__(parent=parent) 37 | self.h_box_layout = QHBoxLayout(self) 38 | self.view = QStackedWidget(self) 39 | 40 | self.h_box_layout.setContentsMargins(0, 0, 0, 0) 41 | self.h_box_layout.addWidget(self.view) 42 | 43 | self.view.currentChanged.connect(self.current_changed) 44 | self.setAttribute(Qt.WidgetAttribute.WA_StyledBackground) 45 | 46 | # region overrides 47 | 48 | def addWidget(self, widget: QWidget): 49 | self.view.addWidget(widget) 50 | 51 | def widget(self, index: int): 52 | return self.view.widget(index) 53 | 54 | def setCurrentWidget(self, widget: QWidget, popOut: bool = True): 55 | self.view.setCurrentWidget(widget) 56 | 57 | def setCurrentIndex(self, index: int, popOut: bool = True): 58 | self.view.setCurrentIndex(index) 59 | 60 | def currentIndex(self) -> int: 61 | return self.view.currentIndex() 62 | 63 | def currentWidget(self) -> QWidget: 64 | return self.view.currentWidget() 65 | 66 | def indexOf(self, widget) -> int: 67 | return self.view.indexOf(widget) 68 | 69 | def count(self) -> int: 70 | return self.view.count() 71 | 72 | # endregion 73 | -------------------------------------------------------------------------------- /widget/tab_widget.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2025-2025 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file tab_widget.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2025-03-08 xqyjlj initial version 25 | # 26 | 27 | from PySide6.QtCore import Qt 28 | from PySide6.QtWidgets import QApplication, QWidget, QVBoxLayout 29 | from qfluentwidgets import getFont, Pivot 30 | 31 | from .stacked_widget import StackedWidget 32 | 33 | 34 | class TabWidget(QWidget): 35 | def __init__(self, parent=None): 36 | super().__init__(parent=parent) 37 | 38 | self.tab_bar = Pivot(self) 39 | self.stacked_widget = StackedWidget(self) 40 | 41 | self.v_box_layout = QVBoxLayout(self) 42 | 43 | self.v_box_layout.addWidget(self.tab_bar, 0, Qt.AlignmentFlag.AlignLeft) 44 | self.v_box_layout.addWidget(self.stacked_widget) 45 | self.v_box_layout.setContentsMargins(0, 0, 0, 0) 46 | 47 | def add_sub_interface(self, view: QWidget, text, is_transparent=False): 48 | if not view.objectName(): 49 | raise ValueError("The object name of `interface` can't be empty string.") 50 | view.setProperty("isStackedTransparent", is_transparent) 51 | self.stacked_widget.addWidget(view) 52 | 53 | routeKey = view.objectName() 54 | item = self.tab_bar.addItem( 55 | routeKey=routeKey, 56 | text=text, 57 | onClick=lambda: self.stacked_widget.setCurrentWidget(view), 58 | ) 59 | item.setFont(getFont(13)) # type: ignore 60 | 61 | if self.stacked_widget.count() == 1: 62 | self.stacked_widget.current_changed.connect( 63 | self.__on_stackedWidget_currentChanged 64 | ) 65 | self.tab_bar.setCurrentItem(routeKey) 66 | 67 | self.__update_stacked_background() 68 | 69 | def __on_stackedWidget_currentChanged(self, index: int): 70 | widget = self.stacked_widget.widget(index) 71 | self.tab_bar.setCurrentItem(widget.objectName()) 72 | 73 | self.__update_stacked_background() 74 | 75 | def __update_stacked_background(self): 76 | is_transparent = self.stacked_widget.currentWidget().property( 77 | "isStackedTransparent" 78 | ) 79 | if bool(self.stacked_widget.property("isTransparent")) == is_transparent: 80 | return 81 | 82 | self.stacked_widget.setProperty("isTransparent", is_transparent) 83 | self.stacked_widget.setStyle(QApplication.style()) 84 | -------------------------------------------------------------------------------- /widget/widget_mode_manager.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file widget_mode_manager.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-07-01 xqyjlj initial version 25 | # 26 | 27 | 28 | from PySide6.QtWidgets import QWidget, QVBoxLayout 29 | from loguru import logger 30 | 31 | from .widget_base_manager import WidgetBaseManager, WidgetBaseManagerType 32 | from .tab_widget import TabWidget 33 | 34 | 35 | class ModeManager(WidgetBaseManager): 36 | 37 | def __init__(self, parent=None): 38 | super().__init__(WidgetBaseManagerType.MODE, parent) 39 | 40 | 41 | class PinMapManager(QWidget): 42 | def __init__(self, parent=None): 43 | super().__init__(parent) 44 | 45 | 46 | class WidgetModeManager(QWidget): 47 | def __init__(self, parent=None): 48 | super().__init__(parent) 49 | 50 | self.v_layout = QVBoxLayout(self) 51 | self.v_layout.setContentsMargins(9, 9, 9, 9) 52 | self.tab_view = TabWidget(self) 53 | self.v_layout.addWidget(self.tab_view) 54 | 55 | self.mode_manager = ModeManager(self) 56 | self.mode_manager.setObjectName("ModeManager") 57 | self.pin_map_manager = PinMapManager(self) 58 | self.pin_map_manager.setObjectName("PinMapManager") 59 | 60 | self.tab_view.add_sub_interface(self.mode_manager, "Mode", True) 61 | self.tab_view.add_sub_interface(self.pin_map_manager, "Pin Map", True) 62 | 63 | def set_target(self, instance: str, target: str): 64 | self.mode_manager.set_target(instance, target) 65 | -------------------------------------------------------------------------------- /win-installer.nsi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/csplink/csp/ceea3fa016b367b777dc7244fef7519c1f1a5f87/win-installer.nsi -------------------------------------------------------------------------------- /window/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding:utf-8 -*- 3 | 4 | # Licensed under the GNU General Public License v. 3 (the "License") 5 | # You may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # https://www.gnu.org/licenses/gpl-3.0.html 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Copyright (C) 2022-2024 xqyjlj 17 | # 18 | # @author xqyjlj 19 | # @file __init__.py 20 | # 21 | # Change Logs: 22 | # Date Author Notes 23 | # ------------ ---------- ----------------------------------------------- 24 | # 2024-12-21 xqyjlj initial version 25 | # 26 | 27 | from .main_window import MainWindow 28 | from .new_project_window import NewProjectWindow 29 | from .startup_window import StartupWindow 30 | 31 | # fmt: off 32 | __all__ = [ 33 | "MainWindow", 34 | "NewProjectWindow", 35 | "StartupWindow" 36 | ] 37 | # fmt: on 38 | -------------------------------------------------------------------------------- /window/ui/startup_view.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | StartupView 4 | 5 | 6 | 7 | 0 8 | 0 9 | 800 10 | 600 11 | 12 | 13 | 14 | StartupView 15 | 16 | 17 | 18 | 19 | 20 | QFrame::StyledPanel 21 | 22 | 23 | QFrame::Raised 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 0 32 | 0 33 | 34 | 35 | 36 | QFrame::StyledPanel 37 | 38 | 39 | QFrame::Raised 40 | 41 | 42 | 43 | 44 | 45 | 46 | QFrame::StyledPanel 47 | 48 | 49 | QFrame::Raised 50 | 51 | 52 | 53 | 54 | 55 | 56 | QFrame::StyledPanel 57 | 58 | 59 | QFrame::Raised 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | HeaderCardWidget 68 | QFrame 69 |
qfluentwidgets
70 | 1 71 |
72 |
73 | 74 | 75 |
76 | --------------------------------------------------------------------------------