194-fitrange #219
@ -1,5 +1,6 @@
|
|||||||
from ..Qt import QtWidgets, QtGui, QtCore
|
from ..Qt import QtWidgets, QtGui, QtCore
|
||||||
from ..lib.iconloading import get_icon
|
from ..lib.iconloading import get_icon
|
||||||
|
from ..lib.pg_objects import RegionItem
|
||||||
|
|
||||||
|
|
||||||
class FitToolbar(QtWidgets.QToolBar):
|
class FitToolbar(QtWidgets.QToolBar):
|
||||||
@ -7,13 +8,12 @@ class FitToolbar(QtWidgets.QToolBar):
|
|||||||
self,
|
self,
|
||||||
fitaction: QtWidgets.QAction,
|
fitaction: QtWidgets.QAction,
|
||||||
limit_menu: QtWidgets.QMenu,
|
limit_menu: QtWidgets.QMenu,
|
||||||
region,
|
|
||||||
parent=None,
|
parent=None,
|
||||||
):
|
):
|
||||||
super().__init__(parent=parent)
|
super().__init__(parent=parent)
|
||||||
|
|
||||||
self.fit_action = fitaction
|
self.fit_action = fitaction
|
||||||
self.region = region
|
self.region = RegionItem()
|
||||||
self.addAction(fitaction)
|
self.addAction(fitaction)
|
||||||
|
|
||||||
self.fitlim_button = QtWidgets.QToolButton(self)
|
self.fitlim_button = QtWidgets.QToolButton(self)
|
||||||
|
@ -2,7 +2,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import time
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from numpy import geomspace, linspace
|
from numpy import geomspace, linspace
|
||||||
@ -24,7 +23,6 @@ from ..graphs.movedialog import QMover
|
|||||||
from ..io.fcbatchreader import QFCReader
|
from ..io.fcbatchreader import QFCReader
|
||||||
from ..io.filedialog import *
|
from ..io.filedialog import *
|
||||||
from ..lib.iconloading import make_action_icons, get_icon
|
from ..lib.iconloading import make_action_icons, get_icon
|
||||||
from ..lib.pg_objects import RegionItem
|
|
||||||
from ..lib.starter import make_starter
|
from ..lib.starter import make_starter
|
||||||
from ..math.binning import BinningWindow
|
from ..math.binning import BinningWindow
|
||||||
from ..math.evaluation import QEvalDialog
|
from ..math.evaluation import QEvalDialog
|
||||||
@ -115,10 +113,9 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
|
|||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
self.statusBar.addWidget(self.mousepos)
|
self.statusBar.addWidget(self.mousepos)
|
||||||
|
|
||||||
self.fitregion = RegionItem()
|
|
||||||
self._fit_plot_id = None
|
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.addToolBar(self.fit_toolbar)
|
||||||
|
|
||||||
self.setGeometry(QtWidgets.QStyle.alignedRect(
|
self.setGeometry(QtWidgets.QStyle.alignedRect(
|
||||||
@ -892,13 +889,13 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
|
|||||||
for item in self.fit_dialog.preview_lines:
|
for item in self.fit_dialog.preview_lines:
|
||||||
self.current_graph_widget.add_external(item)
|
self.current_graph_widget.add_external(item)
|
||||||
if self.action_custom_range.isChecked():
|
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
|
block_window = True
|
||||||
else:
|
else:
|
||||||
for item in self.fit_dialog.preview_lines:
|
for item in self.fit_dialog.preview_lines:
|
||||||
self.current_graph_widget.remove_external(item)
|
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
|
return block_window
|
||||||
|
|
||||||
@ -908,9 +905,9 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if action == self.action_custom_range and self.fit_dialog.isVisible():
|
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:
|
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):
|
def start_fit(self, parameter, links, fit_options):
|
||||||
fit_options['limits'] = self.fit_toolbar.get_limit()
|
fit_options['limits'] = self.fit_toolbar.get_limit()
|
||||||
|
Loading…
Reference in New Issue
Block a user