Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions netpyne_ui/netpyne_geppetto.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,13 +819,17 @@ def checkFileExists(self, path):
path = Path(path or '')
return path.exists()

def getDirList(self, dir=None, onlyDirs=False, filterFiles=False, subDir=None):
# Get Current dir
def getFullPath(self, dir, subDir):
if dir is None or dir == '':
base = constants.NETPYNE_WORKDIR_PATH
if subDir:
base = os.path.join(base, subDir)
base = os.path.join(base, subDir)
dir = os.path.join(os.getcwd(), base)
return dir

def getDirList(self, dir=None, onlyDirs=False, filterFiles=False, subDir=None):
# Get Current dir
dir = self.getFullPath(dir, subDir)
dir_list = []
file_list = []
for f in sorted(os.listdir(str(dir)), key=str.lower):
Expand Down
20 changes: 19 additions & 1 deletion webapp/components/topbar/dialogs/OverwriteModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,35 @@ const saveOptions = [
},
];

const DEFAULT_DIR = "uploads";

const OverwriteModel = (props) => {
const updateFullPath = (value) => {
if (value && value.startsWith('/')) { // We know we will be in a UNIX like env.
return value
}
Utils
.evalPythonMessage('netpyne_geppetto.getFullPath', [null, value])
.then((fullpath) => {
setDstPath(`${fullpath}/`)
})
return DEFAULT_DIR
}

const srcPath = useSelector((state) => state.general.modelPath);
const [explorerDialogOpen, setExplorerDialogOpen] = React.useState(false);
const [openOverwriteDialog, setOpenOverwriteDialog] = React.useState(false);
const [isDirectoryValid, setIsDirectoryValid] = React.useState(false);
const [explorerParameter, setExplorerParameter] = React.useState('srcPath');
const [dstPath, setDstPath] = React.useState(srcPath);
const [dstPath, setDstPath] = React.useState(srcPath ? srcPath: DEFAULT_DIR);
const [options, setOptions] = React.useState({
exportNetParamsAsPython: false,
exportSimConfigAsPython: false
});
const dispatch = useDispatch();

updateFullPath(dstPath);

const getDirAndModuleFromPath = (fullpath) => {
const fileName = fullpath.replace(/^.*[\\/]/, '');
const moduleName = fileName.replace(/\.[^/.]+$/, '');
Expand Down Expand Up @@ -128,6 +144,8 @@ const OverwriteModel = (props) => {
// We cleanup on close
React.useEffect(() => { return () => props.onRequestClose() }, []);



return (
<>
<ActionValidationDialog
Expand Down