Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
1489643a
Commit
1489643a
authored
Mar 23, 2012
by
Luke Campagnola
Browse files
GraphicsLayout: added convenience method for creating sub-layouts
parent
b78662c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
graphicsItems/GraphicsLayout.py
View file @
1489643a
...
...
@@ -26,12 +26,15 @@ class GraphicsLayout(GraphicsWidget):
self
.
currentRow
+=
1
self
.
currentCol
=
0
def
nextCol
(
self
,
colspan
=
1
):
def
nextCol
umn
(
self
,
colspan
=
1
):
"""Advance to next column, while returning the current column number
(generally only for internal use--called by addItem)"""
self
.
currentCol
+=
colspan
return
self
.
currentCol
-
colspan
def
nextCol
(
self
,
*
args
,
**
kargs
):
return
self
.
nextColumn
(
*
args
,
**
kargs
)
def
addPlot
(
self
,
row
=
None
,
col
=
None
,
rowspan
=
1
,
colspan
=
1
,
**
kargs
):
plot
=
PlotItem
(
**
kargs
)
self
.
addItem
(
plot
,
row
,
col
,
rowspan
,
colspan
)
...
...
@@ -47,7 +50,11 @@ class GraphicsLayout(GraphicsWidget):
self
.
addItem
(
text
,
row
,
col
,
rowspan
,
colspan
)
return
text
def
addLayout
(
self
,
row
=
None
,
col
=
None
,
rowspan
=
1
,
colspan
=
1
,
**
kargs
):
layout
=
GraphicsLayout
(
**
kargs
)
self
.
addItem
(
layout
,
row
,
col
,
rowspan
,
colspan
)
return
layout
def
addItem
(
self
,
item
,
row
=
None
,
col
=
None
,
rowspan
=
1
,
colspan
=
1
):
if
row
is
None
:
row
=
self
.
currentRow
...
...
widgets/GraphicsLayoutWidget.py
View file @
1489643a
...
...
@@ -7,6 +7,6 @@ class GraphicsLayoutWidget(GraphicsView):
def
__init__
(
self
,
parent
=
None
,
**
kargs
):
GraphicsView
.
__init__
(
self
,
parent
)
self
.
ci
=
GraphicsLayout
(
**
kargs
)
for
n
in
[
'nextRow'
,
'nextCol'
,
'addPlot'
,
'addViewBox'
,
'addItem'
,
'getItem'
,
'addLabel'
]:
for
n
in
[
'nextRow'
,
'nextCol'
,
'nextColumn'
,
'addPlot'
,
'addViewBox'
,
'addItem'
,
'getItem'
,
'addLabel'
,
'addLayout'
]:
setattr
(
self
,
n
,
getattr
(
self
.
ci
,
n
))
self
.
setCentralItem
(
self
.
ci
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment