This repository was archived by the owner on Jan 3, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.py
executable file
·105 lines (94 loc) · 4.22 KB
/
menu.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env python3
"""
Raspberry Pi OS Menu: Where do you want to go today?
Copyright (C) 2020 Andrew Lee
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import tkinter
import os
from tkinter import *
from tkinter import font as tkFont
from tkinter import messagebox
app = tkinter.Tk()
# Functions
def msgbox():
msgboxMessage = messagebox.showinfo(title="Information", message="This option is currently broken.")
Label(app, text=msgboxMessage).pack()
def launchDesktop():
print("Launching Desktop")
quit()
def launchDashboard():
print("Launching Dashboard")
os.system("nohup /home/pi/menu/startDash.sh &")
#os.system("bash /home/pi/menu/dashboard.sh &")
quit()
def launchRetroPie():
print("Launching RetroPie")
#os.system("nohup sudo su -c \"systemctl stop lightdm ; ttyecho -n /dev/tty1 \"emulationstation ; sudo systemctl start lightdm\"\"")
#os.system("nohup sudo pkill Xorg ; emulationstation")
os.system("nohup /home/pi/menu/launchES.sh")
#msgbox()
quit()
def launchSteam():
print("Launching Steam Link")
os.system("/usr/bin/steamlink &")
quit()
def launchKodi():
print("Launching Kodi")
os.system("/usr/bin/kodi &")
quit()
def launchCLI():
print("Launching CLI")
os.system("sudo pkill Xorg")
quit()
# Variables
appName = "Raspberry Pi OS Menu"
appBackground = "#4d4d4d"
btnSizeW = 60
btnSizeH = 3
btnBG = "#8c8c8c"
btnABG = "#666666"
btnBD = 0
btnRelief = "flat"
labelFont = tkFont.Font(size=15, weight="bold")
btnFont = tkFont.Font(size=12, weight="bold")
print(appName + " Copyright (C) 2020 Andrew Lee\nThis program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\nThis is free software, and you are welcome to redistribute it\nunder certain conditions; type `show c' for details.\n")
print("Starting " + appName)
print("Tkinter Version:" , tkinter.TkVersion)
app.attributes('-fullscreen', True)
app.title(appName)
app.configure(bg=appBackground)
# Labels
varWelcome = StringVar()
labelWelcome = Label( app, textvariable=varWelcome, font=labelFont, bg=appBackground, fg="white")
varWelcome.set("Welcome to Raspberry Pi OS!\nWhere do you want to go today?\n")
varCopyright = StringVar()
labelCopyright = Label( app, textvariable=varCopyright, font=labelFont, bg=appBackground, fg="white")
varCopyright.set("(C) Copyright 2020, Andrew Lee. Licensed with GPL-3.0\nhttps://alee14.me")
# Buttons
btnDesktop = Button(app, text = 'Desktop', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchDesktop)
btnDashboard = Button(app, text = 'Dashboard + Mycroft AI', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchDashboard)
#btnRetroPie = Button(app, text = 'RetroPie', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchRetroPie)
btnSteamLink = Button(app, text = 'Steam Link', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, bd=btnBD, relief=btnRelief, command = launchSteam)
btnKodi = Button(app, text = 'Kodi', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, relief=btnRelief, bd=btnBD, command = launchKodi)
btnCLI = Button(app, text = 'Command Line', width=btnSizeW, height=btnSizeH, font=btnFont, bg=btnBG, activebackground=btnABG, relief=btnRelief, bd=btnBD, command = launchCLI)
# Add the components
labelWelcome.pack()
btnDesktop.pack()
btnDashboard.pack()
#btnRetroPie.pack()
btnSteamLink.pack()
btnKodi.pack()
btnCLI.pack()
labelCopyright.pack()
# Run the app
app.mainloop()