axes label hints added; no need for return press
This commit is contained in:
parent
c8afb2441f
commit
bffd216d4f
@ -1,8 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Form implementation generated from reading ui file 'src/resources/_ui/graph.ui'
|
# Form implementation generated from reading ui file 'resources/_ui/graph.ui'
|
||||||
#
|
#
|
||||||
# Created by: PyQt5 UI code generator 5.15.9
|
# Created by: PyQt5 UI code generator 5.15.10
|
||||||
#
|
#
|
||||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||||
# run again. Do not edit this file unless you know what you are doing.
|
# run again. Do not edit this file unless you know what you are doing.
|
||||||
@ -271,8 +271,11 @@ class Ui_GraphWindow(object):
|
|||||||
self.label_4.setText(_translate("GraphWindow", "---"))
|
self.label_4.setText(_translate("GraphWindow", "---"))
|
||||||
self.apply_button.setText(_translate("GraphWindow", "Apply"))
|
self.apply_button.setText(_translate("GraphWindow", "Apply"))
|
||||||
self.label_5.setText(_translate("GraphWindow", "Title"))
|
self.label_5.setText(_translate("GraphWindow", "Title"))
|
||||||
|
self.title_lineedit.setToolTip(_translate("GraphWindow", "<html><head/><body><p>Uses simple latex syntax, does not support italic/math environment. Sub-/superscripts need curly brackets.<br/></p><p>Example: \\alpha^{123}</p></body></html>"))
|
||||||
self.label_6.setText(_translate("GraphWindow", "X Axis"))
|
self.label_6.setText(_translate("GraphWindow", "X Axis"))
|
||||||
|
self.xaxis_linedit.setToolTip(_translate("GraphWindow", "<html><head/><body><p>Uses simple latex syntax, does not support italic/math environment. Sub-/superscripts need curly brackets.<br/></p><p>Example: \\alpha^{123}</p></body></html>"))
|
||||||
self.label_7.setText(_translate("GraphWindow", "Y Axis"))
|
self.label_7.setText(_translate("GraphWindow", "Y Axis"))
|
||||||
|
self.yaxis_linedit.setToolTip(_translate("GraphWindow", "<html><head/><body><p>Uses simple latex syntax, does not support italic/math environment. Sub-/superscripts need curly brackets.<br/></p><p>Example: \\alpha^{123}</p></body></html>"))
|
||||||
self.checkBox.setText(_translate("GraphWindow", "Show legend"))
|
self.checkBox.setText(_translate("GraphWindow", "Show legend"))
|
||||||
from ..lib.graph_items import NMRPlotWidget
|
from ..lib.graph_items import NMRPlotWidget
|
||||||
from ..lib.listwidget import QListWidgetSelect
|
from ..lib.listwidget import QListWidgetSelect
|
||||||
|
@ -73,7 +73,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
|||||||
self.scene = self.plotItem.scene()
|
self.scene = self.plotItem.scene()
|
||||||
self.scene.sigMouseMoved.connect(self.move_mouse)
|
self.scene.sigMouseMoved.connect(self.move_mouse)
|
||||||
|
|
||||||
self.checkBox.stateChanged.connect(lambda x: self.legend.setVisible(x == QtCore.Qt.Checked))
|
self.checkBox.stateChanged.connect(lambda x: self.legend.setVisible(x == QtCore.Qt.CheckState.Checked))
|
||||||
self.label_button.toggled.connect(lambda x: self.label_widget.setVisible(x))
|
self.label_button.toggled.connect(lambda x: self.label_widget.setVisible(x))
|
||||||
self.limit_button.toggled.connect(lambda x: self.limit_widget.setVisible(x))
|
self.limit_button.toggled.connect(lambda x: self.limit_widget.setVisible(x))
|
||||||
self.gridbutton.toggled.connect(lambda x: self.graphic.showGrid(x=x, y=x))
|
self.gridbutton.toggled.connect(lambda x: self.graphic.showGrid(x=x, y=x))
|
||||||
@ -237,9 +237,13 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
|||||||
self.error_plots[n] = err_plot
|
self.error_plots[n] = err_plot
|
||||||
|
|
||||||
list_item = QtWidgets.QListWidgetItem(real_plot.opts.get('name', ''))
|
list_item = QtWidgets.QListWidgetItem(real_plot.opts.get('name', ''))
|
||||||
list_item.setData(QtCore.Qt.UserRole, n)
|
list_item.setData(QtCore.Qt.ItemDataRole.UserRole, n)
|
||||||
list_item.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsUserCheckable)
|
list_item.setFlags(
|
||||||
list_item.setCheckState(QtCore.Qt.Checked)
|
QtCore.Qt.ItemFlag.ItemIsEnabled |
|
||||||
|
QtCore.Qt.ItemFlag.ItemIsSelectable |
|
||||||
|
QtCore.Qt.ItemFlag.ItemIsUserCheckable
|
||||||
|
)
|
||||||
|
list_item.setCheckState(QtCore.Qt.CheckState.Checked)
|
||||||
self.listWidget.addItem(list_item)
|
self.listWidget.addItem(list_item)
|
||||||
|
|
||||||
toplevel += 1
|
toplevel += 1
|
||||||
@ -271,7 +275,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
|||||||
|
|
||||||
for i in range(self.listWidget.count()-1, 0, -1):
|
for i in range(self.listWidget.count()-1, 0, -1):
|
||||||
item = self.listWidget.item(i)
|
item = self.listWidget.item(i)
|
||||||
if item.data(QtCore.Qt.UserRole) in name:
|
if item.data(QtCore.Qt.ItemDataRole.UserRole) in name:
|
||||||
self.listWidget.takeItem(i)
|
self.listWidget.takeItem(i)
|
||||||
|
|
||||||
self.listWidget.blockSignals(False)
|
self.listWidget.blockSignals(False)
|
||||||
@ -465,24 +469,37 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
|||||||
_y = pos.y()
|
_y = pos.y()
|
||||||
self.mousePositionChanged.emit(_x, _y)
|
self.mousePositionChanged.emit(_x, _y)
|
||||||
|
|
||||||
@QtCore.pyqtSlot(name='on_title_lineedit_returnPressed')
|
@QtCore.pyqtSlot(str, name='on_title_lineedit_textChanged')
|
||||||
@QtCore.pyqtSlot(name='on_xaxis_linedit_returnPressed')
|
@QtCore.pyqtSlot(str, name='on_xaxis_linedit_textChanged')
|
||||||
@QtCore.pyqtSlot(name='on_yaxis_linedit_returnPressed')
|
@QtCore.pyqtSlot(str, name='on_yaxis_linedit_textChanged')
|
||||||
def labels_changed(self):
|
def labels_changed(self, text: str):
|
||||||
label = {self.title_lineedit: 'title', self.xaxis_linedit: 'x', self.yaxis_linedit: 'y'}[self.sender()]
|
label = {
|
||||||
self.set_label(**{label: self.sender().text()})
|
self.title_lineedit: 'title',
|
||||||
|
self.xaxis_linedit: 'x',
|
||||||
|
self.yaxis_linedit: 'y',
|
||||||
|
}[self.sender()]
|
||||||
|
self.set_label(**{label: text})
|
||||||
|
|
||||||
def set_label(self, x=None, y=None, title=None):
|
def set_label(self, x: str = None, y: str = None, title: str = None):
|
||||||
if title is not None:
|
if title is not None:
|
||||||
self.plotItem.setTitle(convert(title, old='tex', new='html'), **{'size': '10pt', 'color': self._fgcolor})
|
self.plotItem.setTitle(
|
||||||
|
convert(title, old='tex', new='html'),
|
||||||
|
**{'size': '10pt', 'color': self._fgcolor},
|
||||||
|
)
|
||||||
|
|
||||||
if x is not None:
|
if x is not None:
|
||||||
self.plotItem.setLabel('bottom', convert(x, old='tex', new='html'),
|
self.plotItem.setLabel(
|
||||||
**{'font-size': '10pt', 'color': self._fgcolor.name()})
|
'bottom',
|
||||||
|
convert(x, old='tex', new='html'),
|
||||||
|
**{'font-size': '10pt', 'color': self._fgcolor.name()},
|
||||||
|
)
|
||||||
|
|
||||||
if y is not None:
|
if y is not None:
|
||||||
self.plotItem.setLabel('left', convert(y, old='tex', new='html'),
|
self.plotItem.setLabel(
|
||||||
**{'font-size': '10pt', 'color': self._fgcolor.name()})
|
'left',
|
||||||
|
convert(y, old='tex', new='html'),
|
||||||
|
**{'font-size': '10pt', 'color': self._fgcolor.name()},
|
||||||
|
)
|
||||||
|
|
||||||
def set_logmode(self, xmode: bool = None, ymode: bool = None):
|
def set_logmode(self, xmode: bool = None, ymode: bool = None):
|
||||||
r = self.ranges
|
r = self.ranges
|
||||||
@ -588,7 +605,7 @@ class QGraphWindow(QtWidgets.QGraphicsView, Ui_GraphWindow):
|
|||||||
|
|
||||||
for i in range(self.listWidget.count()):
|
for i in range(self.listWidget.count()):
|
||||||
item = self.listWidget.item(i)
|
item = self.listWidget.item(i)
|
||||||
if item.data(QtCore.Qt.UserRole) == sid:
|
if item.data(QtCore.Qt.ItemDataRole.UserRole) == sid:
|
||||||
item.setText(convert(name, old='tex', new='html'))
|
item.setText(convert(name, old='tex', new='html'))
|
||||||
|
|
||||||
self.listWidget.blockSignals(False)
|
self.listWidget.blockSignals(False)
|
||||||
|
@ -449,7 +449,11 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="title_lineedit"/>
|
<widget class="QLineEdit" name="title_lineedit">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Uses simple latex syntax, does not support italic/math environment. Sub-/superscripts need curly brackets.<br/></p><p>Example: \alpha^{123}</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="horizontalSpacer_3">
|
||||||
@ -475,7 +479,11 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="xaxis_linedit"/>
|
<widget class="QLineEdit" name="xaxis_linedit">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Uses simple latex syntax, does not support italic/math environment. Sub-/superscripts need curly brackets.<br/></p><p>Example: \alpha^{123}</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_4">
|
<spacer name="horizontalSpacer_4">
|
||||||
@ -501,7 +509,11 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="yaxis_linedit"/>
|
<widget class="QLineEdit" name="yaxis_linedit">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Uses simple latex syntax, does not support italic/math environment. Sub-/superscripts need curly brackets.<br/></p><p>Example: \alpha^{123}</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user