-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNoiceGRUB.py
53 lines (47 loc) · 2.19 KB
/
NoiceGRUB.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from noicegrub import *
from noicegrub.template import NgCommonProps
from noicegrub.template.noice import NgNoiceTemplate
from noicegrub.template.theman import NgTheManTemplate
from noicegrub.template.mountains import NgMountainsTemplate
from noicegrub.template.nico import NgNicoTemplate
from rich import print as richprint
from rich.console import Console
from rich.markdown import Markdown
from rich.prompt import IntPrompt,Confirm
from rich.panel import Panel
import os
init()
console = Console()
richprint(Panel("[cyan bold]" + banner + "[/cyan bold]",width=65,border_style="cyan"))
table,preset_dict = preset_table()
console.print(table)
richprint("[cyan bold][ 0 ][/cyan bold] [green bold]Instructions for creating a preset[/green bold]")
richprint("[cyan bold][ 99 ][/cyan bold] [green bold]Remove installed NoiceGRUB theme[/green bold]")
choice = IntPrompt.ask("[yellow]Choice[/yellow]",choices=gen_choices(preset_dict))
if choice == 0:
console.print(Markdown(open('noicegrub/createpreset.md').read()))
exit()
elif choice == 99:
richprint('\n[green bold]Executing scripts/remove.sh ... [/green bold]')
os.system('sudo ./scripts/remove.sh')
richprint('[green bold]Done[/green bold]')
exit()
print()
preset = get_preset(preset_dict[choice])
table = preset_info_table(preset)
console.print(table)
font_file = preset[1]['font_family']
if not os.path.exists(f'./fonts/{font_file}'):
richprint(f'[red bold][Error] {font_file} is not present in ./fonts/ [/red bold]')
exit()
if preset[0]=='Kewl': NgCommonProps(preset).export_theme()
elif preset[0]=='Noice': NgNoiceTemplate(preset).export_theme()
elif preset[0]=='TheMan': NgTheManTemplate(preset).export_theme()
elif preset[0]=='Mountains': NgMountainsTemplate(preset).export_theme()
elif preset[0]=='Nico': NgNicoTemplate(preset).export_theme()
richprint('\n[cyan bold]Generated theme has been placed in ./export/ [/cyan bold]')
choice = Confirm.ask("[yellow bold]Would you like to install the theme ?[/yellow bold]")
if choice:
richprint('\n[green bold]Executing scripts/install.sh ... [/green bold]')
os.system('sudo ./scripts/install.sh')
richprint('[green bold]Done[/green bold]')