Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EO Time Series Viewer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin Jakimow
EO Time Series Viewer
Commits
8ed04fc9
Commit
8ed04fc9
authored
7 years ago
by
Benjamin Jakimow
Browse files
Options
Downloads
Patches
Plain Diff
refactoring
faster plot style updates
parent
8ab4c18a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
timeseriesviewer/plotstyling.py
+49
-20
49 additions, 20 deletions
timeseriesviewer/plotstyling.py
with
49 additions
and
20 deletions
timeseriesviewer/plotstyling.py
+
49
−
20
View file @
8ed04fc9
...
...
@@ -34,25 +34,40 @@ PENSTYLES = [(Qt.SolidLine, '___'),
class
PlotStyle
(
o
bject
):
class
PlotStyle
(
QO
bject
):
def
__init__
(
self
,
**
kwds
):
self
.
markerSymbol
=
MARKERSYMBOLS
[
0
][
0
]
self
.
markerSize
=
10
self
.
markerBrush
=
QBrush
()
self
.
markerBrush
.
setColor
(
QColor
(
55
,
55
,
55
))
self
.
markerBrush
.
setStyle
(
Qt
.
SolidPattern
)
super
(
PlotStyle
,
self
).
__init__
(
**
kwds
)
self
.
backgroundColor
=
Qt
.
black
if
'
plotStyle
'
in
kwds
.
keys
():
self
.
copyFrom
(
kwds
[
'
plotStyle
'
])
else
:
self
.
markerSymbol
=
MARKERSYMBOLS
[
0
][
0
]
self
.
markerSize
=
10
self
.
markerBrush
=
QBrush
()
self
.
markerBrush
.
setColor
(
Qt
.
green
)
self
.
markerBrush
.
setStyle
(
Qt
.
SolidPattern
)
self
.
backgroundColor
=
Qt
.
black
self
.
markerPen
=
QPen
()
self
.
markerPen
.
setStyle
(
Qt
.
SolidLine
)
self
.
markerPen
.
setColor
(
Qt
.
white
)
self
.
marker
Pen
=
QPen
()
self
.
marker
Pen
.
setStyle
(
Qt
.
SolidLine
)
self
.
marker
Pen
.
setColor
(
Q
t
.
white
)
self
.
line
Pen
=
QPen
()
self
.
line
Pen
.
setStyle
(
Qt
.
NoPen
)
self
.
line
Pen
.
setColor
(
Q
Color
(
74
,
75
,
75
)
)
self
.
linePen
=
QPen
()
self
.
linePen
.
setStyle
(
Qt
.
SolidLine
)
self
.
linePen
.
setColor
(
QColor
(
74
,
75
,
75
))
def
copyFrom
(
self
,
plotStyle
):
assert
isinstance
(
plotStyle
,
PlotStyle
)
self
.
markerSymbol
=
plotStyle
.
markerSymbol
self
.
markerBrush
=
QBrush
(
plotStyle
.
markerBrush
)
self
.
markerPen
=
QPen
(
plotStyle
.
markerPen
)
self
.
markerSize
=
plotStyle
.
markerSize
self
.
backgroundColor
=
QColor
(
plotStyle
.
backgroundColor
)
self
.
linePen
=
QPen
(
plotStyle
.
linePen
)
s
=
""
def
createIcon
(
self
,
size
=
None
):
if
size
is
None
:
...
...
@@ -127,11 +142,11 @@ class PlotStyleWidget(QWidget, load('plotstylewidget.ui')):
#todo: set style to style preview
pi
=
self
.
plotDataItem
pi
.
set
Data
(
x
=
[
0.25
,
0.5
,
0.75
],
y
=
[
0.25
,
0.75
,
0.5
],
symbol
=
style
.
markerSymbol
,
symbolBrush
=
style
.
marker
Brush
,
symbolPen
=
style
.
markerPen
,
symbolSize
=
style
.
marker
Size
,
pen
=
style
.
linePen
,
width
=
style
.
linePen
.
width
()
)
#symbol='o', symbolBrush=sensorView.color, symbolPen='w', symbolSize=8
pi
.
set
Symbol
(
style
.
markerSymbol
)
pi
.
setSymbolSize
(
style
.
marker
Size
)
pi
.
setSymbolBrush
(
style
.
marker
Brush
)
pi
.
setSymbolPen
(
style
.
markerPen
)
pi
.
setPen
(
style
.
linePen
)
pi
.
update
()
self
.
plotWidget
.
update
()
...
...
@@ -211,12 +226,18 @@ class PlotStyleWidget(QWidget, load('plotstylewidget.ui')):
class
PlotStyleButton
(
QPushButton
):
sigPlotStyleChanged
=
pyqtSignal
(
PlotStyle
)
def
__init__
(
self
,
*
args
):
super
(
PlotStyleButton
,
self
).
__init__
(
*
args
)
self
.
mPlotStyle
=
None
self
.
mInitialButtonSize
=
None
self
.
setStyleSheet
(
'
* { padding: 0px; }
'
)
self
.
clicked
.
connect
(
self
.
showDialog
)
self
.
setPlotStyle
(
PlotStyle
())
def
plotStyle
(
self
):
return
self
.
mPlotStyle
...
...
@@ -224,6 +245,7 @@ class PlotStyleButton(QPushButton):
#assert isinstance(plotStyle, PlotStyle)
self
.
mPlotStyle
=
plotStyle
self
.
_updateIcon
()
self
.
sigPlotStyleChanged
.
emit
(
self
.
mPlotStyle
)
pass
def
showDialog
(
self
):
...
...
@@ -235,12 +257,19 @@ class PlotStyleButton(QPushButton):
self
.
_updateIcon
()
def
_updateIcon
(
self
):
if
self
.
mInitialButtonSize
is
None
:
self
.
mInitialButtonSize
=
self
.
sizeHint
()
self
.
setIconSize
(
self
.
mInitialButtonSize
)
if
self
.
mPlotStyle
!=
None
:
icon
=
self
.
mPlotStyle
.
createIcon
(
self
.
size
())
#self.setIconSize(self.size())
s
=
self
.
mInitialButtonSize
s
=
self
.
sizeHint
()
#s = QSize()
icon
=
self
.
mPlotStyle
.
createIcon
(
self
.
mInitialButtonSize
)
self
.
setIcon
(
icon
)
pass
class
PlotStyleDialog
(
QgsDialog
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment