diff --git a/advanced_settings.py b/advanced_settings.py index 951e9bc..5daf1e1 100644 --- a/advanced_settings.py +++ b/advanced_settings.py @@ -477,142 +477,143 @@ def _onCancel(self, e): def _onOk(self, e): - if self.advanced_options_checkbox.GetValue() != self.Parent.config.advanced_options: - print(f"Setting Enable Advanced Options to: {self.advanced_options_checkbox.GetValue()}") - self.Parent.config.advanced_options = self.advanced_options_checkbox.GetValue() - - if self.patch_methods_checkbox.GetValue() != self.Parent.config.offer_patch_methods: - print(f"Setting Offer Patch Methods to: {self.patch_methods_checkbox.GetValue()}") - self.Parent.config.offer_patch_methods = self.patch_methods_checkbox.GetValue() - - if self.recovery_patch_checkbox.GetValue() != self.Parent.config.show_recovery_patching_option: - print(f"Setting Offer Patch Methods to: {self.recovery_patch_checkbox.GetValue()}") - self.Parent.config.show_recovery_patching_option = self.recovery_patch_checkbox.GetValue() - - if self.use_busybox_shell_checkbox.GetValue() != self.Parent.config.use_busybox_shell: - print(f"Setting Use Busybox Shell to: {self.use_busybox_shell_checkbox.GetValue()}") - self.Parent.config.use_busybox_shell = self.use_busybox_shell_checkbox.GetValue() - - if self.low_mem_checkbox.GetValue() != self.Parent.config.low_mem: - print(f"Setting Low Memory to: {self.low_mem_checkbox.GetValue()}") - self.Parent.config.low_mem = self.low_mem_checkbox.GetValue() - set_low_memory(self.low_mem_checkbox.GetValue()) - - if self.extra_img_extracts_checkbox.GetValue() != self.Parent.config.extra_img_extracts: - print(f"Setting Extra img extraction to: {self.extra_img_extracts_checkbox.GetValue()}") - self.Parent.config.extra_img_extracts = self.extra_img_extracts_checkbox.GetValue() - - if self.show_notifications_checkbox.GetValue() != self.Parent.config.show_notifications: - print(f"Setting Show notifications to: {self.show_notifications_checkbox.GetValue()}") - self.Parent.config.show_notifications = self.show_notifications_checkbox.GetValue() - - if self.create_boot_tar_checkbox.GetValue() != self.Parent.config.create_boot_tar: - print(f"Setting Always create boot.tar: {self.create_boot_tar_checkbox.GetValue()}") - self.Parent.config.create_boot_tar = self.create_boot_tar_checkbox.GetValue() - - if self.check_for_update_checkbox.GetValue() != self.Parent.config.update_check: - print(f"Setting Check for updates to: {self.check_for_update_checkbox.GetValue()}") - self.Parent.config.update_check = self.check_for_update_checkbox.GetValue() - - if self.check_for_disk_space_checkbox.GetValue() != self.Parent.config.check_for_disk_space: - print(f"Setting Check for Minimum Disk Space to: {self.check_for_disk_space_checkbox.GetValue()}") - self.Parent.config.check_for_disk_space = self.check_for_disk_space_checkbox.GetValue() - - if self.check_for_bootloader_unlocked_checkbox.GetValue() != self.Parent.config.check_for_bootloader_unlocked: - print(f"Setting Check for Minimum Disk Space to: {self.check_for_bootloader_unlocked_checkbox.GetValue()}") - self.Parent.config.check_for_bootloader_unlocked = self.check_for_bootloader_unlocked_checkbox.GetValue() - - if self.check_for_firmware_hash_validity_checkbox.GetValue() != self.Parent.config.check_for_firmware_hash_validity: - print(f"Setting Check for Firmware Hash Validity to: {self.check_for_firmware_hash_validity_checkbox.GetValue()}") - self.Parent.config.check_for_firmware_hash_validity = self.check_for_firmware_hash_validity_checkbox.GetValue() - - if self.keep_temporary_support_files_checkbox.GetValue() != self.Parent.config.keep_temporary_support_files: - print(f"Setting Keep temporary support files to: {self.keep_temporary_support_files_checkbox.GetValue()}") - self.Parent.config.keep_temporary_support_files = self.keep_temporary_support_files_checkbox.GetValue() - - if self.check_module_updates.GetValue() != self.Parent.config.check_module_updates: - print(f"Setting Check Magisk modules for updates to: {self.check_module_updates.GetValue()}") - self.Parent.config.check_module_updates = self.check_module_updates.GetValue() - - if self.show_custom_rom_options.GetValue() != self.Parent.config.show_custom_rom_options: - print(f"Setting Show custom ROM options to: {self.show_custom_rom_options.GetValue()}") - self.Parent.config.show_custom_rom_options = self.show_custom_rom_options.GetValue() - - if self.sanitize_support_files.GetValue() != self.Parent.config.sanitize_support_files: - print(f"Setting Sanitize Support Files options to: {self.sanitize_support_files.GetValue()}") - self.Parent.config.sanitize_support_files = self.sanitize_support_files.GetValue() - - if self.package_name.GetValue(): - with contextlib.suppress(Exception): - if self.package_name.GetValue() != self.Parent.config.magisk: - print(f"Setting Magisk Package Name to: {self.package_name.GetValue()}") - set_magisk_package(self.package_name.GetValue()) - self.Parent.config.magisk = self.package_name.GetValue() - - if sys.platform.startswith("linux"): - with contextlib.suppress(Exception): - if self.file_explorer.GetValue() != self.Parent.config.linux_file_explorer: - print(f"Setting Linux File Explorer to: {self.file_explorer.GetValue()}") - self.Parent.config.linux_file_explorer = self.file_explorer.GetValue() - - with contextlib.suppress(Exception): - if self.shell.GetValue() != self.Parent.config.linux_shell: - print(f"Setting Linux Shell to: {self.shell.GetValue()}") - set_linux_shell(self.shell.GetValue()) - self.Parent.config.linux_shell = self.shell.GetValue() - - self.Parent.config.force_codepage = self.force_codepage_checkbox.GetValue() - if self.code_page.GetValue() and self.code_page.GetValue().isnumeric(): - self.Parent.config.custom_codepage = int(self.code_page.GetValue()) - - value = self.delete_bundled_libs.GetValue() - if value is None: - value = '' - if value != self.Parent.config.delete_bundled_libs: - print(f"Setting Delete bundled libs to: {value}") - self.Parent.config.delete_bundled_libs = value - - value = self.override_kmi.GetValue() - if value is None: - value = '' - if value != self.Parent.config.override_kmi: - print(f"Setting Kernel KMI to: {value}") - self.Parent.config.override_kmi = value - - font_settings_changed = False - if self.use_custom_font_checkbox.GetValue() != self.Parent.config.customize_font: - print("Enabling Custom Font") - font_settings_changed = True - if self.font.GetStringSelection() != self.Parent.config.pf_font_face: - print(f"Setting Application Font to: {self.font.GetStringSelection()}") - if self.use_custom_font_checkbox.GetValue(): - font_settings_changed = True - if self.font_size.GetValue() != self.Parent.config.pf_font_size: - print(f"Setting Application Font Size to: {self.font_size.GetValue()}") - if self.use_custom_font_checkbox.GetValue(): + try: + if self.advanced_options_checkbox.GetValue() != self.Parent.config.advanced_options: + print(f"Setting Enable Advanced Options to: {self.advanced_options_checkbox.GetValue()}") + self.Parent.config.advanced_options = self.advanced_options_checkbox.GetValue() + + if self.patch_methods_checkbox.GetValue() != self.Parent.config.offer_patch_methods: + print(f"Setting Offer Patch Methods to: {self.patch_methods_checkbox.GetValue()}") + self.Parent.config.offer_patch_methods = self.patch_methods_checkbox.GetValue() + + if self.recovery_patch_checkbox.GetValue() != self.Parent.config.show_recovery_patching_option: + print(f"Setting Offer Patch Methods to: {self.recovery_patch_checkbox.GetValue()}") + self.Parent.config.show_recovery_patching_option = self.recovery_patch_checkbox.GetValue() + + if self.use_busybox_shell_checkbox.GetValue() != self.Parent.config.use_busybox_shell: + print(f"Setting Use Busybox Shell to: {self.use_busybox_shell_checkbox.GetValue()}") + self.Parent.config.use_busybox_shell = self.use_busybox_shell_checkbox.GetValue() + + if self.low_mem_checkbox.GetValue() != self.Parent.config.low_mem: + print(f"Setting Low Memory to: {self.low_mem_checkbox.GetValue()}") + self.Parent.config.low_mem = self.low_mem_checkbox.GetValue() + set_low_memory(self.low_mem_checkbox.GetValue()) + + if self.extra_img_extracts_checkbox.GetValue() != self.Parent.config.extra_img_extracts: + print(f"Setting Extra img extraction to: {self.extra_img_extracts_checkbox.GetValue()}") + self.Parent.config.extra_img_extracts = self.extra_img_extracts_checkbox.GetValue() + + if self.show_notifications_checkbox.GetValue() != self.Parent.config.show_notifications: + print(f"Setting Show notifications to: {self.show_notifications_checkbox.GetValue()}") + self.Parent.config.show_notifications = self.show_notifications_checkbox.GetValue() + + if self.create_boot_tar_checkbox.GetValue() != self.Parent.config.create_boot_tar: + print(f"Setting Always create boot.tar: {self.create_boot_tar_checkbox.GetValue()}") + self.Parent.config.create_boot_tar = self.create_boot_tar_checkbox.GetValue() + + if self.check_for_update_checkbox.GetValue() != self.Parent.config.update_check: + print(f"Setting Check for updates to: {self.check_for_update_checkbox.GetValue()}") + self.Parent.config.update_check = self.check_for_update_checkbox.GetValue() + + if self.check_for_disk_space_checkbox.GetValue() != self.Parent.config.check_for_disk_space: + print(f"Setting Check for Minimum Disk Space to: {self.check_for_disk_space_checkbox.GetValue()}") + self.Parent.config.check_for_disk_space = self.check_for_disk_space_checkbox.GetValue() + + if self.check_for_bootloader_unlocked_checkbox.GetValue() != self.Parent.config.check_for_bootloader_unlocked: + print(f"Setting Check for Minimum Disk Space to: {self.check_for_bootloader_unlocked_checkbox.GetValue()}") + self.Parent.config.check_for_bootloader_unlocked = self.check_for_bootloader_unlocked_checkbox.GetValue() + + if self.check_for_firmware_hash_validity_checkbox.GetValue() != self.Parent.config.check_for_firmware_hash_validity: + print(f"Setting Check for Firmware Hash Validity to: {self.check_for_firmware_hash_validity_checkbox.GetValue()}") + self.Parent.config.check_for_firmware_hash_validity = self.check_for_firmware_hash_validity_checkbox.GetValue() + + if self.keep_temporary_support_files_checkbox.GetValue() != self.Parent.config.keep_temporary_support_files: + print(f"Setting Keep temporary support files to: {self.keep_temporary_support_files_checkbox.GetValue()}") + self.Parent.config.keep_temporary_support_files = self.keep_temporary_support_files_checkbox.GetValue() + + if self.check_module_updates.GetValue() != self.Parent.config.check_module_updates: + print(f"Setting Check Magisk modules for updates to: {self.check_module_updates.GetValue()}") + self.Parent.config.check_module_updates = self.check_module_updates.GetValue() + + if self.show_custom_rom_options.GetValue() != self.Parent.config.show_custom_rom_options: + print(f"Setting Show custom ROM options to: {self.show_custom_rom_options.GetValue()}") + self.Parent.config.show_custom_rom_options = self.show_custom_rom_options.GetValue() + + if self.sanitize_support_files.GetValue() != self.Parent.config.sanitize_support_files: + print(f"Setting Sanitize Support Files options to: {self.sanitize_support_files.GetValue()}") + self.Parent.config.sanitize_support_files = self.sanitize_support_files.GetValue() + + if self.package_name.GetValue(): + with contextlib.suppress(Exception): + if self.package_name.GetValue() != self.Parent.config.magisk: + print(f"Setting Magisk Package Name to: {self.package_name.GetValue()}") + set_magisk_package(self.package_name.GetValue()) + self.Parent.config.magisk = self.package_name.GetValue() + + if sys.platform.startswith("linux"): + with contextlib.suppress(Exception): + if self.file_explorer.GetValue() != self.Parent.config.linux_file_explorer: + print(f"Setting Linux File Explorer to: {self.file_explorer.GetValue()}") + self.Parent.config.linux_file_explorer = self.file_explorer.GetValue() + + with contextlib.suppress(Exception): + if self.shell.GetValue() != self.Parent.config.linux_shell: + print(f"Setting Linux Shell to: {self.shell.GetValue()}") + set_linux_shell(self.shell.GetValue()) + self.Parent.config.linux_shell = self.shell.GetValue() + + self.Parent.config.force_codepage = self.force_codepage_checkbox.GetValue() + if self.code_page.GetValue() and self.code_page.GetValue().isnumeric(): + self.Parent.config.custom_codepage = int(self.code_page.GetValue()) + + value = self.delete_bundled_libs.GetValue() + if value is None: + value = '' + if value != self.Parent.config.delete_bundled_libs: + print(f"Setting Delete bundled libs to: {value}") + self.Parent.config.delete_bundled_libs = value + + value = self.override_kmi.GetValue() + if value is None: + value = '' + if value != self.Parent.config.override_kmi: + print(f"Setting Kernel KMI to: {value}") + self.Parent.config.override_kmi = value + + font_settings_changed = False + if self.use_custom_font_checkbox.GetValue() != self.Parent.config.customize_font: + print("Enabling Custom Font") font_settings_changed = True - self.Parent.config.customize_font = self.use_custom_font_checkbox.GetValue() - self.Parent.config.pf_font_face = self.font.GetStringSelection() - self.Parent.config.pf_font_size = self.font_size.GetValue() - - value = self.scrcpy_path_picker.GetPath() - if value is None: - value = '' - if value != self.Parent.config.scrcpy['path'] and os.path.exists(value): - print(f"Setting scrcpy path path to: {value}") - self.Parent.config.scrcpy['path'] = value - - value = self.scrcpy_flags.GetValue() - if value is None: - value = '' - if value != self.Parent.config.scrcpy['flags']: - print(f"Setting scrcpy flags to: {value}") - self.Parent.config.scrcpy['flags'] = value - - # update the runtime config - set_config(self.Parent.config) - - if font_settings_changed: - self.Parent.set_ui_fonts() - - self.EndModal(wx.ID_OK) + if self.font.GetStringSelection() != self.Parent.config.pf_font_face: + print(f"Setting Application Font to: {self.font.GetStringSelection()}") + if self.use_custom_font_checkbox.GetValue(): + font_settings_changed = True + if self.font_size.GetValue() != self.Parent.config.pf_font_size: + print(f"Setting Application Font Size to: {self.font_size.GetValue()}") + if self.use_custom_font_checkbox.GetValue(): + font_settings_changed = True + self.Parent.config.customize_font = self.use_custom_font_checkbox.GetValue() + self.Parent.config.pf_font_face = self.font.GetStringSelection() + self.Parent.config.pf_font_size = self.font_size.GetValue() + + value = self.scrcpy_path_picker.GetPath() + if value is None: + value = '' + if value != self.Parent.config.scrcpy['path'] and os.path.exists(value): + print(f"Setting scrcpy path path to: {value}") + self.Parent.config.scrcpy['path'] = value + + value = self.scrcpy_flags.GetValue() + if value is None: + value = '' + if value != self.Parent.config.scrcpy['flags']: + print(f"Setting scrcpy flags to: {value}") + self.Parent.config.scrcpy['flags'] = value + + # update the runtime config + set_config(self.Parent.config) + + if font_settings_changed: + self.Parent.set_ui_fonts() + finally: + self.EndModal(wx.ID_OK) diff --git a/build-on-mac.spec b/build-on-mac.spec index 380a1cd..c6b00bb 100644 --- a/build-on-mac.spec +++ b/build-on-mac.spec @@ -57,6 +57,6 @@ exe = EXE(pyz, icon='images/icon-dark-256.icns') app = BUNDLE(exe, name='PixelFlasher.app', - version='7.9.0.3', + version='7.9.1.0', icon='./images/icon-dark-256.icns', bundle_identifier='com.badabing.pixelflasher') diff --git a/build.sh b/build.sh index 8bc15da..45eb317 100755 --- a/build.sh +++ b/build.sh @@ -31,7 +31,7 @@ # . rm -rf build dist -VERSION=7.9.0.3 +VERSION=7.9.1.0 NAME="PixelFlasher" DIST_NAME="PixelFlasher" diff --git a/constants.py b/constants.py index 656dc07..9c64a5f 100644 --- a/constants.py +++ b/constants.py @@ -34,7 +34,7 @@ APPNAME = 'PixelFlasher' CONFIG_FILE_NAME = 'PixelFlasher.json' -VERSION = '7.9.0.3' +VERSION = '7.9.1.0' SDKVERSION = '33.0.3' MAIN_WIDTH = 1400 MAIN_HEIGHT = 1040 diff --git a/modules.py b/modules.py index 400035b..9b86778 100644 --- a/modules.py +++ b/modules.py @@ -657,6 +657,8 @@ def process_file(self, file_type): print(f"Detected Non Pixel firmware, with: {found_boot_img} {found_init_boot_img}") # Check if the firmware file starts with image-* and warn the user or abort firmware_file_name = os.path.basename(file_to_process) + # empty mkdir - Nothing will be extracted here, needed for Non-Pixel factory firmware + os.makedirs(package_dir_full, exist_ok=True) if firmware_file_name.startswith('image-'): title = "Possibly extracted firmware." message = f"WARNING: It looks like you have extracted the firmware file.\nand selected the image zip from it.\n\n" @@ -2027,7 +2029,7 @@ def patch_magisk_script(patch_method): data += " echo $PATCH_FILENAME > /data/local/tmp/pf_patch.log\n" data += " if [[ -n \"$PATCHING_MAGISK_VERSION\" ]]; then echo $PATCHING_MAGISK_VERSION >> /data/local/tmp/pf_patch.log; fi\n" data += "else\n" - data += " echo \"ERROR: Patching failed!\"\n" + data += " echo \"❌ ERROR: Patching failed!\"\n" data += "fi\n\n" if delete_temp_files: data += "echo \"Cleaning up ...\"\n" @@ -2160,7 +2162,7 @@ def patch_kernelsu_script(kernelsu_version): data += " echo $PATCH_FILENAME > /data/local/tmp/pf_patch.log\n" data += " if [[ -n \"$KERNELSU_VERSION\" ]]; then echo $KERNELSU_VERSION >> /data/local/tmp/pf_patch.log; fi\n" data += "else\n" - data += " echo \"ERROR: Patching failed!\"\n" + data += " echo \"❌ ERROR: Patching failed!\"\n" data += "fi\n\n" if delete_temp_files: data += "echo \"Cleaning up ...\"\n" @@ -2328,7 +2330,7 @@ def patch_kernelsu_lkm_script(): data += " echo \"$PATCHING_KSU_VERSION\" >> /data/local/tmp/pf_patch.log\n" data += " fi\n" data += " else\n" - data += " echo \"ERROR: Patching failed!\"\n" + data += " echo \"❌ ERROR: Patching failed!\"\n" data += " fi\n" data += "fi\n\n" delete_temp_files = False @@ -2554,7 +2556,7 @@ def patch_apatch_script(patch_method="app", kernel_patch_version=""): data += " echo $PATCH_FILENAME > /data/local/tmp/pf_patch.log\n" data += " if [[ -n \"$PATCHING_APATCH_VERSION\" ]]; then echo $PATCHING_APATCH_VERSION >> /data/local/tmp/pf_patch.log; fi\n" data += "else\n" - data += " echo \"ERROR: Patching failed!\"\n" + data += " echo \"❌ ERROR: Patching failed!\"\n" data += "fi\n\n" if delete_temp_files: data += "echo \"Cleaning up ...\"\n" @@ -3498,11 +3500,16 @@ def magisk_not_found(): puml("#lightgreen:Magisk Backup: Success;\n") else: print(f"Magisk has NOT made a backup of the source {boot_file_name}") - print("Triggering Magisk to create a backup ...") - # Trigger Magisk to make a backup - res = device.run_magisk_migration(boot_sha1_long) - # if return is -2, then copy boot.img to stock_boot.img - if res == -2: + do_manual_backup = True + if method == 1: + print("Triggering Magisk to create a backup ...") + # Trigger Magisk to make a backup + res = device.run_magisk_migration(boot_sha1_long) + if res != -2: + do_manual_backup = False + else: + print("Magisk did not make a backup, will do a manual backup.") + if do_manual_backup: # copy stock_boot from Downloads folder it already exists, and do it as su if rooted stock_boot_path = '/data/adb/magisk/stock_boot.img' print(f"Copying {boot_img} to {stock_boot_path} ...") @@ -3511,7 +3518,7 @@ def magisk_not_found(): print("Aborting Backup ...\n") else: # rerun the migration. - print("Triggering Magisk migration again to create a backup ...") + print("Triggering Magisk migration to create a backup ...") res = device.run_magisk_migration(boot_sha1_long) print(f"\nChecking to see if Magisk made a backup of the source {boot_file_name}") magisk_backups = device.magisk_backups @@ -3871,7 +3878,7 @@ def live_flash_boot_phone(self, option): # sourcery skip: de-morgan if self.config.fastboot_verbose: fastboot_options += '--verbose ' fastboot_options += 'flash ' - theCmd = f"\"{get_fastboot()}\" -s {device.id} {fastboot_options} boot \"{boot_img_path}\"" + theCmd = f"\"{get_fastboot()}\" -s {device.id} {fastboot_options} {partition} \"{boot_img_path}\"" debug(theCmd) res = run_shell(theCmd) if res and isinstance(res, subprocess.CompletedProcess): @@ -4195,7 +4202,7 @@ def flash_phone(self): # cp = get_system_codepage() cp = "65001" if cp: - first_line_win = f"chcp {cp}\n@ECHO OFF\n" + first_line_win = f"\nchcp {cp}\n@ECHO OFF\n" else: first_line_win = f"@ECHO OFF\n" first_line_linux = "#!/bin/sh\n" @@ -4257,8 +4264,8 @@ def flash_phone(self): action = "boot" msg = "\nLive Boot to: " if device.hardware in KNOWN_INIT_BOOT_DEVICES: - print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Live booting Pixel 7 or newer are not supported yet.") - puml("#orange:Live booting Pixel 7 or newer are not supported yet;\n}\n") + print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Live booting Pixel 7 or newer are not supported.") + puml("#orange:Live booting Pixel 7 or newer are not supported;\n}\n") self.toast("Flash action", "⚠️ Live booting Pixel 7 or newer devices is not supported.") # return -1 else: @@ -4450,7 +4457,7 @@ def flash_phone(self): # Process flash_all files flash_all_win32 = process_flash_all_file(os.path.join(package_dir_full, "flash-all.bat")) if (flash_all_win32 == 'ERROR'): - print("Aborting ...\n") + print("Make sure you have a supported firmware file.\nAborting ...\n") puml("#red:Error processing flash_all.bat file;\n}\n") return -1 flash_all_linux = process_flash_all_file(os.path.join(package_dir_full, "flash-all.sh")) @@ -4474,7 +4481,7 @@ def flash_phone(self): debug(f"\nsh file\n{s2}\n") if cp: - data_win = f"chcp {cp}\n" + data_win = f"\nchcp {cp}\n" else: data_win = '' if self.config.flash_mode == 'dryRun': @@ -4789,7 +4796,7 @@ def apply_patch_if_needed(): # flash the patch flash = "flash" - if (boot.is_init_boot or (device.hardware is not None and device.hardware in KNOWN_INIT_BOOT_DEVICES)) and boot.patch_method not in ['kernelsu', 'apatch', 'apatch_manual']: + if boot.is_init_boot: print("Flashing patched init_boot ...") theCmd = f"\"{get_fastboot()}\" -s {device_id} {fastboot_options} {flash} init_boot \"{boot.boot_path}\"\n" is_init_boot = True diff --git a/package_manager.py b/package_manager.py index 410ce5a..687c8e8 100644 --- a/package_manager.py +++ b/package_manager.py @@ -642,13 +642,20 @@ def EnableDisableButton(self, state): # OnClose # ----------------------------------------------- def OnClose(self, e): - print(f"{datetime.now():%Y-%m-%d %H:%M:%S} User Pressed Close.") - labels = get_labels() - if (labels): - with open(get_labels_file_path(), "w", encoding='ISO-8859-1', errors="replace") as f: - # Write the dictionary to the file in JSON format - json.dump(labels, f, indent=4) - self.EndModal(wx.ID_CANCEL) + try: + print(f"{datetime.now():%Y-%m-%d %H:%M:%S} User Pressed Close.") + labels = get_labels() + if (labels): + with open(get_labels_file_path(), "w", encoding='ISO-8859-1', errors="replace") as f: + # Write the dictionary to the file in JSON format + json.dump(labels, f, indent=4) + # Delete aapt2 from the device + res = self.device.delete("/data/local/tmp/aapt2", self.device.rooted) + except Exception: + traceback.print_exc() + print(f"{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Failed to properly close the window.") + finally: + self.EndModal(wx.ID_CANCEL) # ----------------------------------------------- # OnDisable diff --git a/phone.py b/phone.py index 0f7588a..e38f03f 100644 --- a/phone.py +++ b/phone.py @@ -567,7 +567,7 @@ def root_symbol(self): # ---------------------------------------------------------------------------- @property def kernel(self): - if self._kernel is None and self.mode == 'adb': + if self._kernel is None and self.true_mode == 'adb': try: theCmd = f"\"{get_adb()}\" -s {self.id} shell uname -a" res = run_shell(theCmd) @@ -700,7 +700,7 @@ def apatch_path(self): # ---------------------------------------------------------------------------- @property def magisk_version(self): - if self._magisk_version is None and self.mode == 'adb' and self.rooted: + if self._magisk_version is None and self.true_mode == 'adb' and self.rooted: try: theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'magisk -c\'\"" res = run_shell(theCmd) @@ -746,7 +746,7 @@ def magisk_version_code(self): # ---------------------------------------------------------------------------- @property def magisk_config_path(self): - if self._magisk_config_path is None and self.mode == 'adb' and self.rooted: + if self._magisk_config_path is None and self.true_mode == 'adb' and self.rooted: try: theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'ls -1 $(magisk --path)/.magisk/config\'\"" res = run_shell(theCmd) @@ -834,6 +834,8 @@ def get_verity_verification(self, item): print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Could not get {item} status.") puml(f"#red:ERROR: Could not get {item} status.;\n", True) return -1 + finally: + res = self.delete("/data/local/tmp/avbctl", self.rooted) # ---------------------------------------------------------------------------- # method reset_ota_update @@ -881,6 +883,9 @@ def reset_ota_update(self): print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Encountered an exception if reset_ota_update function.") puml(f"#red:ERROR: Encountered an exception if reset_ota_update function.;\n", True) return -1 + finally: + res = self.delete("/data/local/tmp/update_engine_client", self.rooted) + # ---------------------------------------------------------------------------- # method get_vbmeta_details @@ -1024,7 +1029,7 @@ def get_firmware_from_boot(self, sha1): # ---------------------------------------------------------------------------- @property def magisk_backups(self): - if self.mode == 'adb' and self.rooted: + if self.true_mode == 'adb' and self.rooted: try: theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'ls -d -1 /data/magisk_backup_*\'\"" res = run_shell(theCmd) @@ -1047,7 +1052,7 @@ def magisk_backups(self): # ---------------------------------------------------------------------------- @property def magisk_sha1(self): - if self.mode == 'adb' and self.rooted: + if self.true_mode == 'adb' and self.rooted: try: theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'cat $(magisk --path)/.magisk/config | grep SHA1 | cut -d \'=\' -f 2\'\"" res = run_shell(theCmd) @@ -1141,13 +1146,16 @@ def exec_magisk_settings(self, data, runshell_mode=2): traceback.print_exc() puml("#red:Exception during exec_magisk_settings operation.;\n", True) return -1 + finally: + if script_path: + res = self.delete(script_path, self.rooted) # ---------------------------------------------------------------------------- # method magisk_add_systemless_hosts # ---------------------------------------------------------------------------- def magisk_add_systemless_hosts(self): - if self.mode == 'adb' and self.rooted: + if self.true_mode == 'adb' and self.rooted: try: print("Magisk adding built-in systemless hosts module ...") puml(":Magisk adding built-in systemless hosts module;\n", True) @@ -1192,7 +1200,7 @@ def magisk_add_systemless_hosts(self): # method magisk_enable_zygisk # ---------------------------------------------------------------------------- def magisk_enable_zygisk(self, enable): - if self.mode == 'adb' and self.rooted: + if self.true_mode == 'adb' and self.rooted: try: value = "1" if enable else "0" print(f"Updating Zygisk flag value to: {value}") @@ -1246,7 +1254,7 @@ def magisk_enable_denylist(self, enable): # method magisk_update_su # ---------------------------------------------------------------------------- def magisk_update_su(self, uid, policy, logging, notification, until=0, label=''): - if self.mode == 'adb' and self.rooted: + if self.true_mode == 'adb' and self.rooted: try: if policy == "allow": value = 2 @@ -1280,7 +1288,7 @@ def magisk_update_su(self, uid, policy, logging, notification, until=0, label='' # Method run_magisk_migration # ---------------------------------------------------------------------------- def run_magisk_migration(self, sha1 = None): - if self.mode == 'adb' and self.rooted: + if self.true_mode == 'adb' and self.rooted: try: print("Making sure stock_boot.img is found on the device ...") theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'ls -l /data/adb/magisk/stock_boot.img\'\"" @@ -1306,13 +1314,11 @@ def run_magisk_migration(self, sha1 = None): debug(f"Return Code: {res.returncode}") debug(f"Stdout: {res.stdout}") debug(f"Stderr: {res.stderr}") - if res.returncode == 0: - print("run_migration completed.") - if sha1: - magisk_backups = self.magisk_backups - if self.magisk_backups and sha1 in magisk_backups: - print(f"Magisk backup for {sha1} was successful") - return 0 + if sha1: + magisk_backups = self.magisk_backups + if self.magisk_backups and sha1 in magisk_backups: + print(f"Magisk backup for {sha1} was successful") + return 0 print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Magisk backup failed.") return -1 except Exception as e: @@ -1327,54 +1333,57 @@ def run_magisk_migration(self, sha1 = None): # Method data_adb_backup # ---------------------------------------------------------------------------- def data_adb_backup(self, filename): - if self.mode == 'adb' and self.rooted: - try: - print("Creating a backup of /data/adb ...") - theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'rm -f /data/local/tmp/data_adb.tgz; tar cvfz /data/local/tmp/data_adb.tgz /data/adb/\'\"" - res = run_shell(theCmd) - # expect 0 - if res and isinstance(res, subprocess.CompletedProcess): - debug(f"Return Code: {res.returncode}") - debug(f"Stdout: {res.stdout}") - debug(f"Stderr: {res.stderr}") - if res.returncode != 0: + try: + if self.true_mode == 'adb' and self.rooted: + try: + print("Creating a backup of /data/adb ...") + theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'rm -f /data/local/tmp/data_adb.tgz; tar cvfz /data/local/tmp/data_adb.tgz /data/adb/\'\"" + res = run_shell(theCmd) + # expect 0 + if res and isinstance(res, subprocess.CompletedProcess): + debug(f"Return Code: {res.returncode}") + debug(f"Stdout: {res.stdout}") + debug(f"Stderr: {res.stderr}") + if res.returncode != 0: + print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Failed to create a backup of /data/adb") + print("Aborting ...\n") + return -2 + else: print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Failed to create a backup of /data/adb") print("Aborting ...\n") return -2 - else: - print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Failed to create a backup of /data/adb") - print("Aborting ...\n") - return -2 - # check if backup got created. - print("\nChecking to see if backup file [/data/local/tmp/data_adb.tgz] got created ...") - res,_ = self.check_file("/data/local/tmp/data_adb.tgz") - if res != 1: - print("Aborting ...\n") - puml("#red:Failed to find /data/local/tmp/data_adb.tgz on the phone;\n}\n") - return -2 + # check if backup got created. + print("\nChecking to see if backup file [/data/local/tmp/data_adb.tgz] got created ...") + res,_ = self.check_file("/data/local/tmp/data_adb.tgz") + if res != 1: + print("Aborting ...\n") + puml("#red:Failed to find /data/local/tmp/data_adb.tgz on the phone;\n}\n") + return -2 - print(f"Pulling /data/local/tmp/data_adb.tgz from the phone to: {filename} ...") - res = self.pull_file("/data/local/tmp/data_adb.tgz", f"\"{filename}\"") - if res != 0: - print("Aborting ...\n") - puml("#red:Failed to pull /data/local/tmp/data_adb.tgz from the phone;\n}\n") - return -2 - except Exception as e: - traceback.print_exc() - print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: In function data_adb_backup.") + print(f"Pulling /data/local/tmp/data_adb.tgz from the phone to: {filename} ...") + res = self.pull_file("/data/local/tmp/data_adb.tgz", f"\"{filename}\"") + if res != 0: + print("Aborting ...\n") + puml("#red:Failed to pull /data/local/tmp/data_adb.tgz from the phone;\n}\n") + return -2 + except Exception as e: + traceback.print_exc() + print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: In function data_adb_backup.") + return -1 + else: + print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: data_adb_backup function is only available in adb mode on rooted devices.") return -1 - else: - print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: data_adb_backup function is only available in adb mode on rooted devices.") - return -1 - print("Backup completed.") - return 0 + print("Backup completed.") + return 0 + finally: + res = self.delete("/data/local/tmp/data_adb.tgz", self.rooted) # ---------------------------------------------------------------------------- # Method data_adb_restore # ---------------------------------------------------------------------------- def data_adb_restore(self, filename): - if self.mode == 'adb' and self.rooted: + if self.true_mode == 'adb' and self.rooted: try: print(f"Pushing {filename} to /data/local/tmp/data_adb.tgz on the phone ...") res = self.push_file(filename, "/data/local/tmp/data_adb.tgz", True) @@ -1412,6 +1421,8 @@ def data_adb_restore(self, filename): print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: In function data_adb_restore.") print("Aborting ...\n") return -1 + finally: + res = self.delete("/data/local/tmp/data_adb.tgz", self.rooted) else: print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: data_adb_restore function is only available in adb mode on rooted devices.") return -1 @@ -1420,7 +1431,7 @@ def data_adb_restore(self, filename): # Method data_adb_clear # ---------------------------------------------------------------------------- def data_adb_clear(self): - if self.mode == 'adb' and self.rooted: + if self.true_mode == 'adb' and self.rooted: try: print("Clearing the contents of /data/adb/ ...") theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'rm -rf /data/adb/*\'\"" @@ -1445,10 +1456,10 @@ def data_adb_clear(self): return -1 # ---------------------------------------------------------------------------- - # Method create_magisk_backup + # Method create_magisk_backup (not used) # ---------------------------------------------------------------------------- def create_magisk_backup(self, sha1 = None): - if self.mode == 'adb' and self.rooted and sha1: + if self.true_mode == 'adb' and self.rooted and sha1: try: print("Getting the current SHA1 from Magisk config ...") magisk_sha1 = self.magisk_sha1 @@ -1511,6 +1522,8 @@ def create_magisk_backup(self, sha1 = None): traceback.print_exc() print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Magisk backup failed.") return -1 + finally: + res = self.delete("/data/local/tmp/stock_boot.img") return -1 # ---------------------------------------------------------------------------- @@ -1909,6 +1922,9 @@ def push_file(self, local_file: str, file_path: str, with_su = False) -> int: traceback.print_exc() print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Could not push {file_path}") return -1 + finally: + if with_su: + res = self.delete(remote_file, with_su=True) # ---------------------------------------------------------------------------- # Method pull_file @@ -1970,6 +1986,9 @@ def pull_file(self, remote_file: str, local_file: str, with_su = False, quiet = traceback.print_exc() print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Could not pull {remote_file}") return -1 + finally: + if with_su: + res = self.delete(temp_remote_file, with_su=True) # ---------------------------------------------------------------------------- # Method set_file_permissions @@ -2282,7 +2301,7 @@ def swipe(self, coords): # ---------------------------------------------------------------------------- @property def magisk_app_version(self): - if self._magisk_app_version is None and self.mode == 'adb' and get_magisk_package(): + if self._magisk_app_version is None and self.true_mode == 'adb' and get_magisk_package(): self._magisk_app_version, self._magisk_app_version_code = self.get_app_version(get_magisk_package()) return self._magisk_app_version @@ -2291,7 +2310,7 @@ def magisk_app_version(self): # ---------------------------------------------------------------------------- @property def ksu_app_version(self): - if self._ksu_app_version is None and self.mode == 'adb': + if self._ksu_app_version is None and self.true_mode == 'adb': self._ksu_app_version, self._ksu_app_version_code = self.get_app_version(KERNEL_SU_PKG_NAME) return self._ksu_app_version @@ -2300,7 +2319,7 @@ def ksu_app_version(self): # ---------------------------------------------------------------------------- @property def ksu_next_app_version(self): - if self._ksu_next_app_version is None and self.mode == 'adb': + if self._ksu_next_app_version is None and self.true_mode == 'adb': self._ksu_next_app_version, self._ksu_next_app_version_code = self.get_app_version(KSU_NEXT_PKG_NAME) return self._ksu_next_app_version @@ -2309,7 +2328,7 @@ def ksu_next_app_version(self): # ---------------------------------------------------------------------------- @property def apatch_app_version(self): - if self._apatch_app_version is None and self.mode == 'adb': + if self._apatch_app_version is None and self.true_mode == 'adb': self._apatch_app_version, self._apatch_app_version_code = self.get_app_version(APATCH_PKG_NAME) return self._apatch_app_version @@ -2318,7 +2337,7 @@ def apatch_app_version(self): # ---------------------------------------------------------------------------- @property def apatch_next_app_version(self): - if self._apatch_next_app_version is None and self.mode == 'adb': + if self._apatch_next_app_version is None and self.true_mode == 'adb': self._apatch_next_app_version, self._apatch_next_app_version_code = self.get_app_version(APATCH_NEXT_PKG_NAME) return self._apatch_next_app_version @@ -2327,7 +2346,7 @@ def apatch_next_app_version(self): # ---------------------------------------------------------------------------- @property def config_kallsyms(self): - if self._config_kallsyms is None and self.mode == 'adb': + if self._config_kallsyms is None and self.true_mode == 'adb': self._config_kallsyms = self.get_config_kallsyms() return self._config_kallsyms @@ -2359,7 +2378,7 @@ def get_config_kallsyms(self): # ---------------------------------------------------------------------------- @property def config_kallsyms_all(self): - if self._config_kallsyms_all is None and self.mode == 'adb': + if self._config_kallsyms_all is None and self.true_mode == 'adb': self._config_kallsyms_all = self.get_config_kallsyms_all() return self._config_kallsyms_all @@ -2392,7 +2411,7 @@ def get_config_kallsyms_all(self): def get_app_version(self, pkg): version = '' versionCode = '' - if pkg and self.mode == 'adb': + if pkg and self.true_mode == 'adb': try: theCmd = f"\"{get_adb()}\" -s {self.id} shell dumpsys package {pkg}" res = run_shell(theCmd) @@ -2504,7 +2523,7 @@ def get_uncached_apatch_next_app_version(self): def is_display_unlocked(self): print("Checking to see if display is unlocked ...") try: - if self.mode == 'adb': + if self.true_mode == 'adb': theCmd = f"\"{get_adb()}\" -s {self.id} shell \"dumpsys power | grep \'mHolding\'\"" res = run_shell(theCmd) mHoldingWakeLockSuspendBlocker = False @@ -2553,7 +2572,7 @@ def get_magisk_detailed_modules(self, refresh=False): if self._get_magisk_detailed_modules is None or refresh == True: try: config = get_config() - if self.mode == 'adb' and self.rooted: + if self.true_mode == 'adb' and self.rooted: if sys.platform == "win32": theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'for FILE in /data/adb/modules/*; do if test -d \"$FILE\"; then echo $FILE; if test -f \"$FILE/remove\"; then echo \"state=remove\"; elif test -f \"$FILE/disable\"; then echo \"state=disabled\"; else echo \"state=enabled\"; fi; cat \"$FILE/module.prop\"; echo; echo -----pf; fi; done\'\"" res = run_shell(theCmd, encoding='utf-8') @@ -2613,7 +2632,7 @@ def get_magisk_detailed_modules(self, refresh=False): for module in self._get_magisk_detailed_modules: if module: m = Magisk(module) - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): # get the uninstall state by checking if there is a remove file in the module directory theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c \'ls /data/adb/modules/{module}/remove\'\"" res = run_shell(theCmd) @@ -2699,7 +2718,7 @@ def su_version(self): # ---------------------------------------------------------------------------- @property def rooted(self): - if self._rooted is None and self.mode == 'adb': + if self._rooted is None and self.true_mode == 'adb': if get_adb(): theCmd = f"\"{get_adb()}\" -s {self.id} shell \"su -c 'ls -l /data/adb/'\"" res = run_shell(theCmd, timeout=8) @@ -2728,7 +2747,7 @@ def rooted(self): @property def magisk_denylist_enforced(self): try: - if self._magisk_denylist_enforced is None and self.mode == 'adb': + if self._magisk_denylist_enforced is None and self.true_mode == 'adb': if get_adb(): data = f"magisk --denylist status" res = self.exec_magisk_settings(data, 1) @@ -2753,7 +2772,7 @@ def magisk_denylist_enforced(self): @property def magisk_zygisk_enabled(self): try: - if self._magisk_zygisk_enabled is None and self.mode == 'adb': + if self._magisk_zygisk_enabled is None and self.true_mode == 'adb': if get_adb(): data = f"magisk --sqlite \"SELECT value FROM settings WHERE key='zygisk';\"" res = self.exec_magisk_settings(data, 1) @@ -3456,7 +3475,7 @@ def install_apk(self, app, fastboot_included = False, owner_playstore = False, b else: sdk_flag = "" - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): print(f"Installing {app} on device ...") puml(f":Installing {app};\n", True) theCmd = f"\"{get_adb()}\" -s {self.id} install {playstore_flag} {sdk_flag} -r \"{app}\"" @@ -3476,7 +3495,7 @@ def install_apk(self, app, fastboot_included = False, owner_playstore = False, b self.reboot_system() time.sleep(60) res = self.refresh_phone_mode() - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): res = self.install_apk(app) else: print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Device could not reboot to adb mode.\n Aborting install ...") @@ -3728,7 +3747,7 @@ def unlock_bootloader(self): # ---------------------------------------------------------------------------- def install_magisk_module(self, module): try: - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): print(f"Installing magisk module {module} ...") puml(":Install magisk module;\n", True) puml(f"note right:{module};\n") @@ -3765,7 +3784,7 @@ def install_magisk_module(self, module): # ---------------------------------------------------------------------------- def enable_magisk_module(self, dirname): try: - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): print(f"Enabling magisk module {dirname} ...") puml(":Enable magisk module;\n", True) puml(f"note right:{dirname};\n") @@ -3788,7 +3807,7 @@ def enable_magisk_module(self, dirname): # ---------------------------------------------------------------------------- def restore_magisk_module(self, dirname): try: - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): print(f"Restoring magisk module {dirname} ...") puml(":Restore magisk module;\n", True) puml(f"note right:{dirname};\n") @@ -3852,7 +3871,7 @@ def scrcpy(self): print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: invalid scrcpy path {scrcpy_path} ") return 1 scrcpy_folder = os.path.dirname(scrcpy_path) - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): print(f"Launching scrcpy for device: {self.id} ...") puml(":Launching scrcpy;\n", True) theCmd = f"\"{scrcpy_path}\" -s {self.id} {flags}" @@ -3892,7 +3911,7 @@ def scrcpy(self): # ---------------------------------------------------------------------------- def uninstall_magisk_module(self, dirname): try: - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): print(f"Uninstalling magisk module {dirname} ...") puml(":Uninstall magisk module;\n", True) puml(f"note right:{dirname};\n") @@ -3915,7 +3934,7 @@ def uninstall_magisk_module(self, dirname): # ---------------------------------------------------------------------------- def disable_magisk_module(self, dirname): try: - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): print(f"Disabling magisk module {dirname} ...") puml(":Disable magisk module;\n", True) puml(f"note right:{dirname};\n") @@ -3940,7 +3959,7 @@ def disable_magisk_modules(self): try: print("Disabling magisk modules ...") puml(":SOS Disable magisk modules;\n", True) - if self.mode == 'adb' and get_adb(): + if self.true_mode == 'adb' and get_adb(): theCmd = f"\"{get_adb()}\" -s {self.id} wait-for-device shell magisk --remove-modules" debug(theCmd) return run_shell(theCmd) diff --git a/pif_manager.py b/pif_manager.py index 94f1480..0d57c47 100644 --- a/pif_manager.py +++ b/pif_manager.py @@ -763,14 +763,19 @@ def __del__(self): # onClose # ----------------------------------------------- def onClose(self, e): - dialog_size = self.GetSize() - dialog_x, dialog_y = dialog_size.GetWidth(), dialog_size.GetHeight() - config = get_config() - config.pif_width = dialog_x - config.pif_height = dialog_y - config.pif = self.config.pif - set_config(config) - self.Destroy() + try: + dialog_size = self.GetSize() + dialog_x, dialog_y = dialog_size.GetWidth(), dialog_size.GetHeight() + config = get_config() + config.pif_width = dialog_x + config.pif_height = dialog_y + config.pif = self.config.pif + set_config(config) + except Exception: + traceback.print_exc() + print(f"{datetime.now():%Y-%m-%d %H:%M:%S} ERROR: Failed to properly close the window.") + finally: + self.Destroy() # ----------------------------------------------- # LoadReload @@ -1309,6 +1314,8 @@ def PlayIntegrityCheck(self, e): except Exception: traceback.print_exc() finally: + if device: + res = device.delete("/data/local/tmp/pi.xml", device.rooted) self._on_spin('stop') diff --git a/runtime.py b/runtime.py index 45b3c7c..e76103c 100644 --- a/runtime.py +++ b/runtime.py @@ -1363,6 +1363,9 @@ def open_folder(self, path, isFile = False): dir_path = os.path.dirname(path) else: dir_path = path + if not os.path.exists(dir_path): + print(f"\n❌ {datetime.now():%Y-%m-%d %H:%M:%S} ERROR: {dir_path} does not exist.") + return if sys.platform == "darwin": subprocess.Popen(["open", dir_path], env=get_env_variables()) elif sys.platform == "win32": diff --git a/windows-metadata.yaml b/windows-metadata.yaml index d708116..9c448e3 100644 --- a/windows-metadata.yaml +++ b/windows-metadata.yaml @@ -1,6 +1,6 @@ # https://github.com/DudeNr33/pyinstaller-versionfile # create-version-file windows-metadata.yaml --outfile windows-version-info.txt -Version: 7.9.0.3 +Version: 7.9.1.0 FileDescription: PixelFlasher InternalName: PixelFlasher OriginalFilename: PixelFlasher.exe diff --git a/windows-version-info.txt b/windows-version-info.txt index c52a328..da0545e 100644 --- a/windows-version-info.txt +++ b/windows-version-info.txt @@ -7,8 +7,8 @@ VSVersionInfo( ffi=FixedFileInfo( # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) # Set not needed items to zero 0. Must always contain 4 elements. - filevers=(7,9,0,3), - prodvers=(7,9,0,3), + filevers=(7,9,1,0), + prodvers=(7,9,1,0), # Contains a bitmask that specifies the valid bits 'flags'r mask=0x3f, # Contains a bitmask that specifies the Boolean attributes of the file. @@ -32,12 +32,12 @@ VSVersionInfo( u'040904B0', [StringStruct(u'CompanyName', u''), StringStruct(u'FileDescription', u'PixelFlasher'), - StringStruct(u'FileVersion', u'7.9.0.3'), + StringStruct(u'FileVersion', u'7.9.1.0'), StringStruct(u'InternalName', u'PixelFlasher'), StringStruct(u'LegalCopyright', u''), StringStruct(u'OriginalFilename', u'PixelFlasher.exe'), StringStruct(u'ProductName', u'PixelFlasher'), - StringStruct(u'ProductVersion', u'7.9.0.3')]) + StringStruct(u'ProductVersion', u'7.9.1.0')]) ]), VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) ]