Coverage for src/backend/InvenTree/plugin/samples/icons/icon_sample.py: 0%

11 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 17:47 +0000

1"""Sample icon pack plugin to add custom icons.""" 

2 

3from django.templatetags.static import static 

4 

5from common.icons import IconPack 

6from plugin.base.icons.mixins import IconPackMixin 

7from plugin.plugin import InvenTreePlugin 

8 

9 

10class SampleIconPlugin(IconPackMixin, InvenTreePlugin): 

11 """Example plugin to add custom icons.""" 

12 

13 NAME = 'SampleIconPackPlugin' 

14 SLUG = 'sampleicons' 

15 TITLE = 'My sample icon pack plugin' 

16 

17 VERSION = '0.0.1' 

18 

19 def icon_packs(self): 

20 """Return a list of custom icon packs.""" 

21 return [ 

22 IconPack( 

23 name='My Custom Icons', 

24 prefix='my', 

25 fonts={ 

26 'woff2': static('fontawesome/webfonts/fa-regular-400.woff2'), 

27 'woff': static('fontawesome/webfonts/fa-regular-400.woff'), 

28 'truetype': static('fontawesome/webfonts/fa-regular-400.ttf'), 

29 }, 

30 icons={ 

31 'my-icon': { 

32 'name': 'My Icon', 

33 'category': '', 

34 'tags': ['my', 'icon'], 

35 'variants': {'filled': 'f0a5', 'cool': 'f073'}, 

36 } 

37 }, 

38 ) 

39 ]