Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It does not work in my Mac #1

Open
BakaDream opened this issue Dec 17, 2024 · 1 comment
Open

It does not work in my Mac #1

BakaDream opened this issue Dec 17, 2024 · 1 comment

Comments

@BakaDream
Copy link

环境信息:
Python version:3.12.7
"pyside6==6.8.1",
"pyside6-fluent-widgets[full]==1.7.3"
并且使用rye管理项目
问题主诉:
qt designer里没有自定义组件

过程:
我使用了虚拟环境,在虚拟环境里运行pyside6-designer提示 Unable to find Python library directory. Use a framework build of Python.
所以我试了设置plugin path后 直接打开Designer.app 但是它没有加载自定义组件,所以我查阅https://doc-snapshots.qt.io/qtforpython-dev/tutorials/basictutorial/uifiles.html#custom-widgets-in-qt-designer,里面提到The launcher pyside6-designer must be used. The standalone Qt Widgets Designer will not load the plugin. 我需要使用pyside6-designer打开designer App ,所以我尝试修复pyside6-designer这个命令
我查找资料,发现他是通过PySide6.scripts.pyside_tool里的designer()函数启动的,designer启动前需要进行patch,我检查了他的designer函数,发现它在darwin平台下并没有进行虚拟环境的判断,所以我尝试修复,我从https://bugreports.qt.io/browse/PYSIDE-2795
找到了大约可行的方式(重写designer函数),但是他的代码在我的环境下不能正常运行,我修改了 lib_path = str(os.path.join(Path(sys.base_prefix),'lib',library_name)) 这个,然后他能正常打开qt designer 但是在设置os.environ["PYSIDE_DESIGNER_PLUGINS"] = str(plugin_path) 这个后,再启动designer后他就崩溃了,我确定我的plugin_path没设置错

我查阅了 以下资料并没有解决这个问题
https://bugreports.qt.io/browse/PYSIDE-2795
https://bugreports.qt.io/browse/PYSIDE-2771

@BakaDream
Copy link
Author

补充信息:
我修改了您提供的 designer.py 如下所示
`import os
from pathlib import Path
import sys

plugin_path = Path(file).parent.joinpath("plugins")
os.environ["PYSIDE_DESIGNER_PLUGINS"] = str(plugin_path)
print("插件路径:",plugin_path)

designer_path = r'/Users/dream/Documents/programing/pypool/image-process-pysiede6/.venv/lib/python3.12/site-packages/PySide6/Designer.app'

os.system(f"cd { plugin_path } && open -a {designer_path} ")
`
他会有个崩溃,进入designer后在插件信息那一栏提示
截屏2024-12-17 21 08 07

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant