Commit c2650e33 authored by cponcele's avatar cponcele
Browse files

Sonar explorer : Take into account for user variables and home dir file path expansion

parent 072ef8c3
......@@ -7,8 +7,17 @@
%% Cell type:code id:30ae36d9-cfe8-4245-80b4-fda078680de5 tags:
``` python
#create a NCExplorer with a default path
explorer=NCExplorer(starting_path=r'C:\data\datasets\XSF\data\0006_20200504_111056_FG_EM122.xsf.nc')
explorer=NCExplorer(starting_path=r'~')
explorer.show()
```
%%%% Output: display_data
%% Cell type:code id:9eed79e6-c70b-4573-9961-d6274a2a6164 tags:
``` python
```
......
......@@ -118,8 +118,14 @@ class NCExplorer:
display in a tree view its groups and variables contents and inspect variables definitions and data
"""
def __init__(self, starting_path=r"C:\\"):
def __init__(self, starting_path=r"~"):
# create file chooser
starting_path = os.path.expanduser(starting_path)
starting_path = os.path.expandvars(starting_path)
if not os.path.exists(starting_path):
new_path= os.path.expanduser("~")
print(f"Input file {starting_path} does not exist switching to {new_path}")
starting_path = new_path
self.fc = self._createFileChooser(starting_path, self.on_file_selected)
# create full widget
self.widget = AppLayout2(top=self.fc)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment