Changeset 4992ff2 in sasview for src/sas/qtgui/Plotting


Ignore:
Timestamp:
Nov 9, 2017 8:43:07 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
7969b9c
Parents:
7fb471d
git-author:
Piotr Rozyczko <rozyczko@…> (10/30/17 07:50:09)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 08:43:07)
Message:

Initial, in-progress version. Not really working atm. SASVIEW-787

Location:
src/sas/qtgui/Plotting
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Plotting/AddText.py

    r83eb5208 r4992ff2  
    1 from PyQt4 import QtGui 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    24 
    35import sas.sasview 
     
    57from sas.qtgui.Plotting.UI.AddTextUI import Ui_AddText 
    68 
    7 class AddText(QtGui.QDialog, Ui_AddText): 
     9class AddText(QtWidgets.QDialog, Ui_AddText): 
    810    """ Simple GUI for a single line text query """ 
    911    def __init__(self, parent=None): 
  • src/sas/qtgui/Plotting/BoxSum.py

    rcd2cc745 r4992ff2  
    22Allows users to modify the box slicer parameters. 
    33""" 
    4 from PyQt4 import QtGui 
    5 from PyQt4 import QtCore 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
    67 
    78# Local UI 
     
    910from sas.qtgui.Plotting.UI.BoxSumUI import Ui_BoxSumUI 
    1011 
    11 class BoxSum(QtGui.QDialog, Ui_BoxSumUI): 
     12class BoxSum(QtWidgets.QDialog, Ui_BoxSumUI): 
    1213    apply_signal = QtCore.pyqtSignal(tuple, str) 
    1314    def __init__(self, parent=None, model=None): 
  • src/sas/qtgui/Plotting/ColorMap.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    22Allows users to change the range of the current graph 
    33""" 
    4 from PyQt4 import QtGui 
    5 from PyQt4 import QtCore 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
    67import sas.qtgui.path_prepare 
    78 
     
    1011import numpy 
    1112 
    12 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 
     13from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 
    1314from sas.qtgui.Plotting.PlotterData import Data2D 
    1415from sas.qtgui.Utilities.GuiUtils import formatNumber 
     
    2122from sas.qtgui.Plotting.UI.ColorMapUI import Ui_ColorMapUI 
    2223 
    23 class ColorMap(QtGui.QDialog, Ui_ColorMapUI): 
     24class ColorMap(QtWidgets.QDialog, Ui_ColorMapUI): 
    2425    apply_signal = QtCore.pyqtSignal(tuple, str) 
    2526    def __init__(self, parent=None, cmap=None, vmin=0.0, vmax=100.0, data=None): 
     
    7172 
    7273        # Handle the Reset button click 
    73         self.buttonBox.button(QtGui.QDialogButtonBox.Reset).clicked.connect(self.onReset) 
     74        self.buttonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self.onReset) 
    7475 
    7576        # Handle the Apply button click 
    76         self.buttonBox.button(QtGui.QDialogButtonBox.Apply).clicked.connect(self.onApply) 
     77        self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self.onApply) 
    7778 
    7879        # Handle the amplitude setup 
     
    161162        self.slider.setOrientation(QtCore.Qt.Horizontal) 
    162163 
    163         self.slider_label = QtGui.QLabel() 
     164        self.slider_label = QtWidgets.QLabel() 
    164165        self.slider_label.setText("Drag the sliders to adjust color range.") 
    165166 
     
    192193        self.canvas = FigureCanvas(self.fig) 
    193194 
    194         layout = QtGui.QVBoxLayout() 
     195        layout = QtWidgets.QVBoxLayout() 
    195196        layout.addWidget(self.slider_label) 
    196197        layout.addWidget(self.slider) 
  • src/sas/qtgui/Plotting/LinearFit.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    44import re 
    55import numpy 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
     6from PyQt5 import QtCore 
     7from PyQt5 import QtGui 
     8from PyQt5 import QtWidgets 
    89 
    910from sas.qtgui.Utilities.GuiUtils import formatNumber 
     
    1718from sas.qtgui.Plotting.UI.LinearFitUI import Ui_LinearFitUI 
    1819 
    19 class LinearFit(QtGui.QDialog, Ui_LinearFitUI): 
     20class LinearFit(QtWidgets.QDialog, Ui_LinearFitUI): 
    2021    def __init__(self, parent=None, 
    2122                 data=None, 
  • src/sas/qtgui/Plotting/MaskEditor.py

    rdc5ef15 r4992ff2  
    1 from PyQt4 import QtGui 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    24 
    35from sas.qtgui.Plotting.PlotterData import Data2D 
     
    810from sas.qtgui.Plotting.Plotter2D import Plotter2DWidget 
    911 
    10 class MaskEditor(QtGui.QDialog, Ui_MaskEditorUI): 
     12class MaskEditor(QtWidgets.QDialog, Ui_MaskEditorUI): 
    1113    def __init__(self, parent=None, data=None): 
    1214        super(MaskEditor, self).__init__() 
     
    2325        self.plotter.data = self.data 
    2426 
    25         layout = QtGui.QHBoxLayout() 
     27        layout = QtWidgets.QHBoxLayout() 
    2628        layout.setContentsMargins(0, 0, 0, 0) 
    2729        self.frame.setLayout(layout) 
  • src/sas/qtgui/Plotting/PlotProperties.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    1 from PyQt4 import QtGui 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    24 
    35from sas.qtgui.Plotting.PlotUtilities import COLORS, SHAPES 
     
    68from sas.qtgui.Plotting.UI.PlotPropertiesUI import Ui_PlotPropertiesUI 
    79 
    8 class PlotProperties(QtGui.QDialog, Ui_PlotPropertiesUI): 
     10class PlotProperties(QtWidgets.QDialog, Ui_PlotPropertiesUI): 
    911    """ Dialog for modification of single plot properties """ 
    1012    def __init__(self, 
  • src/sas/qtgui/Plotting/Plotter.py

    rcee5c78 r4992ff2  
    1 from PyQt4 import QtGui 
    2 from PyQt4 import QtCore 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
     4 
    35import functools 
    46import copy 
     
    1921    1D Plot widget for use with a QDialog 
    2022    """ 
     23    updatePlot = QtCore.pyqtSignal(tuple) 
    2124    def __init__(self, parent=None, manager=None, quickplot=False): 
    2225        super(PlotterWidget, self).__init__(parent, manager=manager, quickplot=quickplot) 
     
    4144        # Add a slot for receiving update signal from LinearFit 
    4245        # NEW style signals 
    43         #self.updatePlot = QtCore.pyqtSignal(tuple) 
    44         # self.updatePlot.connect(self.onFitDisplay) 
     46        self.updatePlot.connect(self.onFitDisplay) 
    4547        # OLD style signals 
    46         QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay) 
     48        # QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay) 
    4749 
    4850    @property 
     
    272274        Show a dialog allowing axes rescaling 
    273275        """ 
    274         if self.properties.exec_() == QtGui.QDialog.Accepted: 
     276        if self.properties.exec_() == QtWidgets.QDialog.Accepted: 
    275277            self.xLogLabel, self.yLogLabel = self.properties.getValues() 
    276278            self.xyTransform(self.xLogLabel, self.yLogLabel) 
     
    280282        Show a dialog allowing adding custom text to the chart 
    281283        """ 
    282         if self.addText.exec_() == QtGui.QDialog.Accepted: 
     284        if self.addText.exec_() == QtWidgets.QDialog.Accepted: 
    283285            # Retrieve the new text, its font and color 
    284286            extra_text = self.addText.text() 
     
    332334        """ 
    333335        # min and max of data 
    334         if self.setRange.exec_() == QtGui.QDialog.Accepted: 
     336        if self.setRange.exec_() == QtWidgets.QDialog.Accepted: 
    335337            x_range = self.setRange.xrange() 
    336338            y_range = self.setRange.yrange() 
     
    366368                    xlabel=self.xLogLabel, 
    367369                    ylabel=self.yLogLabel) 
    368         if fit_dialog.exec_() == QtGui.QDialog.Accepted: 
     370        if fit_dialog.exec_() == QtWidgets.QDialog.Accepted: 
    369371            return 
    370372 
     
    443445                                marker_size=marker_size, 
    444446                                legend=legend) 
    445         if plotPropertiesWidget.exec_() == QtGui.QDialog.Accepted: 
     447        if plotPropertiesWidget.exec_() == QtWidgets.QDialog.Accepted: 
    446448            # Update Data1d 
    447449            selected_plot.markersize = plotPropertiesWidget.markersize() 
     
    700702 
    701703 
    702 class Plotter(QtGui.QDialog, PlotterWidget): 
     704class Plotter(QtWidgets.QDialog, PlotterWidget): 
    703705    def __init__(self, parent=None, quickplot=False): 
    704706 
    705         QtGui.QDialog.__init__(self) 
     707        QtWidgets.QDialog.__init__(self) 
    706708        PlotterWidget.__init__(self, parent=self, manager=parent, quickplot=quickplot) 
    707709        icon = QtGui.QIcon() 
  • src/sas/qtgui/Plotting/Plotter2D.py

    rcee5c78 r4992ff2  
    44import functools 
    55 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
     6from PyQt5 import QtCore 
     7from PyQt5 import QtGui 
     8from PyQt5 import QtWidgets 
    89 
    910DEFAULT_CMAP = pylab.cm.jet 
     11 
     12#import sys 
     13#print("SYS.PATH = ", sys.path) 
     14import matplotlib as mpl 
     15mpl.use("Qt5Agg") 
     16 
    1017from mpl_toolkits.mplot3d import Axes3D 
    1118 
     
    365372        color_map_dialog.apply_signal.connect(self.onApplyMap) 
    366373 
    367         if color_map_dialog.exec_() == QtGui.QDialog.Accepted: 
     374        if color_map_dialog.exec_() == QtWidgets.QDialog.Accepted: 
    368375            self.onApplyMap(color_map_dialog.norm(), color_map_dialog.cmap()) 
    369376 
     
    503510 
    504511 
    505 class Plotter2D(QtGui.QDialog, Plotter2DWidget): 
     512class Plotter2D(QtWidgets.QDialog, Plotter2DWidget): 
    506513    """ 
    507514    Plotter widget implementation 
    508515    """ 
    509516    def __init__(self, parent=None, quickplot=False, dimension=2): 
    510         QtGui.QDialog.__init__(self) 
     517        QtWidgets.QDialog.__init__(self) 
    511518        Plotter2DWidget.__init__(self, manager=parent, quickplot=quickplot, dimension=dimension) 
    512519        icon = QtGui.QIcon() 
  • src/sas/qtgui/Plotting/PlotterBase.py

    r7d8bebf r4992ff2  
    22import numpy 
    33 
    4 from PyQt4 import QtGui 
    5 from PyQt4 import QtCore 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
    67 
    78# TODO: Replace the qt4agg calls below with qt5 equivalent. 
     
    910# https://www.boxcontrol.net/embedding-matplotlib-plot-on-pyqt5-gui.html 
    1011# 
    11 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 
    12 from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar 
     12# matplotlib.use("Qt5Agg") 
     13from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 
     14from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar 
    1315 
    1416import matplotlib.pyplot as plt 
     
    2527import sas.qtgui.Plotting.PlotUtilities as PlotUtilities 
    2628 
    27 class PlotterBase(QtGui.QWidget): 
     29class PlotterBase(QtWidgets.QWidget): 
    2830    def __init__(self, parent=None, manager=None, quickplot=False): 
    2931        super(PlotterBase, self).__init__(parent) 
     
    4345 
    4446        # Simple window for data display 
    45         self.txt_widget = QtGui.QTextEdit(None) 
     47        self.txt_widget = QtWidgets.QTextEdit(None) 
    4648 
    4749        # 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) 
    5053        layout.addWidget(self.canvas) 
    5154 
     
    105108        self.canvas.mpl_connect('scroll_event', self.onMplWheel) 
    106109 
    107         self.contextMenu = QtGui.QMenu(self) 
     110        self.contextMenu = QtWidgets.QMenu(self) 
    108111 
    109112        if not quickplot: 
     
    296299        dialog.setModal(True) 
    297300        dialog.setWindowTitle("Print") 
    298         if dialog.exec_() != QtGui.QDialog.Accepted: 
     301        if dialog.exec_() != QtWidgets.QDialog.Accepted: 
    299302            return 
    300303 
     
    303306        pmap = QtGui.QPixmap.grabWidget(self) 
    304307        # Create a label with pixmap drawn 
    305         printLabel = QtGui.QLabel() 
     308        printLabel = QtWidgets.QLabel() 
    306309        printLabel.setPixmap(pmap) 
    307310 
     
    333336        titleWidget = WindowTitle(self, new_title=current_title) 
    334337        result = titleWidget.exec_() 
    335         if result != QtGui.QDialog.Accepted: 
     338        if result != QtWidgets.QDialog.Accepted: 
    336339            return 
    337340 
  • src/sas/qtgui/Plotting/ScaleProperties.py

    rcd2cc745 r4992ff2  
    1 from PyQt4 import QtGui 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    24 
    35import sas.sasview 
     
    2022    view_values[5]: [0, 4], # Kratky 
    2123} 
    22 class ScaleProperties(QtGui.QDialog, Ui_scalePropertiesUI): 
     24class ScaleProperties(QtWidgets.QDialog, Ui_scalePropertiesUI): 
    2325    def __init__(self, parent=None, init_scale_x='x', init_scale_y='y'): 
    2426        super(ScaleProperties, self).__init__(parent) 
  • src/sas/qtgui/Plotting/SetGraphRange.py

    rcd2cc745 r4992ff2  
    22Allows users to change the range of the current graph 
    33""" 
    4 from PyQt4 import QtGui 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
    57 
    68# Local UI 
     
    810from sas.qtgui.Plotting.UI.SetGraphRangeUI import Ui_setGraphRangeUI 
    911 
    10 class SetGraphRange(QtGui.QDialog, Ui_setGraphRangeUI): 
     12class SetGraphRange(QtWidgets.QDialog, Ui_setGraphRangeUI): 
    1113    def __init__(self, parent=None, x_range=(0.0, 0.0), y_range=(0.0, 0.0)): 
    1214        super(SetGraphRange, self).__init__() 
  • src/sas/qtgui/Plotting/SlicerModel.py

    rcee5c78 r4992ff2  
    1 from PyQt4 import QtGui 
    2 from PyQt4 import QtCore 
     1from PyQt5 import QtGui 
    32 
    43import sas.qtgui.Utilities.GuiUtils as GuiUtils 
  • src/sas/qtgui/Plotting/SlicerParameters.py

    rcd2cc745 r4992ff2  
    44import numpy 
    55import functools 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
    8 from PyQt4 import QtWebKit 
     6from PyQt5 import QtCore 
     7from PyQt5 import QtGui 
     8from PyQt5 import QtWidgets 
     9from PyQt5 import QtWebKitWidgets 
    910 
    1011# Local UI 
     
    1213from sas.qtgui.Plotting.UI.SlicerParametersUI import Ui_SlicerParametersUI 
    1314 
    14 class SlicerParameters(QtGui.QDialog, Ui_SlicerParametersUI): 
     15class SlicerParameters(QtWidgets.QDialog, Ui_SlicerParametersUI): 
    1516    """ 
    1617    Interaction between the QTableView and the underlying model, 
     
    4445 
    4546        # Display Help on clicking the button 
    46         self.buttonBox.button(QtGui.QDialogButtonBox.Help).clicked.connect(self.onHelp) 
     47        self.buttonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self.onHelp) 
    4748 
    4849        # Close doesn't trigger closeEvent automatically, so force it 
    49         self.buttonBox.button(QtGui.QDialogButtonBox.Close).clicked.connect(functools.partial(self.closeEvent, None)) 
     50        self.buttonBox.button(QtWidgets.QDialogButtonBox.Close).clicked.connect(functools.partial(self.closeEvent, None)) 
    5051 
    5152        # Disable row number display 
    5253        self.lstParams.verticalHeader().setVisible(False) 
    5354        self.lstParams.setAlternatingRowColors(True) 
    54         self.lstParams.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding) 
     55        self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 
    5556 
    5657        # Header properties for nicer display 
    5758        header = self.lstParams.horizontalHeader() 
    58         header.setResizeMode(QtGui.QHeaderView.Stretch) 
     59        header.setSectionResizeMode(QtWidgets.QHeaderView.Stretch) 
    5960        header.setStretchLastSection(True) 
    6061 
     
    8687        location = "docs/sphinx-docs/build/html" + \ 
    8788            "/user/sasgui/guiframe/graph_help.html#d-data-averaging" 
    88         self.helpView = QtWebKit.QWebView() 
     89        self.helpView = QtWebKitWidgets.QWebView() 
    8990        self.helpView.load(QtCore.QUrl(location)) 
    9091        self.helpView.show() 
    9192 
    9293 
    93 class ProxyModel(QtGui.QIdentityProxyModel): 
     94class ProxyModel(QtCore.QIdentityProxyModel): 
    9495    """ 
    9596    Trivial proxy model with custom column edit flag 
     
    117118        return flags 
    118119 
    119 class PositiveDoubleEditor(QtGui.QLineEdit): 
     120class PositiveDoubleEditor(QtWidgets.QLineEdit): 
    120121    # a signal to tell the delegate when we have finished editing 
    121122    editingFinished = QtCore.Signal() 
     
    136137 
    137138 
    138 class EditDelegate(QtGui.QStyledItemDelegate): 
     139class EditDelegate(QtWidgets.QStyledItemDelegate): 
    139140    refocus_signal = QtCore.pyqtSignal(int, int) 
    140141    def __init__(self, parent=None, validate_method=None): 
     
    155156                return self.editor 
    156157        else: 
    157                 return QtGui.QStyledItemDelegate.createEditor(self, parent, option, index) 
     158                return QtWidgets.QStyledItemDelegate.createEditor(self, parent, option, index) 
    158159 
    159160    def setModelData(self, editor, model, index): 
  • src/sas/qtgui/Plotting/Slicers/AnnulusSlicer.py

    rcee5c78 r4992ff2  
    11import numpy 
    2 from PyQt4 import QtGui 
    3 from PyQt4 import QtCore 
    42 
    53import sas.qtgui.Utilities.GuiUtils as GuiUtils 
  • src/sas/qtgui/Plotting/Slicers/BoxSlicer.py

    rcee5c78 r4992ff2  
    11import numpy 
    2 from PyQt4 import QtGui 
    3 from PyQt4 import QtCore 
    42 
    53from .BaseInteractor import BaseInteractor 
  • src/sas/qtgui/Plotting/Slicers/BoxSum.py

    rcee5c78 r4992ff2  
    44""" 
    55import numpy 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
     6from PyQt5 import QtGui 
     7 
    88from sas.qtgui.Utilities.GuiUtils import formatNumber 
    99 
  • src/sas/qtgui/Plotting/Slicers/SectorSlicer.py

    rcee5c78 r4992ff2  
    33""" 
    44import numpy 
    5 from PyQt4 import QtGui 
    6 from PyQt4 import QtCore 
    75 
    86from .BaseInteractor import BaseInteractor 
  • src/sas/qtgui/Plotting/UnitTesting/SlicerParametersTest.py

    r7fb471d r4992ff2  
    3737        '''Test the GUI in its default state''' 
    3838        #self.widget.mapper 
    39         self.assertIsInstance(self.widget.proxy, QtGui.QIdentityProxyModel) 
     39        self.assertIsInstance(self.widget.proxy, QtCore.QIdentityProxyModel) 
    4040        self.assertIsInstance(self.widget.lstParams.itemDelegate(), QtGui.QStyledItemDelegate) 
    4141        self.assertTrue(self.widget.lstParams.model().columnReadOnly(0)) 
  • src/sas/qtgui/Plotting/WindowTitle.py

    r83eb5208 r4992ff2  
    33from "Graph_n" to any ASCII text. 
    44""" 
    5 from PyQt4 import QtGui 
     5from PyQt5 import QtWidgets 
    66 
    77from sas.qtgui.Plotting.UI.WindowTitleUI import Ui_WindowTitle 
    88 
    9 class WindowTitle(QtGui.QDialog, Ui_WindowTitle): 
     9class WindowTitle(QtWidgets.QDialog, Ui_WindowTitle): 
    1010    """ Simple GUI for a single line text query """ 
    1111    def __init__(self, parent=None, new_title=""): 
  • src/sas/qtgui/Plotting/rangeSlider.py

    • Property mode changed from 100755 to 100644
    r83eb5208 r4992ff2  
    2323""" 
    2424 
    25 from PyQt4 import QtGui, QtCore 
    26  
    27 class RangeSlider(QtGui.QSlider): 
     25from PyQt5 import QtCore 
     26from PyQt5 import QtGui 
     27from PyQt5 import QtWidgets 
     28 
     29class RangeSlider(QtWidgets.QSlider): 
    2830    """ A slider for ranges. 
    2931     
     
    4648        self._high = self.maximum() 
    4749         
    48         self.pressed_control = QtGui.QStyle.SC_None 
    49         self.hover_control = QtGui.QStyle.SC_None 
     50        self.pressed_control = QtWidgets.QStyle.SC_None 
     51        self.hover_control = QtWidgets.QStyle.SC_None 
    5052        self.click_offset = 0 
    5153         
     
    9092 
    9193        for i, value in enumerate([self._low, self._high]): 
    92             opt = QtGui.QStyleOptionSlider() 
     94            opt = QtWidgets.QStyleOptionSlider() 
    9395            self.initStyleOption(opt) 
    9496 
     
    107109                slider_max = gr.bottom() - handle_length + 1 
    108110 
    109             opt.subControls = QtGui.QStyle.SC_SliderGroove | QtGui.QStyle.SC_SliderHandle 
     111            opt.subControls = QtWidgets.QStyle.SC_SliderGroove | QtWidgets.QStyle.SC_SliderHandle 
    110112 
    111113            # draw the first slider with inverted appearance, then the second  
     
    131133                # do not highlight the second part when has focus to avoid  
    132134                # drawing of partially overlapped semi-transparent backgrounds 
    133                 opt.state &= ~QtGui.QStyle.State_HasFocus 
     135                opt.state &= ~QtWidgets.QStyle.State_HasFocus 
    134136 
    135137                opt.sliderValue = 0 
     
    157159 
    158160            if self.tickPosition() != self.NoTicks: 
    159                 opt.subControls |= QtGui.QStyle.SC_SliderTickmarks 
     161                opt.subControls |= QtWidgets.QStyle.SC_SliderTickmarks 
    160162 
    161163            if self.pressed_control: 
    162164                opt.activeSubControls = self.pressed_control 
    163                 opt.state |= QtGui.QStyle.State_Sunken 
     165                opt.state |= QtWidgets.QStyle.State_Sunken 
    164166            else: 
    165167                opt.activeSubControls = self.hover_control 
    166168 
    167             style.drawComplexControl(QtGui.QStyle.CC_Slider, opt, painter, self) 
     169            style.drawComplexControl(QtWidgets.QStyle.CC_Slider, opt, painter, self) 
    168170             
    169171         
     
    181183                 
    182184        if button: 
    183             opt = QtGui.QStyleOptionSlider() 
     185            opt = QtWidgets.QStyleOptionSlider() 
    184186            self.initStyleOption(opt) 
    185187 
     
    206208 
    207209            if self.active_slider == 0: 
    208                 self.pressed_control = QtGui.QStyle.SC_SliderHandle 
     210                self.pressed_control = QtWidgets.QStyle.SC_SliderHandle 
    209211                self.click_offset = self.__pixelPosToRangeValue(self.__pick(event.pos())) 
    210212                self.triggerAction(self.SliderMove) 
     
    215217 
    216218    def mouseReleaseEvent(self, event): 
    217         if self.pressed_control != QtGui.QStyle.SC_SliderHandle: 
     219        if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 
    218220            event.ignore() 
    219221            return 
    220222 
    221223        self.setSliderDown(False) 
    222         return QtGui.QSlider.mouseReleaseEvent(self, event) 
     224        return QtWidgets.QSlider.mouseReleaseEvent(self, event) 
    223225                                 
    224226    def mouseMoveEvent(self, event): 
    225         if self.pressed_control != QtGui.QStyle.SC_SliderHandle: 
     227        if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 
    226228            event.ignore() 
    227229            return 
     
    229231        event.accept() 
    230232        new_pos = self.__pixelPosToRangeValue(self.__pick(event.pos())) 
    231         opt = QtGui.QStyleOptionSlider() 
     233        opt = QtWidgets.QStyleOptionSlider() 
    232234        self.initStyleOption(opt) 
    233235 
     
    274276            
    275277    def __pixelPosToRangeValue(self, pos): 
    276         opt = QtGui.QStyleOptionSlider() 
     278        opt = QtWidgets.QStyleOptionSlider() 
    277279        self.initStyleOption(opt) 
    278280        style = QtGui.QApplication.style() 
Note: See TracChangeset for help on using the changeset viewer.