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
53b34ae7
Commit
53b34ae7
authored
7 years ago
by
benjamin.jakimow@geo.hu-berlin.de
Browse files
Options
Downloads
Patches
Plain Diff
added PlotStyle.createIcon()
parent
030859b1
No related branches found
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
+32
-35
32 additions, 35 deletions
timeseriesviewer/plotstyling.py
with
32 additions
and
35 deletions
timeseriesviewer/plotstyling.py
+
32
−
35
View file @
53b34ae7
...
...
@@ -43,6 +43,8 @@ class PlotStyle(object):
self
.
markerBrush
.
setColor
(
QColor
(
55
,
55
,
55
))
self
.
markerBrush
.
setStyle
(
Qt
.
SolidPattern
)
self
.
backgroundColor
=
Qt
.
black
self
.
markerPen
=
QPen
()
self
.
markerPen
.
setStyle
(
Qt
.
SolidLine
)
self
.
markerPen
.
setColor
(
Qt
.
white
)
...
...
@@ -51,6 +53,24 @@ class PlotStyle(object):
self
.
linePen
.
setStyle
(
Qt
.
SolidLine
)
self
.
linePen
.
setColor
(
QColor
(
74
,
75
,
75
))
def
createIcon
(
self
,
size
=
None
):
if
size
is
None
:
size
=
QSize
(
60
,
60
)
pm
=
QPixmap
(
size
)
pm
.
fill
(
self
.
backgroundColor
)
p
=
QPainter
(
pm
)
#draw the line
p
.
setPen
(
self
.
linePen
)
p
.
drawLine
(
2
,
pm
.
height
()
-
2
,
pm
.
width
()
-
2
,
2
)
p
.
translate
(
pm
.
width
()
/
2
,
pm
.
height
()
/
2
)
from
pyqtgraph.graphicsItems.ScatterPlotItem
import
drawSymbol
path
=
drawSymbol
(
p
,
self
.
markerSymbol
,
self
.
markerSize
,
self
.
markerPen
,
self
.
markerBrush
)
p
.
end
()
return
QIcon
(
pm
)
class
PlotStyleWidget
(
QWidget
,
load
(
'
plotstylewidget.ui
'
)):
...
...
@@ -193,54 +213,33 @@ class PlotStyleButton(QPushButton):
def
__init__
(
self
,
*
args
):
super
(
PlotStyleButton
,
self
).
__init__
(
*
args
)
self
.
mPlotStyle
=
PlotStyle
()
self
.
mPlotStyle
=
None
self
.
clicked
.
connect
(
self
.
showDialog
)
self
.
_updateIcon
()
self
.
setPlotStyle
(
PlotStyle
()
)
def
plotStyle
(
self
):
return
self
.
mPlotStyle
def
setPlotStyle
(
self
,
plotStyle
):
assert
isinstance
(
plotStyle
,
PlotStyle
)
#
assert isinstance(plotStyle, PlotStyle)
self
.
mPlotStyle
=
plotStyle
self
.
_updateIcon
()
pass
def
showDialog
(
self
):
style
=
PlotStyleDialog
.
getPlotStyle
()
style
=
PlotStyleDialog
.
getPlotStyle
(
plotStyle
=
self
.
mPlotStyle
)
if
style
:
self
.
setPlotStyle
(
style
)
def
resizeEvent
(
self
,
arg
):
self
.
_updateIcon
()
def
_updateIcon
(
self
):
return
c
=
self
.
mPlotStyle
.
markerBrush
.
color
()
style
=
"
PlotStyleButton {{color:rgb({},{},{})}}
"
.
format
(
*
c
.
getRgb
())
style
=
"
QPushButton, PlotStyleButton {{color:rgb({},{},{})}}
"
.
format
(
*
c
.
getRgb
())
style
=
""""
* { background-color: rgb(253, 136, 64);};
"""
print
(
style
)
if
opts
.
get
(
'
fillLevel
'
,
None
)
is
not
None
and
opts
.
get
(
'
fillBrush
'
,
None
)
is
not
None
:
p
.
setBrush
(
fn
.
mkBrush
(
opts
[
'
fillBrush
'
]))
p
.
setPen
(
fn
.
mkPen
(
None
))
p
.
drawPolygon
(
QtGui
.
QPolygonF
([
QtCore
.
QPointF
(
2
,
18
),
QtCore
.
QPointF
(
18
,
2
),
QtCore
.
QPointF
(
18
,
18
)]))
if
not
isinstance
(
self
.
item
,
ScatterPlotItem
):
p
.
setPen
(
fn
.
mkPen
(
opts
[
'
pen
'
]))
p
.
drawLine
(
2
,
18
,
18
,
2
)
symbol
=
opts
.
get
(
'
symbol
'
,
None
)
if
symbol
is
not
None
:
if
isinstance
(
self
.
item
,
PlotDataItem
):
opts
=
self
.
item
.
scatter
.
opts
pen
=
fn
.
mkPen
(
opts
[
'
pen
'
])
brush
=
fn
.
mkBrush
(
opts
[
'
brush
'
])
size
=
opts
[
'
size
'
]
p
.
translate
(
10
,
10
)
path
=
drawSymbol
(
p
,
symbol
,
size
,
pen
,
brush
)
s
=
""
if
self
.
mPlotStyle
!=
None
:
icon
=
self
.
mPlotStyle
.
createIcon
(
self
.
size
())
#self.setIconSize(self.size())
self
.
setIcon
(
icon
)
pass
...
...
@@ -296,7 +295,5 @@ if __name__ == '__main__':
qgsApp
=
sandbox
.
initQgisEnvironment
()
btn
=
PlotStyleButton
()
btn
.
show
()
#style = PlotStyleDialog.getPlotStyle()
#print(style)
qgsApp
.
exec_
()
qgsApp
.
exitQgis
()
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