diff --git a/InterSpec/InterSpecServer.h b/InterSpec/InterSpecServer.h
index 8c6eeaf8..f63a6608 100644
--- a/InterSpec/InterSpecServer.h
+++ b/InterSpec/InterSpecServer.h
@@ -218,6 +218,9 @@ namespace InterSpecServer
The file path must either be a file-system path to a spectrum file, or it can be a App URL with
the schema "interspec://..."
+ Call #clear_file_to_open_on_load after you have succesfully handled the file to remove this request
+ and not accidentally request to load it later.
+
Throws exception if an invalid session token, or the session has already been loaded.
*/
void set_file_to_open_on_load( const char *session_token, const std::string file_path );
@@ -227,6 +230,11 @@ namespace InterSpecServer
Returns empty string if none.
*/
std::string file_to_open_on_load( const std::string &session_token );
+
+ /** Once you have loaded the file/url from #file_to_open_on_load, call this function to avoid
+ loading the file/url again later
+ */
+ void clear_file_to_open_on_load( const std::string &session_token );
#if( BUILD_AS_ELECTRON_APP || BUILD_AS_OSX_APP || BUILD_AS_WX_WIDGETS_APP )
diff --git a/data/more_nuclide_info.xml b/data/more_nuclide_info.xml
index 3e179bbc..6357a5da 100644
--- a/data/more_nuclide_info.xml
+++ b/data/more_nuclide_info.xml
@@ -71,7 +71,7 @@ TODO: Need to incorporate the following from FRMAC Spectroscopists guide:
[
FRMAC Gamma Spectroscopist Knowledge Guide. Revision 0., by Michael Enghauser. Sandia National Lab. (SNL-NM), Albuquerque, NM (United States).
- https://www.hamamatsu.com/content/dam/hamamatsu-photonics/sites/documents/99_SALES_LIBRARY/etd/PMT_handbook_v3aE.pdf
+ https://www.osti.gov/servlets/purl/1763003
20230311
]
diff --git a/src/GammaCountDialog.cpp b/src/GammaCountDialog.cpp
index d515fda1..ea9b5e97 100644
--- a/src/GammaCountDialog.cpp
+++ b/src/GammaCountDialog.cpp
@@ -32,14 +32,17 @@
#include
#include
#include
+#include
+#include
#include
#include
#include
-#include
#include
#include "SpecUtils/SpecFile.h"
+#include "SpecUtils/StringAlgo.h"
+
#include "InterSpec/SpecMeas.h"
#include "InterSpec/AuxWindow.h"
#include "InterSpec/InterSpec.h"
@@ -196,8 +199,20 @@ void GammaCountDialog::init()
if( m_specViewer && !m_specViewer->isMobile() )
{
- WLabel* temp = new WLabel("You can also Shift-Alt-Drag on the chart"
+ string key_sequence = "Shift-Alt-Drag"; // Linux / Windows
+ const string &user_agent = wApp->environment().userAgent();
+ if( SpecUtils::icontains( user_agent, "macos")
+ || SpecUtils::icontains( user_agent, "macintel")
+ || SpecUtils::icontains( user_agent, "macintosh")
+ || SpecUtils::icontains( user_agent, "iphone")
+ || SpecUtils::icontains( user_agent, "ipad") )
+ {
+ key_sequence = "Shift-Option-Drag"; //Apple
+ }
+
+ WLabel* temp = new WLabel("You can also " + key_sequence + " on the chart"
" to select the energy range");
+
temp->setWordWrap(true);
layout->addWidget(temp,++row, 0 , 1 ,3,AlignCenter);
temp->setStyleClass("line-below");
diff --git a/src/InterSpecApp.cpp b/src/InterSpecApp.cpp
index 54599d15..66bc5854 100644
--- a/src/InterSpecApp.cpp
+++ b/src/InterSpecApp.cpp
@@ -534,12 +534,13 @@ void InterSpecApp::setupWidgets( const bool attemptStateLoad )
const Http::ParameterMap &parmap = environment().getParameterMap();
#if( !BUILD_FOR_WEB_DEPLOYMENT )
- if( !m_externalToken.empty() )
+ // The check of `attemptStateLoad` isnt strickly needed, as #file_to_open_on_load contents
+ // will be cleared
+ if( attemptStateLoad && !m_externalToken.empty() )
{
const string initial_file = InterSpecServer::file_to_open_on_load( m_externalToken );
if( !initial_file.empty() )
{
-
if( SpecUtils::istarts_with(initial_file, "interspec://")
|| SpecUtils::istarts_with(initial_file, "RADDATA://G0/") )
{
@@ -556,6 +557,8 @@ void InterSpecApp::setupWidgets( const bool attemptStateLoad )
{
loadedSpecFile = m_viewer->userOpenFileFromFilesystem( initial_file );
}//if( SpecUtils::istarts_with(foregroundPath, "interspec://") )
+
+ InterSpecServer::clear_file_to_open_on_load( m_externalToken );
if( loadedSpecFile )
{
diff --git a/src/InterSpecServer.cpp b/src/InterSpecServer.cpp
index 9c8fdd4c..e7132e0b 100644
--- a/src/InterSpecServer.cpp
+++ b/src/InterSpecServer.cpp
@@ -907,6 +907,15 @@ std::string file_to_open_on_load( const std::string &session_token )
}//file_to_open_on_load(...)
+void clear_file_to_open_on_load( const std::string &session_token )
+{
+ lock_guard lock( ns_sessions_mutex );
+ auto pos = ns_sessions.find( session_token );
+ if( pos != end(ns_sessions) )
+ ns_sessions.erase( pos );
+}//void clear_file_to_open_on_load( const std::string &session_token )
+
+
#if( BUILD_AS_ELECTRON_APP || BUILD_AS_OSX_APP || BUILD_AS_WX_WIDGETS_APP )
diff --git a/src/ReferencePhotopeakDisplay.cpp b/src/ReferencePhotopeakDisplay.cpp
index 17c81201..58c07d02 100644
--- a/src/ReferencePhotopeakDisplay.cpp
+++ b/src/ReferencePhotopeakDisplay.cpp
@@ -1356,7 +1356,6 @@ void ReferencePhotopeakDisplay::handleIsotopeChange( const bool useCurrentAge )
try
{
-
if( nuc && !nuc->isStable() && !nuc->decaysToChildren.empty() && !useCurrentAge )
{
if( nuc->decaysToStableChildren() )
@@ -1370,8 +1369,8 @@ void ReferencePhotopeakDisplay::handleIsotopeChange( const bool useCurrentAge )
m_ageEdit->setText( hlstr );
}else if( m_currentlyShowingNuclide.m_input.m_input_txt != nuc->symbol )
{
- string agestr;
- PeakDef::defaultDecayTime( nuc, &agestr );
+ string defagestr;
+ PeakDef::defaultDecayTime( nuc, &defagestr );
m_ageEdit->setText( agestr );
}else
{
@@ -1382,9 +1381,15 @@ void ReferencePhotopeakDisplay::handleIsotopeChange( const bool useCurrentAge )
}//if( nuc->decaysToStableChildren() ) / else
}else if( nuc && useCurrentAge )
{
- double age = PhysicalUnits::stringToTimeDurationPossibleHalfLife( agestr, nuc->halfLife );
- if( age > 100.0*nuc->halfLife || age < 0.0 )
- throw std::runtime_error( "" );
+ if( agestr.empty() && nuc->decaysToStableChildren() )
+ {
+ // We dont need an age - we will set to zero - so dont throw exception from empty string
+ }else
+ {
+ double age = PhysicalUnits::stringToTimeDurationPossibleHalfLife( agestr, nuc->halfLife );
+ if( age > 100.0*nuc->halfLife || age < 0.0 )
+ throw std::runtime_error( "" );
+ }
}
}catch(...)
{