Make action hashes include all properties of the custom action
Thomas Ross
3 years ago
333 | 333 | and conf.has_option("actions", "batch[" + str(i) + "]") |
334 | 334 | ): |
335 | 335 | name = conf.get("actions", "names[" + str(i) + "]") |
336 | command = conf.get("actions", "commands[" + str(i) + "]") | |
337 | shortcut = conf.get("actions", "shortcuts[" + str(i) + "]") | |
338 | batch = conf.getboolean("actions", "batch[" + str(i) + "]") | |
336 | 339 | self.action_names.append(name) |
337 | 340 | self.action_hashes.append( |
338 | hashlib.sha1(name.encode("utf8")).hexdigest() | |
341 | self.hash_for_custom_action(name, command, shortcut, batch) | |
339 | 342 | ) |
340 | self.action_commands.append( | |
341 | conf.get("actions", "commands[" + str(i) + "]") | |
342 | ) | |
343 | self.action_shortcuts.append( | |
344 | conf.get("actions", "shortcuts[" + str(i) + "]") | |
345 | ) | |
346 | self.action_batch.append( | |
347 | conf.getboolean("actions", "batch[" + str(i) + "]") | |
348 | ) | |
343 | self.action_commands.append(command) | |
344 | self.action_shortcuts.append(shortcut) | |
345 | self.action_batch.append(batch) | |
349 | 346 | if conf.has_option("prefs", "savemode"): |
350 | 347 | self.savemode = conf.getint("prefs", "savemode") |
351 | 348 | if conf.has_option("prefs", "start_in_fullscreen"): |
2237 | 2234 | self.set_image_sensitivities(False) |
2238 | 2235 | self.actions_dialog.destroy() |
2239 | 2236 | |
2237 | def hash_for_custom_action(self, name, command, action, batch): | |
2238 | return hashlib.sha1( | |
2239 | "{}$${}$${}$${}".format(name, command, action, batch).encode("utf8") | |
2240 | ).hexdigest() | |
2241 | ||
2240 | 2242 | def add_custom_action(self, button, treeview): |
2241 | 2243 | self.open_custom_action_dialog(True, "", "", "None", False, treeview) |
2242 | 2244 | |
2428 | 2430 | if add_call: |
2429 | 2431 | self.action_names.append(name) |
2430 | 2432 | self.action_hashes.append( |
2431 | hashlib.sha1(name.encode("utf8")).hexdigest() | |
2433 | self.hash_for_custom_action(name, command, shortcut, batch) | |
2432 | 2434 | ) |
2433 | 2435 | self.action_commands.append(command) |
2434 | 2436 | self.action_shortcuts.append(shortcut) |
2437 | 2439 | (model, iter) = self.actionwidget.get_selection().get_selected() |
2438 | 2440 | (rownum,) = self.actionstore.get_path(iter) |
2439 | 2441 | self.action_names[rownum] = name |
2440 | self.action_hashes[rownum] = hashlib.sha1( | |
2441 | name.encode("utf8") | |
2442 | ).hexdigest() | |
2442 | self.action_hashes[rownum] = self.hash_for_custom_action(name, command, shortcut, batch) | |
2443 | 2443 | self.action_commands[rownum] = command |
2444 | 2444 | self.action_shortcuts[rownum] = shortcut |
2445 | 2445 | self.action_batch[rownum] = batch |