pnprog / goreviewpartner

A tool to help analyse and review your game of go (weiqi, baduk) using strong bots.
GNU General Public License v3.0
285 stars 66 forks source link

GUI scaling for hi-dpi displays #5

Open fishcu opened 6 years ago

fishcu commented 6 years ago

With the current libraries used for GUI display, is it possible to add a setting to scale the GUI by a factor of 1.25, 1.5, ..., 2, etc.? On my screen, under Ubuntu 16.04, everything GUI-related looks tiny and hard to navigate.

Thank you for providing this software!

fishcu commented 6 years ago

Here's a screenshot. The titlebar of the window and the title look normal size on my display.

goreviewpartner_gui

EDIT: comparing with screenshots on the documentation page, the font size is also wrong (or maybe correct, but it doesn't fit with the overall scaling).

pnprog commented 6 years ago

Hi! Ok, now I understand why the coordinates appear so big on you screenshot!

There must be a way to tell tkinter to adjust, I will look into it.

pnprog commented 6 years ago

Hi @fishcu,

Would you try this method and tell me if it does the trick? Edit the file main.py, and below line 36 app = Tk() insert those 3 lines:

dpi_value = app.winfo_fpixels('1i')
log("Screen DPI:",dpi_value)
app.tk.call('tk', 'scaling', '-displayof', '.', dpi_value / 72.0)

Then launch the main.py file with python again.

fishcu commented 6 years ago

The resulting display is the same (everything looks the same as before).

The reported DPI is: "Screen DPI: 96.047267356"

I'm on a 14" display, with a 2560x1440 resolution. https://www.sven.de/dpi/ calculates this as around 210 PPI.

pnprog commented 6 years ago

Ok, then the detection of proper DPI does not work. Then can try replacing those 3 lines by those 2 lines and see if it works for you?

dpi_value = 210
app.tk.call('tk', 'scaling', '-displayof', '.', dpi_value / 72.0)

If that works (of if it improves the interface) then I will make it possible to adjust this values manually in the settings.

fishcu commented 6 years ago

To avoid doing the same work twice: I'm currently working on a fix for this issue. I might come up with something this week. :)

pnprog commented 6 years ago

Great!

pnprog commented 6 years ago

@fishcu , I just pushed a commit that aims at a better adjusting of the size of marking (A, B, C, 1, 2, 3...) on the Goban. Because I noticed on all your screen-shots that the letters/numbers are bigger than the circles/stones. I am now making a sort of measurement to get the ratio fontsize/pixel (which appears to be linear) then calculate the font size so that it correspond to 0.7 of one intersection.

Also, the circles containing those letters have width adjusted based on goban size in pixel (same as the 19 lines), so they will appear larger than 1px on high resolution screen like your. And so hopefully more visible.

Could you have a try and let me know if it's working?

fishcu commented 6 years ago

Hi @pnprog

Got extremely busy the last few weeks. Sorry I didn't hold my promise ;) I will test your update soon when the chance arises. Thanks for the support!

fishcu commented 6 years ago

I noticed that in the current version, while most GUI elements are still very small, the Goban and the coordinates are rendered correctly on hi-dpi screens. Great!