MCPcopy Create free account
hub / github.com/bhowiebkr/PyFlowGraph / undo

Method undo

src/commands/node/property_changes.py:57–72  ·  view source on GitHub ↗

Revert the property change.

(self)

Source from the content-addressed store, hash-verified

55 return False
56
57 def undo(self) -> bool:
58 """Revert the property change."""
59 try:
60 setattr(self.node, self.property_name, self.old_value)
61
62 # Special handling for certain properties
63 if self.property_name in ['code', 'gui_code']:
64 self.node.update_pins_from_code()
65 elif self.property_name in ['width', 'height']:
66 self.node.fit_size_to_content()
67
68 self._mark_undone()
69 return True
70 except Exception as e:
71 print(f"Failed to undo property change: {e}")
72 return False
73
74 def get_memory_usage(self) -> int:
75 """Estimate memory usage of this command."""

Callers 1

Calls 3

update_pins_from_codeMethod · 0.80
fit_size_to_contentMethod · 0.80
_mark_undoneMethod · 0.80

Tested by 1