Skip to content

Commit

Permalink
repairing issue 3dem/relion-devel#28
Browse files Browse the repository at this point in the history
  • Loading branch information
scheres committed Sep 16, 2021
1 parent bdbe784 commit 6175b54
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions src/gui_mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2051,21 +2051,34 @@ void GuiMainWindow::cb_save_i()
int iwin = browser->value() - 1;
gui_jobwindows[iwin]->updateMyJob();

Fl::scheme("gtk+");
Fl_File_Chooser * G_chooser = new Fl_File_Chooser(".", "job.star", Fl_File_Chooser::DIRECTORY, "Choose directory to save job.star file");
G_chooser->color(GUI_BACKGROUND_COLOR);
G_chooser->show();
while(G_chooser->shown()) Fl::wait();
if ( G_chooser->value() == NULL ) return;
// SHWS 16092021: to prevent empty labels when saving a job.star from the GUI, go through getCommandLineJob, which also sets deeper levels of labels
std::string error_message;
std::string _final_command;
std::vector<std::string> _commands;
if (!pipeline.getCommandLineJob(gui_jobwindows[iwin]->myjob, current_job, is_main_continue, false,
DONT_MKDIR, _commands, _final_command, error_message))
{
fl_message("%s",error_message.c_str());
}
else
{

char relname[FL_PATH_MAX];
fl_filename_relative(relname,sizeof(relname),G_chooser->value());
FileName fn_dir = (std::string)relname;
if (fn_dir == "") fn_dir = ".";
gui_jobwindows[iwin]->myjob.write(fn_dir + "/job.star");
Fl::scheme("gtk+");
Fl_File_Chooser * G_chooser = new Fl_File_Chooser(".", "job.star", Fl_File_Chooser::DIRECTORY, "Choose directory to save job.star file");
G_chooser->color(GUI_BACKGROUND_COLOR);
G_chooser->show();
while(G_chooser->shown()) Fl::wait();
if ( G_chooser->value() == NULL ) return;

char relname[FL_PATH_MAX];
fl_filename_relative(relname,sizeof(relname),G_chooser->value());
FileName fn_dir = (std::string)relname;
if (fn_dir == "") fn_dir = ".";
gui_jobwindows[iwin]->myjob.write(fn_dir + "/job.star");

// Also save hidden job.star file
gui_jobwindows[iwin]->myjob.write("");
// Also save hidden job.star file
gui_jobwindows[iwin]->myjob.write("");
}

}

Expand Down

0 comments on commit 6175b54

Please sign in to comment.