Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
total_control_app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Drechsler
total_control_app
Commits
d88f54ae
Commit
d88f54ae
authored
Apr 24, 2019
by
Martin Drechsler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created a file with pyqtgraph subclasses
parent
e54ea7ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
pyqtgraph_sublasses.py
pyqtgraph_sublasses.py
+46
-0
No files found.
pyqtgraph_sublasses.py
0 → 100644
View file @
d88f54ae
from
pyqtgraph
import
ROI
class
CustomRectangularROI
(
ROI
):
"""
Rectangular ROI subclass with a single scale handle at the top-right corner.
============== =============================================================
**Arguments**
pos (length-2 sequence) The position of the ROI origin.
See ROI().
size (length-2 sequence) The size of the ROI. See ROI().
centered (bool) If True, scale handles affect the ROI relative to its
center, rather than its origin.
sideScalers (bool) If True, extra scale handles are added at the top and
right edges.
\
**args All extra keyword arguments are passed to ROI()
============== =============================================================
"""
def
__init__
(
self
,
pos
,
size
=
[
8
,
8
],
centered
=
False
,
sideScalers
=
False
):
#ROI.__init__(self, pos, size, **args)
super
()
.
__init__
(
pos
,
size
,
centered
,
sideScalers
)
## handles scaling horizontally around center
self
.
addScaleHandle
([
1
,
0.5
],
[
0.5
,
0.5
])
self
.
addScaleHandle
([
0
,
0.5
],
[
0.5
,
0.5
])
## handles scaling vertically from opposite edge
self
.
addScaleHandle
([
0.5
,
0
],
[
0.5
,
1
])
self
.
addScaleHandle
([
0.5
,
1
],
[
0.5
,
0
])
## handles scaling both vertically and horizontally
self
.
addScaleHandle
([
1
,
1
],
[
0
,
0
])
self
.
addScaleHandle
([
0
,
0
],
[
1
,
1
])
self
.
sigRegionChangeFinished
.
connect
(
self
.
correct_scaling
)
def
correct_scaling
(
self
):
x
,
y
=
self
.
pos
()[
0
],
self
.
pos
()[
1
]
print
(
x
,
y
)
if
x
%
8
!=
0
or
y
%
8
!=
0
:
self
.
setPos
((
x
//
8
)
*
8
,
(
y
//
8
)
*
8
)
\ No newline at end of file
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