Ensure logo is included
Added a check to see if the logo is bundled with the program, and will download it if it isn't
This commit is contained in:
		
							parent
							
								
									fe134a53fe
								
							
						
					
					
						commit
						2c8372c289
					
				
							
								
								
									
										21
									
								
								ERSCMU.py
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								ERSCMU.py
									
									
									
									
									
								
							@ -1,11 +1,12 @@
 | 
				
			|||||||
# Define version number
 | 
					# Define version number
 | 
				
			||||||
PROGRAM_VERSION = "1.7.0.4"
 | 
					PROGRAM_VERSION = "1.7.0.5"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Define a persistent path for the configuration files in the AppData folder
 | 
					# Define a persistent path for the configuration files in the AppData folder
 | 
				
			||||||
PERSISTENT_DIR = os.path.join(os.getenv('APPDATA'), 'ERSC Mod Updater')
 | 
					PERSISTENT_DIR = os.path.join(os.getenv('APPDATA'), 'ERSC Mod Updater')
 | 
				
			||||||
if not os.path.exists(PERSISTENT_DIR):
 | 
					if not os.path.exists(PERSISTENT_DIR):
 | 
				
			||||||
    os.makedirs(PERSISTENT_DIR)
 | 
					    os.makedirs(PERSISTENT_DIR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LOGO_PATH = os.path.join(PERSISTENT_DIR, 'logo.ico')
 | 
				
			||||||
CONFIG_FILE = os.path.join(PERSISTENT_DIR, 'mod_updater_config.json')
 | 
					CONFIG_FILE = os.path.join(PERSISTENT_DIR, 'mod_updater_config.json')
 | 
				
			||||||
DEFAULT_MOD_PATH = r"C:\Program Files (x86)\Steam\steamapps\common\ELDEN RING\Game\SeamlessCoop"
 | 
					DEFAULT_MOD_PATH = r"C:\Program Files (x86)\Steam\steamapps\common\ELDEN RING\Game\SeamlessCoop"
 | 
				
			||||||
GITHUB_API_URL = 'https://api.github.com/repos/LukeYui/EldenRingSeamlessCoopRelease/releases/latest'
 | 
					GITHUB_API_URL = 'https://api.github.com/repos/LukeYui/EldenRingSeamlessCoopRelease/releases/latest'
 | 
				
			||||||
@ -35,6 +36,20 @@ DEFAULT_VALUES = {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
FIRST_RUN = 1
 | 
					FIRST_RUN = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def check_logo():
 | 
				
			||||||
 | 
					    LOGO_URL = 'https://git.rolfsvaag.no/frarol96/ERSCMU/raw/branch/main/logo.ico'
 | 
				
			||||||
 | 
					    if not os.path.isfile(LOGO_PATH):
 | 
				
			||||||
 | 
					        response = requests.get(LOGO_URL, stream=True)
 | 
				
			||||||
 | 
					        if response.status_code == 200:
 | 
				
			||||||
 | 
					            # Open the local file in write-binary mode
 | 
				
			||||||
 | 
					            with open(LOGO_PATH, 'wb') as file:
 | 
				
			||||||
 | 
					                # Write the content in chunks to the local file
 | 
				
			||||||
 | 
					                for chunk in response.iter_content(chunk_size=8192):
 | 
				
			||||||
 | 
					                    file.write(chunk)
 | 
				
			||||||
 | 
					            print(f"Logo downloaded successfully to {LOGO_PATH}")
 | 
				
			||||||
 | 
					        else:
 | 
				
			||||||
 | 
					            print(f"Failed to download logo.\nHTTP status code: {response.status_code}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def ensure_vocabulary(config):
 | 
					def ensure_vocabulary(config):
 | 
				
			||||||
    if "vocabulary" not in config:
 | 
					    if "vocabulary" not in config:
 | 
				
			||||||
        config["vocabulary"] = {
 | 
					        config["vocabulary"] = {
 | 
				
			||||||
@ -808,7 +823,8 @@ def create_gui():
 | 
				
			|||||||
    main_layout = QVBoxLayout(central_widget)
 | 
					    main_layout = QVBoxLayout(central_widget)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Set application icon
 | 
					    # Set application icon
 | 
				
			||||||
    app.setWindowIcon(QtGui.QIcon(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logo.ico')))
 | 
					    #app.setWindowIcon(QtGui.QIcon(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logo.ico')))
 | 
				
			||||||
 | 
					    app.setWindowIcon(QtGui.QIcon(LOGO_PATH))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    menu_bar = main_window.menuBar()
 | 
					    menu_bar = main_window.menuBar()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -900,4 +916,5 @@ def create_gui():
 | 
				
			|||||||
    app.exec_()
 | 
					    app.exec_()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if __name__ == "__main__":
 | 
					if __name__ == "__main__":
 | 
				
			||||||
 | 
					    check_logo()
 | 
				
			||||||
    create_gui()
 | 
					    create_gui()
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user