-
Notifications
You must be signed in to change notification settings - Fork 0
/
hmioptions.py
52 lines (51 loc) · 1.99 KB
/
hmioptions.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
#!/usr/bin/env python3
from tkinter import *
import os
import subprocess
#window parameters
window = Tk()
window.geometry("1000x1000")
window.title("HMI Options")
#user feedback labels
aliasstatus = "cat /etc/environment | grep _JAVA_OPTIONS= | cut -b 46- | sed 's/.$//'"
data = subprocess.check_output(aliasstatus, shell=True)
status = data.decode("utf-8")
lbltext = "Anti-Alias default is ON. It is currently: "+status
lblalias = Label(window, text=lbltext, font=("Verdana", 22))
lblalias.pack()
#command to turn on anti-alias
def antialiason():
directions = "_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on'"
with open('/etc/environment', 'w') as file:
file.write(directions)
aliasstatus = "cat /etc/environment | grep _JAVA_OPTIONS= | cut -b 46- | sed 's/.$//'"
data = subprocess.check_output(aliasstatus, shell=True)
status = data.decode("utf-8")
lbltext = "Anti-Alias default is ON. It is currently: "+status
lblalias.configure(text=lbltext)
#command to turn off anti-alias
def antialiasoff():
directions = "_JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=off'"
with open('/etc/environment', 'w') as file:
file.write(directions)
aliasstatus = "cat /etc/environment | grep _JAVA_OPTIONS= | cut -b 46- | sed 's/.$//'"
data = subprocess.check_output(aliasstatus, shell=True)
status = data.decode("utf-8")
lbltext = "Anti-Alias default is ON. It is currently: "+status
lblalias.configure(text=lbltext)
#close the app
def closeapp():
os.system('pkill python')
#button turn on anti-alias
btnantialiason = Button(window, text="Anti-Alias ON", command=antialiason)
btnantialiason.pack()
#button turn off anti-alias
btnantialiasoff = Button(window, text="Anti-Alias OFF", command=antialiasoff)
btnantialiasoff.pack()
#button to close app
btnclose = Button(window, text="CLOSE", command=closeapp)
btnclose.pack()
lblwarn = Label(window, text="YOU MUST REBOOT FOR CHANGES TO TAKE EFFECT!", font=("Verdana", 22))
lblwarn.pack()
#window main loop
window.mainloop()