Skip to content

Comments

switch to PySide6==6.7.3 and force dpi to 96 for windows#1182

Open
sergey-yaroslavtsev wants to merge 3 commits intomasterfrom
windows_beauty
Open

switch to PySide6==6.7.3 and force dpi to 96 for windows#1182
sergey-yaroslavtsev wants to merge 3 commits intomasterfrom
windows_beauty

Conversation

@sergey-yaroslavtsev
Copy link
Collaborator

Closes #1179
Hopefully there are no other visual bugs... There is no possible automatic test for it unfortunately as it does not break functionality.
Forcing to remove scale factor for Windows can look ugly but I could not find any better solution. The only problem which will appear because of it is that fonts on high DPI screens will be small.
I tested 6.7.3 via local builds as shown in initial issue.
And for DPI local run (before after with scale 150%):
image

image

@vasole
Copy link
Member

vasole commented Feb 10, 2026

I fail to see if you are fixing things (versions, resolutions) everywhere or just for the frozen binaries.

@sergey-yaroslavtsev
Copy link
Collaborator Author

I fail to see if you are fixing things (versions, resolutions) everywhere or just for the frozen binaries.

  1. version is fixed in the .yml file for the release CI - so only for frozen version for Windows. I think locally user should be able to run PyMca with any PySide6 version on his own.
  2. Scale is fixed in PyMcaMain.py by adding extra OS environment variable (related to DPI scaling) only in case if sys.platform == 'win32':

@vasole
Copy link
Member

vasole commented Feb 11, 2026

Thanks. Point 1 is what I wanted to make sure it was applied.

Concerning Point 2, prior to decide the scale, I guess one should check the Desktop resolution. Unless I have missed something, the issue is mainly with the ROI Imaging Tool main window on laptops -not necessarily on windows-. That issue is not there when those laptops are docked or in desktop computers. Did I get it right?

Decisions based on desktop size instead of platform are also at other places in the code. For instance on FitParam.py to prevent the buttons of the fit configuration window from being outside the screen when the vertical resolution is less than 801 pixels (i.e. decision independent of OS but dependent on desktop resolution).

@sergey-yaroslavtsev
Copy link
Collaborator Author

Scale factor could be applied per screen (not per PC) - or example I have three screens and can set different scales for each of them at the same time. So it should not depend on docked not docked. However on desktop PC some people can also use scaling - for example if they have 27 inch 4k screen. I personally hate scaling since it ruins a lot of things but some people like it.

I was also thinking about detecting the screen resolution but it seems there is no need for it - Windows is strange and it defines DPI on its own and default is 96 no matter what is actual DPI... Then all scaling could be killed by forcing this 96.

It is not only about ROI. It is about almost any fonts where images appears, plus relative sizes of "subwindows". For example main windows should look like and actually look like with scaling of 150%

image image

Can you please navigate how to open window related to FitParam.py so i can test it?

@vasole
Copy link
Member

vasole commented Feb 11, 2026

Can you please navigate how to open window related to FitParam.py so i can test it?

Almost every module in PyMca can be executed on its own with a generic path:

python -m PyMca5.PyMca.FitParam

FitParam is part of the configuration window of the XRF fit.

@vasole
Copy link
Member

vasole commented Feb 11, 2026

I still think that with a big desktop resolution, any scaling will work and therefore it should not be necessary to touch things.

I would condition what you are doing to having a small desktop vertical resolution (1024 pixels or less?)

@t20100
Copy link
Member

t20100 commented Feb 11, 2026

Is there opened issues on this in matplotlib? how does silx view behaves in similar conditions?

@sergey-yaroslavtsev
Copy link
Collaborator Author

sergey-yaroslavtsev commented Feb 11, 2026

Is there opened issues on this in matplotlib? how does silx view behaves in similar conditions?

even more funny (with 150%, scale on latest Windows, silx==2.2.2, pyside6==6.10.2):
image

and matplotlib fonts are also weird:
image

Probably require an issue to be created.

So yes Windows scaling is a nightmare. As for Pyside6 version I think issues are related to hardcoded colors so if silx does not have it should be fine.

UPDATE:
first image-issue is not related to the scaling. It is related to silx==2.2.2 + pyside6==6.10.2; silx==2.2.2 + pyside6==6.10.0 works OK

@sergey-yaroslavtsev
Copy link
Collaborator Author

I still think that with a big desktop resolution, any scaling will work and therefore it should not be necessary to touch things.

From what i see (please correct me if you have different experience) the scaling will anyway break "matplolib fonts". I am doing test with my current display (2560x1440 27 inches).

I would condition what you are doing to having a small desktop vertical resolution (1024 pixels or less?)

Scaling indeed will change detectable resolution, so we can "allow small scaling" but not sure (just personal subjective taste) it is good idea. But if you think it is better this way a can agree. Matplotlib fonts still will be ruined but other fonts will not be so small maybe for some people it is crucial...

@vasole
Copy link
Member

vasole commented Feb 11, 2026

It seems the risk to break something playing with the scaling is higher than facing the current situation.

@sergey-yaroslavtsev
Copy link
Collaborator Author

sorry i freeze it via Ci there was compatibility issue with 6.7.3.
6.8.3 provides same fix without issue (6.9.3 works as 6.10) - tested with freezing via CI in fork
https://github.com/sergey-yaroslavtsev/pymca_ci_mod/actions/runs/21918431511/job/63294418498

It seems the risk to break something playing with the scaling is higher than facing the current situation.

Not really sure but does it make any sense to make it optional and save the choice to PyMca.ini? Of course it will require restart of the software to change the option - so some warning window can appear.

I am personally never using the scale - because it breaks not only PyMca but many things... From this perspective Windows users could be familiar with this issue.

@t20100
Copy link
Member

t20100 commented Feb 12, 2026

@sergey-yaroslavtsev thanks for the checks

| matplotlib fonts are also weird

If there's twice antialiasing applied on text, no surprise it looks ugly.

| Probably require an issue to be created.

Definitely, we'll check it for silx: silx-kit/silx#4480

@sergey-yaroslavtsev
Copy link
Collaborator Author

sergey-yaroslavtsev commented Feb 13, 2026

What if we at least fix the fonts in the plots? it do not require forcing DPI=96
Seems to be a minimal fix (last commit).

100% (normal):
image

150% (scaled):
image

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

Successfully merging this pull request may close these issues.

Windows version appearance issues

3 participants