Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2019 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
# This file is part of the mantid workbench.
from __future__ import (absolute_import, unicode_literals)
from qtpy.QtCore import Qt
from qtpy.QtWidgets import QWidget
from mantidqt.widgets.plotconfigdialog.colorselector import ColorSelector
from mantidqt.utils.qt import load_ui
class LineTabWidgetView(QWidget):
def __init__(self, parent=None):
super(LineTabWidgetView, self).__init__(parent=parent)
self.ui = load_ui(__file__,
'curves_tab_line_tab.ui',
baseinstance=self)
self.color_selector_widget = ColorSelector(parent=self)
self.grid_layout.replaceWidget(self.color_selector_dummy_widget,
self.color_selector_widget)
self.setAttribute(Qt.WA_DeleteOnClose, True)
def get_style(self):
return self.line_style_combo_box.currentText()
def set_style(self, line_style):
self.line_style_combo_box.setCurrentText(line_style)
def get_draw_style(self):
return self.draw_style_combo_box.currentText()
def set_draw_style(self, draw_style):
self.draw_style_combo_box.setCurrentText(draw_style)
def get_width(self):
return self.line_width_spin_box.value()
def set_width(self, width):
self.line_width_spin_box.setValue(width)
def get_color(self):
return self.color_selector_widget.get_color()
def set_color(self, color_hex):
self.color_selector_widget.set_color(color_hex)
def update_fields(self, curve_props):
self.set_style(curve_props.linestyle)
self.set_draw_style(curve_props.drawstyle)
self.set_width(curve_props.linewidth)
self.set_color(curve_props.color)
def set_plot_all_enabled(self, enable):
self.apply_to_all_button.setEnabled(enable)