when create new branch in analysis Path, check the branch exist, display raw data path fix

This commit is contained in:
Ryan Tang 2024-07-01 18:19:36 -04:00
parent 3a79c40b32
commit 9bb4abec5d
2 changed files with 34 additions and 10 deletions

View File

@ -1488,6 +1488,7 @@ void MainWindow::ProgramSettingsPanel(){
rawDataPath = expDataPath + "/data_raw/"; rawDataPath = expDataPath + "/data_raw/";
rootDataPath = expDataPath + "/root_data/"; rootDataPath = expDataPath + "/root_data/";
leExpName->setText(expName); leExpName->setText(expName);
leRawDataPath->setText(rawDataPath);
CreateRawDataFolder(); CreateRawDataFolder();
@ -1777,12 +1778,12 @@ void MainWindow::SetupNewExpPanel(){
git.waitForFinished(); git.waitForFinished();
QByteArray output = git.readAllStandardOutput(); QByteArray output = git.readAllStandardOutput();
QStringList branches = (QString::fromLocal8Bit(output)).split("\n"); existGitBranches = (QString::fromLocal8Bit(output)).split("\n");
branches.removeAll(""); existGitBranches.removeAll("");
//qDebug() << branches; //qDebug() << branches;
if( branches.size() == 0) { if( existGitBranches.size() == 0) {
isGitExist = false; isGitExist = false;
}else{ }else{
isGitExist = true; isGitExist = true;
@ -1790,9 +1791,9 @@ void MainWindow::SetupNewExpPanel(){
QString presentBranch; QString presentBranch;
unsigned short bID = 0; // id of the present branch unsigned short bID = 0; // id of the present branch
for( unsigned short i = 0; i < branches.size(); i++){ for( unsigned short i = 0; i < existGitBranches.size(); i++){
if( branches[i].indexOf("*") != -1 ){ if( existGitBranches[i].indexOf("*") != -1 ){
presentBranch = branches[i].remove("*").remove(" "); presentBranch = existGitBranches[i].remove("*").remove(" ");
bID = i; bID = i;
break; break;
} }
@ -1867,11 +1868,11 @@ void MainWindow::SetupNewExpPanel(){
cb->setEnabled(false); cb->setEnabled(false);
bnChangeBranch->setEnabled(false); bnChangeBranch->setEnabled(false);
}else{ }else{
for( int i = 0; i < branches.size(); i++){ for( int i = 0; i < existGitBranches.size(); i++){
if( i == bID ) continue; if( i == bID ) continue;
if( branches[i].contains("HEAD")) continue; if( existGitBranches[i].contains("HEAD")) continue;
if( branches[i].contains(presentBranch)) continue; if( existGitBranches[i].contains(presentBranch)) continue;
cb->addItem(branches[i].remove(" ")); cb->addItem(existGitBranches[i].remove(" "));
} }
if ( cb->count() == 0) { if ( cb->count() == 0) {
cb->setEnabled(false); cb->setEnabled(false);
@ -2023,6 +2024,27 @@ void MainWindow::WriteExpNameSh(){
void MainWindow::CreateNewExperiment(const QString newExpName){ void MainWindow::CreateNewExperiment(const QString newExpName){
if( newExpName == "HEAD" || newExpName == "head") {
LogMsg("Cannot name new exp as HEAD or head");
return;
}
if( newExpName == expName ){
LogMsg("Already at this branch.");
return;
}
//Check if newExpName already exist, if exist, go to run ChanegExperiment()
for( int i = 0; i < existGitBranches.size(); i++){
if( existGitBranches[i].contains("HEAD")) continue;
if( existGitBranches[i] == newExpName ) {
ChangeExperiment(newExpName);
return;
}
}
LogMsg("======================================"); LogMsg("======================================");
LogMsg("Creating new Exp. : <font style=\"color: red;\">" + newExpName + "</font>"); LogMsg("Creating new Exp. : <font style=\"color: red;\">" + newExpName + "</font>");

View File

@ -176,6 +176,8 @@ private:
QLineEdit * lDatbaseName; QLineEdit * lDatbaseName;
QLineEdit * lElogIP; QLineEdit * lElogIP;
QStringList existGitBranches;
QString programPath; QString programPath;
QString analysisPath; QString analysisPath;
QString masterExpDataPath; QString masterExpDataPath;