@@ -1731,45 +1731,11 @@ void MainWindow::selectFile() {
1731
1731
1732
1732
void MainWindow::selectFileDrag (const QList<QString> &fileNames) {
1733
1733
1734
- // check if view object list is empty, if not, prompt to save results or not, if not clear
1735
- if (pageComboBox->count () > 1 ) {
1736
- // prompt
1737
- QMessageBox mBox ;
1738
- mBox .setIcon (QMessageBox::Warning);
1739
- mBox .setStyleSheet (mWidget ->styleSheet ());
1740
- mBox .setText (" There are unsaved results." );
1741
- mBox .setInformativeText (" Do you wish to save them?" );
1742
- mBox .setDefaultButton (QMessageBox::Save);
1743
- mBox .setStandardButtons (QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
1744
- int ret = mBox .exec ();
1745
-
1746
- switch (ret) {
1747
- case QMessageBox::Save:
1748
- std::cout << " Results not saved yet. Just cancelled the switch!" << std::endl;
1749
- // Save was clicked
1750
- return ;
1751
- case QMessageBox::Discard:
1752
- // Don't Save was clicked
1753
- std::cout << " Discarded!" << std::endl;
1754
- break ;
1755
- case QMessageBox::Cancel:
1756
- // Cancel was clicked
1757
- std::cout << " Cancelled!" << std::endl;
1758
- return ;
1759
- default :
1760
- // should never be reached
1761
- break ;
1762
- }
1763
- }
1764
- /*
1765
- if (pageComboBox->count() != 0) { // if not empty, clear
1766
- pageComboBox->clear();
1767
- exportComboBox->clear();
1768
- }
1769
- */
1770
1734
1735
+ // for a new selection of wsi(s), should reset and update these QWidgets
1771
1736
pageComboBox->clear ();
1772
1737
exportComboBox->clear ();
1738
+ m_rendererList.clear ();
1773
1739
1774
1740
auto progDialog = QProgressDialog (mWidget );
1775
1741
progDialog.setRange (0 , fileNames.count ()-1 );
@@ -1780,6 +1746,20 @@ void MainWindow::selectFileDrag(const QList<QString> &fileNames) {
1780
1746
progDialog.move (mWidget ->width () - progDialog.width () / 2 , - mWidget ->width () / 2 - progDialog.width () / 2 );
1781
1747
progDialog.show ();
1782
1748
1749
+ QCoreApplication::processEvents (QEventLoop::AllEvents, 0 );
1750
+ auto currentPosition = curr_pos;
1751
+
1752
+ // need to handle scenario where a WSI is added, but there already exists N WSIs from before
1753
+ auto nb_wsis_in_list = wsiList.size ();
1754
+ if (nb_wsis_in_list != 0 )
1755
+ currentPosition = nb_wsis_in_list;
1756
+
1757
+ // Get old view, and remove it from Widget
1758
+ currentView = getView (0 );
1759
+ currentView->stopPipeline ();
1760
+ currentView->setSynchronizedRendering (false ); // Disable synchronized rendering
1761
+ currentView->removeAllRenderers (); // VERY IMPORTANT THAT THIS IS DONE AFTER!!!
1762
+
1783
1763
QCoreApplication::processEvents (QEventLoop::AllEvents, 0 );
1784
1764
1785
1765
int counter = 0 ;
@@ -3159,7 +3139,7 @@ void MainWindow::runPipeline(std::string path) {
3159
3139
currentWSIs = m_runForProjectWsis;
3160
3140
}
3161
3141
else {
3162
- currentWSIs.push_back (filename); // wsiList[curr_pos]);
3142
+ currentWSIs.push_back (filename);
3163
3143
}
3164
3144
3165
3145
auto progDialog = QProgressDialog (mWidget );
@@ -3197,7 +3177,19 @@ void MainWindow::runPipeline(std::string path) {
3197
3177
3198
3178
// parse fpl-file, and run pipeline with corresponding input arguments
3199
3179
auto pipeline = Pipeline (path, arguments);
3200
- pipeline.parse ();
3180
+ if (m_runForProject) {
3181
+ pipeline.parse ({}, false );
3182
+ }
3183
+ else {
3184
+ pipeline.parse ();
3185
+ }
3186
+
3187
+ if (m_runForProject) {
3188
+ auto data = pipeline.getAllPipelineOutputData ([](float progress) {
3189
+ std::cout << " Progress: " << 100 * progress << " %" << std::endl;
3190
+ });
3191
+ std::cout << " Done" << std::endl;
3192
+ }
3201
3193
3202
3194
// get and start running POs
3203
3195
for (auto && po : pipeline.getProcessObjects ()) {
@@ -3208,11 +3200,13 @@ void MainWindow::runPipeline(std::string path) {
3208
3200
}
3209
3201
}
3210
3202
3211
- // load renderers, if any
3212
- for (const auto & renderer : pipeline.getRenderers ()) {
3213
- auto currId = createRandomNumbers_ (8 );
3214
- insertRenderer (" result_" + currId, renderer);
3215
- createDynamicViewWidget (" result_" + currId, " result_" + currId);
3203
+ if (!m_runForProject) {
3204
+ // load renderers, if any
3205
+ for (const auto & renderer : pipeline.getRenderers ()) {
3206
+ auto currId = createRandomNumbers_ (8 );
3207
+ insertRenderer (" result_" + currId, renderer);
3208
+ createDynamicViewWidget (" result_" + currId, " result_" + currId);
3209
+ }
3216
3210
}
3217
3211
3218
3212
// update progress bar
0 commit comments