Skip to content

Commit

Permalink
[runSofa2] FIX The DataFileName widget.
Browse files Browse the repository at this point in the history
The value are now properly uploaded to the Data.
  • Loading branch information
damienmarchal committed Oct 14, 2019
1 parent 2c50c51 commit 88ca796
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import QtQuick.Dialogs 1.0
import QtQuick.Layouts 1.0
import SofaBasics 1.0
import Sofa.Core.SofaData 1.0
import SofaApplication 1.0

/***************************************************************************************************
*
Expand Down Expand Up @@ -81,9 +82,15 @@ Row {

}
onClicked: {
console.log("TOTO ")
/// Open the FileDialog at the specified location.
fileDialog.folder = "file://"+dataObject.properties.folderurl
var url = "";
if( dataObject.properties.folderurl !== ""){
url = "file://"+dataObject.properties.folderurl
}else{
url = SofaApplication.currentProject.rootDir
}

fileDialog.folder = url
fileDialog.open()
}
position: cornerPositions["Right"]
Expand All @@ -97,7 +104,6 @@ Row {
onAccepted: {
/// Get the URL from the file chooser and convert it to a string.
dataObject.value = fileDialog.fileUrl.toString().replace("file://","") ;
dataObject.upload();
textField.text = dataObject.value.toString();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,15 @@ QVariantMap& convertDataInfoToProperties(const BaseData* data, QVariantMap& prop

if(aDataFilename)
{
std::cout << "DATA FILE NAME DETECTED FOR " << data->getName() << std::endl;
properties.insert("type", "FileName");
properties.insert("url", QString::fromStdString(aDataFilename->getFullPath())) ;

const std::string& directory = FileSystem::getParentDirectory( aDataFilename->getFullPath() ) ;
properties.insert("folderurl", QString::fromStdString(directory)) ;
if(aDataFilename->getValueString() == ""){
properties.insert("folderurl", "") ;
}else{
std::string directory = FileSystem::getParentDirectory( aDataFilename->getFullPath() ) ;
properties.insert("folderurl", QString::fromStdString(directory)) ;
}
return properties;
}

Expand Down

0 comments on commit 88ca796

Please sign in to comment.