mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-17 17:31:10 -06:00
Run file dialog on separate thread and connect chosen file to GUI
This commit is contained in:
committed by
Matthias Berg
parent
b4a7e0acf3
commit
c48d69322a
@@ -150,22 +150,28 @@ Loader::Loader()
|
||||
}
|
||||
|
||||
void Loader::uploadData() {
|
||||
nfdchar_t *outPath = NULL;
|
||||
nfdresult_t result = NFD_OpenDialog( "cdf", NULL, &outPath );
|
||||
std::string fullPaths;
|
||||
|
||||
// TODO: Separate thread
|
||||
if ( outPath && result == NFD_OKAY ) {
|
||||
fullPaths = outPath;
|
||||
free(outPath);
|
||||
LINFO("Paths = " + fullPaths);
|
||||
{
|
||||
std::thread t([&](){
|
||||
LINFO("opened dialog?");
|
||||
nfdchar_t *outPath = NULL;
|
||||
nfdresult_t result = NFD_OpenDialog( "cdf", NULL, &outPath ); //TODO: handle different data types
|
||||
|
||||
if ( outPath && result == NFD_OKAY ) {
|
||||
LINFO("selected a file.");
|
||||
_filePaths = outPath;
|
||||
free(outPath);
|
||||
}
|
||||
else if ( result == NFD_CANCEL ) {
|
||||
LINFO("User pressed cancel.");
|
||||
}
|
||||
else {
|
||||
std::string error = NFD_GetError();
|
||||
LINFO("Error: \n" + error );
|
||||
}
|
||||
});
|
||||
|
||||
t.detach();
|
||||
}
|
||||
else if ( result == NFD_CANCEL ) {
|
||||
LINFO("User pressed cancel.");
|
||||
}
|
||||
// else {
|
||||
// LINFO("Error: \n" + *NFD_GetError() );
|
||||
// }
|
||||
|
||||
// Linux
|
||||
// #ifdef _linux
|
||||
@@ -224,14 +230,14 @@ void Loader::uploadData() {
|
||||
// // Still to do
|
||||
// #endif
|
||||
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
void Loader::createInternalDataItemProperties() {
|
||||
module()->validateDataDirectory();
|
||||
std::vector<std::string> volumeItems = module()->volumeDataItems();
|
||||
|
||||
LDEBUG("volume items vec size " + std::to_string(volumeItems.size()));
|
||||
// LDEBUG("volume items vec size " + std::to_string(volumeItems.size()));
|
||||
|
||||
for (auto item : volumeItems) {
|
||||
const std::string dirLeaf = openspace::dataloader::helpers::getDirLeaf(item);
|
||||
|
||||
@@ -142,7 +142,11 @@ class PrepareUploadedData extends Component {
|
||||
<Window type="small"
|
||||
title="Prepare Data"
|
||||
size={windowSize}
|
||||
<<<<<<< HEAD
|
||||
position={{ x: 300, y: 300 }}
|
||||
=======
|
||||
position={{ x: 100, y: 200 }}
|
||||
>>>>>>> Run file dialog on separate thread and connect chosen file to GUI
|
||||
closeCallback={() => this.setState({ activated: false })}>
|
||||
<div className={styles.content}>
|
||||
<CenteredLabel>{getDirectoryLeaf(this.props.filePaths)}</CenteredLabel>
|
||||
|
||||
@@ -17,9 +17,8 @@ class UploadDataButton extends Component {
|
||||
}
|
||||
|
||||
handleClick() {
|
||||
// this.subscribeToFilepaths();
|
||||
this.subscribeToFilepaths();
|
||||
this.triggerFilesToUpload();
|
||||
this.props.setFilePaths("/home/mberg/Data/testData.cdf");
|
||||
}
|
||||
|
||||
triggerFilesToUpload() {
|
||||
@@ -32,9 +31,6 @@ class UploadDataButton extends Component {
|
||||
|
||||
handleUploadedFiles(data) {
|
||||
this.props.setFilePaths(data.Value);
|
||||
|
||||
// Show window for changing task properties
|
||||
// with "convert" button or something
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
Reference in New Issue
Block a user