Daniel Brötzmann pushed to branch master at gajim / gajim
Commits: c08ccb30 by wurstsalat at 2022-08-13T10:28:37+02:00 imprv: CSS: Use relative sizes for fonts
- - - - - 0da402a7 by wurstsalat at 2022-08-13T10:30:25+02:00 imprv: Windows: Increase default font size
- - - - -
3 changed files:
- gajim/common/const.py - gajim/data/style/gajim.css - gajim/gtk/css_config.py
Changes:
===================================== gajim/common/const.py ===================================== @@ -163,6 +163,7 @@ class StyleAttr(Enum):
@unique class CSSPriority(IntEnum): + PRE_APPLICATION = 599 APPLICATION = 600 APPLICATION_DARK = 601 DEFAULT_THEME = 610
===================================== gajim/data/style/gajim.css ===================================== @@ -92,19 +92,19 @@ .conversation-call-box { padding: 12px; } .conversation-call-box label { - font-size: small; + font-size: 90%; } .conversation-meta { color: @insensitive_fg_color; - font-size: small; + font-size: 90%; } .conversation-read-marker { color: @insensitive_fg_color; - font-size: small; + font-size: 90%; font-style: italic; } .conversation-nickname { - font-size: small; + font-size: 90%; font-weight: bold; } .code-widget { @@ -120,7 +120,7 @@ .code-widget-header { border-top-right-radius: 3px; } .code-widget-header label { - font-size: small; + font-size: 90%; } .code-widget-header button { padding: 0; @@ -172,7 +172,7 @@ .selection-bar { border-bottom-right-radius: 6px; } .small-label { - font-size: small; + font-size: 90%; }
/* ChatList with Workspace and Account sidebars */ @@ -399,7 +399,7 @@ .header-box label { padding: 12px 18px 6px 18px; font-weight: bold; color: @insensitive_fg_color; - font-size: small; + font-size: 90%; } .header-box-first label { padding: 0px 18px 6px 18px; @@ -418,7 +418,7 @@ .search-view-row-grid textview text { background: transparent; } .search-view-row-grid label { - font-size: small; + font-size: 90%; } .search-view-counter label { font-style: italic; @@ -428,7 +428,7 @@ .search-view-header { padding: 12px 6px 6px 6px; } .search-view-header label { - font-size: small; + font-size: 90%; color: @insensitive_fg_color; }
@@ -439,7 +439,7 @@ .resource-selector list row {
/* Profile window */ #NicknameEntry:disabled { - font-size: 28px; + font-size: 2.3rem; font-weight: bold; border: none; padding: 0px 0px 0px 0px; @@ -484,7 +484,7 @@ .stack-header { padding: 9px 9px; } #ContactNameEntry:disabled { - font-size: 24px; + font-size: 2.0rem; font-weight: bold; border: none; padding: 0px 0px 0px 0px; @@ -494,25 +494,25 @@ #ContactNameEntry:disabled {
/* Emoticon Popover */ popover#EmoticonPopover button { background: none; border: none; box-shadow:none; padding: 0px;} -popover#EmoticonPopover button > label { font-size: 24px; } -popover#EmoticonPopover flowboxchild > label { font-size: 24px; } +popover#EmoticonPopover button > label { font-size: 2.0rem; } +popover#EmoticonPopover flowboxchild > label { font-size: 2.0rem; } popover#EmoticonPopover flowboxchild { padding-top: 5px; padding-bottom: 5px; } popover#EmoticonPopover scrolledwindow { border: none; } popover#EmoticonPopover { padding: 5px; background-color: @theme_unfocused_base_color; }
-.emoji-chooser-heading { font-size: 13px; font-weight: bold; padding: 5px;} +.emoji-chooser-heading { font-size: 1.15rem; font-weight: bold; padding: 5px;} .emoji-chooser-flowbox { padding-left: 5px; padding-right: 11px; } .emoji-modifier-chooser-flowbox { padding-left: 5px; }
/* HistorySyncAssistant */ #HistorySyncAssistant notebook { padding: 18px; } -#HistorySyncAssistant progressbar text { color: #000; font-size: 18px; padding: 10px;} +#HistorySyncAssistant progressbar text { color: #000; font-size: 1.6rem; padding: 10px;} #HistorySyncAssistant list { border: 1px solid; border-color: @borders; } #HistorySyncAssistant list > row { padding: 10px 30px 10px 30px; } #HistorySyncAssistant list > row > label { color: @insensitive_fg_color; } #HistorySyncAssistant list > row.activatable > label { color: @theme_text_color; } #HistorySyncAssistant list > row.activatable:selected > label { color: @theme_selected_fg_color; } -#FinishedLabel { font-size: 14px; font-weight: bold; } +#FinishedLabel { font-size: 1.2rem; font-weight: bold; }
/* Server Info */ #ServerInfo { border: 1px solid; border-color: @borders; } @@ -546,7 +546,7 @@ window.settings-dialog list { }
/* GenericSetting */ -#SubDescription { color: @insensitive_fg_color; font-size: small;} +#SubDescription { color: @insensitive_fg_color; font-size: 90%;} #GenericSettingBox { margin-left: 30px; } #GenericSettingBox > label { padding-right: 3px; }
@@ -617,7 +617,7 @@ .accounts-settings stack > box { margin:30px; } .accounts-label-row { padding-top: 10px; padding-bottom: 10px; - font-size: 18px; + font-size: 1.6rem; font-weight: bold; color: @insensitive_fg_color;}
@@ -742,9 +742,18 @@ .theme_popover_listbox row:focus { outline: none; } /* Text style */
.bold { font-weight: bold; } -.bold16 { font-size: 16px; font-weight: bold; } -.bold24 { font-size: 24px; font-weight: bold; } -.large-header { font-size: 20px; font-weight: bold; } +.bold16 { + font-size: 1.33rem; + font-weight: bold; +} +.bold24 { + font-size: 2.0rem; + font-weight: bold; +} +.large-header { + font-size: 1.75rem; + font-weight: bold; +} .insensitive-fg-color {color: @insensitive_fg_color;}
/* Padding/Margins */ @@ -782,8 +791,8 @@ .unencrypted-color { color: @error_color; } .receipt-received-color { color: rgb(75, 181, 67); }
/*Dataforms*/ -.field-fixed { font-size: 16px; font-weight: bold; padding-top:5px;} -.data-form-title { font-size: 16px; font-weight: bold; } +.field-fixed { font-size: 1.33rem; font-weight: bold; padding-top:5px;} +.data-form-title { font-size: 1.33rem; font-weight: bold; } .data-form-widget grid { margin: 0px 18px 18px 18px; } .data-form-widget treeview { padding: 5px; } .data-form-widget scrolledwindow { border: 1px solid; border-color:@unfocused_borders; }
===================================== gajim/gtk/css_config.py ===================================== @@ -23,6 +23,7 @@ import math import logging from pathlib import Path +import sys
from gi.repository import Gtk from gi.repository import Gdk @@ -115,12 +116,15 @@ def __init__(self) -> None: self._load_default() self._load_selected() self._activate_theme() - + Gtk.StyleContext.add_provider_for_screen( Gdk.Screen.get_default(), self._provider, CSSPriority.USER_THEME)
+ if sys.platform == 'win32': + self._apply_windows_font_size() + @property def prefer_dark(self) -> bool: setting = app.settings.get('dark_theme') @@ -185,6 +189,19 @@ def _activate_css(self, css: str, priority: CSSPriority) -> None: except Exception: log.exception('Error loading application css')
+ @staticmethod + def _apply_windows_font_size() -> None: + css = ''' + * { + font-size: 1.125rem; + } + ''' + provider = Gtk.CssProvider() + provider.load_from_data(bytes(css.encode('utf-8'))) + Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), + provider, + CSSPriority.PRE_APPLICATION) + @staticmethod def _pango_to_css_weight(number: int) -> int: # Pango allows for weight values between 100 and 1000
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/d9ac569c221dca9ef8272837a516a10d...