Daniel Brötzmann pushed to branch master at gajim / gajim

Commits:

3 changed files:

Changes:

  • gajim/common/const.py
    ... ... @@ -163,6 +163,7 @@ class StyleAttr(Enum):
    163 163
     
    
    164 164
     @unique
    
    165 165
     class CSSPriority(IntEnum):
    
    166
    +    PRE_APPLICATION = 599
    
    166 167
         APPLICATION = 600
    
    167 168
         APPLICATION_DARK = 601
    
    168 169
         DEFAULT_THEME = 610
    

  • gajim/data/style/gajim.css
    ... ... @@ -92,19 +92,19 @@ .conversation-call-box {
    92 92
         padding: 12px;
    
    93 93
     }
    
    94 94
     .conversation-call-box label {
    
    95
    -    font-size: small;
    
    95
    +    font-size: 90%;
    
    96 96
     }
    
    97 97
     .conversation-meta {
    
    98 98
         color: @insensitive_fg_color;
    
    99
    -    font-size: small;
    
    99
    +    font-size: 90%;
    
    100 100
     }
    
    101 101
     .conversation-read-marker {
    
    102 102
         color: @insensitive_fg_color;
    
    103
    -    font-size: small;
    
    103
    +    font-size: 90%;
    
    104 104
         font-style: italic;
    
    105 105
     }
    
    106 106
     .conversation-nickname {
    
    107
    -    font-size: small;
    
    107
    +    font-size: 90%;
    
    108 108
         font-weight: bold;
    
    109 109
     }
    
    110 110
     .code-widget {
    
    ... ... @@ -120,7 +120,7 @@ .code-widget-header {
    120 120
         border-top-right-radius: 3px;
    
    121 121
     }
    
    122 122
     .code-widget-header label {
    
    123
    -    font-size: small;
    
    123
    +    font-size: 90%;
    
    124 124
     }
    
    125 125
     .code-widget-header button {
    
    126 126
         padding: 0;
    
    ... ... @@ -172,7 +172,7 @@ .selection-bar {
    172 172
         border-bottom-right-radius: 6px;
    
    173 173
     }
    
    174 174
     .small-label {
    
    175
    -    font-size: small;
    
    175
    +    font-size: 90%;
    
    176 176
     }
    
    177 177
     
    
    178 178
     /* ChatList with Workspace and Account sidebars */
    
    ... ... @@ -399,7 +399,7 @@ .header-box label {
    399 399
     	padding: 12px 18px 6px 18px;
    
    400 400
     	font-weight: bold;
    
    401 401
     	color: @insensitive_fg_color;
    
    402
    -	font-size: small;
    
    402
    +	font-size: 90%;
    
    403 403
     }
    
    404 404
     .header-box-first label {
    
    405 405
     	padding: 0px 18px 6px 18px;
    
    ... ... @@ -418,7 +418,7 @@ .search-view-row-grid textview text {
    418 418
     	background: transparent;
    
    419 419
     }
    
    420 420
     .search-view-row-grid label {
    
    421
    -    font-size: small;
    
    421
    +    font-size: 90%;
    
    422 422
     }
    
    423 423
     .search-view-counter label {
    
    424 424
         font-style: italic;
    
    ... ... @@ -428,7 +428,7 @@ .search-view-header {
    428 428
         padding: 12px 6px 6px 6px;
    
    429 429
     }
    
    430 430
     .search-view-header label {
    
    431
    -    font-size: small;
    
    431
    +    font-size: 90%;
    
    432 432
         color: @insensitive_fg_color;
    
    433 433
     }
    
    434 434
     
    
    ... ... @@ -439,7 +439,7 @@ .resource-selector list row {
    439 439
     
    
    440 440
     /*  Profile window */
    
    441 441
     #NicknameEntry:disabled {
    
    442
    -    font-size: 28px;
    
    442
    +    font-size: 2.3rem;
    
    443 443
         font-weight: bold;
    
    444 444
         border: none;
    
    445 445
         padding: 0px 0px 0px 0px;
    
    ... ... @@ -484,7 +484,7 @@ .stack-header {
    484 484
         padding: 9px 9px;
    
    485 485
     }
    
    486 486
     #ContactNameEntry:disabled {
    
    487
    -    font-size: 24px;
    
    487
    +    font-size: 2.0rem;
    
    488 488
         font-weight: bold;
    
    489 489
         border: none;
    
    490 490
         padding: 0px 0px 0px 0px;
    
    ... ... @@ -494,25 +494,25 @@ #ContactNameEntry:disabled {
    494 494
     
    
    495 495
     /* Emoticon Popover */
    
    496 496
     popover#EmoticonPopover button { background: none; border: none; box-shadow:none; padding: 0px;}
    
    497
    -popover#EmoticonPopover button > label { font-size: 24px; }
    
    498
    -popover#EmoticonPopover flowboxchild > label { font-size: 24px; }
    
    497
    +popover#EmoticonPopover button > label { font-size: 2.0rem; }
    
    498
    +popover#EmoticonPopover flowboxchild > label { font-size: 2.0rem; }
    
    499 499
     popover#EmoticonPopover flowboxchild { padding-top: 5px; padding-bottom: 5px; }
    
    500 500
     popover#EmoticonPopover scrolledwindow { border: none; }
    
    501 501
     popover#EmoticonPopover { padding: 5px; background-color: @theme_unfocused_base_color; }
    
    502 502
     
    
    503
    -.emoji-chooser-heading { font-size: 13px; font-weight: bold; padding: 5px;}
    
    503
    +.emoji-chooser-heading { font-size: 1.15rem; font-weight: bold; padding: 5px;}
    
    504 504
     .emoji-chooser-flowbox { padding-left: 5px; padding-right: 11px; }
    
    505 505
     .emoji-modifier-chooser-flowbox { padding-left: 5px; }
    
    506 506
     
    
    507 507
     /* HistorySyncAssistant */
    
    508 508
     #HistorySyncAssistant notebook { padding: 18px; }
    
    509
    -#HistorySyncAssistant progressbar text { color: #000; font-size: 18px; padding: 10px;}
    
    509
    +#HistorySyncAssistant progressbar text { color: #000; font-size: 1.6rem; padding: 10px;}
    
    510 510
     #HistorySyncAssistant list { border: 1px solid; border-color: @borders; }
    
    511 511
     #HistorySyncAssistant list > row { padding: 10px 30px 10px 30px; }
    
    512 512
     #HistorySyncAssistant list > row > label { color: @insensitive_fg_color; }
    
    513 513
     #HistorySyncAssistant list > row.activatable > label { color: @theme_text_color; }
    
    514 514
     #HistorySyncAssistant list > row.activatable:selected > label { color: @theme_selected_fg_color; }
    
    515
    -#FinishedLabel { font-size: 14px; font-weight: bold; }
    
    515
    +#FinishedLabel { font-size: 1.2rem; font-weight: bold; }
    
    516 516
     
    
    517 517
     /* Server Info */
    
    518 518
     #ServerInfo { border: 1px solid; border-color: @borders; }
    
    ... ... @@ -546,7 +546,7 @@ window.settings-dialog list {
    546 546
     }
    
    547 547
     
    
    548 548
     /* GenericSetting */
    
    549
    -#SubDescription { color: @insensitive_fg_color; font-size: small;}
    
    549
    +#SubDescription { color: @insensitive_fg_color; font-size: 90%;}
    
    550 550
     #GenericSettingBox { margin-left: 30px; }
    
    551 551
     #GenericSettingBox > label { padding-right: 3px; }
    
    552 552
     
    
    ... ... @@ -617,7 +617,7 @@ .accounts-settings stack > box { margin:30px; }
    617 617
     .accounts-label-row {
    
    618 618
         padding-top: 10px;
    
    619 619
         padding-bottom: 10px;
    
    620
    -    font-size: 18px;
    
    620
    +    font-size: 1.6rem;
    
    621 621
         font-weight: bold;
    
    622 622
         color: @insensitive_fg_color;}
    
    623 623
     
    
    ... ... @@ -742,9 +742,18 @@ .theme_popover_listbox row:focus { outline: none; }
    742 742
     /* Text style */
    
    743 743
     
    
    744 744
     .bold { font-weight: bold; }
    
    745
    -.bold16 { font-size: 16px; font-weight: bold; }
    
    746
    -.bold24 { font-size: 24px; font-weight: bold; }
    
    747
    -.large-header { font-size: 20px; font-weight: bold; }
    
    745
    +.bold16 {
    
    746
    +    font-size: 1.33rem;
    
    747
    +    font-weight: bold;
    
    748
    +}
    
    749
    +.bold24 {
    
    750
    +    font-size: 2.0rem;
    
    751
    +    font-weight: bold;
    
    752
    +}
    
    753
    +.large-header {
    
    754
    +    font-size: 1.75rem;
    
    755
    +    font-weight: bold;
    
    756
    +}
    
    748 757
     .insensitive-fg-color {color: @insensitive_fg_color;}
    
    749 758
     
    
    750 759
     /* Padding/Margins */
    
    ... ... @@ -782,8 +791,8 @@ .unencrypted-color { color: @error_color; }
    782 791
     .receipt-received-color { color: rgb(75, 181, 67); }
    
    783 792
     
    
    784 793
     /*Dataforms*/
    
    785
    -.field-fixed { font-size: 16px; font-weight: bold; padding-top:5px;}
    
    786
    -.data-form-title { font-size: 16px; font-weight: bold; }
    
    794
    +.field-fixed { font-size: 1.33rem; font-weight: bold; padding-top:5px;}
    
    795
    +.data-form-title { font-size: 1.33rem; font-weight: bold; }
    
    787 796
     .data-form-widget grid { margin: 0px 18px 18px 18px; }
    
    788 797
     .data-form-widget treeview { padding: 5px; }
    
    789 798
     .data-form-widget scrolledwindow { border: 1px solid; border-color:@unfocused_borders; }
    

  • gajim/gtk/css_config.py
    ... ... @@ -23,6 +23,7 @@
    23 23
     import math
    
    24 24
     import logging
    
    25 25
     from pathlib import Path
    
    26
    +import sys
    
    26 27
     
    
    27 28
     from gi.repository import Gtk
    
    28 29
     from gi.repository import Gdk
    
    ... ... @@ -115,12 +116,15 @@ def __init__(self) -> None:
    115 116
             self._load_default()
    
    116 117
             self._load_selected()
    
    117 118
             self._activate_theme()
    
    118
    -
    
    119
    +        
    
    119 120
             Gtk.StyleContext.add_provider_for_screen(
    
    120 121
                 Gdk.Screen.get_default(),
    
    121 122
                 self._provider,
    
    122 123
                 CSSPriority.USER_THEME)
    
    123 124
     
    
    125
    +        if sys.platform == 'win32':
    
    126
    +            self._apply_windows_font_size()
    
    127
    +
    
    124 128
         @property
    
    125 129
         def prefer_dark(self) -> bool:
    
    126 130
             setting = app.settings.get('dark_theme')
    
    ... ... @@ -185,6 +189,19 @@ def _activate_css(self, css: str, priority: CSSPriority) -> None:
    185 189
             except Exception:
    
    186 190
                 log.exception('Error loading application css')
    
    187 191
     
    
    192
    +    @staticmethod
    
    193
    +    def _apply_windows_font_size() -> None:
    
    194
    +        css = '''
    
    195
    +        * {
    
    196
    +            font-size: 1.125rem;
    
    197
    +        }
    
    198
    +        '''
    
    199
    +        provider = Gtk.CssProvider()
    
    200
    +        provider.load_from_data(bytes(css.encode('utf-8')))
    
    201
    +        Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
    
    202
    +                                                 provider,
    
    203
    +                                                 CSSPriority.PRE_APPLICATION)
    
    204
    +
    
    188 205
         @staticmethod
    
    189 206
         def _pango_to_css_weight(number: int) -> int:
    
    190 207
             # Pango allows for weight values between 100 and 1000