Skip to content

Commit d13a3d9

Browse files
committed
Disable re-binning on load by default; fix spec file query tool + more.
Set SpecUtils_REBIN_FILES_TO_SINGLE_BINNING to OFF by default always. Fix some small warnings seen on VS2017. Fix DetectorEdit to not display the same relative efficiency TSV multiple times. Fix DetectorEdit display on Windows to not have scroll bars and mis-formatting all over. Remove explicit test if a directory can be written into in spectrum file query tool; on Windows this test was erroneously failing due to the check not being correectly implemented (will now just error out if the database cant be written too, which is fine). Disable spellcheck by default in Electron builds. Fix invalid runtime check in DoseCalc tool that was accidentally left in.
1 parent b49198a commit d13a3d9

File tree

10 files changed

+54
-26
lines changed

10 files changed

+54
-26
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ option(USE_GOOGLE_MAP "Use google maps widget" ON)
158158
option(
159159
SpecUtils_REBIN_FILES_TO_SINGLE_BINNING
160160
"Rebins all spectra in spectrum file to the same energy calibration"
161-
ON
161+
OFF
162162
)
163163
option(
164164
DECAY_CHART_ADD_IMAGE_DOWNLOAD_LINK

InterSpec_resources/DetectorEdit.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
font-style: italic;
55
}
66

7-
8-
.FormulaDrfTbl
7+
.DetEditContent
98
{
10-
width: 100%;
9+
overflow-y: auto;
10+
}
11+
12+
.FormulaDrfTbl {
13+
width: 95%;
1114
}
1215

1316
.FormulaDrfTbl td

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void processCustomArgs( int argc, char **argv )
171171
SerialToDetectorModel::set_detector_model_input_csv( serial_db[0] );
172172
set_serial_num_file = true;
173173
}
174-
}catch( std::exception &e )
174+
}catch( std::exception & )
175175
{
176176
std::cerr << "Invalid userdatadir ('" << argv[i+1] << "') specified"
177177
<< std::endl;

src/DetectorEdit.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <string>
3030
#include <vector>
3131
#include <fstream>
32+
#include <algorithm>
3233

3334
#include <boost/tokenizer.hpp>
3435
#include <boost/filesystem.hpp>
@@ -684,15 +685,23 @@ void RelEffDetSelect::saveFilePathToUserPreferences()
684685

685686
auto children = m_files->children();
686687

687-
string concat_path;
688+
vector<string> paths;
688689
for( auto w : children )
689690
{
690691
auto child = dynamic_cast<RelEffFile *>( w );
691692
const string filepath = child ? child->filepath() : string("");
692693
if( filepath.size() )
693-
concat_path += (concat_path.size() ? ";" : "") + filepath;
694+
paths.push_back( filepath );
695+
//concat_path += (concat_path.size() ? ";" : "") + filepath;
694696
}//string concat_path;
695697

698+
//Make sure we only save unique paths
699+
paths.erase( std::unique( begin(paths), end(paths) ), end(paths) );
700+
701+
string concat_path;
702+
for( const auto &filepath : paths )
703+
concat_path += (concat_path.size() ? ";" : "") + filepath;
704+
696705
try
697706
{
698707
InterSpecUser::setPreferenceValue( m_interspec->m_user, "RelativeEffDRFPaths", concat_path, m_interspec );
@@ -797,6 +806,9 @@ void RelEffDetSelect::docreate()
797806

798807
SpecUtils::split( paths, pathstr, "\r\n;" );
799808

809+
//Eliminate any duplicate entries in paths
810+
paths.erase( std::unique( begin(paths), end(paths) ), end(paths) );
811+
800812
if( paths.empty() )
801813
new RelEffFile( "", this, m_detectorEdit, m_files );
802814

@@ -1749,7 +1761,7 @@ DetectorEdit::DetectorEdit( std::shared_ptr<DetectorPeakResponse> currentDet,
17491761
lowerContent->resize( WLength::Auto, WLength(190,WLength::Pixel) );
17501762

17511763
m_drfTypeStack = new Wt::WStackedWidget();
1752-
m_drfTypeStack->addStyleClass( "UseInfoStack" );
1764+
m_drfTypeStack->addStyleClass( "UseInfoStack DetEditContent" );
17531765

17541766
m_drfTypeMenu = new WMenu( m_drfTypeStack, Wt::Vertical );
17551767
m_drfTypeMenu->addStyleClass( "VerticalMenu SideMenu DetEditMenu" );
@@ -1939,9 +1951,8 @@ DetectorEdit::DetectorEdit( std::shared_ptr<DetectorPeakResponse> currentDet,
19391951
//--- 5) Recent
19401952
//-------------------------------------
19411953
WContainerWidget *recentDiv = new WContainerWidget( );
1942-
WGridLayout* recentDivLayout = new WGridLayout();
1954+
WGridLayout* recentDivLayout = new WGridLayout( recentDiv );
19431955
recentDivLayout->setContentsMargins( 0, 0, 0, 0 );
1944-
recentDiv->setLayout(recentDivLayout);
19451956

19461957
Dbo::ptr<InterSpecUser> user = m_interspec->m_user;
19471958

@@ -2059,9 +2070,9 @@ DetectorEdit::DetectorEdit( std::shared_ptr<DetectorPeakResponse> currentDet,
20592070

20602071
recentDivLayout->addWidget( filter, 1, 2 );
20612072
recentDivLayout->setRowStretch( 0, 1 );
2062-
recentDiv->setOverflow(Wt::WContainerWidget::OverflowHidden);
2063-
recentDiv->setMaximumSize( WLength::Auto, 180 );
2064-
2073+
//recentDiv->setOverflow(Wt::WContainerWidget::OverflowHidden);
2074+
//recentDiv->setMaximumSize( WLength::Auto, 180 );
2075+
recentDiv->setHeight( WLength( 100, WLength::Unit::Percentage ) );
20652076
m_DBtable->sortByColumn( 2, Wt::SortOrder::DescendingOrder );
20662077

20672078
//--------------------------------------------------------------------------------

src/DoseCalcWidget.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ class GammaSourceEnter : public Wt::WContainerWidget
249249
m_nuclideEdit = new WLineEdit();
250250
layout->addWidget( m_nuclideEdit, 0, 1 );
251251
m_nuclideEdit->addStyleClass( "DoseEnterTxt" );
252+
m_nuclideEdit->setAttributeValue( "spellcheck", "false" );
252253
label->setBuddy( m_nuclideEdit );
253254

254255
label = new WLabel( "Age:" );
@@ -1327,7 +1328,7 @@ void DoseCalcWidget::runtime_sanity_checks()
13271328
checkPrintDose( 8.23688E-2, "82.37 msv/hr", true );
13281329
checkPrintDose( 8.23688E2, "823.69 sv/hr", true );
13291330
checkPrintDose( 8.23688E5, "823.69 ksv/hr", true );
1330-
checkPrintDose( 8.23688E6, "8.24 Msv/hr...", true );
1331+
checkPrintDose( 8.23688E6, "8.24 Msv/hr", true );
13311332
}//void runtime_sanity_checks()
13321333

13331334

src/MakeDrf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ namespace
799799
try
800800
{
801801
age_at_meas = PhysicalUnits::stringToTimeDurationPossibleHalfLife( mtch[2].str(), (nuc ? nuc->halfLife : -1.0) );
802-
}catch( std::exception &e )
802+
}catch( std::exception & )
803803
{
804804
cerr << "Failed to convert '" << mtch[2].str() << "' to an age." << endl;
805805
}

src/SpecFileQueryDbCache.cpp

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,16 +1151,28 @@ bool SpecFileQueryDbCache::open_db( const std::string &path, const bool create_t
11511151
bool SpecFileQueryDbCache::init_existing_persisted_db()
11521152
{
11531153
if( !SpecUtils::is_directory( m_fs_path ) )
1154+
{
1155+
std::cerr << "m_fs_path='" << m_fs_path << "', is not a path" << std::endl;
11541156
return false;
1155-
1156-
if( !SpecUtils::can_rw_in_directory( m_fs_path ) )
1157-
return false;
1158-
1157+
}
1158+
1159+
// The read-only atribute of a Windows directory doesnt mean you cant read/write in that dir
1160+
// so we'll just always skip checking if you can RW in a directory, even on POSIX, and
1161+
// instead wait for openeing of the database to fail.
1162+
//if( !SpecUtils::can_rw_in_directory( m_fs_path ) )
1163+
//{
1164+
// std::cerr << "Can not RW in directory '" << m_fs_path << "'." << std::endl;
1165+
// return false;
1166+
//}
1167+
11591168
const string persisted_path = construct_persisted_db_filename(m_fs_path);
11601169

11611170
if( !SpecUtils::is_file( persisted_path ) )
1171+
{
1172+
std::cerr << "Persisted db path '" << persisted_path << "' is not a file" << std::endl;
11621173
return false;
1163-
1174+
}
1175+
11641176
try
11651177
{
11661178
std::unique_ptr<Wt::Dbo::backend::Sqlite3> db( new Wt::Dbo::backend::Sqlite3(persisted_path) );
@@ -1234,6 +1246,7 @@ bool SpecFileQueryDbCache::init_existing_persisted_db()
12341246
m_db_session.reset();
12351247
m_db.reset();
12361248
//passMessage( "Caught exception initind persisted DB; " + string(e.what()), "", 3 );
1249+
cerr << "\n\nIn persisting cache, caught: " << e.what() << endl << endl;
12371250
}
12381251
return false;
12391252
}//bool init_existing_persisted_db()
@@ -1547,7 +1560,7 @@ void SpecFileQueryDbCache::set_persist( const bool persist )
15471560
}//
15481561

15491562
const string oldloc = m_db_location;
1550-
1563+
m_db_location = newfilename;
15511564

15521565
if( init_existing_persisted_db() )
15531566
return;

src/SpecFileQueryWidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,9 +2142,9 @@ void SpecFileQueryWidget::updateNumberFiles( const string srcdir,
21422142
nfiles, true, srcdir, recursive, extfilter, querywidget, widgetdeleted ) );
21432143

21442144
#endif
2145-
} catch( ... )
2145+
} catch( std::exception &e )
21462146
{
2147-
std::cerr << "Error in updateNumberFiles; unexpected exception" << std::endl;
2147+
std::cerr << "Error in updateNumberFiles; unexpected exception: " << e.what() << std::endl;
21482148

21492149
if( !(*widgetdeleted) )
21502150
WServer::instance()->post( sessionid, boost::bind( &SpecFileQueryWidget::updateNumberFilesInGui,

target/electron/app/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ function createWindow () {
282282

283283
//To get nodeIntegration to work, there is som JS hacks in
284284
// InterSpecApp::setupDomEnvironment()
285-
windowPrefs.webPreferences = {nodeIntegration: true, nativeWindowOpen: true, enableRemoteModule: true };
285+
windowPrefs.webPreferences = {nodeIntegration: true, nativeWindowOpen: true, enableRemoteModule: true, spellcheck: false };
286286

287287
mainWindow = new BrowserWindow( windowPrefs );
288288

target/electron/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "InterSpecAddOn",
3-
"version": "1.0.5",
3+
"version": "1.0.7",
44
"description": "Application for interactive gamma spectroscopy",
55
"homepage": "https://github.com/sandialabs/InterSpec",
66
"main": "main.js",
@@ -10,7 +10,7 @@
1010
},
1111
"scripts": {
1212
"install": "cmake-js compile",
13-
"start": "electron ./build_vs2017/app/",
13+
"start": "electron ./build_win/app/",
1414
"package-mac": "electron-packager ./build_macos/app --overwrite --platform=darwin --arch=x64 --icon=macOS/InterSpec.icns --prune=true --out=release-builds --binaries=InterSpec.exe --extendInfo=macOS/Info.plist --entitlements=macOS/entitlements.mac.plist --ignore=copy_resources.* --ignore=LICENSE.md --ignore=README.md",
1515
"package-win": "electron-packager ./build_win/app InterSpec --overwrite --asar=0 --platform=win32 --arch=x64 --icon=windows/icon.ico --prune=true --out=release-builds --version-string.CompanyName=\"Sandia National Laboratories\" --version-string.FileDescription=\"nuclear spectroscopy analysis program\" --version-string.ProductName=\"InterSpec\" --ignore=LICENSE.md --ignore=README.md",
1616
"package-linux": "electron-packager ./build_linux/app InterSpec --overwrite --asar=0 --platform=linux --arch=x64 --icon=linux/InterSpec_desktop_icon_256x256.png --prune=true --out=release-builds --ignore=copy_resources.* --ignore=LICENSE.md --ignore=README.md"

0 commit comments

Comments
 (0)