diff --git a/src/duckypad_config.py b/src/duckypad_config.py index ee43a95..2f2c215 100644 --- a/src/duckypad_config.py +++ b/src/duckypad_config.py @@ -150,9 +150,12 @@ Unified configurator public beta 3.1.0 Profile import/export minor bug fixes + +3.1.1 +removes state.sps on edited profile """ -THIS_VERSION_NUMBER = '3.1.0' +THIS_VERSION_NUMBER = '3.1.1' THIS_DUCKYPAD = dp_type() @@ -222,8 +225,8 @@ def ui_reset(): check_syntax_label.config(text="", fg="green") profile_import_button.config(state=DISABLED) profile_export_button.config(state=DISABLED) - exp_page_plus_button.config(state=DISABLED) - exp_page_minus_button.config(state=DISABLED) + # exp_page_plus_button.config(state=DISABLED) + # exp_page_minus_button.config(state=DISABLED) root.update() def fw_update_click(event, dp_info_dict): @@ -471,8 +474,8 @@ def enable_buttons(): key_remove_button.config(state=NORMAL) profile_import_button.config(state=NORMAL) profile_export_button.config(state=NORMAL) - exp_page_plus_button.config(state=NORMAL) - exp_page_minus_button.config(state=NORMAL) + # exp_page_plus_button.config(state=NORMAL) + # exp_page_minus_button.config(state=NORMAL) def profile_shift_up(): global profile_list @@ -1719,11 +1722,10 @@ expansion_lf = LabelFrame(root, text="Expansion Modules", width=scaled_size(150) expansion_lf.place(x=scaled_size(590), y=scaled_size(260)) root.update() - -exp_page_minus_button = Button(expansion_lf, text="-", command=exp_page_minus_button_click, state=DISABLED) +exp_page_minus_button = Button(expansion_lf, text="-", command=exp_page_minus_button_click, state=NORMAL) exp_page_minus_button.place(x=scaled_size(10), y=scaled_size(0), width=scaled_size(25), height=scaled_size(22)) -exp_page_plus_button = Button(expansion_lf, text="+", command=exp_page_plus_button_click, state=DISABLED) +exp_page_plus_button = Button(expansion_lf, text="+", command=exp_page_plus_button_click, state=NORMAL) exp_page_plus_button.place(x=scaled_size(110), y=scaled_size(0), width=scaled_size(25), height=scaled_size(22)) current_module_label = Label(master=expansion_lf) diff --git a/src/duckypad_config_3.1.0_win10_x64.zip b/src/duckypad_config_3.1.0_win10_x64.zip deleted file mode 100644 index 615537f..0000000 Binary files a/src/duckypad_config_3.1.0_win10_x64.zip and /dev/null differ diff --git a/src/my_compare.py b/src/my_compare.py index 40ebf17..f820871 100644 --- a/src/my_compare.py +++ b/src/my_compare.py @@ -4,6 +4,7 @@ import hashlib import shutil from pathlib import Path from shared import * +import hid_op duckypad_file_whitelist = [ "profile_", @@ -134,9 +135,12 @@ def get_file_sync_ops(original_dir_root, modified_dir_root): subdir_diff_dict["dirs_to_add"] = [] subdir_diff_dict["dirs_to_delete"] = [] subdir_diff_dict["dir_in_both_not_checked"] = [] - file_ops_all += make_file_op(subdir_diff_dict, this_dir) - return file_ops_all + + sps_ops = get_remove_sps_ops(file_ops_all) + result = file_ops_all + sps_ops + + return result def execute_sync_ops_msc(op_list): for item in op_list: @@ -153,20 +157,32 @@ def execute_sync_ops_msc(op_list): dst = Path(os.path.join(item.destination_parent, item.destination_path)) shutil.copy(src, dst) -import hid_op def duckypad_file_sync(orig_path, modified_path, THIS_DUCKYPAD, tk_root_obj=None, ui_text_obj=None): - sync_ops = get_file_sync_ops(orig_path, modified_path) if THIS_DUCKYPAD.connection_type == THIS_DUCKYPAD.hidmsg: hid_op.duckypad_file_sync_hid(THIS_DUCKYPAD.info_dict['hid_path'], orig_path, modified_path, tk_root_obj, ui_text_obj) else: + sync_ops = get_file_sync_ops(orig_path, modified_path) execute_sync_ops_msc(sync_ops) +def get_remove_sps_ops(fops): + sps_delete_ops = set() + for item in fops: + last_part = Path(item.source_parent).name + if not str(last_part).strip().startswith("profile"): + continue + sps_op = dp_file_op() + sps_op.local_dir = item.local_dir + sps_op.action = sps_op.delete_file + sps_op.source_parent = item.source_parent + sps_op.source_path = "state.sps" + sps_delete_ops.add(sps_op) + return list(sps_delete_ops) + # sd_path = "C:\\Users\\allen\\AppData\\Roaming\\dekuNukem\\duckypad_config\\hid_dump" # modified_path = "C:\\Users\\allen\\AppData\\Roaming\\dekuNukem\\duckypad_config\\profile_backups\\duckyPad_Pro_backup_2025-03-29T20-48-30" # ops = get_file_sync_ops(sd_path, modified_path) - # for item in ops: # print(item) - +# print("-----------") diff --git a/src/shared.py b/src/shared.py index 3d39f95..afcc4a2 100644 --- a/src/shared.py +++ b/src/shared.py @@ -597,6 +597,28 @@ class dp_file_op(object): self.destination_parent = None self.destination_path = None self.local_dir = None + + def __eq__(self, other): + if not isinstance(other, dp_file_op): + return NotImplemented + return ( + self.action == other.action and + self.source_parent == other.source_parent and + self.source_path == other.source_path and + self.destination_parent == other.destination_parent and + self.destination_path == other.destination_path and + self.local_dir == other.local_dir + ) + + def __hash__(self): + return hash(( + self.action, + self.source_parent, + self.source_path, + self.destination_parent, + self.destination_path, + self.local_dir + )) def ui_print(text, tk_root_obj, ui_text_obj): if tk_root_obj is None or ui_text_obj is None: