nowin/nowin.py
2024-07-02 18:41:47 +02:00

89 lines
3.1 KiB
Python

#!/usr/bin/python3
import platform
system = platform.system()
def main():
if system == "Linux":
linux = True
else:
print("Why tf you not using Linux???")
confront_user()
def confront_user():
import pygame
import webbrowser
from pathlib import Path
import winreg
pygame.init()
screen = pygame.display.set_mode((800, 400), flags=pygame.NOFRAME)
clock = pygame.time.Clock()
font_fat = pygame.font.Font(pygame.font.get_default_font(), 24)
font = pygame.font.Font(pygame.font.get_default_font(), 16)
why = font_fat.render("WHY DONT YOU USE LINUX??? WHY??? YOU CRIMINAL!!!", True, "white")
why_pos = (400 - why.get_width() // 2, 100 - why.get_height() // 2)
wont_close = font.render("This window will only close after you downloaded a linux iso.", True, "white")
wocl_pos = (400 - wont_close.get_width() // 2, 200 - wont_close.get_height() // 2)
linux_link = font.render("Download Linux Mint here: https://www.linuxmint.com/download.php", True, "darkslateblue")
ll_pos = (400 - linux_link.get_width() // 2, 300 - linux_link.get_height() // 2)
sub_key = r'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
downloads_guid = '{374DE290-123F-4565-9164-39C4925E467B}'
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, sub_key) as key:
downloads_path = winreg.QueryValueEx(key, downloads_guid)[0]
link_opened = False
scan_cooldown = 300
system_names = ["linux", "mint", "amogos", "ubuntu", "debian", "arch", "kde", "pop", "manjaro", "garuda", "steam", "fedora", "suse"]
downloaded = False
while True:
screen.fill("gray8")
screen.blit(why, why_pos)
screen.blit(wont_close, wocl_pos)
screen.blit(linux_link, ll_pos)
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONDOWN and pygame.mouse.get_pressed()[0]:
webbrowser.open("https://www.linuxmint.com/download.php")
link_opened = True
if link_opened:
if scan_cooldown == 0:
scan_cooldown = 300
for file_path in Path(downloads_path).glob('**/*.iso'):
filename = file_path.name
for s_name in system_names:
if s_name in filename.lower():
print("You really have come to your senses, or has reason come to you?")
downloaded = True
pygame.quit()
break
if downloaded:
break
if downloaded:
break
else:
scan_cooldown -= 1
pygame.display.update()
clock.tick(60)
main()