Skip to content

Commit

Permalink
Initial way to make logic to install bundled fonts system wide public…
Browse files Browse the repository at this point in the history
…ly available
  • Loading branch information
dalthviz committed Feb 13, 2025
1 parent 5738510 commit 7be0cd0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions qtawesome/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.. autosummary::
:toctree: _generate
install_bundled_fonts_system_wide
icon
load_font
charmap
Expand Down Expand Up @@ -81,6 +82,10 @@
}


def install_bundled_fonts_system_wide():
_instance().install_fonts_system_wide()


def has_valid_font_ids(inst):
"""Validate instance's font ids are loaded to QFontDatabase.
Expand Down
8 changes: 8 additions & 0 deletions qtawesome/iconic_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,14 @@ def set_custom_icon(self, name, painter):
"""
self.painters[name] = painter

def install_fonts_system_wide(self):
fonts_directory = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "fonts"
)
if os.name == "nt":
fonts_directory = self._install_fonts(fonts_directory, system_wide=True)
return fonts_directory

def _custom_icon(self, name, **kwargs):
"""Return the custom icon corresponding to the given name."""
options = dict(_default_options, **kwargs)
Expand Down

0 comments on commit 7be0cd0

Please sign in to comment.