diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md deleted file mode 100644 index a547c91..0000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: 'Pull request' -about: Write down what you changed -title: 'Pull request' -labels: '' -assignees: '' - ---- - -In order to make everything clear -**Write down what you changed and why** \ No newline at end of file diff --git a/src/functions/__init__.py b/src/functions/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/functions/config.py b/src/functions/config.py deleted file mode 100644 index 5600924..0000000 --- a/src/functions/config.py +++ /dev/null @@ -1,47 +0,0 @@ -import configparser -import os - - -class Config: - def create_config(self, path): - if not os.path.exists(path): - config = configparser.ConfigParser() - config.add_section("Config") - - config.set("Config", "wallpaper-link", "None") - - with open(path, "w") as file: - config.write(file) - else: - return print("The file exists") - - def get_config(self, path): - if not os.path.exists(path): - self.create_config(path) - - config = configparser.ConfigParser() - config.read(path) - return config - - def get_setting(self, path, section, setting): - if not os.path.exists(path): - self.create_config(path) - - config = self.get_config(path) - value = config.get(section, setting) - return value - - def update_setting(self, path, section, setting, value): - if not os.path.exists(path): - self.create_config(path) - - config = self.get_config(path) - config.set(section, setting, value) - with open(path, "w") as file: - config.write(file) - - def delete_setting(self, path, section, setting): - config = self.get_config(path) - config.remove_option(section, setting) - with open(path, "w") as file: - config.write(file) diff --git a/src/functions/wallpaper.py b/src/functions/wallpaper.py deleted file mode 100644 index b9dc06e..0000000 --- a/src/functions/wallpaper.py +++ /dev/null @@ -1,93 +0,0 @@ -from bs4 import BeautifulSoup - -import requests -import urllib -import sys -import ctypes -import os - -from .config import Config - - -class Wallpaper(Config): - def __init__(self): - super().__init__() - self.url = "https://apod.nasa.gov/apod/" - self.config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config.ini") - - self.full_page = requests.get(self.url) - self.soup = BeautifulSoup(self.full_page.content, 'html.parser') - self.lnk = None - - def check(self): - config = Config.get_setting(self, path=self.config_path, section="Config", setting="wallpaper-link") - - for link in self.soup.select("img"): - self.lnk = link["src"] - - if self.lnk is None: - return "On the NASA website, they posted not a picture but a video, " \ - "unfortunately, it will not work to install wallpaper" - - if config == self.lnk: - return - else: - Config.update_setting( - self, - path=self.config_path, - section="Config", - setting="wallpaper-link", - value=self.lnk - ) - - def download(self): - try: - img = urllib.request.urlopen(self.url + self.lnk).read() - with open("everyNASA.jpg", "wb") as file: - file.write(img) - except requests.exceptions.ConnectionError: - return "Connection error, please try again later." - - @staticmethod - def set(): - if sys.platform == "win32": - ctypes.windll.user32.SystemParametersInfoW(20, 0, os.path.abspath("everyNASA.jpg"), 0) - elif sys.platform == "linux": - desk_env = os.environ.get("DESKTOP_SESSION") - if desk_env == "gnome": - os.system( - "gsettings set org.gnome.desktop.background " - "picture-uri 'file://{}'" - .format( - os.path.abspath( - "everyNASA.jpg" - ) - ) - ) - elif desk_env == "plasma": - import dbus - jscript = """ - var allDesktops = desktops(); - print (allDesktops); - for (i=0;i