dglent / meteo-qt

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

[FR] Please add tray icon font setup #121

Closed kanyck closed 2 years ago

kanyck commented 2 years ago

Regular sans-serif is too wide so the temp reading is stripped. As a workaround I just replaced it with a font I like (Roboto Condensed), but this obviously is wrong kind of hacking... Also, I'd like to have the tray icon bigger, it's not on par with other icons in my tray. BTW, there is a typing error in meteo_qt.py: pt.setFont(QFont('sans-sertif', int(self.fontsize), weight=br)) -- should be 'sans-serif'.

dglent commented 2 years ago

Hello thanks for your proposals For the used font, i tried with Roboto Condensed and you have right, it fits much better. Maybe it needs to be verified if exists first (or will fallback to default...) For the icon, i don't know if i can do better, when i have checked the last time, normally the icon should take the whole available space https://github.com/dglent/meteo-qt/issues/45#issuecomment-166030724 i will try again ...

kanyck commented 2 years ago

That's reasonable. Maybe you should check for Roboto Condensed/Ubuntu Condensed and maybe some other popular condensed fonts, if none installed, fallback to sans-serif. BTW, thanks for your efforts! I do like meteo-qt. Where I live it's quite necessary app!

kanyck commented 2 years ago

That's how it looks in my environment. And with negative 2-digit temp readings the sides are still slightly cut out, but not as heavy as before. Quite bearable. screenshot1

(You can see that Claws Mail icon doesn't fit in well, too. It doesn't scale at all for some reason. All others do).

dglent commented 2 years ago

Ah i see better but is shown as it only in icon mode ? Which environment do you use ? I have it as this: εικόνα

If you want to display the icon and the T° then the vertical margins are filled and if the icon is scaled only horizontally will be shown with a poor ratio ... εικόνα

Maybe in "Icon mode" it could take more place (from margins (?)) , i will check again ....

kanyck commented 2 years ago

I fiddled a little bit with tint2 setlup enlarging the icon space and disabled switching between icon and temp in icon mode, now looks much better: screenshot3 I'm quite happy now))) FYI I use tint2 under Compiz standalone on Gentoo. I think this part is solved. As soon as you add the condensed font the issue may be closed. Thanks!

dglent commented 2 years ago

ok i will close later with the font modification

dglent commented 2 years ago

If you can try the above commit, you can choose the font from the dialogue

kanyck commented 2 years ago

The patch did not applied properly on v3.0 -- 2 chunks were rejected. Most probably master differs from release.

#❯ cat meteo_qt.py.rej
--- meteo_qt.py
+++ meteo_qt.py
@@ -2539,8 +2535,7 @@ def config_save(self):
         if (
             self.traycolor != traycolor
             or self.tray_type != tray_type
-            or self.fontsize != fontsize
-            or self.bold_set != bold_set
+            or self.font_tray != font_tray
             or decimal != self.temp_decimal_bool
             or toggle_tray
         ):
#❯ cat settings.py.rej
--- settings.py
+++ settings.py
@@ -354,35 +354,27 @@ def __init__(self, accurate_url, appid, parent=None):
             )
         )
         self.activate_toggle_check()
-        # Font size
-        fontsize = self.settings.value('FontSize') or '18'
-        self.fontsize_label = QLabel(
+        # Font of temperature in tray
+        self.font_tray_changed = False
+        self.font_tray_conf_new = ''
+        self.font_tray_conf = self.settings.value('FontTray') or False
+        if not self.font_tray_conf:
+            self.font_tray_conf = 'Sans Serif,18,-1,5,50,0,0,0,0,0'
+            self.settings.setValue('FontTray', self.font_tray_conf)
+        self.font_tray_label = QLabel(
             QCoreApplication.translate(
                 'Settings dialogue',
-                'Font size in tray',
+                'Temperature font in system tray',
                 'Setting for the font size of the temperature in the tray icon'
             )
         )
-        self.fontsize_spinbox = QSpinBox()
-        self.fontsize_spinbox.setRange(6, 32)
-        self.fontsize_spinbox.setValue(int(fontsize))
-        if fontsize is None or fontsize == '':
-            self.settings.setValue('FontSize', '18')
-        self.fontsize_changed = False
-        self.fontsize_spinbox.valueChanged.connect(self.fontsize_change)
-        # Font weight
-        self.bold_checkbox = QCheckBox(
-            QCoreApplication.translate(
-                'Font setting - Checkbox label',
-                'Bold',
-                'Settings dialogue'
-            )
+        font_tray_btn_label = (
+            f"{self.font_tray_conf.split(',')[0]} - "
+            f"{self.font_tray_conf.split(',')[1]} - "
+            f"{self.font_tray_conf.split(',')[-1]}"
         )
-        bold_bool = self.settings.value('Bold') or 'False'
-        self.bold_bool = eval(bold_bool)
-        self.bold_checkbox.setChecked(self.bold_bool)
-        self.bold_checkbox.stateChanged.connect(self.bold)
-        self.bold_changed = False
+        self.font_tray_btn = QPushButton(font_tray_btn_label)
+        self.font_tray_btn.clicked.connect(self.getfont)
         # Proxy
         self.proxy_label = QLabel(
             QCoreApplication.translate(
kanyck commented 2 years ago

I'd postpone this until new release: my hack still works, and I'll reopen this ticket to let you know if something goes wrong upon an update. Closing for now.

dglent commented 2 years ago

Ok thanks it will be with the 3.1