move fitregion to toolbar

This commit is contained in:
Dominik Demuth 2024-01-04 13:30:59 +01:00
parent 9068ec2b83
commit fa7ed8810f
2 changed files with 7 additions and 10 deletions

View File

@ -1,5 +1,6 @@
from ..Qt import QtWidgets, QtGui, QtCore
from ..lib.iconloading import get_icon
from ..lib.pg_objects import RegionItem
class FitToolbar(QtWidgets.QToolBar):
@ -7,13 +8,12 @@ class FitToolbar(QtWidgets.QToolBar):
self,
fitaction: QtWidgets.QAction,
limit_menu: QtWidgets.QMenu,
region,
parent=None,
):
super().__init__(parent=parent)
self.fit_action = fitaction
self.region = region
self.region = RegionItem()
self.addAction(fitaction)
self.fitlim_button = QtWidgets.QToolButton(self)

View File

@ -2,7 +2,6 @@ from __future__ import annotations
import os
import re
import time
from pathlib import Path
from numpy import geomspace, linspace
@ -24,7 +23,6 @@ from ..graphs.movedialog import QMover
from ..io.fcbatchreader import QFCReader
from ..io.filedialog import *
from ..lib.iconloading import make_action_icons, get_icon
from ..lib.pg_objects import RegionItem
from ..lib.starter import make_starter
from ..math.binning import BinningWindow
from ..math.evaluation import QEvalDialog
@ -115,10 +113,9 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
# noinspection PyUnresolvedReferences
self.statusBar.addWidget(self.mousepos)
self.fitregion = RegionItem()
self._fit_plot_id = None
self.fit_toolbar = FitToolbar(self.action_FitWidget, self.menuLimits, self.fitregion, self)
self.fit_toolbar = FitToolbar(self.action_FitWidget, self.menuLimits, self)
self.addToolBar(self.fit_toolbar)
self.setGeometry(QtWidgets.QStyle.alignedRect(
@ -892,13 +889,13 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
for item in self.fit_dialog.preview_lines:
self.current_graph_widget.add_external(item)
if self.action_custom_range.isChecked():
self.current_graph_widget.add_external(self.fitregion)
self.current_graph_widget.add_external(self.fit_toolbar.region)
block_window = True
else:
for item in self.fit_dialog.preview_lines:
self.current_graph_widget.remove_external(item)
self.current_graph_widget.remove_external(self.fitregion)
self.current_graph_widget.remove_external(self.fit_toolbar.region)
return block_window
@ -908,9 +905,9 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
return
if action == self.action_custom_range and self.fit_dialog.isVisible():
self.current_graph_widget.add_external(self.fitregion)
self.current_graph_widget.add_external(self.fit_toolbar.region)
else:
self.current_graph_widget.remove_external(self.fitregion)
self.current_graph_widget.remove_external(self.fit_toolbar.region)
def start_fit(self, parameter, links, fit_options):
fit_options['limits'] = self.fit_toolbar.get_limit()