2023-07-11 06:48:53 +00:00
|
|
|
"""
|
2024-06-12 12:52:51 +00:00
|
|
|
* Author: PepDebian (peppermintosteam@proton.me)
|
2023-07-11 06:48:53 +00:00
|
|
|
*
|
|
|
|
* License: SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
|
|
|
* This is for the suggested packages GUI
|
|
|
|
"""
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import tkinter as tk
|
|
|
|
import ttkbootstrap as ttk
|
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
# Create the main window
|
2024-06-02 12:42:02 +00:00
|
|
|
pwin = ttk.Window(themename="peppermint")
|
2023-07-11 06:48:53 +00:00
|
|
|
pwin.title("Suggested Packages")
|
|
|
|
pwin.resizable(False, False)
|
2024-06-02 12:42:02 +00:00
|
|
|
pwin.geometry('475x470')
|
2024-06-12 12:52:51 +00:00
|
|
|
pwin.tk.call('wm', 'iconphoto', pwin, tk.PhotoImage(file='/usr/share/pixmaps/peppermint-old.png'))
|
2024-06-02 12:42:02 +00:00
|
|
|
|
|
|
|
notebook = ttk.Notebook(pwin)
|
|
|
|
# Add some tabs to the notebook
|
|
|
|
tab1 = ttk.Frame(notebook)
|
|
|
|
tab2 = ttk.Frame(notebook)
|
|
|
|
notebook.add(tab1, text="Tab 1")
|
|
|
|
notebook.add(tab2, text="Tab 2")
|
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
# Function to check if certain software packages are installed
|
2023-07-11 06:48:53 +00:00
|
|
|
def check_packages():
|
2024-06-12 12:52:51 +00:00
|
|
|
""" Check if software is installed """
|
2023-07-11 06:48:53 +00:00
|
|
|
if os.path.exists('/usr/bin/atril'):
|
|
|
|
pdf_viewer['state'] = tk.DISABLED
|
|
|
|
if os.path.exists('/usr/bin/snap'):
|
|
|
|
snap['state'] = tk.DISABLED
|
|
|
|
if os.path.exists('/usr/bin/parole'):
|
|
|
|
media_player['state'] = tk.DISABLED
|
|
|
|
if os.path.exists('/usr/bin/gufw'):
|
|
|
|
fire_wall['state'] = tk.DISABLED
|
|
|
|
if os.path.exists('/usr/bin/flatpak'):
|
|
|
|
flatpak['state'] = tk.DISABLED
|
2024-06-12 12:52:51 +00:00
|
|
|
if os.path.exists('/usr/bin/timeshift'):
|
|
|
|
backup_tool['state'] = tk.DISABLED
|
2023-07-11 06:48:53 +00:00
|
|
|
if os.path.exists('/usr/bin/gnome-software'):
|
|
|
|
store['state'] = tk.DISABLED
|
2024-06-02 12:42:02 +00:00
|
|
|
if os.path.exists('/usr/bin/keepassxc'):
|
2024-06-12 12:52:51 +00:00
|
|
|
pwd_tool['state'] = tk.DISABLED
|
2023-07-11 06:48:53 +00:00
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
# Function to check if certain web browsers are installed
|
2023-07-11 06:48:53 +00:00
|
|
|
def check_web_browsers():
|
2024-06-12 12:52:51 +00:00
|
|
|
""" Check what browsers are installed """
|
2023-07-11 06:48:53 +00:00
|
|
|
if os.path.exists('/usr/bin/firefox'):
|
|
|
|
fire_fox['state'] = tk.DISABLED
|
|
|
|
if os.path.exists('/usr/bin/konqueror'):
|
|
|
|
kde_web['state'] = tk.DISABLED
|
|
|
|
if os.path.exists('/usr/bin/qutebrowser'):
|
|
|
|
qute_web['state'] = tk.DISABLED
|
|
|
|
if os.path.exists('/usr/bin/falkon'):
|
|
|
|
falkon_web['state'] = tk.DISABLED
|
|
|
|
if os.path.exists('/usr/bin/chromium'):
|
|
|
|
chromium_web['state'] = tk.DISABLED
|
|
|
|
if os.path.exists('/usr/bin/epiphany-browser'):
|
|
|
|
gnome_web['state'] = tk.DISABLED
|
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
# Functions to install packages
|
|
|
|
def install_package(package_name, check_function):
|
|
|
|
""" Generic function to install a package and check installation status """
|
|
|
|
subprocess.Popen(["x-terminal-emulator", "-e", "sudo", "apt", "install", package_name])
|
|
|
|
check_function()
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_atril():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("atril", check_packages)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
2023-08-05 08:44:26 +00:00
|
|
|
def install_keepass():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("keepassxc", check_packages)
|
2023-08-05 08:44:26 +00:00
|
|
|
|
2023-07-11 06:48:53 +00:00
|
|
|
def install_parole():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("parole", check_packages)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_gufw():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("gufw", check_packages)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_snap():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("snapd", check_packages)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_flatpak():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("flatpak", check_packages)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_store():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("gnome-software", check_packages)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_timeshift():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("timeshift", check_packages)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_firefox():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("firefox-esr", check_web_browsers)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_konqueror():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("konqueror", check_web_browsers)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_epiphany():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("epiphany-browser", check_web_browsers)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_tor():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("torbrowser-launcher", check_web_browsers)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_qute():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("qutebrowser", check_web_browsers)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_chromium():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("chromium", check_web_browsers)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
|
|
|
def install_falkon():
|
2024-06-12 12:52:51 +00:00
|
|
|
install_package("falkon", check_web_browsers)
|
2023-07-11 06:48:53 +00:00
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
# Function to set up the software installation options based on the OS
|
2023-08-05 08:44:26 +00:00
|
|
|
def check_base_snaps():
|
|
|
|
""" If Devuan is loaded do not show snaps """
|
2024-06-12 12:52:51 +00:00
|
|
|
global flatpak, store, backup_tool, pwd_tool, snap
|
2023-08-05 08:44:26 +00:00
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
if os.path.exists("/etc/devuan_version"):
|
|
|
|
flatpak = ttk.Button(software_frame, text="Flatpak Package Platform", cursor="hand2", style="danger", command=install_flatpak)
|
|
|
|
flatpak.grid(row=4, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
store = ttk.Button(software_frame, text="Gnome Software Store", cursor="hand2", style="danger", command=install_store)
|
|
|
|
store.grid(row=5, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
backup_tool = ttk.Button(software_frame, text="TimeShift: Backup Tool", cursor="hand2", style="danger", command=install_timeshift)
|
|
|
|
backup_tool.grid(row=6, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
pwd_tool = ttk.Button(software_frame, text="KeePassXC: Password Tool", cursor="hand2", style="danger", command=install_keepass)
|
|
|
|
pwd_tool.grid(row=7, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
2023-08-05 08:44:26 +00:00
|
|
|
elif os.path.exists("/etc/debian_version"):
|
2024-06-12 12:52:51 +00:00
|
|
|
snap = ttk.Button(software_frame, text="Snap Package Platform", cursor="hand2", style="danger", command=install_snap)
|
|
|
|
snap.grid(row=4, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
flatpak = ttk.Button(software_frame, text="Flatpak Package Platform", cursor="hand2", style="danger", command=install_flatpak)
|
|
|
|
flatpak.grid(row=5, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
store = ttk.Button(software_frame, text="Gnome Software Store", cursor="hand2", style="danger", command=install_store)
|
|
|
|
store.grid(row=6, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
backup_tool = ttk.Button(software_frame, text="TimeShift: Backup Tool", cursor="hand2", style="danger", command=install_timeshift)
|
|
|
|
backup_tool.grid(row=7, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
# Create and organize the layout
|
2023-07-11 06:48:53 +00:00
|
|
|
fsw = ttk.Frame(pwin, width=200)
|
|
|
|
fsw.grid(row=2, column=0, columnspan=4)
|
2024-06-12 12:52:51 +00:00
|
|
|
software_frame = ttk.Labelframe(fsw, bootstyle="dark", text="Suggested Software")
|
|
|
|
software_frame.grid(row=5, column=0, columnspan=2, ipadx=0, ipady=0, padx=10, pady=10)
|
|
|
|
|
2023-07-11 06:48:53 +00:00
|
|
|
# Buttons for the suggested software
|
2024-06-12 12:52:51 +00:00
|
|
|
pdf_viewer = ttk.Button(software_frame, text="Atril: a document viewer", cursor="hand2", style="danger", command=install_atril)
|
|
|
|
pdf_viewer.grid(row=0, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
media_player = ttk.Button(software_frame, text="Parole: Media Player", cursor="hand2", style="danger", command=install_parole)
|
|
|
|
media_player.grid(row=2, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
fire_wall = ttk.Button(software_frame, text="gufw: GNU Firewall", cursor="hand2", style="danger", command=install_gufw)
|
|
|
|
fire_wall.grid(row=3, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
2023-08-05 08:44:26 +00:00
|
|
|
# Frame that manages the Browser buttons
|
2023-07-11 06:48:53 +00:00
|
|
|
fs = ttk.Frame(pwin)
|
|
|
|
fs.grid(row=2, column=5, columnspan=2, ipadx=0, ipady=0, padx=10, pady=10)
|
|
|
|
|
|
|
|
# Frame Title
|
2024-06-02 12:42:02 +00:00
|
|
|
soc = ttk.Labelframe(fs, bootstyle="dark", text="Suggested Web Browsers")
|
2023-07-11 06:48:53 +00:00
|
|
|
soc.grid(row=5, column=0, columnspan=2, ipadx=0, ipady=0, padx=10, pady=10)
|
|
|
|
|
|
|
|
# Web Browser Buttons
|
2024-06-12 12:52:51 +00:00
|
|
|
fire_fox = ttk.Button(soc, text="Firefox ESR Browser", cursor="hand2", style="danger", command=install_firefox)
|
2023-07-11 06:48:53 +00:00
|
|
|
fire_fox.grid(row=0, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
kde_web = ttk.Button(soc, text="Konqueror KDE Browser", cursor="hand2", style="danger", command=install_konqueror)
|
2023-07-11 06:48:53 +00:00
|
|
|
kde_web.grid(row=1, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
gnome_web = ttk.Button(soc, text="Gnome Web (Epiphany)", cursor="hand2", style="danger", command=install_epiphany)
|
2023-07-11 06:48:53 +00:00
|
|
|
gnome_web.grid(row=2, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
tor_web = ttk.Button(soc, text="Tor Browser: Privacy", cursor="hand2", style="danger", command=install_tor)
|
2023-07-11 06:48:53 +00:00
|
|
|
tor_web.grid(row=3, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
qute_web = ttk.Button(soc, text="Qutebrowser: Vim-like", cursor="hand2", style="danger", command=install_qute)
|
2023-07-11 06:48:53 +00:00
|
|
|
qute_web.grid(row=4, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
2024-06-12 12:52:51 +00:00
|
|
|
chromium_web = ttk.Button(soc, text="Chromium Browser", cursor="hand2", style="danger", command=install_chromium)
|
|
|
|
chromium_web.grid(row=5, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
falkon_web = ttk.Button(soc, text="Falkon Qt Browser", cursor="hand2", style="danger", command=install_falkon)
|
|
|
|
falkon_web.grid(row=6, column=0, ipadx=5, ipady=5, padx=5, pady=5, sticky='ew')
|
|
|
|
|
|
|
|
lblpmtitle = ttk.Label(pwin, style="F62817.TLabel", text='These suggestions are listed in the official repositories')
|
|
|
|
lblpmtitle.place(x=5, y=440)
|
|
|
|
|
2023-08-05 08:44:26 +00:00
|
|
|
check_base_snaps()
|
2024-06-12 12:52:51 +00:00
|
|
|
check_packages()
|
2023-07-11 06:48:53 +00:00
|
|
|
check_web_browsers()
|
|
|
|
pwin.mainloop()
|