Commit 5cb1e812 authored by Benjamin Jakimow's avatar Benjamin Jakimow
Browse files

settings.py settingsdialog.ui: assed Start-Up - Restore settings from QgsProject option


main.py: EOTSV restores QgsProject settings on startup
Signed-off-by: Benjamin Jakimow's avatarBenjamin Jakimow benjamin.jakimow@geo.hu-berlin.de <benjamin.jakimow@geo.hu-berlin.de>
parent d76307b5
Pipeline #12597 failed
......@@ -7,7 +7,9 @@ from qgis.core import QgsMapLayer, QgsRasterLayer, QgsVectorLayer, QgsField, Qgs
from qgis.gui import *
from qgis.gui import QgsDockWidget, QgsSpinBox, QgsDoubleSpinBox, \
QgsEditorConfigWidget, QgsEditorWidgetFactory, QgsEditorWidgetWrapper, \
QgsGui, QgsEditorWidgetRegistry, QgsDateTimeEdit, QgsDateEdit, QgsTimeEdit
QgsGui, QgsEditorWidgetRegistry, \
QgsDateTimeEdit, QgsDateEdit, QgsTimeEdit
from eotimeseriesviewer.externals.qps.layerproperties import *
from eotimeseriesviewer.timeseries import TimeSeriesDate, TimeSeriesSource
......
......@@ -53,6 +53,7 @@ import qgis.utils
from eotimeseriesviewer import LOG_MESSAGE_TAG
from eotimeseriesviewer.utils import *
from eotimeseriesviewer.timeseries import *
from eotimeseriesviewer.settings import Keys as SettingKeys
from eotimeseriesviewer.mapcanvas import MapCanvas
from eotimeseriesviewer.profilevisualization import ProfileViewDock
from eotimeseriesviewer.temporalprofiles import TemporalProfileLayer
......@@ -204,6 +205,8 @@ class EOTimeSeriesViewerUI(QMainWindow):
self.dockTimeSeries.raise_()
def addDockWidget(self, area: Qt.DockWidgetArea, dock: QDockWidget) -> QDockWidget:
"""
shortcut to add a created dock and return it
......@@ -671,6 +674,9 @@ class EOTimeSeriesViewer(QgisInterface, QObject):
QgsProject.instance().writeProject.connect(self.onWriteProject)
QgsProject.instance().readProject.connect(self.onReadProject)
if eotsvSettings.value(SettingKeys.StartupRestoreProjectSettings, False):
self.onReloadProject()
def onWriteProject(self, dom: QDomDocument):
node = dom.createElement('EOTSV')
......
......@@ -37,6 +37,7 @@ class Keys(enum.Enum):
QgsTaskBlockSize = 'qgs_task_block_size'
BandStatsSampleSize = 'band_stats_sample_size'
RasterOverlapSampleSize = 'raster_overlap_sample_size'
StartupRestoreProjectSettings = 'startup_load_projectsettings'
def defaultValues() -> dict:
......@@ -68,6 +69,8 @@ def defaultValues() -> dict:
d[Keys.BandStatsSampleSize] = 256
d[Keys.RasterOverlapSampleSize] = 25
d[Keys.StartupRestoreProjectSettings] = True
d[Keys.SettingsVersion] = EOTSV_VERSION
textFormat = QgsTextFormat()
textFormat.setColor(QColor('black'))
......@@ -567,7 +570,11 @@ class SettingsDialog(QDialog):
if self.cbSensorMatchingSensorName.isChecked():
flags = flags | SensorMatching.NAME
d[Keys.StartupRestoreProjectSettings] = self.cbStartupRestoreSettings.isChecked()
d[Keys.SensorMatching] = flags
d[Keys.SensorSpecs] = self.mSensorSpecsModel.specs()
d[Keys.MapSize] = QSize(self.sbMapSizeX.value(), self.sbMapSizeY.value())
d[Keys.MapUpdateInterval] = self.sbMapRefreshIntervall.value()
......@@ -621,6 +628,9 @@ class SettingsDialog(QDialog):
if i > -1:
self.cbDateTimePrecission.setCurrentIndex(i)
if checkKey(key, Keys.StartupRestoreProjectSettings):
self.cbStartupRestoreSettings.setChecked(bool(value in [True, 'true', 'True']))
if checkKey(key, Keys.SensorMatching):
assert isinstance(value, SensorMatching)
self.cbSensorMatchingPxDims.setChecked(bool(value & SensorMatching.PX_DIMS))
......
......@@ -44,7 +44,11 @@ from qgis.core import QgsRasterLayer, QgsCoordinateReferenceSystem, \
Qgis, QgsDateTimeRange, QgsMapLayerStyle, \
QgsProject, QgsGeometry, QgsApplication, QgsTask, QgsRasterBandStats, QgsRectangle, QgsRasterDataProvider, \
QgsTaskManager, QgsPoint, QgsPointXY, \
QgsRasterLayerTemporalProperties, QgsMimeDataUtils, QgsCoordinateTransform
QgsMimeDataUtils, QgsCoordinateTransform
try:
from qgis.core import QgsRasterLayerTemporalProperties
except:
pass
from qgis.gui import QgsDockWidget, QgisInterface
DEFAULT_WKT = QgsCoordinateReferenceSystem('EPSG:4326').toWkt()
......
......@@ -61,7 +61,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="pageGeneral">
<layout class="QVBoxLayout" name="verticalLayout_3">
......@@ -90,8 +90,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>397</height>
<width>395</width>
<height>388</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
......@@ -213,6 +213,28 @@
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBox" name="mGroupBox_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="title">
<string>Start up</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="cbStartupRestoreSettings">
<property name="text">
<string>Restore settings from QgsProject</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment