dglent / meteo-qt

System tray application for weather status information
GNU General Public License v3.0
82 stars 22 forks source link

Allow and account for larger font sizes #80

Closed AndydeCleyre closed 5 years ago

AndydeCleyre commented 5 years ago

This is mostly a resurrection of #41. Although it is possible to set a larger font size than the current max of 32 directly in the config file, the result gets cropped.

Here's a screenshot of the max allowed size of 32px on my system. The time in the panel is from the Event Calendar applet, with the font set to 28px. The price in the panel is from the Command Output applet, with the font set to 21px.

image

Arch Linux Plasma 5.15.3 Meteo-Qt 1.0.0

dglent commented 5 years ago

Could you increase in your installation the value in this line https://github.com/dglent/meteo-qt/blob/f69ede290088b526fbf5d48db5b33cef770b6250/meteo_qt/settings.py#L231 and see the maximum that you can set ?

Assuming that the font size cannot exceed the dimensions of it's icon (it is not a KDE widget but a tray icon)

AndydeCleyre commented 5 years ago

Looks like I can bring it up to 46 before the degree symbol starts getting cropped. That's a good point about it being limited by the tray applet itself.

AndydeCleyre commented 5 years ago

Here it is in visual context, Iosevka font, at 46, with the other text applets' sizes as in the first message.

image

dglent commented 5 years ago

Did you test also with two digits temperature ?

AndydeCleyre commented 5 years ago

Ah, no, then it gets cut off much smaller. I guess I'll just implement a text-temperature applet via the Command Output applet, and avoid the tray altogether.

AndydeCleyre commented 5 years ago

Now that I understand the systray being a size limitation, I am ok if this is closed, it's up to you if there's anything to be done here.

FWIW, if anyone else is interested, I am using this script with the Zren's Command Output plasmoid to achieve consistent panel font sizes:

image

#!/usr/bin/env python3
from time import sleep

from requests import get
from requests.exceptions import ConnectionError

from vault import DARKSKY_API_KEY, LAT, LONG

icons = {
    'rain': '\N{cloud with rain}',
    'snow': '\N{cloud with snow}',
    'sleet': '\N{cloud with rain}',
    # 'clear-day': '\N{sun with face}',
    # 'clear-night': '\N{full moon with face}',
    # 'wind': '\N{leaf fluttering in wind}',
    # 'fog': '\N{fog}',
    # 'cloudy': '\N{cloud}',
    # 'partly-cloudy-day': '\N{sun behind cloud}',
    # 'partly-cloudy-night': '\N{cloud}'
}

API_BASE = f'https://api.darksky.net/forecast/{DARKSKY_API_KEY}/{LAT},{LONG}'
for attempt in range(3):
    try:
        r = get(
            f"{API_BASE}",
            params={
                'exclude': 'minutely,hourly,daily,alerts,flags',
                'units': 'uk2'
            }
        )
    except ConnectionError:
        sleep(6)
    else:
        data = r.json()['currently']
        temp = round(data['temperature'])
        icon = icons.get(data['icon'], '')
        print(f"{temp}°{icon}")
        break
dglent commented 5 years ago

Unfortunately cannot be better as we have only the icon size width available in the taskbar The desktop widget can have more space

dglent commented 2 years ago

Font dialog to set the font of the T° in the system tray https://github.com/dglent/meteo-qt/commit/5d528e2f40c1ad5550b405a81a0d309a9f84b90e