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

Method load

src/data/file_operations.py:96–133  ·  view source on GitHub ↗

Load a graph from file.

(self, file_path=None)

Source from the content-addressed store, hash-verified

94 return self._save_file(self.current_file_path)
95
96 def load(self, file_path=None):
97 """Load a graph from file."""
98 if not file_path:
99 # Get last used directory
100 last_dir = self.settings.value("last_directory", "")
101 file_path, _ = QFileDialog.getOpenFileName(
102 self.parent_window,
103 "Load Graph",
104 last_dir,
105 "Flow Files (*.md);;All Files (*.*)"
106 )
107
108 if file_path and os.path.exists(file_path):
109 self.current_file_path = file_path
110 self.current_graph_name = os.path.splitext(os.path.basename(file_path))[0]
111
112 self.update_window_title()
113
114 data = self._load_file(file_path)
115 if data:
116 self.graph.deserialize(data)
117 self.current_requirements = data.get("requirements", [])
118 self.settings.setValue("last_file_path", file_path)
119 # Save directory for next time
120 self.settings.setValue("last_directory", os.path.dirname(file_path))
121
122 # Handle environment selection for the loaded graph
123 self._handle_environment_selection(file_path)
124
125 # Let the graph's built-in deferred sizing fix handle the rendering
126 # The original fix from v0.5.0 already handles proper timing for node sizing
127 pass
128
129 self.output_log.append(f"Graph loaded from {file_path}")
130 self._show_environment_status()
131 return True
132
133 return False
134
135 def load_last_file(self):
136 """Load the last opened file or default graph."""

Callers 10

load_last_fileMethod · 0.95
load_initial_graphMethod · 0.95
load_fileFunction · 0.80
on_loadMethod · 0.80
store_test_resultsMethod · 0.80
analyze_coverage_gapsMethod · 0.80
analyze_coverage_gapsMethod · 0.80
parse_test_resultsMethod · 0.80

Calls 5

update_window_titleMethod · 0.95
_load_fileMethod · 0.95
deserializeMethod · 0.45

Tested by 6

store_test_resultsMethod · 0.64
analyze_coverage_gapsMethod · 0.64
analyze_coverage_gapsMethod · 0.64
parse_test_resultsMethod · 0.64