Skip to content

Commit 55f1fdf

Browse files
authored
Merge pull request #1449 from EnMAP-Box/fix_1445
Fixes spectral library widget
2 parents e96cd86 + 61cf96b commit 55f1fdf

File tree

7 files changed

+31
-24
lines changed

7 files changed

+31
-24
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,6 @@ scripts/changelog/fetch_issues.bat
5353
scripts/changelog/fetch_issues.txt
5454
scripts/changelog/fetch_releases.txt
5555
scripts/changelog/ISSUES.md
56+
57+
# CatBoost training logs
58+
catboost_info/

enmapbox/apps/lmuvegetationapps/IVVRM/IVVRM_GUI.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,23 @@
2323
***************************************************************************
2424
"""
2525

26-
import sys
2726
import os
27+
import sys
28+
import warnings
29+
2830
import numpy as np
2931
from scipy.interpolate import interp1d
30-
# from qgis.gui import *
3132

33+
from enmapbox.coreapps._classic.hubflow.core import openRasterDataset
3234
# ensure to call QGIS before PyQtGraph
33-
from qgis.PyQt.QtGui import *
34-
from qgis.PyQt.QtWidgets import *
3535
from enmapbox.qgispluginsupport.qps.pyqtgraph import pyqtgraph as pg
36+
from lmuvegetationapps import APP_DIR
3637
from lmuvegetationapps.Resources.PROSAIL import call_model as mod
3738
from lmuvegetationapps.Resources.Spec2Sensor.Spec2Sensor_core import Spec2Sensor, BuildTrueSRF, BuildGenericSRF
38-
from lmuvegetationapps import APP_DIR
39-
39+
from qgis.PyQt.QtGui import QColor
40+
from qgis.PyQt.QtWidgets import QDialog, QFileDialog, QHeaderView, QTableWidgetItem, QMessageBox, QApplication, \
41+
QWidgetAction, QWidget, QLabel, QGridLayout
4042
from qgis.gui import QgsMapLayerComboBox
41-
from _classic.hubflow.core import *
42-
43-
import warnings
4443

4544
warnings.filterwarnings('ignore') # ignore warnings, like ZeroDivision
4645

@@ -1022,6 +1021,7 @@ def open_image(self, mode): # open image
10221021

10231022
def image_read(self): # read only necessary info: fwhm and center wavelengths
10241023
inras = self.image
1024+
10251025
image = openRasterDataset(inras)
10261026
meta = image.metadataDict()
10271027
try:

enmapbox/gui/dataviews/docks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,13 +820,15 @@ def __init__(self, *args,
820820
# speclib.nameChanged.connect(lambda slib=speclib: self.setTitle(slib.name()))
821821
# self.sigTitleChanged.connect(speclib.setName)
822822
self.mDefaultSpeclibId: str = ''
823+
if isinstance(speclib, QgsVectorLayer):
824+
self.mDefaultSpeclibId = speclib.id()
823825

824826
def createDefaultSpeclib(self) -> QgsVectorLayer:
825827
"""
826828
Creates an in-memory spectral library whose layer name is linked to the dock's name
827829
"""
828830
sl = SpectralLibraryUtils.createSpectralLibrary(['profiles'])
829-
sl.setName(f'{self.name()}')
831+
sl.setName(f'{self.title()}')
830832
with edit(sl):
831833
sl.addAttribute(QgsField('name', QMetaType.QString))
832834
self.speclibWidget().project().addMapLayer(sl)

tests/enmap-box/enmapbox/apps/lmuvegetationapps/test_lmuvegetationapps.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
from enmapbox.apps.lmuvegetationapps.IVVRM.IVVRM_GUI import IVVRM_GUI, MainUiFunc
1818
from enmapbox.gui.enmapboxgui import EnMAPBox
19-
from enmapbox.testing import EnMAPBoxTestCase
19+
from enmapbox.testing import EnMAPBoxTestCase, start_app
20+
21+
start_app()
2022

2123

2224
def has_package(name: str):
@@ -35,17 +37,13 @@ def test_MainUiFunc(self):
3537
self.showGui(m)
3638

3739
def test_application(self):
38-
EB = EnMAPBox.instance()
39-
if EB is None:
40-
EB = EnMAPBox()
41-
EB.ui.hide()
40+
EB = EnMAPBox(load_core_apps=False, load_other_apps=False)
41+
EB.ui.show()
4242

4343
w = IVVRM_GUI()
4444
self.showGui(w)
45-
# app = LMU_EnMAPBoxApp(EB)
46-
# app.start_GUI_IVVRM()
47-
48-
self.showGui(EB.ui)
45+
w.close()
46+
EB.close()
4947

5048

5149
if __name__ == "__main__":

tests/enmap-box/enmapbox/apps/otherapps/test_enpt_enmapboxapp.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
__copyright__ = 'Copyright 2017, Benjamin Jakimow'
1313

1414
import unittest
15-
from enmapbox import initPythonPaths
15+
16+
from enmapbox import initAll
1617
from enmapbox.gui.enmapboxgui import EnMAPBox
17-
from enmapbox.testing import EnMAPBoxTestCase
18+
from enmapbox.testing import start_app, EnMAPBoxTestCase
1819

19-
initPythonPaths()
20+
start_app()
21+
initAll()
2022

2123
try:
2224
from enpt_enmapboxapp.enpt_enmapboxapp import EnPTEnMAPBoxApp
@@ -39,6 +41,7 @@ def test_application(self):
3941
self.assertIsInstance(app, EnPTEnMAPBoxApp)
4042
# app.startGUI()
4143
self.showGui(EB.ui)
44+
EB.close()
4245

4346

4447
if __name__ == "__main__":

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[enmapbox:metadata]
22
name = EnMAP-Box 3
3-
version = 3.17.4
3+
version = 3.17.5
44
qgisMinimumVersion = 3.40
55
description = Imaging Spectroscopy and Remote Sensing for QGIS
66
tags =
@@ -242,6 +242,7 @@ norecursedirs =
242242
# tests/enmap-box/enmapbox/coreapps
243243
tests/enmap-box/enmapbox/apps/SpecDeepMap
244244
tests/excluded
245+
tests/enmap-box/enmapbox/apps/otherapps/test_enpt_enmapboxapp.py
245246
# tests/enmap-box/enmapbox/eo4qapps
246247
# tests/enmap-box/enmapbox/gui
247248
# tests/enmap-box/enmapbox/provider

0 commit comments

Comments
 (0)