Commit fbd6f81d authored by 3Yan's avatar 3Yan
Browse files

Advanced image clipping config settings pt 1/2

parent 036fd365
......@@ -20,6 +20,7 @@ def settings():
("imggen/yinch", 4),
("imggen/dpi", 300),
("imggen/xtics", 5),
("imggen/onlymanann", False),
("recents", "")}
for i in defvals if not settings.contains(i[0])]
......@@ -64,6 +65,14 @@ def posvarconf(label, value, config, num="int"):
return layout
def checkboxconf(label, value, config):
checkbox = QtWidgets.QCheckBox(label)
checkbox.stateChanged.connect(lambda: config.setValue(
value, checkbox.checkState()))
return checkbox
def dial(parent):
"""constructs a dialog window"""
dialog = QtWidgets.QDialog(
......@@ -104,6 +113,8 @@ def dial(parent):
"Figure dpi", "imggen/dpi", config))
"Figure x axis major ticks count", "imggen/xtics", config))
"Manual annotation only", "imggen/onlymanann", config))
tabs.addTab(imggentab, "Image clip/export")
close_button = QtWidgets.QPushButton("Close")
......@@ -401,7 +401,7 @@ def ann_spec(ms_spec, msdata, ann_limit=0.01):
def pop_plot(xdata, ydata, plot, plot_data, colornum=0, legend=None):
def pop_plot(xdata, ydata, plot, plot_data, colornum=0, legend=None, annotate=True):
"""Define and populate plot"""
plot.plot(xdata, ydata, linewidth=1, color=(
colors[colornum % len(colors)]/255), label=legend)
......@@ -417,8 +417,8 @@ def pop_plot(xdata, ydata, plot, plot_data, colornum=0, legend=None):
plot_data['texts'] = [plot.annotate(
a.get_text(), a.xy, picker=True, bbox=ann_bbox, in_layout=False)
for a in plot_data['texts']]
if "annotation" in plot_data:
ann_spec(plot, plot_data)
if "annotation" in plot_data and annotate == True:
ann_spec(plot, plot_data)
if "xtics" in plot_data:
plot.locator_params(nbins=plot_data["xtics"], axis='x')
......@@ -29,9 +29,13 @@ def paint_image(mass_spec, spect, fn=None, painttarget=None):
texts = copy.copy(mass_spec)
if len(mass_spec['headers']) != 0:
legend = spect.get_legend().get_texts()
[gt.pop_plot(*line, printplot, texts, i, legend[i].get_text())
[gt.pop_plot(*line, printplot, texts, i, legend[i].get_text(),
not (cf.settings().value(
configtype.format("onlymanann"), type=bool)))
for i, line in enumerate(data)]
legend = 1
if legend == True:
[gt.pop_plot(*line, printplot, texts, i)
for i, line in enumerate(data)]
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