Ignore:
Timestamp:
Nov 9, 2017 6: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 05:50:09)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 06:43:07)
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.