2023-01-19 11:05:14 -01:00
|
|
|
"""
|
|
|
|
* Author: "PepDebian(peppermintosteam@proton.me)
|
|
|
|
*
|
|
|
|
* License: SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
|
|
|
* This script is used to help get the wallpapers
|
|
|
|
"""
|
2022-07-19 18:52:03 +00:00
|
|
|
|
|
|
|
import os
|
|
|
|
import tkinter as tk
|
|
|
|
from tendo import singleton
|
|
|
|
import ttkbootstrap as ttk
|
|
|
|
|
2023-01-19 11:05:14 -01:00
|
|
|
# setting up window
|
2022-07-19 18:52:03 +00:00
|
|
|
pexs = ttk.Window(themename="darkly")
|
|
|
|
window_height = 120
|
|
|
|
window_width = 420
|
|
|
|
pexs.title('Additional Wallpaper')
|
2023-01-19 11:05:14 -01:00
|
|
|
pexs.tk.call('wm', 'iconphoto', pexs._w, tk.PhotoImage(
|
|
|
|
file='/usr/share/pixmaps/peppermint-old.png'))
|
2022-07-19 18:52:03 +00:00
|
|
|
|
2023-01-19 11:05:14 -01:00
|
|
|
# keep only instance at a time
|
2022-07-19 18:52:03 +00:00
|
|
|
me = singleton.SingleInstance()
|
2023-01-19 11:05:14 -01:00
|
|
|
|
|
|
|
|
2022-07-19 18:52:03 +00:00
|
|
|
def center_screen():
|
2023-01-19 11:05:14 -01:00
|
|
|
""" gets the coordinates of the center of the screen """
|
|
|
|
global screen_height, screen_width, x_cordinate, y_cordinate
|
|
|
|
|
|
|
|
screen_width = pexs.winfo_screenwidth()
|
|
|
|
screen_height = pexs.winfo_screenheight()
|
|
|
|
# Coordinates of the upper left corner of the window to make the window
|
|
|
|
# appear in the center
|
|
|
|
x_cordinate = int((screen_width / 2) - (window_width / 2))
|
|
|
|
y_cordinate = int((screen_height / 2) - (window_height / 2))
|
|
|
|
pexs.geometry("{}x{}+{}+{}".format(window_width,
|
|
|
|
window_height, x_cordinate, y_cordinate))
|
|
|
|
|
|
|
|
|
|
|
|
def wls():
|
2022-07-19 18:52:03 +00:00
|
|
|
"""Check if user can connect to codeberg"""
|
|
|
|
pexs.destroy()
|
|
|
|
os.system('python3 /opt/pypep/diagwlschk.py')
|
|
|
|
|
2023-01-19 11:05:14 -01:00
|
|
|
|
|
|
|
def xc():
|
2022-07-19 18:52:03 +00:00
|
|
|
"""close the form start back at pge"""
|
|
|
|
pexs.destroy()
|
2023-01-19 11:05:14 -01:00
|
|
|
os.popen('python3 /opt/pypep/pge.py')
|
|
|
|
|
2022-07-19 18:52:03 +00:00
|
|
|
|
2023-01-19 11:05:14 -01:00
|
|
|
# title message
|
|
|
|
lblexp = ttk.Label(
|
|
|
|
pexs,
|
|
|
|
bootstyle="light",
|
|
|
|
text="Would you like to install addtional wallpaper created by the Peppermint Team and Community?.",
|
|
|
|
wraplength=400)
|
|
|
|
lblexp.pack(side="top")
|
2022-07-19 18:52:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
###All the buttons and placements##
|
2023-01-19 11:05:14 -01:00
|
|
|
btncore = ttk.Button(
|
|
|
|
text="Install",
|
|
|
|
bootstyle="danger-outline",
|
|
|
|
command=wls,
|
|
|
|
width=8)
|
|
|
|
btncore.pack(side="left", padx=5, pady=5)
|
|
|
|
bttut = ttk.Button(
|
|
|
|
text='Cancel',
|
|
|
|
bootstyle="danger-outline",
|
|
|
|
width=8,
|
|
|
|
command=xc)
|
|
|
|
bttut.pack(side="left", padx=5, pady=5)
|
|
|
|
|
|
|
|
# call Center screen
|
|
|
|
center_screen()
|
|
|
|
|
2022-07-19 18:52:03 +00:00
|
|
|
pexs.mainloop()
|