diff --git a/mirage/__init__.py b/mirage/__init__.py index 0e27e08..638887f 100755 --- a/mirage/__init__.py +++ b/mirage/__init__.py @@ -334,19 +334,16 @@ and conf.has_option("actions", "batch[" + str(i) + "]") ): name = conf.get("actions", "names[" + str(i) + "]") + command = conf.get("actions", "commands[" + str(i) + "]") + shortcut = conf.get("actions", "shortcuts[" + str(i) + "]") + batch = conf.getboolean("actions", "batch[" + str(i) + "]") self.action_names.append(name) self.action_hashes.append( - hashlib.sha1(name.encode("utf8")).hexdigest() + self.hash_for_custom_action(name, command, shortcut, batch) ) - self.action_commands.append( - conf.get("actions", "commands[" + str(i) + "]") - ) - self.action_shortcuts.append( - conf.get("actions", "shortcuts[" + str(i) + "]") - ) - self.action_batch.append( - conf.getboolean("actions", "batch[" + str(i) + "]") - ) + self.action_commands.append(command) + self.action_shortcuts.append(shortcut) + self.action_batch.append(batch) if conf.has_option("prefs", "savemode"): self.savemode = conf.getint("prefs", "savemode") if conf.has_option("prefs", "start_in_fullscreen"): @@ -2238,6 +2235,11 @@ self.set_image_sensitivities(False) self.actions_dialog.destroy() + def hash_for_custom_action(self, name, command, action, batch): + return hashlib.sha1( + "{}$${}$${}$${}".format(name, command, action, batch).encode("utf8") + ).hexdigest() + def add_custom_action(self, button, treeview): self.open_custom_action_dialog(True, "", "", "None", False, treeview) @@ -2429,7 +2431,7 @@ if add_call: self.action_names.append(name) self.action_hashes.append( - hashlib.sha1(name.encode("utf8")).hexdigest() + self.hash_for_custom_action(name, command, shortcut, batch) ) self.action_commands.append(command) self.action_shortcuts.append(shortcut) @@ -2438,9 +2440,7 @@ (model, iter) = self.actionwidget.get_selection().get_selected() (rownum,) = self.actionstore.get_path(iter) self.action_names[rownum] = name - self.action_hashes[rownum] = hashlib.sha1( - name.encode("utf8") - ).hexdigest() + self.action_hashes[rownum] = self.hash_for_custom_action(name, command, shortcut, batch) self.action_commands[rownum] = command self.action_shortcuts[rownum] = shortcut self.action_batch[rownum] = batch