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
fa82b41d
Commit
fa82b41d
authored
Oct 04, 2019
by
3Yan
Browse files
Spectrum clipping now shows part of the path
parent
6e88d312
Changes
2
Hide whitespace changes
Inline
Side-by-side
prasopes/__main__.py
View file @
fa82b41d
...
...
@@ -179,7 +179,7 @@ def key_pressed(event, chrom, spect, ds, ms_ds, fn, chrom_ds, config):
update_spectrum
(
chrom
,
spect
,
ds
,
ms_ds
,
fn
,
chrom_ds
,
config
)
if
event
.
key
()
==
QtCore
.
Qt
.
Key_C
:
if
event
.
modifiers
().
__int__
()
==
QtCore
.
Qt
.
ControlModifier
:
imgt
.
clip_spect_img
(
ms_ds
,
spect
)
imgt
.
clip_spect_img
(
ms_ds
,
spect
,
fn
)
if
event
.
modifiers
().
__int__
()
==
QtCore
.
Qt
.
ControlModifier
+
\
QtCore
.
Qt
.
ShiftModifier
:
dt
.
clip_spectstr
(
spect
,
chrom_ds
,
fn
)
...
...
prasopes/imagetools.py
View file @
fa82b41d
...
...
@@ -6,11 +6,12 @@ from PyQt5 import QtCore
from
PyQt5
import
QtGui
from
PyQt5
import
QtPrintSupport
from
PyQt5
import
QtWidgets
from
pathlib
import
Path
import
prasopes.graphtools
as
gt
import
prasopes.config
as
cf
def
paint_image
(
mass_spec
,
spect
,
painttarget
=
None
):
def
paint_image
(
mass_spec
,
spect
,
fn
=
None
,
painttarget
=
None
):
"""generates QImage from mass spectrum"""
if
isinstance
(
painttarget
,
type
(
QtPrintSupport
.
QPrinter
())):
xinch
,
yinch
,
dpi
,
xtics
=
[
cf
.
settings
().
value
(
"print/{}"
.
format
(
i
),
...
...
@@ -33,6 +34,9 @@ def paint_image(mass_spec, spect, painttarget=None):
[
gt
.
pop_plot
(
*
line
,
printplot
,
mass_spec
,
i
)
for
i
,
line
in
enumerate
(
data
)]
printplot
.
locator_params
(
nbins
=
xtics
,
axis
=
'x'
)
if
fn
not
in
(
None
,
[
None
]):
printplot
.
set_title
(
Path
(
*
Path
(
fn
[
0
]).
resolve
().
parts
[
-
2
:]),
loc
=
"right"
)
cache_file
=
BytesIO
()
paintfig
.
savefig
(
cache_file
)
cache_file
.
seek
(
0
)
...
...
@@ -40,7 +44,7 @@ def paint_image(mass_spec, spect, painttarget=None):
return
image
def
clip_spect_img
(
mass_spec
,
spect
):
image
=
paint_image
(
mass_spec
,
spect
)
def
clip_spect_img
(
mass_spec
,
spect
,
fn
):
image
=
paint_image
(
mass_spec
,
spect
,
fn
=
fn
)
QtWidgets
.
QApplication
.
clipboard
().
setImage
(
image
)
QtWidgets
.
QApplication
.
clipboard
().
setPixmap
(
QtGui
.
QPixmap
.
fromImage
(
image
))
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