283 lines
10 KiB
Python
283 lines
10 KiB
Python
|
#!/usr/bin/env python3
|
||
|
import os
|
||
|
import subprocess
|
||
|
import tkinter as tk
|
||
|
import time
|
||
|
from tkinter import *
|
||
|
import ttkbootstrap as ttk
|
||
|
from tkinter import font
|
||
|
#from ttkthemes import ThemedTk
|
||
|
from tkinter import PhotoImage
|
||
|
import apt
|
||
|
import putilities
|
||
|
from tendo import singleton
|
||
|
|
||
|
#makes sure only a single instance is running
|
||
|
me = singleton.SingleInstance()
|
||
|
|
||
|
#list of all checkboxes and their current value
|
||
|
checkboxstates = []
|
||
|
|
||
|
#this will set the window name and style.
|
||
|
instw = ttk.Window(themename="darkly")
|
||
|
#the window size
|
||
|
instw.geometry('680x520')
|
||
|
#the title of the window
|
||
|
instw.title("Suggested Packages")
|
||
|
#set the icon for the window
|
||
|
instw.tk.call('wm', 'iconphoto', instw._w, tk.PhotoImage(file='/usr/share/pixmaps/peppermint-old.png'))
|
||
|
|
||
|
|
||
|
#logo for the main window
|
||
|
#peplogo = PhotoImage(file = "/usr/share/pixmaps/peppermint-48.png")
|
||
|
#logo = tk.Label(instw, image=peplogo, borderwidth=0,bg='#2f2f2f').place(x=85, y=5)
|
||
|
|
||
|
#row for all the items but the logo and the title
|
||
|
row = 20
|
||
|
row2 = 360
|
||
|
|
||
|
#main title style
|
||
|
spmt = ttk.Style()
|
||
|
spmt.configure("F62817.TLabel", foreground ="#ffffff", background ="#222222", font = ("Helvetica", '22', 'bold') )
|
||
|
|
||
|
###This is all the lables and verbiage used and thier placements
|
||
|
lblpmtitle = ttk.Label(instw, style="F62817.TLabel", text="Select Your Software Packages").place(x=140, y=10)
|
||
|
lblpmsubtitle = ttk.Label(instw, bootstyle="light", text="Darkened items are already installed. \nPackages are from Debian Repositories.").place(x=row2, y=310)
|
||
|
lblpmsubtitle = ttk.Label(instw, bootstyle="light", text="At PeppermintOS, we let our users decide what software is on their system.").place(x=140, y=40)
|
||
|
|
||
|
lblsoftware = ttk.Label(instw, bootstyle="light", text="Software").place(x=100, y=80)
|
||
|
lblbrowsers = ttk.Label(instw, bootstyle="light", text="Browsers").place(x=440, y=80)
|
||
|
|
||
|
#installed message
|
||
|
|
||
|
#instaledtitle = ttk.Label(instw, style="Dark.TLabel", text="ColoF62817 Packages are installed.").place(x=row2, y=300)
|
||
|
|
||
|
#output textbox
|
||
|
textbox = Text(instw, background="#2f2f2f",foreground="white", height="50",state='disabled')
|
||
|
textbox.place(x=0, y=420, height=100, width=680)
|
||
|
textbox.configure(font = ("GNU Unifont", '8') )
|
||
|
|
||
|
#if this package is already installed, grey out the item
|
||
|
def InstallCheck(appname, checkbox):
|
||
|
if putilities.installcheck(appname):
|
||
|
checkbox.configure(state=["disabled"])
|
||
|
|
||
|
#firefox
|
||
|
firefox = StringVar()
|
||
|
firefox.set("off")
|
||
|
cbfirefox = ttk.Checkbutton(instw, bootstyle="danger", variable=firefox, onvalue='firefox-esr', offvalue="off", text="Firefox: Mozilla's Open-source browser")
|
||
|
cbfirefox.place(x=row2,y=100)
|
||
|
checkboxstates.append(firefox)
|
||
|
InstallCheck("firefox-esr", cbfirefox)
|
||
|
|
||
|
#konqueror
|
||
|
konqueror = StringVar()
|
||
|
konqueror.set("off")
|
||
|
cbkonqueror = ttk.Checkbutton(instw, bootstyle="danger", variable=konqueror, onvalue="konqueror", offvalue="off", text="Konqueror: KDE browser and file manager")
|
||
|
cbkonqueror.place(x=row2,y=120)
|
||
|
checkboxstates.append(konqueror)
|
||
|
InstallCheck("konqueror", cbkonqueror)
|
||
|
|
||
|
#epiphany-browser
|
||
|
epiphany = StringVar()
|
||
|
epiphany.set("off")
|
||
|
cbepiphany = ttk.Checkbutton(instw, bootstyle="danger", variable=epiphany, onvalue="epiphany-browser", offvalue="off", text="Gnome Web (Epiphany): Intuitive browser")
|
||
|
cbepiphany.place(x=row2,y=140)
|
||
|
checkboxstates.append(epiphany)
|
||
|
InstallCheck("epiphany-browser", cbepiphany)
|
||
|
|
||
|
#falkon
|
||
|
falkon = StringVar()
|
||
|
falkon.set("off")
|
||
|
cbfalkon = ttk.Checkbutton(instw, bootstyle="danger", variable=falkon, onvalue="falkon", offvalue="off", text="Falkon: Qt5 browser by KDE")
|
||
|
cbfalkon.place(x=row2,y=160)
|
||
|
checkboxstates.append(falkon)
|
||
|
InstallCheck("falkon", cbfalkon)
|
||
|
|
||
|
#torbrowser-launcher
|
||
|
torbrowser = StringVar()
|
||
|
torbrowser.set("off")
|
||
|
cbtorbrowser = ttk.Checkbutton(instw, bootstyle="danger", variable=torbrowser, onvalue="torbrowser-launcher", offvalue="off", text="Tor Browser: Privacy browser")
|
||
|
cbtorbrowser.place(x=row2,y=180)
|
||
|
checkboxstates.append(torbrowser)
|
||
|
InstallCheck("torbrowser-launcher", cbtorbrowser)
|
||
|
|
||
|
#midori
|
||
|
midori = StringVar()
|
||
|
midori.set("off")
|
||
|
cbmidori = ttk.Checkbutton(instw, bootstyle="danger", variable=midori, onvalue="midori", offvalue="off", text="Midori: Fast, lightweight browser")
|
||
|
cbmidori.place(x=row2,y=200)
|
||
|
checkboxstates.append(midori)
|
||
|
InstallCheck("midori", cbmidori)
|
||
|
|
||
|
#qutebrowser
|
||
|
qutebrowser = StringVar()
|
||
|
qutebrowser.set("off")
|
||
|
cbqutebrowser = ttk.Checkbutton(instw, bootstyle="danger", variable=qutebrowser, onvalue="qutebrowser", offvalue="off", text="Qutebrowser: Vim-like browser")
|
||
|
cbqutebrowser.place(x=row2,y=220)
|
||
|
checkboxstates.append(qutebrowser)
|
||
|
InstallCheck("qutebrowser", cbqutebrowser)
|
||
|
|
||
|
#luakit
|
||
|
luakit = StringVar()
|
||
|
luakit.set("off")
|
||
|
cbluakit = ttk.Checkbutton(instw, bootstyle="danger", variable=luakit, onvalue="luakit", offvalue="off", text="Luakit: Browser extensible by Lua")
|
||
|
cbluakit.place(x=row2,y=240)
|
||
|
checkboxstates.append(luakit)
|
||
|
InstallCheck("luakit", cbluakit)
|
||
|
|
||
|
#chromium
|
||
|
chromium = StringVar()
|
||
|
chromium.set("off")
|
||
|
cbchromium = ttk.Checkbutton(instw, bootstyle="danger", variable=chromium, onvalue="chromium", offvalue="off", text="Chromium: Google's Open-Source browser")
|
||
|
cbchromium.place(x=row2,y=260)
|
||
|
checkboxstates.append(chromium)
|
||
|
InstallCheck("chromium", cbchromium)
|
||
|
|
||
|
#atril
|
||
|
atril = StringVar()
|
||
|
atril.set("off")
|
||
|
cbatril = ttk.Checkbutton(instw, bootstyle="danger", variable=atril, onvalue="atril", offvalue="off", text="Atril: a multi-page document viewer")
|
||
|
cbatril.place(x=row,y=100)
|
||
|
checkboxstates.append(atril)
|
||
|
InstallCheck("atril", cbatril)
|
||
|
|
||
|
#transmission
|
||
|
transmission = StringVar()
|
||
|
transmission.set("off")
|
||
|
cbtransmission = ttk.Checkbutton(instw, bootstyle="danger", variable=transmission, onvalue="transmission", offvalue="off", text="Transmission BitTorrent Client")
|
||
|
cbtransmission.place(x=row,y=120)
|
||
|
checkboxstates.append(transmission)
|
||
|
InstallCheck("transmission", cbtransmission)
|
||
|
|
||
|
#ARandR
|
||
|
arandr = StringVar()
|
||
|
arandr.set("off")
|
||
|
cbarandr = ttk.Checkbutton(instw, bootstyle="danger", variable=arandr, onvalue="arandr", offvalue="off", text="ARandR: Another XRandR GUI")
|
||
|
cbarandr.place(x=row,y=140)
|
||
|
checkboxstates.append(arandr)
|
||
|
InstallCheck("arandr", cbarandr)
|
||
|
|
||
|
#pmount
|
||
|
pmount = StringVar()
|
||
|
pmount.set("off")
|
||
|
cbpmount = ttk.Checkbutton(instw, bootstyle="danger", variable=pmount, onvalue="pmount", offvalue="off", text="pmount: Standard mount program")
|
||
|
cbpmount.place(x=row,y=160)
|
||
|
checkboxstates.append(pmount)
|
||
|
InstallCheck("pmount", cbpmount)
|
||
|
|
||
|
#dconf-editor
|
||
|
dconfeditor = StringVar()
|
||
|
dconfeditor.set("off")
|
||
|
cbdconfeditor = ttk.Checkbutton(instw, bootstyle="danger", variable=dconfeditor, onvalue="dconf-editor", offvalue="off", text="DConf Editor: For environment settings")
|
||
|
cbdconfeditor.place(x=row,y=180)
|
||
|
checkboxstates.append(dconfeditor)
|
||
|
InstallCheck("dconf-editor", cbdconfeditor)
|
||
|
|
||
|
#gpicview
|
||
|
gpicview = StringVar()
|
||
|
gpicview.set("off")
|
||
|
cbgpicview = ttk.Checkbutton(instw, bootstyle="danger", variable=gpicview, onvalue="gpicview", offvalue="off", text="GpicView image viewer")
|
||
|
cbgpicview.place(x=row,y=200)
|
||
|
checkboxstates.append(gpicview)
|
||
|
InstallCheck("gpicview", cbgpicview)
|
||
|
|
||
|
#parole
|
||
|
parole = StringVar()
|
||
|
parole.set("off")
|
||
|
cbparole = ttk.Checkbutton(instw, bootstyle="danger", variable=parole, onvalue="parole", offvalue="off", text="Parole: Media player for Xfce")
|
||
|
cbparole.place(x=row,y=220)
|
||
|
checkboxstates.append(parole)
|
||
|
InstallCheck("parole", cbparole)
|
||
|
|
||
|
#mate-calc
|
||
|
matecalc = StringVar()
|
||
|
matecalc.set("off")
|
||
|
cbmatecalc = ttk.Checkbutton(instw, bootstyle="danger", variable=matecalc, onvalue="mate-calc", offvalue="off", text="Mate Calculator")
|
||
|
cbmatecalc.place(x=row,y=240)
|
||
|
checkboxstates.append(matecalc)
|
||
|
InstallCheck("mate-calc", cbmatecalc)
|
||
|
|
||
|
#snapd
|
||
|
snapd = StringVar()
|
||
|
snapd.set("off")
|
||
|
cbsnapd = ttk.Checkbutton(instw, bootstyle="danger", variable=snapd, onvalue="snapd", offvalue="off", text="Snap Package Platform")
|
||
|
cbsnapd.place(x=row,y=260)
|
||
|
checkboxstates.append(snapd)
|
||
|
InstallCheck("snapd", cbsnapd)
|
||
|
|
||
|
#flatpak
|
||
|
flatpak = StringVar()
|
||
|
flatpak.set("off")
|
||
|
cbflatpak = ttk.Checkbutton(instw, bootstyle="danger", variable=flatpak, onvalue="flatpak", offvalue="off", text="Flatpak Packages Platform")
|
||
|
cbflatpak.place(x=row,y=280)
|
||
|
checkboxstates.append(flatpak)
|
||
|
InstallCheck("flatpak", cbflatpak)
|
||
|
|
||
|
#gnome-software
|
||
|
gnomesoftware = StringVar()
|
||
|
gnomesoftware.set("off")
|
||
|
cbgnomesoftware = ttk.Checkbutton(instw, bootstyle="danger", variable=gnomesoftware, onvalue="gnome-software", offvalue="off", text="Gnome software store")
|
||
|
cbgnomesoftware.place(x=row,y=300)
|
||
|
checkboxstates.append(gnomesoftware)
|
||
|
InstallCheck("gnome-software", cbgnomesoftware)
|
||
|
|
||
|
#youtube-dl
|
||
|
youtubedl = StringVar()
|
||
|
youtubedl.set("off")
|
||
|
cbyoutubedl = ttk.Checkbutton(instw, bootstyle="danger", variable=youtubedl, onvalue="youtube-dl", offvalue="off", text="YouTube-DL: YouTube Downloader Tool")
|
||
|
cbyoutubedl.place(x=row,y=320)
|
||
|
checkboxstates.append(youtubedl)
|
||
|
InstallCheck("youtube-dl", cbyoutubedl)
|
||
|
|
||
|
def install(applist):
|
||
|
btn.place_forget()
|
||
|
textbox.configure(state='normal')
|
||
|
|
||
|
def textout(line):
|
||
|
textbox.insert(tk.END, line)
|
||
|
textbox.update_idletasks()
|
||
|
textbox.see("end")
|
||
|
print(line + "\n")
|
||
|
|
||
|
if(len(applist) > 0):
|
||
|
with subprocess.Popen( ["apt-get","install","-y"] + applist,shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) as p:
|
||
|
if p.stdout:
|
||
|
for line in p.stdout:
|
||
|
textout(line)
|
||
|
if p.stderr:
|
||
|
for line in p.stderr:
|
||
|
textout(line)
|
||
|
textout("Done.")
|
||
|
textbox.configure(state='disabled')
|
||
|
btn.place(x=245, y=375, height= 30, width=150)
|
||
|
def fin ():
|
||
|
instw.destroy()
|
||
|
|
||
|
def getcheckboxes():
|
||
|
btnwk = ttk.Button(instw,text="Installing...")
|
||
|
btn.place(x=245, y=375, height= 30, width=150)
|
||
|
appqueue = []
|
||
|
for item in checkboxstates:
|
||
|
if item.get() != "off":
|
||
|
appqueue.append(item.get())
|
||
|
print(appqueue)
|
||
|
|
||
|
if(len(appqueue) > 0):
|
||
|
install(appqueue)
|
||
|
else:
|
||
|
textbox.configure(state='normal')
|
||
|
textbox.insert(tk.END, "No packages selected. Please select a package.\n")
|
||
|
textbox.update_idletasks()
|
||
|
textbox.see("end")
|
||
|
textbox.configure(state='disabled')
|
||
|
|
||
|
#inital Begin install button
|
||
|
btn = ttk.Button(instw,text="Install Selected",bootstyle="light-outline",command=getcheckboxes)
|
||
|
##Placement of the Begin install button##
|
||
|
btn.place(x=245, y=375, height= 30, width=150)
|
||
|
btnf = ttk.Button(instw,bootstyle="light-outline", text="Done",command=getcheckboxes)
|
||
|
btn.place(x=245, y=375, height= 30, width=150)
|
||
|
##Start the window#
|
||
|
instw.mainloop()
|