From cedf04fd98d7ca5fd6cd7fb052ca32eaa7d3ce6f Mon Sep 17 00:00:00 2001 From: "benjamin.jakimow@geo.hu-berlin.de" <q8DTkxUg-BB> Date: Thu, 30 Nov 2017 14:29:34 +0100 Subject: [PATCH] refactoring fixed icon of mainwindow --- timeseriesviewer/__init__.py | 6 +- timeseriesviewer/main.py | 1 - timeseriesviewer/mapvisualization.py | 19 +- timeseriesviewer/ui/mapviewdock.ui | 310 ++++++++++++------------ timeseriesviewer/ui/mapviewdockV2.ui | 213 ---------------- timeseriesviewer/ui/timeseriesviewer.ui | 6 +- timeseriesviewer/ui/widgets.py | 9 - 7 files changed, 175 insertions(+), 389 deletions(-) delete mode 100644 timeseriesviewer/ui/mapviewdockV2.ui diff --git a/timeseriesviewer/__init__.py b/timeseriesviewer/__init__.py index c46b1ea5..c08cf2c5 100644 --- a/timeseriesviewer/__init__.py +++ b/timeseriesviewer/__init__.py @@ -22,7 +22,7 @@ from __future__ import absolute_import VERSION = '0.4' LICENSE = 'GNU GPL-3' -TITLE = 'HUB TimeSeriesViewer' +TITLE = 'HUB Time Series Viewer' DESCRIPTION = 'A QGIS Plugin to visualize multi-sensor remote-sensing time-series data.' WEBSITE = 'bitbucket.org/jakimowb/hub-timeseriesviewer' REPOSITORY = 'bitbucket.org/jakimowb/hub-timeseriesviewer' @@ -112,9 +112,7 @@ def initSettings(): initSettings() def icon(): - - - return QIcon(os.path.join(os.path.dirname(__file__), *['ui','icons','icon.png'])) + return QIcon(':/timeseriesviewer/icons/IconTimeSeries.svg') diff --git a/timeseriesviewer/main.py b/timeseriesviewer/main.py index 7d87716d..631b0c0c 100644 --- a/timeseriesviewer/main.py +++ b/timeseriesviewer/main.py @@ -414,7 +414,6 @@ class TimeSeriesViewer(QObject): # initialize GUI self.ui = TimeSeriesViewerUI() - msgLog = QgsMessageLog.instance() #msgLog.messageReceived.connect(self.logMessage) diff --git a/timeseriesviewer/mapvisualization.py b/timeseriesviewer/mapvisualization.py index 004a0c70..b5d58b5d 100644 --- a/timeseriesviewer/mapvisualization.py +++ b/timeseriesviewer/mapvisualization.py @@ -29,13 +29,24 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * import numpy as np from timeseriesviewer.utils import * -from timeseriesviewer.main import TimeSeriesViewer + from timeseriesviewer.timeseries import SensorInstrument, TimeSeriesDatum, TimeSeries from timeseriesviewer.ui.docks import TsvDockWidgetBase, loadUi from timeseriesviewer.ui.widgets import TsvMimeDataUtils, maxWidgetSizes from timeseriesviewer.mapcanvas import MapCanvas from timeseriesviewer.crosshair import CrosshairStyle +class MapViewScrollArea(QScrollArea): + + sigResized = pyqtSignal() + def __init__(self, *args, **kwds): + super(MapViewScrollArea, self).__init__(*args, **kwds) + + def resizeEvent(self, event): + super(MapViewScrollArea, self).resizeEvent(event) + self.sigResized.emit() + + class MapViewUI(QFrame, loadUi('mapviewdefinition.ui')): @@ -892,9 +903,9 @@ class SpatialTemporalVisualization(QObject): self.mMapCanvases = [] self.ui = timeSeriesViewer.ui - from timeseriesviewer.ui.widgets import TsvScrollArea + self.scrollArea = self.ui.scrollAreaSubsets - assert isinstance(self.scrollArea, TsvScrollArea) + assert isinstance(self.scrollArea, MapViewScrollArea) self.mRefreshTimer = QTimer(self) @@ -1613,7 +1624,7 @@ class MapViewListModel(QAbstractListModel): value = mapView return value -class MapViewCollectionDock(QgsDockWidget, loadUi('mapviewdockV2.ui')): +class MapViewCollectionDock(QgsDockWidget, loadUi('mapviewdock.ui')): sigMapViewAdded = pyqtSignal(MapView) sigMapViewRemoved = pyqtSignal(MapView) diff --git a/timeseriesviewer/ui/mapviewdock.ui b/timeseriesviewer/ui/mapviewdock.ui index 0fabc894..fa51c60a 100644 --- a/timeseriesviewer/ui/mapviewdock.ui +++ b/timeseriesviewer/ui/mapviewdock.ui @@ -6,14 +6,14 @@ <rect> <x>0</x> <y>0</y> - <width>480</width> - <height>175</height> + <width>218</width> + <height>272</height> </rect> </property> <property name="minimumSize"> <size> - <width>100</width> - <height>175</height> + <width>124</width> + <height>218</height> </size> </property> <property name="windowTitle"> @@ -22,13 +22,13 @@ <widget class="QWidget" name="dockWidgetContents"> <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> - <number>0</number> + <number>2</number> </property> <property name="margin"> - <number>0</number> + <number>2</number> </property> <item> - <widget class="QScrollArea" name="scrollAreaMapViews"> + <widget class="QFrame" name="BVButtonList"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -37,175 +37,175 @@ </property> <property name="minimumSize"> <size> - <width>100</width> - <height>100</height> + <width>25</width> + <height>0</height> </size> </property> - <property name="autoFillBackground"> - <bool>true</bool> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="verticalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAsNeeded</enum> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <widget class="QWidget" name="scrollAreaMapsViewDockContent"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>480</width> - <height>153</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>100</width> - <height>100</height> - </size> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>2</number> </property> - <property name="styleSheet"> - <string notr="true"/> + <property name="margin"> + <number>0</number> </property> - <layout class="QHBoxLayout" name="horizontalLayout_8"> - <property name="spacing"> - <number>2</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QFrame" name="BVButtonList"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>25</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>25</width> - <height>16777215</height> - </size> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <property name="spacing"> - <number>1</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="btnApplyStyles"> - <property name="text"> - <string>...</string> - </property> - <property name="icon"> - <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/mActionRefresh.svg</normaloff>:/timeseriesviewer/icons/mActionRefresh.svg</iconset> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="btnAddMapView"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>...</string> - </property> - <property name="icon"> - <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</iconset> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_5"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> + <item> + <widget class="QToolButton" name="btnAddMapView"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>...</string> + </property> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</iconset> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="btnRemoveMapView"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="text"> + <string>...</string> + </property> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/timeseriesviewer/icons/mActionRemoveMapView.svg</normaloff>:/timeseriesviewer/icons/mActionRemoveMapView.svg</iconset> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="btnRefresh"> + <property name="toolTip"> + <string>Refresh map view rendering</string> + </property> + <property name="text"> + <string>...</string> + </property> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/timeseriesviewer/icons/mActionRefresh.png</normaloff>:/timeseriesviewer/icons/mActionRefresh.png</iconset> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="cbMapView"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Select the rendersettings for a specific map view</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="btnHighlightMapView"> + <property name="text"> + <string>?</string> + </property> + <property name="autoRaise"> + <bool>true</bool> + </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> + <item> + <widget class="QStackedWidget" name="stackedWidget"/> + </item> </layout> </widget> <action name="actionApplyStyles"> <property name="icon"> <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/mActionRefresh.svg</normaloff>:/timeseriesviewer/icons/mActionRefresh.svg</iconset> + <normaloff>:/timeseriesviewer/icons/mActionRefresh.png</normaloff>:/timeseriesviewer/icons/mActionRefresh.png</iconset> + </property> + <property name="text"> + <string>ApplyStyles</string> + </property> + <property name="toolTip"> + <string>Refresh this map view and apply all render settings</string> + </property> + </action> + <action name="actionRemoveMapView"> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/timeseriesviewer/icons/mActionRemoveMapView.svg</normaloff>:/timeseriesviewer/icons/mActionRemoveMapView.svg</iconset> + </property> + <property name="text"> + <string>Remove view</string> + </property> + <property name="toolTip"> + <string>Remove this map view</string> + </property> + </action> + <action name="actionAddMapView"> + <property name="icon"> + <iconset resource="resources.qrc"> + <normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</iconset> </property> <property name="text"> <string>ApplyStyles</string> </property> <property name="toolTip"> - <string>Apply Render Styles</string> + <string>Create a new map view</string> + </property> + </action> + <action name="actionHighlightMapView"> + <property name="text"> + <string>?</string> + </property> + <property name="toolTip"> + <string>Click to highlight this map view</string> </property> </action> </widget> diff --git a/timeseriesviewer/ui/mapviewdockV2.ui b/timeseriesviewer/ui/mapviewdockV2.ui deleted file mode 100644 index 301c265a..00000000 --- a/timeseriesviewer/ui/mapviewdockV2.ui +++ /dev/null @@ -1,213 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>dockMapViews</class> - <widget class="QDockWidget" name="dockMapViews"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>218</width> - <height>272</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>124</width> - <height>218</height> - </size> - </property> - <property name="windowTitle"> - <string>Map Views</string> - </property> - <widget class="QWidget" name="dockWidgetContents"> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>2</number> - </property> - <property name="margin"> - <number>2</number> - </property> - <item> - <widget class="QFrame" name="BVButtonList"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>25</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>16777215</height> - </size> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>2</number> - </property> - <property name="margin"> - <number>0</number> - </property> - <item> - <widget class="QToolButton" name="btnAddMapView"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>...</string> - </property> - <property name="icon"> - <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</iconset> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="btnRemoveMapView"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string>...</string> - </property> - <property name="icon"> - <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/mActionRemoveMapView.svg</normaloff>:/timeseriesviewer/icons/mActionRemoveMapView.svg</iconset> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="btnRefresh"> - <property name="toolTip"> - <string>Refresh map view rendering</string> - </property> - <property name="text"> - <string>...</string> - </property> - <property name="icon"> - <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/mActionRefresh.png</normaloff>:/timeseriesviewer/icons/mActionRefresh.png</iconset> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="cbMapView"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>1</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="btnHighlightMapView"> - <property name="text"> - <string>?</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </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> - <item> - <widget class="QStackedWidget" name="stackedWidget"/> - </item> - </layout> - </widget> - <action name="actionApplyStyles"> - <property name="icon"> - <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/mActionRefresh.png</normaloff>:/timeseriesviewer/icons/mActionRefresh.png</iconset> - </property> - <property name="text"> - <string>ApplyStyles</string> - </property> - <property name="toolTip"> - <string>Refresh this map view and apply all render settings</string> - </property> - </action> - <action name="actionRemoveMapView"> - <property name="icon"> - <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/mActionRemoveMapView.svg</normaloff>:/timeseriesviewer/icons/mActionRemoveMapView.svg</iconset> - </property> - <property name="text"> - <string>Remove view</string> - </property> - <property name="toolTip"> - <string>Remove this map view</string> - </property> - </action> - <action name="actionAddMapView"> - <property name="icon"> - <iconset resource="resources.qrc"> - <normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</normaloff>:/timeseriesviewer/icons/mActionAddMapView.svg</iconset> - </property> - <property name="text"> - <string>ApplyStyles</string> - </property> - <property name="toolTip"> - <string>Create a new map view</string> - </property> - </action> - <action name="actionHighlightMapView"> - <property name="text"> - <string>?</string> - </property> - <property name="toolTip"> - <string>Click to highlight this map view</string> - </property> - </action> - </widget> - <resources> - <include location="resources.qrc"/> - </resources> - <connections/> -</ui> diff --git a/timeseriesviewer/ui/timeseriesviewer.ui b/timeseriesviewer/ui/timeseriesviewer.ui index 9d437076..b644e504 100644 --- a/timeseriesviewer/ui/timeseriesviewer.ui +++ b/timeseriesviewer/ui/timeseriesviewer.ui @@ -60,7 +60,7 @@ </widget> </item> <item> - <widget class="TsvScrollArea" name="scrollAreaSubsets"> + <widget class="MapViewScrollArea" name="scrollAreaSubsets"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <horstretch>1</horstretch> @@ -599,9 +599,9 @@ <container>1</container> </customwidget> <customwidget> - <class>TsvScrollArea</class> + <class>MapViewScrollArea</class> <extends>QScrollArea</extends> - <header>timeseriesviewer.ui.widgets.h</header> + <header>timeseriesviewer.mapvisualization.h</header> <container>1</container> </customwidget> </customwidgets> diff --git a/timeseriesviewer/ui/widgets.py b/timeseriesviewer/ui/widgets.py index bdd679d5..80343ea8 100644 --- a/timeseriesviewer/ui/widgets.py +++ b/timeseriesviewer/ui/widgets.py @@ -33,15 +33,6 @@ import PyQt4.QtWebKit import sys, re, os, six #widgets defined without UI file -class TsvScrollArea(QScrollArea): - - sigResized = pyqtSignal() - def __init__(self, *args, **kwds): - super(TsvScrollArea, self).__init__(*args, **kwds) - - def resizeEvent(self, event): - super(TsvScrollArea, self).resizeEvent(event) - self.sigResized.emit() class VerticalLabel(QLabel): -- GitLab