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

bleachbit / bleachbit / 24034766860

05 Apr 2026 08:50PM UTC coverage: 73.613% (-0.03%) from 73.641%
24034766860

push

github

az0
Update translation template

7139 of 9698 relevant lines covered (73.61%)

0.74 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."""
42
    desc = Pango.FontDescription(ALT_FONT)
×
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
    )
54
    dialog.set_border_width(12)
×
55
    dialog.set_resizable(False)
×
56

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. This is one of
61
        # three buttons the user can click to report how the text appears.
62
        # The user clicks this if the text is readable but appears fuzzy.
63
        _("Text is blurry"), RESPONSE_TEXT_BLURRY,
64
        # TRANSLATORS: Button label in the font check dialog in case the font
65
        # looks like an alien language. This is one of three buttons the user
66
        # can click to report how the text appears.
67
        _("Text is unrecognizable"), RESPONSE_TEXT_UNREADABLE,
68
    )
69

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

80
    content = dialog.get_content_area()
×
81
    content.set_spacing(8)
×
82

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

91
    label_alt = Gtk.Label(label=text_quality_msg)
×
92
    label_alt.set_xalign(0.0)
×
93
    label_alt.set_line_wrap(True)
×
94
    _apply_alt_font(label_alt)
×
95

96
    content.pack_start(label_default, False, False, 0)
×
97
    content.pack_start(label_alt, False, False, 0)
×
98

99
    dialog.show_all()
×
100
    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