Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jan Zelenka
prasopes
Commits
f2cf4c35
Commit
f2cf4c35
authored
Jul 26, 2019
by
Yan
Browse files
Xtics density can be set in print and clipping
parent
9654c5ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
prasopes/config.py
View file @
f2cf4c35
...
...
@@ -14,9 +14,11 @@ def settings():
(
"print/xinch"
,
10
),
(
"print/yinch"
,
4
),
(
"print/dpi"
,
300
),
(
"print/xtics"
,
5
),
(
"imggen/xinch"
,
10
),
(
"imggen/yinch"
,
4
),
(
"imggen/dpi"
,
300
)}
(
"imggen/dpi"
,
300
),
(
"imggen/xtics"
,
5
)}
[
settings
.
setValue
(
i
[
0
],
i
[
1
])
for
i
in
defvals
if
settings
.
value
(
i
[
0
])
==
None
]
return
settings
...
...
@@ -84,6 +86,8 @@ def dial(parent):
"Figure height (inch)"
,
"print/yinch"
,
config
))
printlayout
.
addLayout
(
posintvarconf
(
"Figure dpi"
,
"print/dpi"
,
config
))
printlayout
.
addLayout
(
posintvarconf
(
"Figure x axis major ticks count"
,
"print/xtics"
,
config
))
tabs
.
addTab
(
printtab
,
"Printing"
)
imggentab
=
QtWidgets
.
QWidget
()
...
...
@@ -94,6 +98,8 @@ def dial(parent):
"Figure height (inch)"
,
"imggen/yinch"
,
config
))
imggenlayout
.
addLayout
(
posintvarconf
(
"Figure dpi"
,
"imggen/dpi"
,
config
))
imggenlayout
.
addLayout
(
posintvarconf
(
"Figure x axis major ticks count"
,
"imggen/xtics"
,
config
))
tabs
.
addTab
(
imggentab
,
"Image clip/export"
)
close_button
=
QtWidgets
.
QPushButton
(
"Close"
)
...
...
prasopes/imagetools.py
View file @
f2cf4c35
...
...
@@ -13,11 +13,11 @@ import prasopes.config as cf
def
paint_image
(
mass_spec
,
spect
,
painttarget
=
None
):
"""generates QImage from mass spectrum"""
if
isinstance
(
painttarget
,
type
(
QtPrintSupport
.
QPrinter
())):
xinch
,
yinch
,
dpi
=
[
cf
.
settings
().
value
(
"print/{}"
.
format
(
i
),
type
=
int
)
for
i
in
(
"xinch"
,
"yinch"
,
"dpi"
)]
xinch
,
yinch
,
dpi
,
xtics
=
[
cf
.
settings
().
value
(
"print/{}"
.
format
(
i
),
type
=
int
)
for
i
in
(
"xinch"
,
"yinch"
,
"dpi"
,
"xtics"
)]
else
:
xinch
,
yinch
,
dpi
=
[
cf
.
settings
().
value
(
"imggen/{}"
.
format
(
i
),
type
=
int
)
for
i
in
(
"xinch"
,
"yinch"
,
"dpi"
)]
xinch
,
yinch
,
dpi
,
xtics
=
[
cf
.
settings
().
value
(
"imggen/{}"
.
format
(
i
),
type
=
int
)
for
i
in
(
"xinch"
,
"yinch"
,
"dpi"
,
"xtics"
)]
paintfig
=
Figure
(
figsize
=
(
xinch
,
yinch
),
dpi
=
dpi
)
canvas
=
FigureCanvas
(
paintfig
)
printplot
=
paintfig
.
add_subplot
(
111
)
...
...
@@ -28,6 +28,7 @@ def paint_image(mass_spec, spect, painttarget=None):
mspect
=
mass_spec
.
copy
()
mspect
[
'y'
]
=
yline
gt
.
pop_plot
(
printplot
,
mspect
)
printplot
.
locator_params
(
nbins
=
xtics
,
axis
=
'x'
)
cache_file
=
BytesIO
()
paintfig
.
savefig
(
cache_file
)
cache_file
.
seek
(
0
)
...
...
Write
Preview
Supports
Markdown
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