dglent / meteo-qt

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

Font size too small for temperature #127

Closed kreddkrikk closed 2 years ago

kreddkrikk commented 2 years ago

The font size is way too small for the temperature in a system tray item that is scaled to 24x24:

image

I'm using tint2 in Openbox under Arch Linux. Don't know if this issue is also affecting other panel apps or X Window Managers. I did manage to fix it in meteo_qt.py by setting the icon to QPixmap(24, 24) instead of ':/empty' (which is 64x64) and initializing it with QColorConstants.Transparent.

        # Place empty.png here to initialize the icon
        # don't paint the T° over the old value
        icon = QPixmap(24, 24) #':/empty')
        icon.fill(QColorConstants.Transparent)

And this fixes an oversized icon as a result of the above mod:

        if self.tray_type != 'temp' and self.tray_type != 'feels_like_temp':
            pt.drawPixmap(0, -4, 24, 24, self.wIcon)
            #pt.drawPixmap(0, -12, 64, 64, self.wIcon)

The result:

image

This seems to be related to scaling in tint2, which scales whatever the QPixmap image is (by default 64x64) to fit the current systray item bounds (in my case 24x24). When tint2 scales the icon, it also scales down the text with it. Perhaps create an option in the meteo-qt settings for scaling.

dglent commented 2 years ago

Thank you @kreddkrikk, i will add an option to set the initialisation icon as you did (ranges 16x16, 24x24, 32x32, 64x64) and to set the position of the text (maybe from -20 to 20...)

dglent commented 2 years ago

The option has been added in the above commit. Thanks a lot ;)