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

[Bug]: Gallery的demo运行后当在默认窗口大小时点击侧边栏的菜单按钮展开时耗时比较久 #642

Open
qianye216 opened this issue Nov 24, 2023 · 12 comments

Comments

@qianye216
Copy link

What happened?

Gallery的demo运行后当在默认窗口大小时点击侧边栏的菜单按钮展开时耗时比较久,每次展开侧边栏接近耗时1秒
但是如果最大化窗口后再点击菜单按钮进行展开则耗时正常

Operation System

Mac

Python Version

3.9.6

PyQt/PySide Version

PyQt5.15.10

PyQt/PySide-Fluent-Widgets Version

1.3.8

How to Reproduce?

这是默认窗口大小点击菜单按钮展开的耗时:
image

这是最大化窗口点击菜单按钮展开的耗时:
image

Minimum code

def toggle(self):
        """ toggle navigation panel """
        start_time = time.time()
        print(self.displayMode)
        if self.displayMode in [NavigationDisplayMode.COMPACT, NavigationDisplayMode.MINIMAL]:
            self.expand()
        else:
            self.collapse()
        end_time = time.time()
        print("toggle time: ", end_time - start_time)
@qianye216 qianye216 added the bug Something isn't working label Nov 24, 2023
@zhiyiYo
Copy link
Owner

zhiyiYo commented Nov 24, 2023

把亚克力效果关掉应该会好很多

@zhiyiYo zhiyiYo closed this as completed Nov 24, 2023
@qianye216
Copy link
Author

把亚克力效果关掉应该会好很多

我的是mac,没有启用亚克力效果呢

@qianye216
Copy link
Author

把亚克力效果关掉应该会好很多

而且默认窗口大小展开就比较耗时,最大化后就不会,很奇怪,具体是哪些代码耗时比较久需要大佬排查下了,两个不同状态耗时不是一个数量级的

@zhiyiYo
Copy link
Owner

zhiyiYo commented Nov 24, 2023

我再测试一下

@zhiyiYo zhiyiYo reopened this Nov 24, 2023
@zhiyiYo
Copy link
Owner

zhiyiYo commented Nov 24, 2023

最大化之后应该不会显示成菜单模式吧?

@zhiyiYo
Copy link
Owner

zhiyiYo commented Nov 24, 2023

最大化之后不是长这样吗:
image

@qianye216
Copy link
Author

最大化之后不是长这样吗: image

点击左上角的菜单按钮从侧边栏收起状态变成展开状态在默认窗口大小就有问题

@zhiyiYo
Copy link
Owner

zhiyiYo commented Nov 24, 2023

没用亚克力在默认窗口大小的时候应该挺快的:
image

@qianye216
Copy link
Author

qianye216 commented Nov 24, 2023

没用亚克力在默认窗口大小的时候应该挺快的: image

我逐行代码排查了下是以下代码导致耗时比较久,是否针对mac系统不用进行判断以下是否可以绘制亚力克,因为mac不支持:

if self._canDrawAcrylic():
     self.acrylicBrush.grabImage(
       QRect(self.mapToGlobal(QPoint()), QSize(self.expandWidth, self.height())))

image

@zhiyiYo
Copy link
Owner

zhiyiYo commented Nov 24, 2023

把 main_window.py 构造函数的下述代码注释掉应该就不会启用亚克力了

self.navigationInterface.setAcrylicEnabled(True)

@zhiyiYo
Copy link
Owner

zhiyiYo commented Nov 24, 2023

可以是 mac 分辨率太高导致磨砂时间过长,应该对图像进行缩放来加快磨砂速度

@qianye216
Copy link
Author

self.navigationInterface.setAcrylicEnabled(True)

谢谢大佬,注释掉后正常了

@zhiyiYo zhiyiYo removed the bug Something isn't working label Mar 25, 2024
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

2 participants