diff --git a/timeseriesviewer/ui/docks.py b/timeseriesviewer/ui/docks.py index edf74cd3894eda1c7ee316ab910e2895ce61a5e8..83daa54d0c8e2ecdaa6e097b4acf06e7ae3a4d2a 100644 --- a/timeseriesviewer/ui/docks.py +++ b/timeseriesviewer/ui/docks.py @@ -103,10 +103,11 @@ class NavigationDockUI(TsvDockWidgetBase, load('navigationdock.ui')): def __init__(self, parent=None): super(NavigationDockUI, self).__init__(parent) self.setupUi(self) - self.mCrs = None #default: disable QgsSync box self.gbSyncQgs.setEnabled(False) + self.btnCrs.crsChanged.connect(self.sigCrsChanged.emit) + self.btnCrs.crsChanged.connect(self.onCrsUpdated) self.cbSyncQgsMapExtent.clicked.connect(self.qgsSyncStateChanged) self.cbSyncQgsMapCenter.clicked.connect(self.qgsSyncStateChanged) @@ -146,14 +147,16 @@ class NavigationDockUI(TsvDockWidgetBase, load('navigationdock.ui')): sigCrsChanged = pyqtSignal(QgsCoordinateReferenceSystem) def setCrs(self, crs): assert isinstance(crs, QgsCoordinateReferenceSystem) - old = self.mCrs - self.mCrs = crs - self.textBoxCRSInfo.setPlainText(crs.toWkt()) - if self.mCrs != old: - self.sigCrsChanged.emit(crs) + self.btnCrs.setCrs(crs) + self.btnCrs.setLayerCrs(crs) + self.onCrsUpdated(crs) def crs(self): - return self.mCrs + return self.btnCrs.crs() + + def onCrsUpdated(self, crs): + self.gbCrs.setTitle(crs.authid()) + self.textBoxCRSInfo.setPlainText(crs.toWkt()) sigSpatialExtentChanged = pyqtSignal(SpatialExtent) diff --git a/timeseriesviewer/ui/navigationdock.ui b/timeseriesviewer/ui/navigationdock.ui index 594a8284d58fea651052713f1be603bb03edf88e..4741405380ae1493404c0cc3d8715eccb32a5b5b 100644 --- a/timeseriesviewer/ui/navigationdock.ui +++ b/timeseriesviewer/ui/navigationdock.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>237</width> - <height>217</height> + <width>397</width> + <height>309</height> </rect> </property> <property name="windowTitle"> @@ -291,103 +291,113 @@ </layout> </widget> </item> - <item row="3" column="0"> - <widget class="QToolButton" name="btnCRS"> - <property name="text"> - <string>...</string> - </property> - <property name="icon"> - <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/CRS.png</normaloff>:/timeseriesviewer/icons/CRS.png</iconset> - </property> - </widget> - </item> <item row="3" column="1"> - <widget class="QPlainTextEdit" name="textBoxCRSInfo"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>50</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>50</height> - </size> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <widget class="QGroupBox" name="gbSyncQgs"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>50</height> - </size> - </property> + <widget class="QgsCollapsibleGroupBox" name="gbCrs"> <property name="title"> - <string>Sync with QGIS on...</string> + <string><Coordinate Reference System></string> </property> - <property name="flat"> - <bool>false</bool> + <property name="collapsed"> + <bool>true</bool> </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QCheckBox" name="cbSyncQgsMapCenter"> - <property name="text"> - <string>center</string> - </property> - </widget> - </item> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <property name="spacing"> + <number>0</number> + </property> + <property name="margin"> + <number>6</number> + </property> <item> - <widget class="QCheckBox" name="cbSyncQgsMapExtent"> - <property name="text"> - <string>exent</string> + <widget class="QPlainTextEdit" name="textBoxCRSInfo"> + <property name="enabled"> + <bool>true</bool> </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="cbSyncQgsCRS"> - <property name="text"> - <string>CRS</string> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <property name="minimumSize"> + <size> + <width>0</width> + <height>100</height> + </size> </property> - <property name="sizeHint" stdset="0"> + <property name="maximumSize"> <size> - <width>40</width> - <height>20</height> + <width>16777215</width> + <height>16777215</height> </size> </property> - </spacer> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> </item> </layout> </widget> </item> + <item row="3" column="0"> + <widget class="QgsProjectionSelectionWidget" name="btnCrs"/> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="gbSyncQgs"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>50</height> + </size> + </property> + <property name="title"> + <string>Sync with QGIS on...</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QCheckBox" name="cbSyncQgsMapCenter"> + <property name="text"> + <string>center</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbSyncQgsMapExtent"> + <property name="text"> + <string>exent</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="cbSyncQgsCRS"> + <property name="text"> + <string>CRS</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> </layout> </widget> </item> @@ -455,6 +465,20 @@ </property> </action> </widget> + <customwidgets> + <customwidget> + <class>QgsCollapsibleGroupBox</class> + <extends>QGroupBox</extends> + <header>qgscollapsiblegroupbox.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>QgsProjectionSelectionWidget</class> + <extends>QWidget</extends> + <header>qgsprojectionselectionwidget.h</header> + <container>1</container> + </customwidget> + </customwidgets> <resources> <include location="resources.qrc"/> </resources>