Changeset 0849aec in sasview for src/sas/qtgui/Plotting
- Timestamp:
- Oct 30, 2017 7:50:09 AM (7 years ago)
- Branches:
- ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 304d082
- Parents:
- 99ea1b0
- Location:
- src/sas/qtgui/Plotting
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Plotting/AddText.py
r83eb5208 r0849aec 1 from PyQt4 import QtGui 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 2 4 3 5 import sas.sasview … … 5 7 from sas.qtgui.Plotting.UI.AddTextUI import Ui_AddText 6 8 7 class AddText(Qt Gui.QDialog, Ui_AddText):9 class AddText(QtWidgets.QDialog, Ui_AddText): 8 10 """ Simple GUI for a single line text query """ 9 11 def __init__(self, parent=None): -
src/sas/qtgui/Plotting/BoxSum.py
rcd2cc745 r0849aec 2 2 Allows users to modify the box slicer parameters. 3 3 """ 4 from PyQt4 import QtGui 5 from PyQt4 import QtCore 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 6 7 7 8 # Local UI … … 9 10 from sas.qtgui.Plotting.UI.BoxSumUI import Ui_BoxSumUI 10 11 11 class BoxSum(Qt Gui.QDialog, Ui_BoxSumUI):12 class BoxSum(QtWidgets.QDialog, Ui_BoxSumUI): 12 13 apply_signal = QtCore.pyqtSignal(tuple, str) 13 14 def __init__(self, parent=None, model=None): -
src/sas/qtgui/Plotting/ColorMap.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 2 2 Allows users to change the range of the current graph 3 3 """ 4 from PyQt4 import QtGui 5 from PyQt4 import QtCore 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 6 7 import sas.qtgui.path_prepare 7 8 … … 10 11 import numpy 11 12 12 from matplotlib.backends.backend_qt 4agg import FigureCanvasQTAgg as FigureCanvas13 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 13 14 from sas.qtgui.Plotting.PlotterData import Data2D 14 15 from sas.qtgui.Utilities.GuiUtils import formatNumber … … 21 22 from sas.qtgui.Plotting.UI.ColorMapUI import Ui_ColorMapUI 22 23 23 class ColorMap(Qt Gui.QDialog, Ui_ColorMapUI):24 class ColorMap(QtWidgets.QDialog, Ui_ColorMapUI): 24 25 apply_signal = QtCore.pyqtSignal(tuple, str) 25 26 def __init__(self, parent=None, cmap=None, vmin=0.0, vmax=100.0, data=None): … … 71 72 72 73 # Handle the Reset button click 73 self.buttonBox.button(Qt Gui.QDialogButtonBox.Reset).clicked.connect(self.onReset)74 self.buttonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self.onReset) 74 75 75 76 # Handle the Apply button click 76 self.buttonBox.button(Qt Gui.QDialogButtonBox.Apply).clicked.connect(self.onApply)77 self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self.onApply) 77 78 78 79 # Handle the amplitude setup … … 161 162 self.slider.setOrientation(QtCore.Qt.Horizontal) 162 163 163 self.slider_label = Qt Gui.QLabel()164 self.slider_label = QtWidgets.QLabel() 164 165 self.slider_label.setText("Drag the sliders to adjust color range.") 165 166 … … 192 193 self.canvas = FigureCanvas(self.fig) 193 194 194 layout = Qt Gui.QVBoxLayout()195 layout = QtWidgets.QVBoxLayout() 195 196 layout.addWidget(self.slider_label) 196 197 layout.addWidget(self.slider) -
src/sas/qtgui/Plotting/LinearFit.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 4 4 import re 5 5 import numpy 6 from PyQt4 import QtGui 7 from PyQt4 import QtCore 6 from PyQt5 import QtCore 7 from PyQt5 import QtGui 8 from PyQt5 import QtWidgets 8 9 9 10 from sas.qtgui.Utilities.GuiUtils import formatNumber … … 17 18 from sas.qtgui.Plotting.UI.LinearFitUI import Ui_LinearFitUI 18 19 19 class LinearFit(Qt Gui.QDialog, Ui_LinearFitUI):20 class LinearFit(QtWidgets.QDialog, Ui_LinearFitUI): 20 21 def __init__(self, parent=None, 21 22 data=None, -
src/sas/qtgui/Plotting/MaskEditor.py
rdc5ef15 r0849aec 1 from PyQt4 import QtGui 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 2 4 3 5 from sas.qtgui.Plotting.PlotterData import Data2D … … 8 10 from sas.qtgui.Plotting.Plotter2D import Plotter2DWidget 9 11 10 class MaskEditor(Qt Gui.QDialog, Ui_MaskEditorUI):12 class MaskEditor(QtWidgets.QDialog, Ui_MaskEditorUI): 11 13 def __init__(self, parent=None, data=None): 12 14 super(MaskEditor, self).__init__() … … 23 25 self.plotter.data = self.data 24 26 25 layout = Qt Gui.QHBoxLayout()27 layout = QtWidgets.QHBoxLayout() 26 28 layout.setContentsMargins(0, 0, 0, 0) 27 29 self.frame.setLayout(layout) -
src/sas/qtgui/Plotting/PlotProperties.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 1 from PyQt4 import QtGui 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 2 4 3 5 from sas.qtgui.Plotting.PlotUtilities import COLORS, SHAPES … … 6 8 from sas.qtgui.Plotting.UI.PlotPropertiesUI import Ui_PlotPropertiesUI 7 9 8 class PlotProperties(Qt Gui.QDialog, Ui_PlotPropertiesUI):10 class PlotProperties(QtWidgets.QDialog, Ui_PlotPropertiesUI): 9 11 """ Dialog for modification of single plot properties """ 10 12 def __init__(self, -
src/sas/qtgui/Plotting/Plotter.py
r895e7359 r0849aec 1 from PyQt4 import QtGui 2 from PyQt4 import QtCore 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 4 3 5 import functools 4 6 import copy … … 19 21 1D Plot widget for use with a QDialog 20 22 """ 23 updatePlot = QtCore.pyqtSignal(tuple) 21 24 def __init__(self, parent=None, manager=None, quickplot=False): 22 25 super(PlotterWidget, self).__init__(parent, manager=manager, quickplot=quickplot) … … 41 44 # Add a slot for receiving update signal from LinearFit 42 45 # NEW style signals 43 #self.updatePlot = QtCore.pyqtSignal(tuple) 44 # self.updatePlot.connect(self.onFitDisplay) 46 self.updatePlot.connect(self.onFitDisplay) 45 47 # OLD style signals 46 QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay)48 # QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay) 47 49 48 50 @property … … 269 271 Show a dialog allowing axes rescaling 270 272 """ 271 if self.properties.exec_() == Qt Gui.QDialog.Accepted:273 if self.properties.exec_() == QtWidgets.QDialog.Accepted: 272 274 self.xLogLabel, self.yLogLabel = self.properties.getValues() 273 275 self.xyTransform(self.xLogLabel, self.yLogLabel) … … 277 279 Show a dialog allowing adding custom text to the chart 278 280 """ 279 if self.addText.exec_() == Qt Gui.QDialog.Accepted:281 if self.addText.exec_() == QtWidgets.QDialog.Accepted: 280 282 # Retrieve the new text, its font and color 281 283 extra_text = self.addText.text() … … 329 331 """ 330 332 # min and max of data 331 if self.setRange.exec_() == Qt Gui.QDialog.Accepted:333 if self.setRange.exec_() == QtWidgets.QDialog.Accepted: 332 334 x_range = self.setRange.xrange() 333 335 y_range = self.setRange.yrange() … … 363 365 xlabel=self.xLogLabel, 364 366 ylabel=self.yLogLabel) 365 if fit_dialog.exec_() == Qt Gui.QDialog.Accepted:367 if fit_dialog.exec_() == QtWidgets.QDialog.Accepted: 366 368 return 367 369 … … 440 442 marker_size=marker_size, 441 443 legend=legend) 442 if plotPropertiesWidget.exec_() == Qt Gui.QDialog.Accepted:444 if plotPropertiesWidget.exec_() == QtWidgets.QDialog.Accepted: 443 445 # Update Data1d 444 446 selected_plot.markersize = plotPropertiesWidget.markersize() … … 697 699 698 700 699 class Plotter(Qt Gui.QDialog, PlotterWidget):701 class Plotter(QtWidgets.QDialog, PlotterWidget): 700 702 def __init__(self, parent=None, quickplot=False): 701 703 702 Qt Gui.QDialog.__init__(self)704 QtWidgets.QDialog.__init__(self) 703 705 PlotterWidget.__init__(self, parent=self, manager=parent, quickplot=quickplot) 704 706 icon = QtGui.QIcon() -
src/sas/qtgui/Plotting/Plotter2D.py
r895e7359 r0849aec 4 4 import functools 5 5 6 from PyQt4 import QtGui 7 from PyQt4 import QtCore 6 from PyQt5 import QtCore 7 from PyQt5 import QtGui 8 from PyQt5 import QtWidgets 8 9 9 10 DEFAULT_CMAP = pylab.cm.jet 11 12 #import sys 13 #print("SYS.PATH = ", sys.path) 14 import matplotlib as mpl 15 mpl.use("Qt5Agg") 16 10 17 from mpl_toolkits.mplot3d import Axes3D 11 18 … … 365 372 color_map_dialog.apply_signal.connect(self.onApplyMap) 366 373 367 if color_map_dialog.exec_() == Qt Gui.QDialog.Accepted:374 if color_map_dialog.exec_() == QtWidgets.QDialog.Accepted: 368 375 self.onApplyMap(color_map_dialog.norm(), color_map_dialog.cmap()) 369 376 … … 503 510 504 511 505 class Plotter2D(Qt Gui.QDialog, Plotter2DWidget):512 class Plotter2D(QtWidgets.QDialog, Plotter2DWidget): 506 513 """ 507 514 Plotter widget implementation 508 515 """ 509 516 def __init__(self, parent=None, quickplot=False, dimension=2): 510 Qt Gui.QDialog.__init__(self)517 QtWidgets.QDialog.__init__(self) 511 518 Plotter2DWidget.__init__(self, manager=parent, quickplot=quickplot, dimension=dimension) 512 519 icon = QtGui.QIcon() -
src/sas/qtgui/Plotting/PlotterBase.py
r7d8bebf r0849aec 2 2 import numpy 3 3 4 from PyQt4 import QtGui 5 from PyQt4 import QtCore 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 6 7 7 8 # TODO: Replace the qt4agg calls below with qt5 equivalent. … … 9 10 # https://www.boxcontrol.net/embedding-matplotlib-plot-on-pyqt5-gui.html 10 11 # 11 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 12 from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar 12 # matplotlib.use("Qt5Agg") 13 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 14 from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar 13 15 14 16 import matplotlib.pyplot as plt … … 25 27 import sas.qtgui.Plotting.PlotUtilities as PlotUtilities 26 28 27 class PlotterBase(Qt Gui.QWidget):29 class PlotterBase(QtWidgets.QWidget): 28 30 def __init__(self, parent=None, manager=None, quickplot=False): 29 31 super(PlotterBase, self).__init__(parent) … … 43 45 44 46 # Simple window for data display 45 self.txt_widget = Qt Gui.QTextEdit(None)47 self.txt_widget = QtWidgets.QTextEdit(None) 46 48 47 49 # Set the layout and place the canvas widget in it. 48 layout = QtGui.QVBoxLayout() 49 layout.setMargin(0) 50 layout = QtWidgets.QVBoxLayout() 51 # FIXME setMargin -> setContentsMargins in qt5 with 4 args 52 #layout.setContentsMargins(0) 50 53 layout.addWidget(self.canvas) 51 54 … … 105 108 self.canvas.mpl_connect('scroll_event', self.onMplWheel) 106 109 107 self.contextMenu = Qt Gui.QMenu(self)110 self.contextMenu = QtWidgets.QMenu(self) 108 111 109 112 if not quickplot: … … 296 299 dialog.setModal(True) 297 300 dialog.setWindowTitle("Print") 298 if dialog.exec_() != Qt Gui.QDialog.Accepted:301 if dialog.exec_() != QtWidgets.QDialog.Accepted: 299 302 return 300 303 … … 303 306 pmap = QtGui.QPixmap.grabWidget(self) 304 307 # Create a label with pixmap drawn 305 printLabel = Qt Gui.QLabel()308 printLabel = QtWidgets.QLabel() 306 309 printLabel.setPixmap(pmap) 307 310 … … 333 336 titleWidget = WindowTitle(self, new_title=current_title) 334 337 result = titleWidget.exec_() 335 if result != Qt Gui.QDialog.Accepted:338 if result != QtWidgets.QDialog.Accepted: 336 339 return 337 340 -
src/sas/qtgui/Plotting/ScaleProperties.py
rcd2cc745 r0849aec 1 from PyQt4 import QtGui 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 2 4 3 5 import sas.sasview … … 20 22 view_values[5]: [0, 4], # Kratky 21 23 } 22 class ScaleProperties(Qt Gui.QDialog, Ui_scalePropertiesUI):24 class ScaleProperties(QtWidgets.QDialog, Ui_scalePropertiesUI): 23 25 def __init__(self, parent=None, init_scale_x='x', init_scale_y='y'): 24 26 super(ScaleProperties, self).__init__(parent) -
src/sas/qtgui/Plotting/SetGraphRange.py
rcd2cc745 r0849aec 2 2 Allows users to change the range of the current graph 3 3 """ 4 from PyQt4 import QtGui 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 5 7 6 8 # Local UI … … 8 10 from sas.qtgui.Plotting.UI.SetGraphRangeUI import Ui_setGraphRangeUI 9 11 10 class SetGraphRange(Qt Gui.QDialog, Ui_setGraphRangeUI):12 class SetGraphRange(QtWidgets.QDialog, Ui_setGraphRangeUI): 11 13 def __init__(self, parent=None, x_range=(0.0, 0.0), y_range=(0.0, 0.0)): 12 14 super(SetGraphRange, self).__init__() -
src/sas/qtgui/Plotting/SlicerModel.py
r895e7359 r0849aec 1 from PyQt4 import QtGui 2 from PyQt4 import QtCore 1 from PyQt5 import QtGui 3 2 4 3 import sas.qtgui.Utilities.GuiUtils as GuiUtils -
src/sas/qtgui/Plotting/SlicerParameters.py
rcd2cc745 r0849aec 4 4 import numpy 5 5 import functools 6 from PyQt4 import QtGui 7 from PyQt4 import QtCore 8 from PyQt4 import QtWebKit 6 from PyQt5 import QtCore 7 from PyQt5 import QtGui 8 from PyQt5 import QtWidgets 9 from PyQt5 import QtWebKitWidgets 9 10 10 11 # Local UI … … 12 13 from sas.qtgui.Plotting.UI.SlicerParametersUI import Ui_SlicerParametersUI 13 14 14 class SlicerParameters(Qt Gui.QDialog, Ui_SlicerParametersUI):15 class SlicerParameters(QtWidgets.QDialog, Ui_SlicerParametersUI): 15 16 """ 16 17 Interaction between the QTableView and the underlying model, … … 44 45 45 46 # Display Help on clicking the button 46 self.buttonBox.button(Qt Gui.QDialogButtonBox.Help).clicked.connect(self.onHelp)47 self.buttonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self.onHelp) 47 48 48 49 # Close doesn't trigger closeEvent automatically, so force it 49 self.buttonBox.button(Qt Gui.QDialogButtonBox.Close).clicked.connect(functools.partial(self.closeEvent, None))50 self.buttonBox.button(QtWidgets.QDialogButtonBox.Close).clicked.connect(functools.partial(self.closeEvent, None)) 50 51 51 52 # Disable row number display 52 53 self.lstParams.verticalHeader().setVisible(False) 53 54 self.lstParams.setAlternatingRowColors(True) 54 self.lstParams.setSizePolicy(Qt Gui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding)55 self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 55 56 56 57 # Header properties for nicer display 57 58 header = self.lstParams.horizontalHeader() 58 header.set ResizeMode(QtGui.QHeaderView.Stretch)59 header.setSectionResizeMode(QtWidgets.QHeaderView.Stretch) 59 60 header.setStretchLastSection(True) 60 61 … … 86 87 location = "docs/sphinx-docs/build/html" + \ 87 88 "/user/sasgui/guiframe/graph_help.html#d-data-averaging" 88 self.helpView = QtWebKit .QWebView()89 self.helpView = QtWebKitWidgets.QWebView() 89 90 self.helpView.load(QtCore.QUrl(location)) 90 91 self.helpView.show() 91 92 92 93 93 class ProxyModel(Qt Gui.QIdentityProxyModel):94 class ProxyModel(QtCore.QIdentityProxyModel): 94 95 """ 95 96 Trivial proxy model with custom column edit flag … … 117 118 return flags 118 119 119 class PositiveDoubleEditor(Qt Gui.QLineEdit):120 class PositiveDoubleEditor(QtWidgets.QLineEdit): 120 121 # a signal to tell the delegate when we have finished editing 121 122 editingFinished = QtCore.Signal() … … 136 137 137 138 138 class EditDelegate(Qt Gui.QStyledItemDelegate):139 class EditDelegate(QtWidgets.QStyledItemDelegate): 139 140 refocus_signal = QtCore.pyqtSignal(int, int) 140 141 def __init__(self, parent=None, validate_method=None): … … 155 156 return self.editor 156 157 else: 157 return Qt Gui.QStyledItemDelegate.createEditor(self, parent, option, index)158 return QtWidgets.QStyledItemDelegate.createEditor(self, parent, option, index) 158 159 159 160 def setModelData(self, editor, model, index): -
src/sas/qtgui/Plotting/Slicers/AnnulusSlicer.py
r895e7359 r0849aec 1 1 import numpy 2 from PyQt4 import QtGui3 from PyQt4 import QtCore4 2 5 3 import sas.qtgui.Utilities.GuiUtils as GuiUtils -
src/sas/qtgui/Plotting/Slicers/BoxSlicer.py
r895e7359 r0849aec 1 1 import numpy 2 from PyQt4 import QtGui3 from PyQt4 import QtCore4 2 5 3 from .BaseInteractor import BaseInteractor -
src/sas/qtgui/Plotting/Slicers/BoxSum.py
r895e7359 r0849aec 4 4 """ 5 5 import numpy 6 from PyQt 4import QtGui7 from PyQt4 import QtCore 6 from PyQt5 import QtGui 7 8 8 from sas.qtgui.Utilities.GuiUtils import formatNumber 9 9 -
src/sas/qtgui/Plotting/Slicers/SectorSlicer.py
r895e7359 r0849aec 3 3 """ 4 4 import numpy 5 from PyQt4 import QtGui6 from PyQt4 import QtCore7 5 8 6 from .BaseInteractor import BaseInteractor -
src/sas/qtgui/Plotting/UnitTesting/SlicerParametersTest.py
r99ea1b0 r0849aec 37 37 '''Test the GUI in its default state''' 38 38 #self.widget.mapper 39 self.assertIsInstance(self.widget.proxy, Qt Gui.QIdentityProxyModel)39 self.assertIsInstance(self.widget.proxy, QtCore.QIdentityProxyModel) 40 40 self.assertIsInstance(self.widget.lstParams.itemDelegate(), QtGui.QStyledItemDelegate) 41 41 self.assertTrue(self.widget.lstParams.model().columnReadOnly(0)) -
src/sas/qtgui/Plotting/WindowTitle.py
r83eb5208 r0849aec 3 3 from "Graph_n" to any ASCII text. 4 4 """ 5 from PyQt 4 import QtGui5 from PyQt5 import QtWidgets 6 6 7 7 from sas.qtgui.Plotting.UI.WindowTitleUI import Ui_WindowTitle 8 8 9 class WindowTitle(Qt Gui.QDialog, Ui_WindowTitle):9 class WindowTitle(QtWidgets.QDialog, Ui_WindowTitle): 10 10 """ Simple GUI for a single line text query """ 11 11 def __init__(self, parent=None, new_title=""): -
src/sas/qtgui/Plotting/rangeSlider.py
- Property mode changed from 100755 to 100644
r83eb5208 r0849aec 23 23 """ 24 24 25 from PyQt4 import QtGui, QtCore 26 27 class RangeSlider(QtGui.QSlider): 25 from PyQt5 import QtCore 26 from PyQt5 import QtGui 27 from PyQt5 import QtWidgets 28 29 class RangeSlider(QtWidgets.QSlider): 28 30 """ A slider for ranges. 29 31 … … 46 48 self._high = self.maximum() 47 49 48 self.pressed_control = Qt Gui.QStyle.SC_None49 self.hover_control = Qt Gui.QStyle.SC_None50 self.pressed_control = QtWidgets.QStyle.SC_None 51 self.hover_control = QtWidgets.QStyle.SC_None 50 52 self.click_offset = 0 51 53 … … 90 92 91 93 for i, value in enumerate([self._low, self._high]): 92 opt = Qt Gui.QStyleOptionSlider()94 opt = QtWidgets.QStyleOptionSlider() 93 95 self.initStyleOption(opt) 94 96 … … 107 109 slider_max = gr.bottom() - handle_length + 1 108 110 109 opt.subControls = Qt Gui.QStyle.SC_SliderGroove | QtGui.QStyle.SC_SliderHandle111 opt.subControls = QtWidgets.QStyle.SC_SliderGroove | QtWidgets.QStyle.SC_SliderHandle 110 112 111 113 # draw the first slider with inverted appearance, then the second … … 131 133 # do not highlight the second part when has focus to avoid 132 134 # drawing of partially overlapped semi-transparent backgrounds 133 opt.state &= ~Qt Gui.QStyle.State_HasFocus135 opt.state &= ~QtWidgets.QStyle.State_HasFocus 134 136 135 137 opt.sliderValue = 0 … … 157 159 158 160 if self.tickPosition() != self.NoTicks: 159 opt.subControls |= Qt Gui.QStyle.SC_SliderTickmarks161 opt.subControls |= QtWidgets.QStyle.SC_SliderTickmarks 160 162 161 163 if self.pressed_control: 162 164 opt.activeSubControls = self.pressed_control 163 opt.state |= Qt Gui.QStyle.State_Sunken165 opt.state |= QtWidgets.QStyle.State_Sunken 164 166 else: 165 167 opt.activeSubControls = self.hover_control 166 168 167 style.drawComplexControl(Qt Gui.QStyle.CC_Slider, opt, painter, self)169 style.drawComplexControl(QtWidgets.QStyle.CC_Slider, opt, painter, self) 168 170 169 171 … … 181 183 182 184 if button: 183 opt = Qt Gui.QStyleOptionSlider()185 opt = QtWidgets.QStyleOptionSlider() 184 186 self.initStyleOption(opt) 185 187 … … 206 208 207 209 if self.active_slider == 0: 208 self.pressed_control = Qt Gui.QStyle.SC_SliderHandle210 self.pressed_control = QtWidgets.QStyle.SC_SliderHandle 209 211 self.click_offset = self.__pixelPosToRangeValue(self.__pick(event.pos())) 210 212 self.triggerAction(self.SliderMove) … … 215 217 216 218 def mouseReleaseEvent(self, event): 217 if self.pressed_control != Qt Gui.QStyle.SC_SliderHandle:219 if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 218 220 event.ignore() 219 221 return 220 222 221 223 self.setSliderDown(False) 222 return Qt Gui.QSlider.mouseReleaseEvent(self, event)224 return QtWidgets.QSlider.mouseReleaseEvent(self, event) 223 225 224 226 def mouseMoveEvent(self, event): 225 if self.pressed_control != Qt Gui.QStyle.SC_SliderHandle:227 if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 226 228 event.ignore() 227 229 return … … 229 231 event.accept() 230 232 new_pos = self.__pixelPosToRangeValue(self.__pick(event.pos())) 231 opt = Qt Gui.QStyleOptionSlider()233 opt = QtWidgets.QStyleOptionSlider() 232 234 self.initStyleOption(opt) 233 235 … … 274 276 275 277 def __pixelPosToRangeValue(self, pos): 276 opt = Qt Gui.QStyleOptionSlider()278 opt = QtWidgets.QStyleOptionSlider() 277 279 self.initStyleOption(opt) 278 280 style = QtGui.QApplication.style()
Note: See TracChangeset
for help on using the changeset viewer.