Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- from tkinter import filedialog
- from tkinter import simpledialog as spd
- import os
- import sys
- _root = frame1
- PROGRAMLIST_STARTUP = open("T:/TechOS/Virtual/Settings/PROGRAMLIST_STARTUP.set", "r").read()
- RANDOMIZE_WALLPAPERS = open("T:/TechOS/Virtual/Settings/RANDOMIZE_WALLPAPERS.set", "r").read()
- TECHMAIL_STARTUP = open("T:/TechOS/Virtual/Settings/TECHMAIL_STARTUP.set", "r").read()
- SET_WALLPAPER = open("T:/TechOS/Virtual/Settings/SET_WALLPAPER.set", "r").read()
- DARK_SYSTEM_APPS = open("T:/TechOS/Virtual/Settings/DARK_SYSTEM_APPS.set", "r").read()
- ACCENT_COLOR = open("T:/TechOS/Virtual/Settings/ACCENT_COLOR.set", "r").read()
- LARGER_BORDERS = open("T:/TechOS/Virtual/Settings/LARGER_BORDERS.set", "r").read()
- slideroff = tk.PhotoImage(file="T:/TechOS/Virtual/Images/Slider Off.png")
- slideron = tk.PhotoImage(file="T:/TechOS/Virtual/Images/Slider On.png")
- settingslabel = tk.Label(_root, text='Settings\n', font='TkDefaultFont 20', bg='white')
- settingslabel.pack(anchor='nw', padx=5, pady=5)
- plsvar = tk.BooleanVar()
- if PROGRAMLIST_STARTUP == 'False':
- plsvar.set(False)
- elif PROGRAMLIST_STARTUP == 'True':
- plsvar.set(True)
- def plsupdate():
- global plsvar
- global PROGRAMLIST_STARTUP
- if plsvar.get() == True:
- open("T:/TechOS/Virtual/Settings/PROGRAMLIST_STARTUP.set", "w").write("True")
- PROGRAMLIST_STARTUP = "True"
- elif plsvar.get() == False:
- open("T:/TechOS/Virtual/Settings/PROGRAMLIST_STARTUP.set", "w").write("False")
- PROGRAMLIST_STARTUP = "False"
- plsbutton = tk.Checkbutton(_root, bg='white', activebackground='white', text=" Show Program List on startup", compound='left', bd=0, selectcolor='white', padx=0, pady=0, command=plsupdate, variable=plsvar, offvalue=False, onvalue=True)
- plsbutton.image = slideroff
- plsbutton.selectimage = slideron
- plsbutton.config(image=plsbutton.image, selectimage=plsbutton.selectimage, indicatoron=False)
- plsbutton.pack(anchor='nw', padx=5, pady=5)
- tmsvar = tk.BooleanVar()
- if TECHMAIL_STARTUP == 'False':
- tmsvar.set(False)
- elif TECHMAIL_STARTUP == 'True':
- tmsvar.set(True)
- def tmsupdate():
- global tmsvar
- global TECHMAIL_STARTUP
- if tmsvar.get() == True:
- open("T:/TechOS/Virtual/Settings/TECHMAIL_STARTUP.set", "w").write("True")
- TECHMAIL_STARTUP = "True"
- elif tmsvar.get() == False:
- open("T:/TechOS/Virtual/Settings/TECHMAIL_STARTUP.set", "w").write("False")
- TECHMAIL_STARTUP = "False"
- tmsbutton = tk.Checkbutton(_root, bg='white', activebackground='white', text=" Run TechMail on startup", compound='left', bd=0, selectcolor='white', padx=0, pady=0, command=tmsupdate, variable=tmsvar, offvalue=False, onvalue=True)
- tmsbutton.image = slideroff
- tmsbutton.selectimage = slideron
- tmsbutton.config(image=tmsbutton.image, selectimage=tmsbutton.selectimage, indicatoron=False)
- tmsbutton.pack(anchor='nw', padx=5, pady=5)
- dsavar = tk.BooleanVar()
- if DARK_SYSTEM_APPS == 'False':
- dsavar.set(False)
- elif DARK_SYSTEM_APPS == 'True':
- dsavar.set(True)
- def dsaupdate():
- global dsavar
- global DARK_SYSTEM_APPS
- if dsavar.get() == True:
- open("T:/TechOS/Virtual/Settings/DARK_SYSTEM_APPS.set", "w").write("True")
- DARK_SYSTEM_APPS = "True"
- elif dsavar.get() == False:
- open("T:/TechOS/Virtual/Settings/DARK_SYSTEM_APPS.set", "w").write("False")
- DARK_SYSTEM_APPS = "False"
- dsabutton = tk.Checkbutton(_root, bg='white', activebackground='white', text=" Dark mode for system apps", compound='left', bd=0, selectcolor='white', padx=0, pady=0, command=dsaupdate, variable=dsavar, offvalue=False, onvalue=True)
- dsabutton.image = slideroff
- dsabutton.selectimage = slideron
- dsabutton.config(image=dsabutton.image, selectimage=dsabutton.selectimage, indicatoron=False)
- dsabutton.pack(anchor='nw', padx=5, pady=5)
- lwbvar = tk.BooleanVar()
- if LARGER_BORDERS == 'False':
- lwbvar.set(False)
- elif LARGER_BORDERS == 'True':
- lwbvar.set(True)
- def lwbupdate():
- global lwbvar
- global LARGER_BORDERS
- if lwbvar.get() == True:
- open("T:/TechOS/Virtual/Settings/LARGER_BORDERS.set", "w").write("True")
- LARGER_BORDERS = "True"
- elif lwbvar.get() == False:
- open("T:/TechOS/Virtual/Settings/LARGER_BORDERS.set", "w").write("False")
- LARGER_BORDERS = "False"
- lwbbutton = tk.Checkbutton(_root, bg='white', activebackground='white', text=" Make window borders larger for easier resizing", compound='left', bd=0, selectcolor='white', padx=0, pady=0, command=lwbupdate, variable=lwbvar, offvalue=False, onvalue=True)
- lwbbutton.image = slideroff
- lwbbutton.selectimage = slideron
- lwbbutton.config(image=lwbbutton.image, selectimage=lwbbutton.selectimage, indicatoron=False)
- lwbbutton.pack(anchor='nw', padx=5, pady=5)
- rdwvar = tk.BooleanVar()
- if RANDOMIZE_WALLPAPERS == 'False':
- rdwvar.set(False)
- elif RANDOMIZE_WALLPAPERS == 'True':
- rdwvar.set(True)
- def rdwupdate():
- global rdwvar
- global RANDOMIZE_WALLPAPERS
- if rdwvar.get() == True:
- open("T:/TechOS/Virtual/Settings/RANDOMIZE_WALLPAPERS.set", "w").write("True")
- RANDOMIZE_WALLPAPERS = "True"
- elif rdwvar.get() == False:
- open("T:/TechOS/Virtual/Settings/RANDOMIZE_WALLPAPERS.set", "w").write("False")
- RANDOMIZE_WALLPAPERS = "False"
- rdwbutton = tk.Checkbutton(_root, bg='white', activebackground='white', text=" Randomize Wallpapers", compound='left', bd=0, selectcolor='white', padx=0, pady=0, command=rdwupdate, variable=rdwvar, offvalue=False, onvalue=True)
- rdwbutton.image = slideroff
- rdwbutton.selectimage = slideron
- rdwbutton.config(image=rdwbutton.image, selectimage=rdwbutton.selectimage, indicatoron=False)
- rdwbutton.pack(anchor='nw', padx=5, pady=5)
- def setwallpaper():
- global filedialog
- global rdwbutton
- global rdwupdate
- global os
- nwppath = filedialog.askopenfilename(filetypes=[('Supported Files', '.png .jpg .jpeg'), ('Portable Network Graphics', '.png'), ('Joint Photographic Experts Group Images', '.jpg .jpeg')], title='Open Wallpaper')
- try:
- nwp = open(nwppath, 'rb')
- nwpconts = nwp.read()
- nwp.close()
- extension = os.path.splitext(nwppath)[1]
- nwpf = open('T:\TechOS\Virtual\Images\Wallpapers\Custom' + extension, 'wb')
- nwpf.write(nwpconts)
- nwpf.close()
- swpfile = open("T:/TechOS/Virtual/Settings/SET_WALLPAPER.set", "w")
- swpfile.write("Custom" + extension)
- rdwbutton.deselect()
- rdwupdate()
- except FileNotFoundError:
- pass
- swpbutton = tk.Button(_root, bg='white', bd=0, activebackground='lightgray', text='Set Custom Background', command=setwallpaper)
- swpbutton.pack(anchor='nw', padx=5, pady=5)
- def removecwp():
- try:
- os.remove('T:/TechOS/Virtual/Images/Wallpapers/Custom.png')
- except FileNotFoundError:
- pass
- try:
- os.remove('T:/TechOS/Virtual/Images/Wallpapers/Custom.jpg')
- except FileNotFoundError:
- pass
- try:
- os.remove('T:/TechOS/Virtual/Images/Wallpapers/Custom.jpeg')
- except FileNotFoundError:
- pass
- rwpbutton = tk.Button(_root, bg='white', bd=0, activebackground='lightgray', text='Remove Custom Wallpapers', command=removecwp)
- rwpbutton.pack(anchor='nw', padx=5, pady=5)
- def setaccentcolor():
- global spd
- newcolor = spd.askstring("Change Accent Color", "Type the accent color in 6-digit hexadecimal format (#0a1b2c):")
- if newcolor.startswith("#") and len(newcolor) == 7:
- open("T:/TechOS/Virtual/Settings/ACCENT_COLOR.set", "w").write(newcolor)
- else:
- pass
- sacbutton = tk.Button(_root, bg='white', bd=0, activebackground='lightgray', text='Set Accent Color', command=setaccentcolor)
- sacbutton.pack(anchor='nw', padx=5, pady=5)
- def rsaccentcolor():
- open("T:/TechOS/Virtual/Settings/ACCENT_COLOR.set", "w").write("#0090ff")
- rsabutton = tk.Button(_root, bg='white', bd=0, activebackground='lightgray', text='Reset Accent Color', command=rsaccentcolor)
- rsabutton.pack(anchor='nw', padx=5, pady=5)
- def restarttechos():
- global sys
- root.destroy()
- exec(compile(open("T:/TechOS/Virtual/TechOS.py", "rb").read(), "T:/TechOS/Virtual/TechOS.py", 'exec'), {})
- sys.exit()
- restartbutton = tk.Button(_root, bg='white', bd=0, activebackground='lightgray', text='Restart to apply changes', command=restarttechos)
- restartbutton.pack(side='bottom', anchor='sw', padx=5, pady=5)
- if DARK_SYSTEM_APPS == "True":
- frame1.config(bg='gray10')
- settingslabel.config(bg='gray10', fg='gray90')
- plsbutton.config(bg='gray10', selectcolor='gray10', fg='gray90', activebackground='gray20', activeforeground='gray90')
- tmsbutton.config(bg='gray10', selectcolor='gray10', fg='gray90', activebackground='gray20', activeforeground='gray90')
- dsabutton.config(bg='gray10', selectcolor='gray10', fg='gray90', activebackground='gray20', activeforeground='gray90')
- rdwbutton.config(bg='gray10', selectcolor='gray10', fg='gray90', activebackground='gray20', activeforeground='gray90')
- lwbbutton.config(bg='gray10', selectcolor='gray10', fg='gray90', activebackground='gray20', activeforeground='gray90')
- swpbutton.config(bg='gray10', activebackground='gray20', fg='gray90', activeforeground='gray90')
- rwpbutton.config(bg='gray10', activebackground='gray20', fg='gray90', activeforeground='gray90')
- sacbutton.config(bg='gray10', activebackground='gray20', fg='gray90', activeforeground='gray90')
- rsabutton.config(bg='gray10', activebackground='gray20', fg='gray90', activeforeground='gray90')
- restartbutton.config(bg='gray10', activebackground='gray20', fg='gray90', activeforeground='gray90')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement