Skip to content

Commit

Permalink
code revision
Browse files Browse the repository at this point in the history
  • Loading branch information
h0anle committed Sep 26, 2024
1 parent 24e2151 commit 1617016
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,7 @@ def save(self, fname=None):

def set_attributes(self, attributes_dict):
"""Set attributes of the Graph object from a given dictionary."""

for key, value in attributes_dict.items():
if hasattr(self, key):
setattr(self, key, value)
Expand Down
4 changes: 3 additions & 1 deletion app/visualisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ def load(self, file_path):
for graph_id, graph_data in plots_data.items():
# Recreate graph instance
graph = Graph(graph_id=graph_id)
graph.filters = graph_data.get('filters', [])
graph.set_attributes(graph_data)

# Plot the graph
Expand Down Expand Up @@ -833,7 +834,8 @@ def load(self, file_path):
self.add_graph_list_to_combobox()

except Exception as e:
print(f"Error loading work: {e}")
show_alert(f"Error loading saved work (Visulization Tab): {e}")
# print(f"Error loading work: {e}")

def delete_graph(self, graph_id):
"""Delete the specified graph from the plots dictionary by graph_id"""
Expand Down
1 change: 1 addition & 0 deletions examples/ex_loading_saved_files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
import os
from pathlib import Path
import pytest

from PySide6.QtWidgets import QApplication
from PySide6.QtGui import QIcon
Expand Down
1 change: 0 additions & 1 deletion tests/test_2_loading_saved_files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Test_1
import sys
from pathlib import Path

Expand Down

0 comments on commit 1617016

Please sign in to comment.