Commit 59ba6394 authored by Yan's avatar Yan

Implemented PaintFig into reactivitytools

parent fdc3a84e
...@@ -19,14 +19,20 @@ def settings(): ...@@ -19,14 +19,20 @@ def settings():
("print/zcespec_xinch", 5), ("print/zcespec_xinch", 5),
("print/zcespec_yinch", 2), ("print/zcespec_yinch", 2),
("print/zcespec_dpi", 300), ("print/zcespec_dpi", 300),
("print/reactspecspec_xinch", 3.5),
("print/reactspecspec_yinch", 2),
("print/reactspecspec_dpi", 300),
("imggen/msspec_xinch", 10), ("imggen/msspec_xinch", 10),
("imggen/msspec_yinch", 4), ("imggen/msspec_yinch", 4),
("imggen/msspec_dpi", 300), ("imggen/msspec_dpi", 300),
("imggen/msspec_xtics", 5), ("imggen/msspec_xtics", 5),
("imggen/msspec_onlymanann", False),
("imggen/zcespec_xinch", 5), ("imggen/zcespec_xinch", 5),
("imggen/zcespec_yinch", 2), ("imggen/zcespec_yinch", 2),
("imggen/zcespec_dpi", 300), ("imggen/zcespec_dpi", 300),
("imggen/msspec_onlymanann", False), ("imggen/reactspecspec_xinch", 3.5),
("imggen/reactspecspec_yinch", 2),
("imggen/reactspecspec_dpi", 300),
("reactivity/index", 0), ("reactivity/index", 0),
("recents", "")} ("recents", "")}
[settings.setValue(*i) [settings.setValue(*i)
......
...@@ -13,6 +13,7 @@ import prasopes.graphtools as gt ...@@ -13,6 +13,7 @@ import prasopes.graphtools as gt
import prasopes.filetools as ft import prasopes.filetools as ft
import prasopes.config as cf import prasopes.config as cf
import prasopes.drltools as drl import prasopes.drltools as drl
import prasopes.imagetools as imgt
import os.path import os.path
import logging import logging
matplotlib.use("Qt5Agg") matplotlib.use("Qt5Agg")
...@@ -65,7 +66,10 @@ class reactivityParam(QtWidgets.QHBoxLayout): ...@@ -65,7 +66,10 @@ class reactivityParam(QtWidgets.QHBoxLayout):
def key_pressed(event, augCanvas, drls, grph, labels, parselect): def key_pressed(event, augCanvas, drls, grph, labels, parselect):
if event.key() == QtCore.Qt.Key_C: if event.key() == QtCore.Qt.Key_C:
if event.modifiers().__int__() == QtCore.Qt.ControlModifier: if event.modifiers().__int__() == QtCore.Qt.ControlModifier:
clip_spect_img(augCanvas, drls, grph, labels, parselect) imggen = imgt.ImagePainter("zcespec")
imggen.popfig = lambda: paint_override(
imggen, augCanvas, drls, grph, labels, parselect)
imggen.clip()
def export_dial(augCanvas, drls, grph, labels, parselect): def export_dial(augCanvas, drls, grph, labels, parselect):
...@@ -102,25 +106,10 @@ def update_parselect(augCanvas, parselect): ...@@ -102,25 +106,10 @@ def update_parselect(augCanvas, parselect):
parselect.setCurrentIndex(index) parselect.setCurrentIndex(index)
def paint_image(augCanvas, drls, grph, labels, parselect): def paint_override(self, augCanvas, drls, grph, labels, parselect):
paintfig = Figure(figsize=(3.5, 2), dpi=300, constrained_layout=True) pop_dial(augCanvas, drls, self.plot, labels, parselect)
FigureCanvas(paintfig) self.plot.set_xlim(grph.get_xlim())
printplot = paintfig.add_subplot(111) self.plot.set_ylim(grph.get_ylim())
pop_dial(augCanvas, drls, printplot, labels, parselect)
printplot.set_xlim(grph.get_xlim())
printplot.set_ylim(grph.get_ylim())
paintfig.canvas.draw()
cache_file = BytesIO()
paintfig.savefig(cache_file)
cache_file.seek(0)
image = QtGui.QImage.fromData(cache_file.read())
return image
def clip_spect_img(augCanvas, drls, grph, labels, parselect):
image = paint_image(augCanvas, drls, grph, labels, parselect)
QtWidgets.QApplication.clipboard().clear()
[QtWidgets.QApplication.clipboard().setImage(image, i) for i in range(2)]
def pop_dial(augCanvas, drls, graph, labels, parselect): def pop_dial(augCanvas, drls, graph, labels, parselect):
......
...@@ -6,11 +6,11 @@ from PyQt5 import QtGui ...@@ -6,11 +6,11 @@ from PyQt5 import QtGui
from PyQt5 import QtWidgets from PyQt5 import QtWidgets
from PyQt5 import QtPrintSupport from PyQt5 import QtPrintSupport
from prasopes.zcetools_help import helpstr from prasopes.zcetools_help import helpstr
from prasopes import imagetools as imgt
from io import BytesIO from io import BytesIO
import numpy as np import numpy as np
import prasopes.graphtools as gt import prasopes.graphtools as gt
import prasopes.filetools as ft import prasopes.filetools as ft
import prasopes.imagetools as imgt
import os.path import os.path
import logging import logging
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment