• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bleachbit / bleachbit / 23113774427

15 Mar 2026 03:49PM UTC coverage: 73.163% (+2.0%) from 71.208%
23113774427

push

github

az0
Merge branch 'dev4'

654 of 873 new or added lines in 32 files covered. (74.91%)

15 existing lines in 11 files now uncovered.

7028 of 9606 relevant lines covered (73.16%)

0.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

30.3
/bleachbit/FontCheckDialog.py
1
# vim: ts=4:sw=4:expandtab
2

3
# BleachBit
4
# Copyright (C) 2008-2025 Andrew Ziem
5
# https://www.bleachbit.org
6
#
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
19

20
"""Dialog used to verify text rendering on Windows.
21

22
This is a temporary workaround.
23
"""
24

25

26
from bleachbit.GtkShim import require_gtk, Gtk
1✔
27
from bleachbit.Language import get_text as _
1✔
28

29
require_gtk()
1✔
30

31
from gi.repository import Pango
1✔
32

33

34
ALT_FONT = "Arial 14"
1✔
35

36
RESPONSE_TEXT_BLURRY = 1001
1✔
37
RESPONSE_TEXT_UNREADABLE = 1002
1✔
38

39

40
def _apply_alt_font(widget):
1✔
41
    """Apply the alternate font to a label or label-like widget."""
NEW
42
    desc = Pango.FontDescription(ALT_FONT)
×
NEW
43
    widget.modify_font(desc)
×
44

45

46
def create_font_check_dialog(parent=None):
1✔
47
    """Return the dialog prompting the user about font rendering."""
48
    dialog = Gtk.Dialog(
1✔
49
        # TRANSLATORS: Title of the font check dialog
50
        title=_("Font check"),
51
        parent=parent,
52
        flags=Gtk.DialogFlags.MODAL,
53
    )
NEW
54
    dialog.set_border_width(12)
×
NEW
55
    dialog.set_resizable(False)
×
56

NEW
57
    dialog.add_buttons(
×
58
        # TRANSLATORS: Button label in the font check dialog
59
        _("Text is okay"), Gtk.ResponseType.YES,
60
        # TRANSLATORS: Button label in the font check dialog
61
        _("Text is blurry"), RESPONSE_TEXT_BLURRY,
62
        # TRANSLATORS: Button label in the font check dialog in case the font
63
        # looks like an alien language.
64
        _("Text is unrecognizable"), RESPONSE_TEXT_UNREADABLE,
65
    )
66

67
    # To ensure user can read them, apply the alternate font to all buttons.
NEW
68
    for response_id in (
×
69
        Gtk.ResponseType.YES,
70
        RESPONSE_TEXT_BLURRY,
71
        RESPONSE_TEXT_UNREADABLE,
72
    ):
NEW
73
        button = dialog.get_widget_for_response(response_id)
×
NEW
74
        if button is not None:
×
NEW
75
            _apply_alt_font(button)
×
76

NEW
77
    content = dialog.get_content_area()
×
NEW
78
    content.set_spacing(8)
×
79

80
    # TRANSLATORS: Question shown in the font check dialog displayed
81
    # on startup on Windows. There are bugs that for some users the
82
    # font is blurry or resembles an alien language.
NEW
83
    text_quality_msg = _('Does all the text in this window look okay?')
×
NEW
84
    label_default = Gtk.Label(label=text_quality_msg)
×
NEW
85
    label_default.set_xalign(0.0)
×
NEW
86
    label_default.set_line_wrap(True)
×
87

NEW
88
    label_alt = Gtk.Label(label=text_quality_msg)
×
NEW
89
    label_alt.set_xalign(0.0)
×
NEW
90
    label_alt.set_line_wrap(True)
×
NEW
91
    _apply_alt_font(label_alt)
×
92

NEW
93
    content.pack_start(label_default, False, False, 0)
×
NEW
94
    content.pack_start(label_alt, False, False, 0)
×
95

NEW
96
    dialog.show_all()
×
NEW
97
    return dialog
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc