Codebase list mirage / 84c1898
Make action hashes include all properties of the custom action Thomas Ross 3 years ago
1 changed file(s) with 14 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
333333 and conf.has_option("actions", "batch[" + str(i) + "]")
334334 ):
335335 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) + "]")
336339 self.action_names.append(name)
337340 self.action_hashes.append(
338 hashlib.sha1(name.encode("utf8")).hexdigest()
341 self.hash_for_custom_action(name, command, shortcut, batch)
339342 )
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)
349346 if conf.has_option("prefs", "savemode"):
350347 self.savemode = conf.getint("prefs", "savemode")
351348 if conf.has_option("prefs", "start_in_fullscreen"):
22372234 self.set_image_sensitivities(False)
22382235 self.actions_dialog.destroy()
22392236
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
22402242 def add_custom_action(self, button, treeview):
22412243 self.open_custom_action_dialog(True, "", "", "None", False, treeview)
22422244
24282430 if add_call:
24292431 self.action_names.append(name)
24302432 self.action_hashes.append(
2431 hashlib.sha1(name.encode("utf8")).hexdigest()
2433 self.hash_for_custom_action(name, command, shortcut, batch)
24322434 )
24332435 self.action_commands.append(command)
24342436 self.action_shortcuts.append(shortcut)
24372439 (model, iter) = self.actionwidget.get_selection().get_selected()
24382440 (rownum,) = self.actionstore.get_path(iter)
24392441 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)
24432443 self.action_commands[rownum] = command
24442444 self.action_shortcuts[rownum] = shortcut
24452445 self.action_batch[rownum] = batch