├── src ├── exception_handle.py ├── setup.py ├── wall.py ├── utils.py ├── win_darkmode.py ├── history_window.py ├── unsplash.py ├── bing.py ├── app.py ├── bing_window.py ├── reddit.py ├── unsplash_window.py ├── reddit_window.py ├── wallhaven.py ├── wallhaven_window.py ├── kustompyper.u.ui └── gui.py ├── requirements.txt ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── .gitignore ├── README.md └── LICENSE /src/exception_handle.py: -------------------------------------------------------------------------------- 1 | class Error(Exception): 2 | """Base class for other exceptions""" 3 | pass 4 | 5 | class NoResultsFound(Error): 6 | """Raised when there are no results found for search term """ 7 | pass 8 | -------------------------------------------------------------------------------- /src/setup.py: -------------------------------------------------------------------------------- 1 | from cx_Freeze import setup, Executable 2 | 3 | setup( 4 | name="KustomPyper", 5 | version="1.0", 6 | description="Find and set random wallpapers from reddit as your desktop wallpaper", 7 | executables=[ 8 | Executable("app.py", shortcutName="KustomPyper", shortcutDir="DesktopFolder") 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2019.11.28 2 | chardet==3.0.4 3 | click==7.1.1 4 | cx-Freeze==6.1 5 | idna==2.9 6 | praw==6.5.1 7 | prawcore==1.0.1 8 | PyQt5==5.13.2 9 | PyQt5-sip==12.7.1 10 | pyqt5-tools==5.13.2.1.6rc1 11 | python-dotenv==0.12.0 12 | requests==2.23.0 13 | six==1.14.0 14 | update-checker==0.16 15 | urllib3==1.26.5 16 | websocket-client==0.57.0 17 | winpath==202002.2 -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[Feature] Short description of your proposed feature" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve KustomPyper 4 | title: "[BUG] Short description of the bug" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Desktop (please complete the following information):** 14 | - OS version 15 | - Python version 16 | - KustomPyper Version [e.g. 0.2] 17 | 18 | **To Reproduce** 19 | Steps to reproduce the behavior: 20 | 1. Go to '...' 21 | 2. Click on '....' 22 | 3. Scroll down to '....' 23 | 4. See error 24 | 25 | **Expected behavior** 26 | A clear and concise description of what you expected to happen. 27 | 28 | **Actual behavior** 29 | Tell us what happens instead 30 | 31 | **Screenshots** 32 | If applicable, add screenshots to help explain your problem. 33 | 34 | **Additional context** 35 | Add any other context about the problem here. 36 | -------------------------------------------------------------------------------- /src/wall.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | import os 3 | import winpath 4 | import shutil 5 | 6 | 7 | def temp_download_dir(): 8 | path = winpath.get_local_appdata() + "\\Programs\\KustomPyper" 9 | if not os.path.exists(path): 10 | os.mkdir(path) 11 | return path 12 | 13 | 14 | def history_db_dir(db_name): 15 | path = temp_download_dir() + f"\\{db_name}.db" 16 | # print(path) 17 | return path 18 | 19 | 20 | def saveWall(image_path, imagetitle): 21 | path = winpath.get_my_pictures() + "\\KustomPyper" 22 | if not os.path.exists(path): 23 | os.mkdir(path) 24 | shutil.copyfile(image_path, path + f"\\{imagetitle}") 25 | 26 | 27 | def changeBG(image): 28 | # print(directory) 29 | image_path = image 30 | # print(image_path) 31 | 32 | # Constant for setting the desktop wallpaper 33 | SPI_SETDESKWALLPAPER = 20 34 | # Constant for making the wallpaper persist across reboots 35 | SPIF_UPDATEINIFILE = 1 36 | ctypes.windll.user32.SystemParametersInfoW( 37 | SPI_SETDESKWALLPAPER, 0, image_path, SPIF_UPDATEINIFILE 38 | ) 39 | return 40 | 41 | 42 | if __name__ == "__main__": 43 | print("Not a standalone program") 44 | -------------------------------------------------------------------------------- /src/utils.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | import requests 3 | import sqlite3 4 | import wall 5 | 6 | 7 | class Helpers: 8 | @staticmethod 9 | def download_wall(download_path, download_url): 10 | with open(download_path, "wb") as handle: 11 | 12 | response = requests.get(download_url, stream=True) 13 | 14 | if not response.ok: 15 | print(response) 16 | 17 | for block in response.iter_content(1024): 18 | if not block: 19 | break 20 | 21 | handle.write(block) 22 | 23 | @staticmethod 24 | def saved_wall_path(image_path, image_extension): 25 | now = datetime.now() 26 | timestamp = datetime.timestamp(now) 27 | timestamp = str(int(timestamp)) 28 | return "KustomPyper_" + timestamp + image_extension 29 | 30 | @staticmethod 31 | def insert_history(wallpaper_url, source): 32 | try: 33 | conn = sqlite3.connect(wall.history_db_dir("wall_history")) 34 | c = conn.cursor() 35 | c.execute( 36 | "INSERT OR IGNORE INTO history (wallpaper,source) VALUES (?,?)", 37 | (wallpaper_url, source), 38 | ) 39 | conn.commit() 40 | c.close() 41 | conn.close() 42 | return True 43 | except Exception as e: 44 | print(e) 45 | return False 46 | -------------------------------------------------------------------------------- /src/win_darkmode.py: -------------------------------------------------------------------------------- 1 | import winreg 2 | 3 | # Path to the required registry 4 | REG_PATH = "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize" 5 | 6 | 7 | def get_reg(name): 8 | try: 9 | with winreg.OpenKey( 10 | winreg.HKEY_CURRENT_USER, REG_PATH, 0, winreg.KEY_READ 11 | ) as registry_key: 12 | value, regtype = winreg.QueryValueEx(registry_key, name) 13 | return value 14 | except WindowsError: 15 | return None 16 | 17 | 18 | def set_reg(name, value): 19 | try: 20 | winreg.CreateKey(winreg.HKEY_CURRENT_USER, REG_PATH) 21 | with winreg.OpenKey( 22 | winreg.HKEY_CURRENT_USER, REG_PATH, 0, winreg.KEY_WRITE 23 | ) as registry_key: 24 | # use winreg.REG_DWORD as it covers both the cases for us 25 | winreg.SetValueEx(registry_key, name, 0, winreg.REG_DWORD, value) 26 | return True 27 | except WindowsError: 28 | return False 29 | 30 | 31 | def setDarkMode(): 32 | set_reg("AppsUseLightTheme", 0) 33 | set_reg("SystemUsesLightTheme", 0) 34 | 35 | 36 | def setLightMode(): 37 | set_reg("AppsUseLightTheme", 1) 38 | set_reg("SystemUsesLightTheme", 1) 39 | 40 | 41 | def toggleDarkMode(): 42 | isDarkMode = get_reg("AppsUseLightTheme") or get_reg("SystemUsesLightTheme") 43 | print(isDarkMode) 44 | if isDarkMode == 0: 45 | set_reg("AppsUseLightTheme", 1) 46 | set_reg("SystemUsesLightTheme", 1) 47 | else: 48 | set_reg("AppsUseLightTheme", 0) 49 | set_reg("SystemUsesLightTheme", 0) 50 | 51 | 52 | if __name__ == "__main__": 53 | toggleDarkMode() 54 | -------------------------------------------------------------------------------- /src/history_window.py: -------------------------------------------------------------------------------- 1 | import sqlite3 2 | 3 | from PyQt5 import QtGui 4 | from PyQt5.QtCore import * 5 | from PyQt5.QtGui import * 6 | from PyQt5.QtWidgets import * 7 | import wall 8 | 9 | 10 | class HistoryWindow: 11 | def __init__(self, main_window): 12 | self.ui = main_window 13 | self.ui.historyClearButton.clicked.connect(self.clear_history) 14 | self.ui.historyRefreshButton.clicked.connect(self.refresh_history) 15 | self.tableWidget = self.ui.historyTableWidget 16 | self.refresh_history() 17 | 18 | def clear_history(self): 19 | try: 20 | conn = sqlite3.connect(wall.history_db_dir("wall_history")) 21 | c = conn.cursor() 22 | c.execute("DELETE FROM history ") 23 | conn.commit() 24 | c.close() 25 | conn.close() 26 | self.refresh_history() 27 | except Exception: 28 | QMessageBox.warning( 29 | QMessageBox(), "Error", "Could not clear wall from history." 30 | ) 31 | 32 | def refresh_history(self): 33 | connection = sqlite3.connect(wall.history_db_dir("wall_history")) 34 | query = "SELECT * FROM history" 35 | result = connection.execute(query) 36 | self.tableWidget.setRowCount(0) 37 | for row_number, row_data in enumerate(result): 38 | self.tableWidget.insertRow(row_number) 39 | for column_number, data in enumerate(row_data): 40 | self.tableWidget.setItem( 41 | row_number, column_number, QTableWidgetItem(str(data)) 42 | ) 43 | connection.close() 44 | self.tableWidget.resizeColumnsToContents() 45 | -------------------------------------------------------------------------------- /src/unsplash.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import secrets 3 | import wall 4 | 5 | import urllib.parse 6 | 7 | 8 | class Unsplash: 9 | def __init__(self, width, height): 10 | self.BASE_URL = "https://source.unsplash.com" 11 | self.width = width 12 | self.height = height 13 | self.query = None 14 | self.headers = {"user-agent": secrets.user_agent} 15 | self.prev_wall = "" 16 | 17 | def set_featured(self, state): 18 | if state: 19 | self.is_featured = True 20 | else: 21 | self.is_featured = False 22 | 23 | def set_query(self, query): 24 | self.query = query 25 | 26 | def url_builder(self): 27 | if self.is_featured: 28 | url = self.BASE_URL + f"/featured" 29 | else: 30 | url = self.BASE_URL 31 | url += f"/{self.width}x{self.height}" 32 | if self.query != None: 33 | self.query = urllib.parse.quote_plus(self.query) 34 | url += f"/?{self.query}" 35 | print(f"url : {url}") 36 | return url 37 | 38 | def get_image_extension(self): 39 | return self.download_extension 40 | 41 | def get_download_path(self): 42 | # find image extension 43 | self.download_file = "pic1.jpg" 44 | self.download_extension = ".jpg" 45 | 46 | if "fm=png" in str(self.wallpaper_url): 47 | self.download_file = self.download_file.replace("jpg", "png") 48 | self.download_extension = ".png" 49 | 50 | self.download_path = wall.temp_download_dir() + "\\" + self.download_file 51 | print(self.download_path) 52 | return self.download_path 53 | 54 | def get_unsplash_pic(self): 55 | response = requests.get(self.url_builder(), headers=self.headers) 56 | self.query = None 57 | if response.status_code == 200: 58 | self.wallpaper_url = response.url 59 | print(f"wallpaper_url : {self.wallpaper_url}") 60 | if self.prev_wall == self.wallpaper_url: 61 | self.get_unsplash_pic() 62 | self.prev_wall = self.wallpaper_url -------------------------------------------------------------------------------- /src/bing.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import secrets 3 | import random 4 | import wall 5 | 6 | 7 | class Bing: 8 | def __init__(self): 9 | self.BASE_URL = "http://www.bing.com" 10 | self.WALL_API_URL = "http://www.bing.com//HPImageArchive.aspx?format=js&idx=0&n=8&mkt=en-{country}" 11 | self.headers = {"user-agent": secrets.user_agent} 12 | self.country = "init" 13 | self.prev_wall = "" 14 | 15 | def set_country(self, country): 16 | if (self.country != country) or (self.country == "init"): 17 | self.country_specific_wall = True 18 | self.country = country 19 | else: 20 | self.country_specific_wall = False 21 | 22 | def url_builder(self): 23 | if self.country == "India": 24 | return self.WALL_API_URL.replace("{country}", "in") 25 | elif self.country == "US": 26 | return self.WALL_API_URL.replace("{country}", "us") 27 | elif self.country == "China": 28 | self.WALL_API_URL = self.WALL_API_URL.replace("en", "zh") 29 | return self.WALL_API_URL.replace("{country}", "cn") 30 | 31 | def get_wallpapers(self): 32 | url = self.url_builder() 33 | # print(url) 34 | response = requests.get(url, headers=self.headers) 35 | if response.status_code == 200: 36 | limit = 0 37 | for image in response.json()["images"]: 38 | limit += 1 39 | 40 | if self.country_specific_wall: 41 | self.random_index = 0 42 | else: 43 | self.random_index = random.randint(1, limit - 1) 44 | 45 | self.wallpaper_url = ( 46 | self.BASE_URL + response.json()["images"][self.random_index]["url"] 47 | ) 48 | 49 | if (self.prev_wall == self.wallpaper_url) and (not self.country_specific_wall): 50 | self.get_wallpapers() 51 | self.prev_wall = self.wallpaper_url 52 | print(self.wallpaper_url) 53 | 54 | def get_download_path(self): 55 | self.download_file = "pic1.jpg" 56 | self.download_extension = ".jpg" 57 | 58 | if ".png" in str(self.wallpaper_url): 59 | self.download_file = self.download_file.replace("jpg", "png") 60 | self.download_extension = ".png" 61 | 62 | self.download_path = wall.temp_download_dir() + "\\" + self.download_file 63 | # print(self.download_path) 64 | return self.download_path 65 | 66 | def get_image_extension(self): 67 | return self.download_extension 68 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | pip-wheel-metadata/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | target/ 76 | 77 | # Jupyter Notebook 78 | .ipynb_checkpoints 79 | 80 | # IPython 81 | profile_default/ 82 | ipython_config.py 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # pipenv 88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 91 | # install all needed dependencies. 92 | #Pipfile.lock 93 | 94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 95 | __pypackages__/ 96 | 97 | # Celery stuff 98 | celerybeat-schedule 99 | celerybeat.pid 100 | 101 | # SageMath parsed files 102 | *.sage.py 103 | 104 | # Environments 105 | .env 106 | .venv 107 | env/ 108 | venv/ 109 | ENV/ 110 | env.bak/ 111 | venv.bak/ 112 | 113 | # Spyder project settings 114 | .spyderproject 115 | .spyproject 116 | 117 | # Rope project settings 118 | .ropeproject 119 | 120 | # mkdocs documentation 121 | /site 122 | 123 | # mypy 124 | .mypy_cache/ 125 | .dmypy.json 126 | dmypy.json 127 | 128 | # Pyre type checker 129 | .pyre/ 130 | 131 | # Project specific 132 | secrets.py 133 | Venv/ 134 | .vscode 135 | ui/ 136 | src/build/ 137 | src/__pycache__/ 138 | src/dist/ 139 | *.db -------------------------------------------------------------------------------- /src/app.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import sqlite3 3 | 4 | from PyQt5.QtGui import * 5 | from PyQt5.QtWidgets import * 6 | from PyQt5.QtCore import * 7 | from PyQt5 import QtGui 8 | 9 | from gui import Ui_MainWindow 10 | import reddit_window 11 | import unsplash_window 12 | import bing_window 13 | import wallhaven_window 14 | import history_window 15 | import wall 16 | 17 | class MainWindow(QMainWindow, Ui_MainWindow): 18 | def __init__(self): 19 | super(MainWindow, self).__init__() 20 | self.setupUi(self) 21 | self.show_reddit_page() 22 | """ Moving the next two lines to the reddit window init results in the following warning 23 | QWindowsWindow::setGeometry: Unable to set geometry 1920x1080+0+29 (frame: 1938x1127-9-9) on QWidgetWindow/"MainWindowWindow" 24 | on " \\\.\DISPLAY1". Resulting geometry: 1920x1001+0+29 """ 25 | self.screenSize = QDesktopWidget().screenGeometry(0) 26 | self.setMinimumSize(self.screenSize.width(), self.screenSize.height()) 27 | self.pageRedditAction.triggered.connect(self.show_reddit_page) 28 | self.pageUnsplashAction.triggered.connect(self.show_unsplash_page) 29 | self.pageBingAction.triggered.connect(self.show_bing_page) 30 | self.pageWallHavenAction.triggered.connect(self.show_wallhaven_page) 31 | self.aboutAction.triggered.connect(self.show_about_page) 32 | self.helpAction.triggered.connect(self.open_help_url) 33 | self.historyAction.triggered.connect(self.show_history_page) 34 | self.init_history_db() 35 | self.showMaximized() 36 | 37 | def show_reddit_page(self): 38 | self.pageStackWidget.setCurrentIndex(0) 39 | 40 | def show_unsplash_page(self): 41 | self.pageStackWidget.setCurrentIndex(1) 42 | 43 | def show_bing_page(self): 44 | self.pageStackWidget.setCurrentIndex(2) 45 | 46 | def show_wallhaven_page(self): 47 | self.pageStackWidget.setCurrentIndex(3) 48 | 49 | def show_about_page(self): 50 | self.pageStackWidget.setCurrentIndex(4) 51 | 52 | def show_history_page(self): 53 | self.pageStackWidget.setCurrentIndex(5) 54 | 55 | def open_help_url(self): 56 | url = QUrl("https://github.com/kriticalflare/KustomPyper/blob/master/README.md") 57 | if not QtGui.QDesktopServices.openUrl(url): 58 | QMessageBox.warning( 59 | self, 60 | "Open Url", 61 | "Could not open https://github.com/kriticalflare/KustomPyper/", 62 | ) 63 | 64 | def init_history_db(self): 65 | conn = sqlite3.connect(wall.history_db_dir("wall_history")) 66 | c = conn.cursor() 67 | c.execute( 68 | "CREATE TABLE IF NOT EXISTS history(wallpaper TEXT PRIMARY KEY,source TEXT)" 69 | ) 70 | c.close() 71 | 72 | 73 | if __name__ == "__main__": 74 | if len(sys.argv) > 1: 75 | print(sys.argv) 76 | arg = sys.argv[1] 77 | if arg == "--no-gui": 78 | print("yas") 79 | app = QApplication(sys.argv) 80 | MainWindow = MainWindow() 81 | RedditWindow = reddit_window.RedditWindow(MainWindow) 82 | UnsplashWindow = unsplash_window.UnsplashWindow(MainWindow) 83 | BingWindow = bing_window.BingWindow(MainWindow) 84 | WallhaveWindow = wallhaven_window.WallhavenWindow(MainWindow) 85 | HistoryWindow = history_window.HistoryWindow(MainWindow) 86 | MainWindow.show() 87 | sys.exit(app.exec_()) 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # KustomPyper 2 | ### Get amazing wallpapers from reddit, unsplash , wallhaven and bing for your Desktop 3 | [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) 4 | [![issues](https://img.shields.io/github/issues/kriticalflare/KustomPyper)](https://github.com/kriticalflare/KustomPyper/issues) 5 | [![forks](https://img.shields.io/github/forks/kriticalflare/KustomPyper)](https://github.com/kriticalflare/KustomPyper/network/members) 6 | [![GPLv3 License](https://img.shields.io/badge/License-GPL%20v3-yellow.svg)](https://opensource.org/licenses/) 7 | [![GitHub stars](https://img.shields.io/github/stars/kriticalflare/KustomPyper.svg?style=social&label=Star&cacheSeconds=3600)](https://GitHub.com/kriticalflare/KustomPyper/stargazers/) 8 | [![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) 9 | 10 | 11 | 12 | 13 | GUI tool to get random wallpapers: 14 | 15 | - Choose from default subreddits 16 | - Or even add your own! 17 | - Get wallpapers according to relevance 18 | - Search for wallpapers 19 | - Find wallpapers featured by unsplash 20 | - find the best anime walls from wallhaven 21 | - Set the range of random posts 22 | - Get the wallpapers of the day from bing 23 | - Toggle Windows dark mode from the app itself! 24 | - Keep track of the wallpapers you have set before 25 | - Save your favourite walls 26 | 27 | ### Built With 28 | 29 | * [Python](https://www.python.org/) 30 | * [Praw](https://github.com/praw-dev/praw) 31 | * [PyQt5](https://pypi.org/project/PyQt5/) 32 | 33 | ## Getting Started 34 | 35 | First of all make sure to get your own set of api keys as mentioned [here](#api-key-requirements). 36 | 37 | Create a ```secrets.py``` file inside ```KustomPyper\src``` folder as shown below 38 | ``` 39 | reddit_client_id = '' 40 | reddit_client_secret = '' 41 | user_agent = '' 42 | wallhaven_api_key = '' 43 | ``` 44 | 45 | Now make sure you have installed all the required dependencies, preferrably in a virtual environment. 46 | Run the following commands in the command prompt: 47 | To create a virtual environment 48 | ``` 49 | python -m venv Venv 50 | ``` 51 | Now to activate the virtual environment 52 | ``` 53 | Venv\Scripts\activate.bat 54 | ``` 55 | Install the requirements 56 | ``` 57 | pip install -r requirements.txt 58 | ``` 59 | To run the app without building an exe 60 | ``` 61 | python app.py 62 | ``` 63 | One can also build the project by 64 | ``` 65 | python setup.py bdist_msi 66 | ``` 67 | You will find an executable installer in the ```KustomPyper\src\dist``` folder that can be used to install KustomPyper on the supported platforms 68 | 69 | ## Supported Platforms 70 | - Windows 10 1809 and later 71 | 72 | ## API Key Requirements 73 | - reddit and wallhaven require your own api keys 74 | - [reddit](https://old.reddit.com/prefs/apps/) 75 | - [wallhaven](https://wallhaven.cc/settings/account) 76 | - bing and unsplash dont require keys as of now 77 | 78 | ## Contributing 79 | 80 | Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. 81 | 82 | 1. Fork the Project 83 | 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) 84 | 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) 85 | 4. Push to the Branch (`git push origin feature/AmazingFeature`) 86 | 5. Open a Pull Request 87 | 88 | ## License 89 | [GPL](https://github.com/kriticalflare/KustomPyper/blob/master/LICENSE) 90 | -------------------------------------------------------------------------------- /src/bing_window.py: -------------------------------------------------------------------------------- 1 | 2 | from os import path 3 | 4 | from PyQt5 import QtGui 5 | from PyQt5.QtCore import * 6 | from PyQt5.QtGui import * 7 | from PyQt5.QtWidgets import * 8 | 9 | import bing 10 | import wall 11 | import win_darkmode 12 | import utils 13 | 14 | class BingWindow: 15 | def __init__(self, main_window): 16 | self.ui = main_window 17 | self.screenSize = QDesktopWidget().screenGeometry(0) 18 | self.image_path = None 19 | self.bing_instance = bing.Bing() 20 | self.ui.bingPhoto.setMaximumHeight(int(0.7 * self.screenSize.height())) 21 | self.ui.bingPhoto.setMaximumWidth(int(0.99 * self.screenSize.width())) 22 | self.ui.bingNextWallButton.clicked.connect(self.next_wallpaper) 23 | self.ui.bingWallpaperButton.clicked.connect(self.set_wallpaper) 24 | self.ui.bingSaveButton.clicked.connect(self.save_wallpaper) 25 | 26 | def next_wallpaper(self): 27 | self.enable_wall_buttons(False) 28 | country = self.ui.bingCountryCombo.currentText() 29 | self.download_thread = BingDownloadThread(self.bing_instance, country) 30 | self.download_thread.signal.connect(self.display_wallpaper) 31 | self.download_thread.start() 32 | 33 | 34 | def save_wallpaper(self): 35 | if self.image_path is None: 36 | messagebox = QMessageBox() 37 | messagebox.setWindowTitle("Wallpaper not found!") 38 | messagebox.setText("Choose a wallpaper to set") 39 | messagebox.setIcon(QMessageBox.Critical) 40 | messagebox.exec_() 41 | else: 42 | wall.saveWall( 43 | self.image_path, 44 | utils.Helpers.saved_wall_path( 45 | self.image_path, 46 | self.bing_instance.get_image_extension() 47 | ) 48 | ) 49 | messagebox = QMessageBox() 50 | messagebox.setWindowTitle("Wallpaper saved!") 51 | messagebox.setText("Wallpaper saved in User's Pictures folder") 52 | messagebox.setIcon(QMessageBox.Information) 53 | messagebox.exec_() 54 | 55 | def set_wallpaper(self): 56 | if self.image_path is None: 57 | messagebox = QMessageBox() 58 | messagebox.setWindowTitle("Wallpaper not found!") 59 | messagebox.setText("Choose a wallpaper to set") 60 | messagebox.setIcon(QMessageBox.Critical) 61 | messagebox.exec_() 62 | else: 63 | self.toggle_dark_mode() 64 | wall.changeBG(self.image_path) 65 | if not utils.Helpers.insert_history(self.bing_instance.wallpaper_url,"bing"): 66 | QMessageBox.warning(QMessageBox(), 'Error', 'Could not add wall to the history.') 67 | 68 | def display_wallpaper(self, image_path): 69 | self.image_path = image_path 70 | self.ui.bingPhoto.setPixmap(QtGui.QPixmap(self.image_path)) 71 | self.ui.bingPhoto.setScaledContents(True) 72 | self.enable_wall_buttons(True) 73 | 74 | def toggle_dark_mode(self): 75 | if self.ui.bingDarkModeCheck.isChecked(): 76 | win_darkmode.setDarkMode() 77 | else: 78 | win_darkmode.setLightMode() 79 | 80 | def enable_wall_buttons(self, state): 81 | self.ui.bingNextWallButton.setEnabled(state) 82 | self.ui.bingSaveButton.setEnabled(state) 83 | self.ui.bingWallpaperButton.setEnabled(state) 84 | 85 | class BingDownloadThread(QThread): 86 | signal = pyqtSignal(str) 87 | 88 | def __init__(self, bing_instance, country): 89 | QThread.__init__(self) 90 | self.bing_instance = bing_instance 91 | self.bing_instance.set_country(country) 92 | 93 | def run(self): 94 | self.bing_instance.get_wallpapers() 95 | self.image_path = self.bing_instance.get_download_path() 96 | utils.Helpers.download_wall(self.image_path, self.bing_instance.wallpaper_url) 97 | self.signal.emit(self.image_path) 98 | -------------------------------------------------------------------------------- /src/reddit.py: -------------------------------------------------------------------------------- 1 | import praw 2 | import requests 3 | import random 4 | import secrets 5 | import wall 6 | import exception_handle 7 | 8 | class Reddit: 9 | def __init__(self): 10 | self.instance = praw.Reddit( 11 | client_id=secrets.reddit_client_id, 12 | client_secret=secrets.reddit_client_secret, 13 | user_agent=secrets.user_agent, 14 | ) 15 | self.query = None 16 | self.prev_wall = "" 17 | self.blacklistUrl = ("imgur.com/gallery/", "imgur.com/a/", "v.redd.it") 18 | 19 | def set_subreddit(self, subreddit): 20 | self.subreddit = subreddit 21 | 22 | def set_category(self, category): 23 | self.category = category 24 | 25 | def set_limit(self, limit): 26 | self.limit = limit 27 | 28 | def set_search_query(self, query): 29 | self.query = query 30 | 31 | def get_search_results(self): 32 | self.wallpaper_sub = self.instance.subreddit(self.subreddit) 33 | return self.wallpaper_sub.search(query=self.query, sort="top", limit=self.limit) 34 | 35 | def get_submissions(self): 36 | self.wallpaper_sub = self.instance.subreddit(self.subreddit) 37 | if self.category == "hot": 38 | return self.wallpaper_sub.hot(limit=self.limit) 39 | elif self.category == "top": 40 | return self.wallpaper_sub.top(limit=self.limit) 41 | elif self.category == "new": 42 | return self.wallpaper_sub.new(limit=self.limit) 43 | elif self.category == "controversial": 44 | return self.wallpaper_sub.controversial(limit=self.limit) 45 | elif self.category == "rising": 46 | return self.wallpaper_sub.rising(limit=self.limit) 47 | 48 | def next_wallpaper(self): 49 | print(self.subreddit) 50 | self.count = 0 51 | if self.query != None: 52 | wallpaper_submissions = self.get_search_results() 53 | self.query = None 54 | else: 55 | wallpaper_submissions = self.get_submissions() 56 | submission_list = [] 57 | for submission in wallpaper_submissions: 58 | self.count = self.count + 1 59 | submission_list.append(submission) 60 | # print(submission.title) 61 | 62 | if self.limit >= self.count: 63 | self.upperlimit = self.count - 1 64 | else: 65 | self.upperlimit = self.limit - 1 66 | 67 | if self.upperlimit <= 0: 68 | self.error_text = "No walls found" 69 | raise exception_handle.NoResultsFound() 70 | else: 71 | self.error_text = "" 72 | print(self.upperlimit) 73 | random_int = random.randint(0, self.upperlimit) 74 | # print(random_int) 75 | self.submission = submission_list[random_int] 76 | self.wallpaper_url = submission_list[random_int].url 77 | print(self.wallpaper_url) 78 | if any(_ in self.wallpaper_url for _ in self.blacklistUrl): 79 | # pass on blacklisted urls (ie not direct image links) 80 | self.next_wallpaper() 81 | if self.prev_wall == self.wallpaper_url: 82 | self.next_wallpaper() 83 | self.prev_wall = self.wallpaper_url 84 | 85 | 86 | 87 | def get_download_path(self): 88 | # find image extension 89 | self.download_file = "pic1.jpg" 90 | self.download_extension = ".jpg" 91 | 92 | if "png" in str(self.wallpaper_url): 93 | print("contains") 94 | self.download_file = self.download_file.replace("jpg", "png") 95 | self.download_extension = ".png" 96 | print(self.download_extension) 97 | self.download_path = wall.temp_download_dir() + "\\" + self.download_file 98 | return self.download_path 99 | 100 | def get_download_file(self): 101 | return self.download_file 102 | 103 | def get_image_extension(self): 104 | return self.download_extension 105 | 106 | def get_image_title(self): 107 | return self.submission.title 108 | -------------------------------------------------------------------------------- /src/unsplash_window.py: -------------------------------------------------------------------------------- 1 | 2 | from os import path 3 | 4 | from PyQt5 import QtGui 5 | from PyQt5.QtCore import * 6 | from PyQt5.QtGui import * 7 | from PyQt5.QtWidgets import * 8 | 9 | import unsplash 10 | import wall 11 | import win_darkmode 12 | import utils 13 | 14 | 15 | class UnsplashWindow: 16 | def __init__(self, main_window): 17 | self.ui = main_window 18 | self.screenSize = QDesktopWidget().screenGeometry(0) 19 | self.image_path = None 20 | self.unsplash_instance = unsplash.Unsplash( 21 | self.screenSize.width(), self.screenSize.height() 22 | ) 23 | self.ui.unsplashPhoto.setMaximumHeight(int(0.7 * self.screenSize.height())) 24 | self.ui.unsplashPhoto.setMaximumWidth(int(0.99 * self.screenSize.width())) 25 | self.ui.unsplashSearchTextEdit.setMaximumWidth( 26 | int(0.15 * self.screenSize.width()) 27 | ) 28 | self.ui.unsplashNextWallButton.clicked.connect(self.next_wallpaper) 29 | self.ui.unsplashWallpaperButton.clicked.connect(self.set_wallpaper) 30 | self.ui.unsplashSaveButton.clicked.connect(self.save_wallpaper) 31 | 32 | def next_wallpaper(self): 33 | self.enable_wall_buttons(False) 34 | query = self.ui.unsplashSearchTextEdit.toPlainText() 35 | if self.ui.unsplashFeaturedCheck.isChecked(): 36 | is_featured = True 37 | else: 38 | is_featured = False 39 | 40 | self.download_thread = UnsplashDownloadThread( 41 | self.unsplash_instance, is_featured, query 42 | ) 43 | self.download_thread.signal.connect(self.display_wallpaper) 44 | self.download_thread.start() 45 | 46 | def save_wallpaper(self): 47 | if self.image_path is None: 48 | messagebox = QMessageBox() 49 | messagebox.setWindowTitle("Wallpaper not found!") 50 | messagebox.setText("Choose a wallpaper to set") 51 | messagebox.setIcon(QMessageBox.Critical) 52 | messagebox.exec_() 53 | else: 54 | wall.saveWall( 55 | self.image_path, 56 | utils.Helpers.saved_wall_path( 57 | self.image_path, 58 | self.unsplash_instance.get_image_extension() 59 | ) 60 | ) 61 | messagebox = QMessageBox() 62 | messagebox.setWindowTitle("Wallpaper saved!") 63 | messagebox.setText("Wallpaper saved in User's Pictures folder") 64 | messagebox.setIcon(QMessageBox.Information) 65 | messagebox.exec_() 66 | 67 | def set_wallpaper(self): 68 | if self.image_path is None: 69 | messagebox = QMessageBox() 70 | messagebox.setWindowTitle("Wallpaper not found!") 71 | messagebox.setText("Choose a wallpaper to set") 72 | messagebox.setIcon(QMessageBox.Critical) 73 | messagebox.exec_() 74 | else: 75 | self.toggle_dark_mode() 76 | wall.changeBG(self.image_path) 77 | if not utils.Helpers.insert_history(self.unsplash_instance.wallpaper_url, "unsplash"): 78 | QMessageBox.warning(QMessageBox(), 'Error', 'Could not add wall to the history.') 79 | 80 | def display_wallpaper(self, image_path): 81 | self.image_path = image_path 82 | self.ui.unsplashPhoto.setPixmap(QtGui.QPixmap(self.image_path)) 83 | self.ui.unsplashPhoto.setScaledContents(True) 84 | self.enable_wall_buttons(True) 85 | 86 | def toggle_dark_mode(self): 87 | if self.ui.unsplashDarkModeCheck.isChecked(): 88 | win_darkmode.setDarkMode() 89 | else: 90 | win_darkmode.setLightMode() 91 | 92 | def enable_wall_buttons(self, state): 93 | self.ui.unsplashNextWallButton.setEnabled(state) 94 | self.ui.unsplashSaveButton.setEnabled(state) 95 | self.ui.unsplashWallpaperButton.setEnabled(state) 96 | 97 | class UnsplashDownloadThread(QThread): 98 | signal = pyqtSignal(str) 99 | 100 | def __init__(self, unsplash_instance,is_featured, query): 101 | QThread.__init__(self) 102 | self.unsplash_instance = unsplash_instance 103 | self.unsplash_instance.set_featured(is_featured) 104 | if query and not query.isspace(): 105 | self.unsplash_instance.set_query(query) 106 | 107 | def run(self): 108 | self.unsplash_instance.get_unsplash_pic() 109 | print(self.unsplash_instance.wallpaper_url) 110 | self.image_path = self.unsplash_instance.get_download_path() 111 | utils.Helpers.download_wall(self.image_path,self.unsplash_instance.wallpaper_url) 112 | self.signal.emit(self.image_path) 113 | -------------------------------------------------------------------------------- /src/reddit_window.py: -------------------------------------------------------------------------------- 1 | from os import path 2 | 3 | from PyQt5 import QtGui 4 | from PyQt5.QtCore import * 5 | from PyQt5.QtGui import * 6 | from PyQt5.QtWidgets import * 7 | 8 | import reddit 9 | import wall 10 | import win_darkmode 11 | import utils 12 | import exception_handle 13 | 14 | 15 | class RedditWindow: 16 | def __init__(self, main_window): 17 | self.ui = main_window 18 | self.image_path = None 19 | self.reddit_instance = reddit.Reddit() 20 | self.ui.redditNextWallButton.clicked.connect(self.next_wallpaper) 21 | self.ui.redditWallpaperButton.clicked.connect(self.set_wallpaper) 22 | self.ui.redditSaveButton.clicked.connect(self.save_wallpaper) 23 | self.screenSize = QDesktopWidget().screenGeometry(0) 24 | self.ui.redditPhoto.setMaximumHeight(int(0.7 * self.screenSize.height())) 25 | self.ui.redditPhoto.setMaximumWidth(int(0.99 * self.screenSize.width())) 26 | self.ui.redditSearchTextEdit.setMaximumWidth( 27 | int(0.15 * self.screenSize.width()) 28 | ) 29 | 30 | def next_wallpaper(self): 31 | self.enable_wall_buttons(False) 32 | query = self.ui.redditSearchTextEdit.toPlainText() 33 | subreddit = self.ui.redditSubredditCombo.currentText() 34 | category = self.ui.redditCategoryCombo.currentText() 35 | limit = self.ui.redditLimitCombo.currentText() 36 | limit = int(limit) 37 | self.download_thread = DownloadThread( 38 | self.reddit_instance, subreddit, category, limit, query 39 | ) 40 | self.download_thread.signal.connect(self.display_wallpaper) 41 | self.download_thread.start() 42 | 43 | def display_wallpaper(self, image_path): 44 | if image_path == "No results found!": 45 | self.ui.redditPhoto.setText("No results found!") 46 | self.enable_wall_buttons(True) 47 | else: 48 | self.image_path = image_path 49 | self.ui.redditPhoto.setPixmap(QtGui.QPixmap(self.image_path)) 50 | self.ui.redditPhoto.setScaledContents(True) 51 | self.enable_wall_buttons(True) 52 | 53 | 54 | def save_wallpaper(self): 55 | if self.image_path is None: 56 | messagebox = QMessageBox() 57 | messagebox.setWindowTitle("Wallpaper not found!") 58 | messagebox.setText("Choose a wallpaper to set") 59 | messagebox.setIcon(QMessageBox.Critical) 60 | messagebox.exec_() 61 | else: 62 | wall.saveWall( 63 | self.image_path, 64 | utils.Helpers.saved_wall_path( 65 | self.image_path, self.reddit_instance.get_image_extension() 66 | ), 67 | ) 68 | messagebox = QMessageBox() 69 | messagebox.setWindowTitle("Wallpaper saved!") 70 | messagebox.setText("Wallpaper saved in User's Pictures folder") 71 | messagebox.setIcon(QMessageBox.Information) 72 | messagebox.exec_() 73 | 74 | def toggle_darkmode(self): 75 | if self.ui.redditDarkModeCheck.isChecked(): 76 | win_darkmode.setDarkMode() 77 | else: 78 | win_darkmode.setLightMode() 79 | 80 | def enable_wall_buttons(self, state): 81 | self.ui.redditNextWallButton.setEnabled(state) 82 | self.ui.redditSaveButton.setEnabled(state) 83 | self.ui.redditWallpaperButton.setEnabled(state) 84 | 85 | def set_wallpaper(self): 86 | if self.image_path is None: 87 | messagebox = QMessageBox() 88 | messagebox.setWindowTitle("Wallpaper not found!") 89 | messagebox.setText("Choose a wallpaper to set") 90 | messagebox.setIcon(QMessageBox.Critical) 91 | messagebox.exec_() 92 | else: 93 | self.toggle_darkmode() 94 | wall.changeBG(self.image_path) 95 | if not utils.Helpers.insert_history(self.reddit_instance.wallpaper_url, "reddit"): 96 | QMessageBox.warning(QMessageBox(), 'Error', 'Could not add wall to the history.') 97 | 98 | 99 | class DownloadThread(QThread): 100 | signal = pyqtSignal(str) 101 | 102 | def __init__(self, reddit_instance, subreddit, category, limit, query): 103 | QThread.__init__(self) 104 | self.reddit_instance = reddit_instance 105 | self.reddit_instance.set_category(category) 106 | self.reddit_instance.set_subreddit(subreddit) 107 | self.reddit_instance.set_limit(limit) 108 | if query and not query.isspace(): 109 | self.reddit_instance.set_search_query(query) 110 | 111 | # run method gets called when we start the thread 112 | def run(self): 113 | try: 114 | self.reddit_instance.next_wallpaper() 115 | self.image_path = self.reddit_instance.get_download_path() 116 | utils.Helpers.download_wall(self.image_path, self.reddit_instance.wallpaper_url) 117 | self.signal.emit(self.image_path) 118 | except exception_handle.NoResultsFound: 119 | self.signal.emit("No results found!") -------------------------------------------------------------------------------- /src/wallhaven.py: -------------------------------------------------------------------------------- 1 | import random 2 | import secrets 3 | import wall 4 | import requests 5 | import exception_handle 6 | 7 | 8 | class Wallhaven: 9 | def __init__(self, width, height): 10 | self._query = None 11 | self.__BASE_URL = "https://wallhaven.cc/api/v1/search" 12 | self._width = str(width) 13 | self._height = str(height) 14 | self._prev_wall = "" 15 | 16 | def _build_headers(self): 17 | headers = { 18 | "user-agent": secrets.user_agent, 19 | "X-API-Key": secrets.wallhaven_api_key, 20 | } 21 | return headers 22 | 23 | def _build_categories(self): 24 | _categories = "" 25 | if self._general: 26 | _categories = _categories + "1" 27 | else: 28 | _categories = _categories + "0" 29 | 30 | if self._anime: 31 | _categories = _categories + "1" 32 | else: 33 | _categories = _categories + "0" 34 | 35 | if self._people: 36 | _categories = _categories + "1" 37 | else: 38 | _categories = _categories + "0" 39 | 40 | return _categories 41 | 42 | def _build_purity(self): 43 | _purity = "" 44 | if self._sfw: 45 | _purity = _purity + "1" 46 | else: 47 | _purity = _purity + "0" 48 | 49 | if self._sketchy: 50 | _purity = _purity + "1" 51 | else: 52 | _purity = _purity + "0" 53 | 54 | if self._nsfw: 55 | _purity = _purity + "1" 56 | else: 57 | _purity = _purity + "0" 58 | 59 | return _purity 60 | 61 | def _screen_res(self): 62 | return self._width + "x" + self._height 63 | 64 | def _build_params(self): 65 | parameters = { 66 | "q": self._query, 67 | "categories": self._build_categories(), 68 | "purity": self._build_purity(), 69 | "sorting": self._sort, 70 | "atleast": self._screen_res(), 71 | } 72 | return parameters 73 | 74 | def wallpapers(self): 75 | response = requests.get( 76 | self.__BASE_URL, headers=self._build_headers(), params=self._build_params() 77 | ) 78 | 79 | if response.status_code == 200: 80 | image_count = 0 81 | for _ in response.json()["data"]: 82 | image_count += 1 83 | if image_count == 0: 84 | raise exception_handle.NoResultsFound() 85 | else: 86 | index = random.randint(0, image_count - 1) 87 | print(image_count) 88 | print(index) 89 | image = response.json()["data"][index] 90 | self._wallpaper_url = image["path"] 91 | if self._prev_wall == self._wallpaper_url: 92 | self.wallpapers() 93 | self._prev_wall = self._wallpaper_url 94 | print(self._wallpaper_url) 95 | self._image_extension = image["file_type"].replace("image/", ".") 96 | # print(self._image_extension) 97 | 98 | def get_download_path(self): 99 | self.download_file = "pic1.jpeg" 100 | 101 | if ".png" in str(self._image_extension): 102 | self.download_file = self.download_file.replace("jpeg", "png") 103 | 104 | self._download_path = wall.temp_download_dir() + "\\" + self.download_file 105 | return self._download_path 106 | 107 | @property 108 | def wallpaper_url(self): 109 | return self._wallpaper_url 110 | 111 | @wallpaper_url.setter 112 | def wallpaper_url(self, w): 113 | pass 114 | 115 | @property 116 | def image_extension(self): 117 | return self._image_extension 118 | 119 | @image_extension.setter 120 | def image_extension(self, i): 121 | pass 122 | 123 | @property 124 | def query(self): 125 | return self._query 126 | 127 | @query.setter 128 | def query(self, query): 129 | self._query = query 130 | 131 | @property 132 | def general(self): 133 | return self._general 134 | 135 | @general.setter 136 | def general(self, general): 137 | self._general = general 138 | 139 | @property 140 | def anime(self): 141 | return self._anime 142 | 143 | @anime.setter 144 | def anime(self, anime): 145 | self._anime = anime 146 | 147 | @property 148 | def people(self): 149 | return self._people 150 | 151 | @people.setter 152 | def people(self, people): 153 | self._people = people 154 | 155 | @property 156 | def sfw(self): 157 | return self._sfw 158 | 159 | @sfw.setter 160 | def sfw(self, sfw): 161 | self._sfw = sfw 162 | 163 | @property 164 | def sketchy(self): 165 | return self._sketchy 166 | 167 | @sketchy.setter 168 | def sketchy(self, sketchy): 169 | self._sketchy = sketchy 170 | 171 | @property 172 | def nsfw(self): 173 | return self._nsfw 174 | 175 | @nsfw.setter 176 | def nsfw(self, nsfw): 177 | self._nsfw = nsfw 178 | 179 | @property 180 | def sort(self): 181 | return self._sort 182 | 183 | @sort.setter 184 | def sort(self, sort): 185 | self._sort = sort 186 | 187 | 188 | if __name__ == "__main__": 189 | wallhaven = Wallhaven("1920", "1080") 190 | wallhaven.general = False 191 | wallhaven.anime = False 192 | wallhaven.people = False 193 | wallhaven.sort = "views" 194 | wallhaven.sfw = False 195 | wallhaven.sketchy = False 196 | wallhaven.nsfw = False 197 | wallhaven.wallpapers() 198 | wallhaven.get_download_path() 199 | -------------------------------------------------------------------------------- /src/wallhaven_window.py: -------------------------------------------------------------------------------- 1 | from os import path 2 | 3 | from PyQt5 import QtGui 4 | from PyQt5.QtCore import * 5 | from PyQt5.QtGui import * 6 | from PyQt5.QtWidgets import * 7 | 8 | import wallhaven 9 | import wall 10 | import win_darkmode 11 | import utils 12 | import exception_handle 13 | 14 | 15 | class WallhavenWindow: 16 | def __init__(self, main_window): 17 | self.ui = main_window 18 | self.screenSize = QDesktopWidget().screenGeometry(0) 19 | self.image_path = None 20 | self.wh_instance = wallhaven.Wallhaven(self.screenSize.width(), self.screenSize.height()) 21 | self.ui.whPhoto.setMaximumHeight(int(0.7 * self.screenSize.height())) 22 | self.ui.whPhoto.setMaximumWidth(int(0.99 * self.screenSize.width())) 23 | self.ui.whNextWallButton.clicked.connect(self.next_wallpaper) 24 | self.ui.whWallpaperButton.clicked.connect(self.set_wallpaper) 25 | self.ui.whSaveButton.clicked.connect(self.save_wallpaper) 26 | 27 | def next_wallpaper(self): 28 | self.enable_wall_buttons(False) 29 | query = self.ui.whSearchTextEdit.toPlainText() 30 | is_general = self.ui.whGeneralCheck.isChecked() 31 | is_anime = self.ui.whAnimeCheck.isChecked() 32 | is_people = self.ui.whPeopleCheck.isChecked() 33 | is_sfw = self.ui.whSfwCheck.isChecked() 34 | is_sketchy = self.ui.whSketchyCheck.isChecked() 35 | is_nsfw = self.ui.whNsfwCheck.isChecked() 36 | sort = self.ui.whSortCombo.currentText() 37 | if self.valid_categories(is_general, is_anime, is_people) and self.valid_purity( 38 | is_sfw, is_sketchy, is_nsfw 39 | ): 40 | self.download_thread = WallhavenDownloadThread( 41 | self.wh_instance, 42 | query, 43 | is_general, 44 | is_anime, 45 | is_people, 46 | is_sfw, 47 | is_sketchy, 48 | is_nsfw, 49 | sort, 50 | ) 51 | self.download_thread.signal.connect(self.display_wallpaper) 52 | self.download_thread.start() 53 | else: 54 | self.enable_wall_buttons(True) 55 | 56 | def save_wallpaper(self): 57 | if self.image_path is None: 58 | messagebox = QMessageBox() 59 | messagebox.setWindowTitle("Wallpaper not found!") 60 | messagebox.setText("Choose a wallpaper to set") 61 | messagebox.setIcon(QMessageBox.Critical) 62 | messagebox.exec_() 63 | else: 64 | wall.saveWall( 65 | self.image_path, 66 | utils.Helpers.saved_wall_path( 67 | self.image_path, self.wh_instance.image_extension 68 | ), 69 | ) 70 | messagebox = QMessageBox() 71 | messagebox.setWindowTitle("Wallpaper saved!") 72 | messagebox.setText("Wallpaper saved in User's Pictures folder") 73 | messagebox.setIcon(QMessageBox.Information) 74 | messagebox.exec_() 75 | 76 | def set_wallpaper(self): 77 | if self.image_path is None: 78 | messagebox = QMessageBox() 79 | messagebox.setWindowTitle("Wallpaper not found!") 80 | messagebox.setText("Choose a wallpaper to set") 81 | messagebox.setIcon(QMessageBox.Critical) 82 | messagebox.exec_() 83 | else: 84 | self.toggle_dark_mode() 85 | wall.changeBG(self.image_path) 86 | if not utils.Helpers.insert_history(self.wh_instance.wallpaper_url, "wallhaven"): 87 | QMessageBox.warning(QMessageBox(), 'Error', 'Could not add wall to the history.') 88 | 89 | def display_wallpaper(self, image_path): 90 | if image_path == "No results found!": 91 | self.ui.whPhoto.setText("No results found!") 92 | self.enable_wall_buttons(True) 93 | else: 94 | self.image_path = image_path 95 | self.ui.whPhoto.setPixmap(QtGui.QPixmap(self.image_path)) 96 | self.ui.whPhoto.setScaledContents(True) 97 | self.enable_wall_buttons(True) 98 | 99 | def toggle_dark_mode(self): 100 | if self.ui.whDarkModeCheck.isChecked(): 101 | win_darkmode.setDarkMode() 102 | else: 103 | win_darkmode.setLightMode() 104 | 105 | def valid_categories(self, is_general, is_anime, is_people): 106 | if not (is_general or is_anime or is_people): 107 | messagebox = QMessageBox() 108 | messagebox.setWindowTitle("Error!") 109 | messagebox.setText( 110 | "Choose atleast one option out of general, anime and people" 111 | ) 112 | messagebox.setIcon(QMessageBox.Critical) 113 | messagebox.exec_() 114 | return False 115 | else: 116 | return True 117 | 118 | def valid_purity(self, is_sfw, is_sketchy, is_nsfw): 119 | if not (is_sfw or is_sketchy or is_nsfw): 120 | messagebox = QMessageBox() 121 | messagebox.setWindowTitle("Error!") 122 | messagebox.setText("Choose atleast one option out of sfw, sketchy and nsfw") 123 | messagebox.setIcon(QMessageBox.Critical) 124 | messagebox.exec_() 125 | return False 126 | else: 127 | return True 128 | 129 | def enable_wall_buttons(self, state): 130 | self.ui.whNextWallButton.setEnabled(state) 131 | self.ui.whSaveButton.setEnabled(state) 132 | self.ui.whWallpaperButton.setEnabled(state) 133 | 134 | 135 | class WallhavenDownloadThread(QThread): 136 | signal = pyqtSignal(str) 137 | 138 | def __init__( 139 | self, 140 | wh_instance, 141 | query, 142 | is_general, 143 | is_anime, 144 | is_people, 145 | is_sfw, 146 | is_sketchy, 147 | is_nsfw, 148 | sort, 149 | ): 150 | QThread.__init__(self) 151 | self.wh_instance = wh_instance 152 | self.wh_instance.general = is_general 153 | self.wh_instance.anime = is_anime 154 | self.wh_instance.people = is_people 155 | self.wh_instance.sfw = is_sfw 156 | self.wh_instance.sketchy = is_sketchy 157 | self.wh_instance.nsfw = is_nsfw 158 | self.wh_instance.sort = sort 159 | if query and not query.isspace(): 160 | self.wh_instance.query = query 161 | else: 162 | self.wh_instance.query = None 163 | 164 | def run(self): 165 | try: 166 | self.wh_instance.wallpapers() 167 | self.image_path = self.wh_instance.get_download_path() 168 | utils.Helpers.download_wall( 169 | self.image_path, self.wh_instance.wallpaper_url 170 | ) 171 | self.signal.emit(self.image_path) 172 | except exception_handle.NoResultsFound: 173 | self.signal.emit("No results found!") 174 | -------------------------------------------------------------------------------- /src/kustompyper.u.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1239 10 | 777 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 21 | 5 22 | 23 | 24 | 25 | 26 | 27 | 28 | true 29 | 30 | 31 | 32 | wallpapers 33 | 34 | 35 | 36 | 37 | amoledbackgrounds 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | Limit : 46 | 47 | 48 | 49 | 50 | 51 | 52 | Subreddit : 53 | 54 | 55 | 56 | 57 | 58 | 59 | true 60 | 61 | 62 | Set a random wallpaper from reddit! 63 | 64 | 65 | false 66 | 67 | 68 | Qt::AlignCenter 69 | 70 | 71 | 72 | 73 | 74 | 75 | Qt::Horizontal 76 | 77 | 78 | 79 | 784 80 | 20 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | Category : 89 | 90 | 91 | 92 | 93 | 94 | 95 | true 96 | 97 | 98 | 99 | 10 100 | 101 | 102 | 103 | 104 | 25 105 | 106 | 107 | 108 | 109 | 50 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | Dark Mode : 118 | 119 | 120 | 121 | 122 | 123 | 124 | Save to Pictures 125 | 126 | 127 | 128 | 129 | 130 | 131 | Next wallpaper 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 500 140 | 21 141 | 142 | 143 | 144 | Qt::ScrollBarAlwaysOff 145 | 146 | 147 | Qt::ScrollBarAlwaysOff 148 | 149 | 150 | false 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | Set as wallpaper 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | hot 173 | 174 | 175 | 176 | 177 | rising 178 | 179 | 180 | 181 | 182 | new 183 | 184 | 185 | 186 | 187 | top 188 | 189 | 190 | 191 | 192 | controversial 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | Search: 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | true 212 | 213 | 214 | Set a random wallpaper from Unsplash! 215 | 216 | 217 | false 218 | 219 | 220 | Qt::AlignCenter 221 | 222 | 223 | 224 | 225 | 226 | 227 | Search: 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 500 236 | 21 237 | 238 | 239 | 240 | Qt::ScrollBarAlwaysOff 241 | 242 | 243 | Qt::ScrollBarAlwaysOff 244 | 245 | 246 | false 247 | 248 | 249 | 250 | 251 | 252 | 253 | Qt::Horizontal 254 | 255 | 256 | 257 | 752 258 | 20 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | Featured : 267 | 268 | 269 | 270 | 271 | 272 | 273 | Dark Mode : 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | Next wallpaper 288 | 289 | 290 | 291 | 292 | 293 | 294 | Save to Pictures 295 | 296 | 297 | 298 | 299 | 300 | 301 | Set as wallpaper 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | true 320 | 321 | 322 | Set the wallpaper of the day from Bing! 323 | 324 | 325 | false 326 | 327 | 328 | Qt::AlignCenter 329 | 330 | 331 | 332 | 333 | 334 | 335 | Qt::Horizontal 336 | 337 | 338 | 339 | 871 340 | 20 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | Country: 349 | 350 | 351 | 352 | 353 | 354 | 355 | Dark Mode : 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | Next wallpaper 370 | 371 | 372 | 373 | 374 | 375 | 376 | Save to Pictures 377 | 378 | 379 | 380 | 381 | 382 | 383 | Set as wallpaper 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | India 392 | 393 | 394 | 395 | 396 | US 397 | 398 | 399 | 400 | 401 | China 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | true 414 | 415 | 416 | Set a random wallpaper from Walhaven! 417 | 418 | 419 | false 420 | 421 | 422 | Qt::AlignCenter 423 | 424 | 425 | 426 | 427 | 428 | 429 | Search: 430 | 431 | 432 | 433 | 434 | 435 | 436 | Categories: 437 | 438 | 439 | 440 | 441 | 442 | 443 | General 444 | 445 | 446 | 447 | 448 | 449 | 450 | Anime 451 | 452 | 453 | 454 | 455 | 456 | 457 | People 458 | 459 | 460 | 461 | 462 | 463 | 464 | sfw 465 | 466 | 467 | 468 | 469 | 470 | 471 | sketchy 472 | 473 | 474 | 475 | 476 | 477 | 478 | nsfw 479 | 480 | 481 | 482 | 483 | 484 | 485 | Qt::Horizontal 486 | 487 | 488 | 489 | 780 490 | 20 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | Sort Criteria: 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | random 507 | 508 | 509 | 510 | 511 | favorites 512 | 513 | 514 | 515 | 516 | toplist 517 | 518 | 519 | 520 | 521 | relevance 522 | 523 | 524 | 525 | 526 | views 527 | 528 | 529 | 530 | 531 | date_added 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | Dark Mode : 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | Next wallpaper 554 | 555 | 556 | 557 | 558 | 559 | 560 | Save to Pictures 561 | 562 | 563 | 564 | 565 | 566 | 567 | Set as wallpaper 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 500 576 | 21 577 | 578 | 579 | 580 | Qt::ScrollBarAlwaysOff 581 | 582 | 583 | Qt::ScrollBarAlwaysOff 584 | 585 | 586 | false 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | KustomPyper - Get amazing wallpapers for your desktop. <br> Created by Kriticalflare (<a href="https://github.com/kriticalflare">Github</a>) </br> 598 | 599 | 600 | Qt::RichText 601 | 602 | 603 | Qt::AlignCenter 604 | 605 | 606 | true 607 | 608 | 609 | true 610 | 611 | 612 | Qt::TextBrowserInteraction 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | QAbstractScrollArea::AdjustToContents 624 | 625 | 626 | QAbstractItemView::NoEditTriggers 627 | 628 | 629 | true 630 | 631 | 632 | 633 | wallpaper 634 | 635 | 636 | 637 | 638 | source 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | Qt::Horizontal 647 | 648 | 649 | 650 | 992 651 | 20 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | Refresh 660 | 661 | 662 | 663 | 664 | 665 | 666 | Clear 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 0 680 | 0 681 | 1239 682 | 26 683 | 684 | 685 | 686 | 687 | Help 688 | 689 | 690 | 691 | 692 | 693 | 694 | Navigate 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | History 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | About 715 | 716 | 717 | 718 | 719 | Help 720 | 721 | 722 | 723 | 724 | false 725 | 726 | 727 | Reddit Walls 728 | 729 | 730 | 731 | 732 | Reddit 733 | 734 | 735 | 736 | 737 | Reddit Walls 738 | 739 | 740 | 741 | 742 | Unsplash Walls 743 | 744 | 745 | 746 | 747 | Bing Walls 748 | 749 | 750 | 751 | 752 | Wallhaven Walls 753 | 754 | 755 | 756 | 757 | View History 758 | 759 | 760 | 761 | 762 | 763 | 764 | -------------------------------------------------------------------------------- /src/gui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'F:\PythonProjects\KustomPyper\ui\basic_history.u.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.13.2 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | 10 | from PyQt5 import QtCore, QtGui, QtWidgets 11 | 12 | 13 | class Ui_MainWindow(object): 14 | def setupUi(self, MainWindow): 15 | MainWindow.setObjectName("MainWindow") 16 | MainWindow.resize(1239, 777) 17 | self.centralwidget = QtWidgets.QWidget(MainWindow) 18 | self.centralwidget.setObjectName("centralwidget") 19 | self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) 20 | self.gridLayout.setObjectName("gridLayout") 21 | self.pageStackWidget = QtWidgets.QStackedWidget(self.centralwidget) 22 | self.pageStackWidget.setObjectName("pageStackWidget") 23 | self.redditPage = QtWidgets.QWidget() 24 | self.redditPage.setObjectName("redditPage") 25 | self.gridLayout_2 = QtWidgets.QGridLayout(self.redditPage) 26 | self.gridLayout_2.setObjectName("gridLayout_2") 27 | self.redditSubredditCombo = QtWidgets.QComboBox(self.redditPage) 28 | self.redditSubredditCombo.setEditable(True) 29 | self.redditSubredditCombo.setObjectName("redditSubredditCombo") 30 | self.redditSubredditCombo.addItem("") 31 | self.redditSubredditCombo.addItem("") 32 | self.gridLayout_2.addWidget(self.redditSubredditCombo, 2, 3, 1, 1) 33 | self.redditLimitLabel = QtWidgets.QLabel(self.redditPage) 34 | self.redditLimitLabel.setObjectName("redditLimitLabel") 35 | self.gridLayout_2.addWidget(self.redditLimitLabel, 4, 1, 1, 1) 36 | self.redditSubredditLabel = QtWidgets.QLabel(self.redditPage) 37 | self.redditSubredditLabel.setObjectName("redditSubredditLabel") 38 | self.gridLayout_2.addWidget(self.redditSubredditLabel, 2, 1, 1, 1) 39 | self.redditPhoto = QtWidgets.QLabel(self.redditPage) 40 | self.redditPhoto.setEnabled(True) 41 | self.redditPhoto.setScaledContents(False) 42 | self.redditPhoto.setAlignment(QtCore.Qt.AlignCenter) 43 | self.redditPhoto.setObjectName("redditPhoto") 44 | self.gridLayout_2.addWidget(self.redditPhoto, 0, 0, 1, 4) 45 | spacerItem = QtWidgets.QSpacerItem(784, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 46 | self.gridLayout_2.addItem(spacerItem, 3, 0, 1, 1) 47 | self.redditCategoryLabel = QtWidgets.QLabel(self.redditPage) 48 | self.redditCategoryLabel.setObjectName("redditCategoryLabel") 49 | self.gridLayout_2.addWidget(self.redditCategoryLabel, 3, 1, 1, 1) 50 | self.redditLimitCombo = QtWidgets.QComboBox(self.redditPage) 51 | self.redditLimitCombo.setEditable(True) 52 | self.redditLimitCombo.setObjectName("redditLimitCombo") 53 | self.redditLimitCombo.addItem("") 54 | self.redditLimitCombo.addItem("") 55 | self.redditLimitCombo.addItem("") 56 | self.gridLayout_2.addWidget(self.redditLimitCombo, 4, 3, 1, 1) 57 | self.redditDarkModelabel = QtWidgets.QLabel(self.redditPage) 58 | self.redditDarkModelabel.setObjectName("redditDarkModelabel") 59 | self.gridLayout_2.addWidget(self.redditDarkModelabel, 5, 1, 1, 1) 60 | self.redditSaveButton = QtWidgets.QPushButton(self.redditPage) 61 | self.redditSaveButton.setObjectName("redditSaveButton") 62 | self.gridLayout_2.addWidget(self.redditSaveButton, 6, 2, 1, 1) 63 | self.redditNextWallButton = QtWidgets.QPushButton(self.redditPage) 64 | self.redditNextWallButton.setObjectName("redditNextWallButton") 65 | self.gridLayout_2.addWidget(self.redditNextWallButton, 6, 1, 1, 1) 66 | self.redditSearchTextEdit = QtWidgets.QTextEdit(self.redditPage) 67 | self.redditSearchTextEdit.setMaximumSize(QtCore.QSize(500, 21)) 68 | self.redditSearchTextEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 69 | self.redditSearchTextEdit.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 70 | self.redditSearchTextEdit.setAcceptRichText(False) 71 | self.redditSearchTextEdit.setObjectName("redditSearchTextEdit") 72 | self.gridLayout_2.addWidget(self.redditSearchTextEdit, 1, 3, 1, 1) 73 | self.redditDarkModeCheck = QtWidgets.QCheckBox(self.redditPage) 74 | self.redditDarkModeCheck.setText("") 75 | self.redditDarkModeCheck.setObjectName("redditDarkModeCheck") 76 | self.gridLayout_2.addWidget(self.redditDarkModeCheck, 5, 3, 1, 1) 77 | self.redditWallpaperButton = QtWidgets.QPushButton(self.redditPage) 78 | self.redditWallpaperButton.setObjectName("redditWallpaperButton") 79 | self.gridLayout_2.addWidget(self.redditWallpaperButton, 6, 3, 1, 1) 80 | self.redditCategoryCombo = QtWidgets.QComboBox(self.redditPage) 81 | self.redditCategoryCombo.setObjectName("redditCategoryCombo") 82 | self.redditCategoryCombo.addItem("") 83 | self.redditCategoryCombo.addItem("") 84 | self.redditCategoryCombo.addItem("") 85 | self.redditCategoryCombo.addItem("") 86 | self.redditCategoryCombo.addItem("") 87 | self.gridLayout_2.addWidget(self.redditCategoryCombo, 3, 3, 1, 1) 88 | self.redditSearchLabel = QtWidgets.QLabel(self.redditPage) 89 | self.redditSearchLabel.setObjectName("redditSearchLabel") 90 | self.gridLayout_2.addWidget(self.redditSearchLabel, 1, 1, 1, 1) 91 | self.pageStackWidget.addWidget(self.redditPage) 92 | self.unsplashPage = QtWidgets.QWidget() 93 | self.unsplashPage.setObjectName("unsplashPage") 94 | self.gridLayout_4 = QtWidgets.QGridLayout(self.unsplashPage) 95 | self.gridLayout_4.setObjectName("gridLayout_4") 96 | self.unsplashPhoto = QtWidgets.QLabel(self.unsplashPage) 97 | self.unsplashPhoto.setEnabled(True) 98 | self.unsplashPhoto.setScaledContents(False) 99 | self.unsplashPhoto.setAlignment(QtCore.Qt.AlignCenter) 100 | self.unsplashPhoto.setObjectName("unsplashPhoto") 101 | self.gridLayout_4.addWidget(self.unsplashPhoto, 0, 0, 1, 4) 102 | self.unsplashSearchLabel = QtWidgets.QLabel(self.unsplashPage) 103 | self.unsplashSearchLabel.setObjectName("unsplashSearchLabel") 104 | self.gridLayout_4.addWidget(self.unsplashSearchLabel, 1, 1, 1, 1) 105 | self.unsplashSearchTextEdit = QtWidgets.QTextEdit(self.unsplashPage) 106 | self.unsplashSearchTextEdit.setMaximumSize(QtCore.QSize(500, 21)) 107 | self.unsplashSearchTextEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 108 | self.unsplashSearchTextEdit.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 109 | self.unsplashSearchTextEdit.setAcceptRichText(False) 110 | self.unsplashSearchTextEdit.setObjectName("unsplashSearchTextEdit") 111 | self.gridLayout_4.addWidget(self.unsplashSearchTextEdit, 1, 3, 1, 1) 112 | spacerItem1 = QtWidgets.QSpacerItem(752, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 113 | self.gridLayout_4.addItem(spacerItem1, 2, 0, 1, 1) 114 | self.unsplashFeaturedLabel = QtWidgets.QLabel(self.unsplashPage) 115 | self.unsplashFeaturedLabel.setObjectName("unsplashFeaturedLabel") 116 | self.gridLayout_4.addWidget(self.unsplashFeaturedLabel, 2, 1, 1, 1) 117 | self.unsplashDarkModeLabel = QtWidgets.QLabel(self.unsplashPage) 118 | self.unsplashDarkModeLabel.setObjectName("unsplashDarkModeLabel") 119 | self.gridLayout_4.addWidget(self.unsplashDarkModeLabel, 3, 1, 1, 1) 120 | self.unsplashDarkModeCheck = QtWidgets.QCheckBox(self.unsplashPage) 121 | self.unsplashDarkModeCheck.setText("") 122 | self.unsplashDarkModeCheck.setObjectName("unsplashDarkModeCheck") 123 | self.gridLayout_4.addWidget(self.unsplashDarkModeCheck, 3, 3, 1, 1) 124 | self.unsplashNextWallButton = QtWidgets.QPushButton(self.unsplashPage) 125 | self.unsplashNextWallButton.setObjectName("unsplashNextWallButton") 126 | self.gridLayout_4.addWidget(self.unsplashNextWallButton, 4, 1, 1, 1) 127 | self.unsplashSaveButton = QtWidgets.QPushButton(self.unsplashPage) 128 | self.unsplashSaveButton.setObjectName("unsplashSaveButton") 129 | self.gridLayout_4.addWidget(self.unsplashSaveButton, 4, 2, 1, 1) 130 | self.unsplashWallpaperButton = QtWidgets.QPushButton(self.unsplashPage) 131 | self.unsplashWallpaperButton.setObjectName("unsplashWallpaperButton") 132 | self.gridLayout_4.addWidget(self.unsplashWallpaperButton, 4, 3, 1, 1) 133 | self.unsplashFeaturedCheck = QtWidgets.QCheckBox(self.unsplashPage) 134 | self.unsplashFeaturedCheck.setText("") 135 | self.unsplashFeaturedCheck.setObjectName("unsplashFeaturedCheck") 136 | self.gridLayout_4.addWidget(self.unsplashFeaturedCheck, 2, 3, 1, 1) 137 | self.pageStackWidget.addWidget(self.unsplashPage) 138 | self.bingPage = QtWidgets.QWidget() 139 | self.bingPage.setObjectName("bingPage") 140 | self.gridLayout_5 = QtWidgets.QGridLayout(self.bingPage) 141 | self.gridLayout_5.setObjectName("gridLayout_5") 142 | self.bingPhoto = QtWidgets.QLabel(self.bingPage) 143 | self.bingPhoto.setEnabled(True) 144 | self.bingPhoto.setScaledContents(False) 145 | self.bingPhoto.setAlignment(QtCore.Qt.AlignCenter) 146 | self.bingPhoto.setObjectName("bingPhoto") 147 | self.gridLayout_5.addWidget(self.bingPhoto, 0, 0, 1, 4) 148 | spacerItem2 = QtWidgets.QSpacerItem(871, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 149 | self.gridLayout_5.addItem(spacerItem2, 1, 0, 1, 1) 150 | self.bingCountryLabel = QtWidgets.QLabel(self.bingPage) 151 | self.bingCountryLabel.setObjectName("bingCountryLabel") 152 | self.gridLayout_5.addWidget(self.bingCountryLabel, 1, 1, 1, 1) 153 | self.bingDarkModeLabel = QtWidgets.QLabel(self.bingPage) 154 | self.bingDarkModeLabel.setObjectName("bingDarkModeLabel") 155 | self.gridLayout_5.addWidget(self.bingDarkModeLabel, 2, 1, 1, 1) 156 | self.bingDarkModeCheck = QtWidgets.QCheckBox(self.bingPage) 157 | self.bingDarkModeCheck.setText("") 158 | self.bingDarkModeCheck.setObjectName("bingDarkModeCheck") 159 | self.gridLayout_5.addWidget(self.bingDarkModeCheck, 2, 2, 1, 1) 160 | self.bingNextWallButton = QtWidgets.QPushButton(self.bingPage) 161 | self.bingNextWallButton.setObjectName("bingNextWallButton") 162 | self.gridLayout_5.addWidget(self.bingNextWallButton, 3, 1, 1, 1) 163 | self.bingSaveButton = QtWidgets.QPushButton(self.bingPage) 164 | self.bingSaveButton.setObjectName("bingSaveButton") 165 | self.gridLayout_5.addWidget(self.bingSaveButton, 3, 2, 1, 1) 166 | self.bingWallpaperButton = QtWidgets.QPushButton(self.bingPage) 167 | self.bingWallpaperButton.setObjectName("bingWallpaperButton") 168 | self.gridLayout_5.addWidget(self.bingWallpaperButton, 3, 3, 1, 1) 169 | self.bingCountryCombo = QtWidgets.QComboBox(self.bingPage) 170 | self.bingCountryCombo.setObjectName("bingCountryCombo") 171 | self.bingCountryCombo.addItem("") 172 | self.bingCountryCombo.addItem("") 173 | self.bingCountryCombo.addItem("") 174 | self.gridLayout_5.addWidget(self.bingCountryCombo, 1, 2, 1, 2) 175 | self.pageStackWidget.addWidget(self.bingPage) 176 | self.wallhavenPage = QtWidgets.QWidget() 177 | self.wallhavenPage.setObjectName("wallhavenPage") 178 | self.gridLayout_6 = QtWidgets.QGridLayout(self.wallhavenPage) 179 | self.gridLayout_6.setObjectName("gridLayout_6") 180 | self.whPhoto = QtWidgets.QLabel(self.wallhavenPage) 181 | self.whPhoto.setEnabled(True) 182 | self.whPhoto.setScaledContents(False) 183 | self.whPhoto.setAlignment(QtCore.Qt.AlignCenter) 184 | self.whPhoto.setObjectName("whPhoto") 185 | self.gridLayout_6.addWidget(self.whPhoto, 0, 0, 1, 5) 186 | self.whSearchLabel = QtWidgets.QLabel(self.wallhavenPage) 187 | self.whSearchLabel.setObjectName("whSearchLabel") 188 | self.gridLayout_6.addWidget(self.whSearchLabel, 1, 1, 1, 1) 189 | self.whCategoriesLabel = QtWidgets.QLabel(self.wallhavenPage) 190 | self.whCategoriesLabel.setObjectName("whCategoriesLabel") 191 | self.gridLayout_6.addWidget(self.whCategoriesLabel, 2, 1, 1, 1) 192 | self.whGeneralCheck = QtWidgets.QCheckBox(self.wallhavenPage) 193 | self.whGeneralCheck.setObjectName("whGeneralCheck") 194 | self.gridLayout_6.addWidget(self.whGeneralCheck, 2, 2, 1, 1) 195 | self.whAnimeCheck = QtWidgets.QCheckBox(self.wallhavenPage) 196 | self.whAnimeCheck.setObjectName("whAnimeCheck") 197 | self.gridLayout_6.addWidget(self.whAnimeCheck, 2, 3, 1, 1) 198 | self.whPeopleCheck = QtWidgets.QCheckBox(self.wallhavenPage) 199 | self.whPeopleCheck.setObjectName("whPeopleCheck") 200 | self.gridLayout_6.addWidget(self.whPeopleCheck, 2, 4, 1, 1) 201 | self.whSfwCheck = QtWidgets.QCheckBox(self.wallhavenPage) 202 | self.whSfwCheck.setObjectName("whSfwCheck") 203 | self.gridLayout_6.addWidget(self.whSfwCheck, 3, 2, 1, 1) 204 | self.whSketchyCheck = QtWidgets.QCheckBox(self.wallhavenPage) 205 | self.whSketchyCheck.setObjectName("whSketchyCheck") 206 | self.gridLayout_6.addWidget(self.whSketchyCheck, 3, 3, 1, 1) 207 | self.whNsfwCheck = QtWidgets.QCheckBox(self.wallhavenPage) 208 | self.whNsfwCheck.setObjectName("whNsfwCheck") 209 | self.gridLayout_6.addWidget(self.whNsfwCheck, 3, 4, 1, 1) 210 | spacerItem3 = QtWidgets.QSpacerItem(780, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 211 | self.gridLayout_6.addItem(spacerItem3, 4, 0, 1, 1) 212 | self.whSortLabel = QtWidgets.QLabel(self.wallhavenPage) 213 | self.whSortLabel.setObjectName("whSortLabel") 214 | self.gridLayout_6.addWidget(self.whSortLabel, 4, 1, 1, 1) 215 | self.whSortCombo = QtWidgets.QComboBox(self.wallhavenPage) 216 | self.whSortCombo.setObjectName("whSortCombo") 217 | self.whSortCombo.addItem("") 218 | self.whSortCombo.addItem("") 219 | self.whSortCombo.addItem("") 220 | self.whSortCombo.addItem("") 221 | self.whSortCombo.addItem("") 222 | self.whSortCombo.addItem("") 223 | self.gridLayout_6.addWidget(self.whSortCombo, 4, 2, 1, 1) 224 | self.whDarkModelabel = QtWidgets.QLabel(self.wallhavenPage) 225 | self.whDarkModelabel.setObjectName("whDarkModelabel") 226 | self.gridLayout_6.addWidget(self.whDarkModelabel, 5, 1, 1, 1) 227 | self.whDarkModeCheck = QtWidgets.QCheckBox(self.wallhavenPage) 228 | self.whDarkModeCheck.setText("") 229 | self.whDarkModeCheck.setObjectName("whDarkModeCheck") 230 | self.gridLayout_6.addWidget(self.whDarkModeCheck, 5, 2, 1, 1) 231 | self.whNextWallButton = QtWidgets.QPushButton(self.wallhavenPage) 232 | self.whNextWallButton.setObjectName("whNextWallButton") 233 | self.gridLayout_6.addWidget(self.whNextWallButton, 6, 2, 1, 1) 234 | self.whSaveButton = QtWidgets.QPushButton(self.wallhavenPage) 235 | self.whSaveButton.setObjectName("whSaveButton") 236 | self.gridLayout_6.addWidget(self.whSaveButton, 6, 3, 1, 1) 237 | self.whWallpaperButton = QtWidgets.QPushButton(self.wallhavenPage) 238 | self.whWallpaperButton.setObjectName("whWallpaperButton") 239 | self.gridLayout_6.addWidget(self.whWallpaperButton, 6, 4, 1, 1) 240 | self.whSearchTextEdit = QtWidgets.QTextEdit(self.wallhavenPage) 241 | self.whSearchTextEdit.setMaximumSize(QtCore.QSize(500, 21)) 242 | self.whSearchTextEdit.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 243 | self.whSearchTextEdit.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) 244 | self.whSearchTextEdit.setAcceptRichText(False) 245 | self.whSearchTextEdit.setObjectName("whSearchTextEdit") 246 | self.gridLayout_6.addWidget(self.whSearchTextEdit, 1, 2, 1, 3) 247 | self.pageStackWidget.addWidget(self.wallhavenPage) 248 | self.aboutPage = QtWidgets.QWidget() 249 | self.aboutPage.setObjectName("aboutPage") 250 | self.gridLayout_3 = QtWidgets.QGridLayout(self.aboutPage) 251 | self.gridLayout_3.setObjectName("gridLayout_3") 252 | self.aboutLabel = QtWidgets.QLabel(self.aboutPage) 253 | self.aboutLabel.setTextFormat(QtCore.Qt.RichText) 254 | self.aboutLabel.setAlignment(QtCore.Qt.AlignCenter) 255 | self.aboutLabel.setWordWrap(True) 256 | self.aboutLabel.setOpenExternalLinks(True) 257 | self.aboutLabel.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction) 258 | self.aboutLabel.setObjectName("aboutLabel") 259 | self.gridLayout_3.addWidget(self.aboutLabel, 0, 0, 1, 1) 260 | self.pageStackWidget.addWidget(self.aboutPage) 261 | self.historyPage = QtWidgets.QWidget() 262 | self.historyPage.setObjectName("historyPage") 263 | self.gridLayout_7 = QtWidgets.QGridLayout(self.historyPage) 264 | self.gridLayout_7.setObjectName("gridLayout_7") 265 | self.historyTableWidget = QtWidgets.QTableWidget(self.historyPage) 266 | self.historyTableWidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) 267 | self.historyTableWidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) 268 | self.historyTableWidget.setObjectName("historyTableWidget") 269 | self.historyTableWidget.setColumnCount(2) 270 | self.historyTableWidget.setRowCount(0) 271 | item = QtWidgets.QTableWidgetItem() 272 | self.historyTableWidget.setHorizontalHeaderItem(0, item) 273 | item = QtWidgets.QTableWidgetItem() 274 | self.historyTableWidget.setHorizontalHeaderItem(1, item) 275 | self.historyTableWidget.verticalHeader().setVisible(True) 276 | self.gridLayout_7.addWidget(self.historyTableWidget, 0, 0, 1, 3) 277 | spacerItem4 = QtWidgets.QSpacerItem(992, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) 278 | self.gridLayout_7.addItem(spacerItem4, 1, 0, 1, 1) 279 | self.historyRefreshButton = QtWidgets.QPushButton(self.historyPage) 280 | self.historyRefreshButton.setObjectName("historyRefreshButton") 281 | self.gridLayout_7.addWidget(self.historyRefreshButton, 1, 1, 1, 1) 282 | self.historyClearButton = QtWidgets.QPushButton(self.historyPage) 283 | self.historyClearButton.setObjectName("historyClearButton") 284 | self.gridLayout_7.addWidget(self.historyClearButton, 1, 2, 1, 1) 285 | self.pageStackWidget.addWidget(self.historyPage) 286 | self.gridLayout.addWidget(self.pageStackWidget, 0, 0, 1, 1) 287 | MainWindow.setCentralWidget(self.centralwidget) 288 | self.menubar = QtWidgets.QMenuBar(MainWindow) 289 | self.menubar.setGeometry(QtCore.QRect(0, 0, 1239, 26)) 290 | self.menubar.setObjectName("menubar") 291 | self.menuHelp = QtWidgets.QMenu(self.menubar) 292 | self.menuHelp.setObjectName("menuHelp") 293 | self.menuNavigate = QtWidgets.QMenu(self.menubar) 294 | self.menuNavigate.setObjectName("menuNavigate") 295 | self.menuHistory = QtWidgets.QMenu(self.menubar) 296 | self.menuHistory.setObjectName("menuHistory") 297 | MainWindow.setMenuBar(self.menubar) 298 | self.statusbar = QtWidgets.QStatusBar(MainWindow) 299 | self.statusbar.setObjectName("statusbar") 300 | MainWindow.setStatusBar(self.statusbar) 301 | self.aboutAction = QtWidgets.QAction(MainWindow) 302 | self.aboutAction.setObjectName("aboutAction") 303 | self.helpAction = QtWidgets.QAction(MainWindow) 304 | self.helpAction.setObjectName("helpAction") 305 | self.redditAction = QtWidgets.QAction(MainWindow) 306 | self.redditAction.setCheckable(False) 307 | self.redditAction.setObjectName("redditAction") 308 | self.redditPageAction = QtWidgets.QAction(MainWindow) 309 | self.redditPageAction.setObjectName("redditPageAction") 310 | self.pageRedditAction = QtWidgets.QAction(MainWindow) 311 | self.pageRedditAction.setObjectName("pageRedditAction") 312 | self.pageUnsplashAction = QtWidgets.QAction(MainWindow) 313 | self.pageUnsplashAction.setObjectName("pageUnsplashAction") 314 | self.pageBingAction = QtWidgets.QAction(MainWindow) 315 | self.pageBingAction.setObjectName("pageBingAction") 316 | self.pageWallHavenAction = QtWidgets.QAction(MainWindow) 317 | self.pageWallHavenAction.setObjectName("pageWallHavenAction") 318 | self.historyAction = QtWidgets.QAction(MainWindow) 319 | self.historyAction.setObjectName("historyAction") 320 | self.menuHelp.addAction(self.aboutAction) 321 | self.menuHelp.addAction(self.helpAction) 322 | self.menuNavigate.addAction(self.pageRedditAction) 323 | self.menuNavigate.addAction(self.pageUnsplashAction) 324 | self.menuNavigate.addAction(self.pageBingAction) 325 | self.menuNavigate.addAction(self.pageWallHavenAction) 326 | self.menuHistory.addAction(self.historyAction) 327 | self.menubar.addAction(self.menuNavigate.menuAction()) 328 | self.menubar.addAction(self.menuHelp.menuAction()) 329 | self.menubar.addAction(self.menuHistory.menuAction()) 330 | 331 | self.retranslateUi(MainWindow) 332 | self.pageStackWidget.setCurrentIndex(5) 333 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 334 | 335 | def retranslateUi(self, MainWindow): 336 | _translate = QtCore.QCoreApplication.translate 337 | MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) 338 | self.redditSubredditCombo.setItemText(0, _translate("MainWindow", "wallpapers")) 339 | self.redditSubredditCombo.setItemText(1, _translate("MainWindow", "amoledbackgrounds")) 340 | self.redditLimitLabel.setText(_translate("MainWindow", "Limit :")) 341 | self.redditSubredditLabel.setText(_translate("MainWindow", "Subreddit : ")) 342 | self.redditPhoto.setText(_translate("MainWindow", "Set a random wallpaper from reddit!")) 343 | self.redditCategoryLabel.setText(_translate("MainWindow", "Category :")) 344 | self.redditLimitCombo.setItemText(0, _translate("MainWindow", "10")) 345 | self.redditLimitCombo.setItemText(1, _translate("MainWindow", "25")) 346 | self.redditLimitCombo.setItemText(2, _translate("MainWindow", "50")) 347 | self.redditDarkModelabel.setText(_translate("MainWindow", "Dark Mode :")) 348 | self.redditSaveButton.setText(_translate("MainWindow", "Save to Pictures")) 349 | self.redditNextWallButton.setText(_translate("MainWindow", "Next wallpaper")) 350 | self.redditWallpaperButton.setText(_translate("MainWindow", "Set as wallpaper")) 351 | self.redditCategoryCombo.setItemText(0, _translate("MainWindow", "hot")) 352 | self.redditCategoryCombo.setItemText(1, _translate("MainWindow", "rising")) 353 | self.redditCategoryCombo.setItemText(2, _translate("MainWindow", "new")) 354 | self.redditCategoryCombo.setItemText(3, _translate("MainWindow", "top")) 355 | self.redditCategoryCombo.setItemText(4, _translate("MainWindow", "controversial")) 356 | self.redditSearchLabel.setText(_translate("MainWindow", "Search:")) 357 | self.unsplashPhoto.setText(_translate("MainWindow", "Set a random wallpaper from Unsplash!")) 358 | self.unsplashSearchLabel.setText(_translate("MainWindow", "Search:")) 359 | self.unsplashFeaturedLabel.setText(_translate("MainWindow", "Featured :")) 360 | self.unsplashDarkModeLabel.setText(_translate("MainWindow", "Dark Mode :")) 361 | self.unsplashNextWallButton.setText(_translate("MainWindow", "Next wallpaper")) 362 | self.unsplashSaveButton.setText(_translate("MainWindow", "Save to Pictures")) 363 | self.unsplashWallpaperButton.setText(_translate("MainWindow", "Set as wallpaper")) 364 | self.bingPhoto.setText(_translate("MainWindow", "Set the wallpaper of the day from Bing!")) 365 | self.bingCountryLabel.setText(_translate("MainWindow", "Country:")) 366 | self.bingDarkModeLabel.setText(_translate("MainWindow", "Dark Mode :")) 367 | self.bingNextWallButton.setText(_translate("MainWindow", "Next wallpaper")) 368 | self.bingSaveButton.setText(_translate("MainWindow", "Save to Pictures")) 369 | self.bingWallpaperButton.setText(_translate("MainWindow", "Set as wallpaper")) 370 | self.bingCountryCombo.setItemText(0, _translate("MainWindow", "India")) 371 | self.bingCountryCombo.setItemText(1, _translate("MainWindow", "US")) 372 | self.bingCountryCombo.setItemText(2, _translate("MainWindow", "China")) 373 | self.whPhoto.setText(_translate("MainWindow", "Set a random wallpaper from Walhaven!")) 374 | self.whSearchLabel.setText(_translate("MainWindow", "Search:")) 375 | self.whCategoriesLabel.setText(_translate("MainWindow", "Categories:")) 376 | self.whGeneralCheck.setText(_translate("MainWindow", "General")) 377 | self.whAnimeCheck.setText(_translate("MainWindow", "Anime")) 378 | self.whPeopleCheck.setText(_translate("MainWindow", "People")) 379 | self.whSfwCheck.setText(_translate("MainWindow", "sfw")) 380 | self.whSketchyCheck.setText(_translate("MainWindow", "sketchy")) 381 | self.whNsfwCheck.setText(_translate("MainWindow", "nsfw")) 382 | self.whSortLabel.setText(_translate("MainWindow", "Sort Criteria:")) 383 | self.whSortCombo.setItemText(0, _translate("MainWindow", "random")) 384 | self.whSortCombo.setItemText(1, _translate("MainWindow", "favorites")) 385 | self.whSortCombo.setItemText(2, _translate("MainWindow", "toplist")) 386 | self.whSortCombo.setItemText(3, _translate("MainWindow", "relevance")) 387 | self.whSortCombo.setItemText(4, _translate("MainWindow", "views")) 388 | self.whSortCombo.setItemText(5, _translate("MainWindow", "date_added")) 389 | self.whDarkModelabel.setText(_translate("MainWindow", "Dark Mode :")) 390 | self.whNextWallButton.setText(_translate("MainWindow", "Next wallpaper")) 391 | self.whSaveButton.setText(_translate("MainWindow", "Save to Pictures")) 392 | self.whWallpaperButton.setText(_translate("MainWindow", "Set as wallpaper")) 393 | self.aboutLabel.setText(_translate("MainWindow", "KustomPyper - Get amazing wallpapers for your desktop.
Created by Kriticalflare (Github)
")) 394 | item = self.historyTableWidget.horizontalHeaderItem(0) 395 | item.setText(_translate("MainWindow", "wallpaper")) 396 | item = self.historyTableWidget.horizontalHeaderItem(1) 397 | item.setText(_translate("MainWindow", "source")) 398 | self.historyRefreshButton.setText(_translate("MainWindow", "Refresh ")) 399 | self.historyClearButton.setText(_translate("MainWindow", "Clear")) 400 | self.menuHelp.setTitle(_translate("MainWindow", "Help")) 401 | self.menuNavigate.setTitle(_translate("MainWindow", "Navigate")) 402 | self.menuHistory.setTitle(_translate("MainWindow", "History")) 403 | self.aboutAction.setText(_translate("MainWindow", "About")) 404 | self.helpAction.setText(_translate("MainWindow", "Help")) 405 | self.redditAction.setText(_translate("MainWindow", "Reddit Walls")) 406 | self.redditPageAction.setText(_translate("MainWindow", "Reddit")) 407 | self.pageRedditAction.setText(_translate("MainWindow", "Reddit Walls")) 408 | self.pageUnsplashAction.setText(_translate("MainWindow", "Unsplash Walls")) 409 | self.pageBingAction.setText(_translate("MainWindow", "Bing Walls")) 410 | self.pageWallHavenAction.setText(_translate("MainWindow", "Wallhaven Walls")) 411 | self.historyAction.setText(_translate("MainWindow", "View History")) 412 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------