import math
import logging
-from PyQt4 import QtGui
-from PyQt4 import QtCore
+import qt_compat
+QtCore = qt_compat.QtCore
+QtGui = qt_compat.import_module("QtGui")
-try:
- from util import misc as misc_utils
-except ImportError:
- class misc_utils(object):
-
- @staticmethod
- def log_exception(logger):
-
- def wrapper(func):
- return func
- return wrapper
+import misc as misc_utils
_moduleLogger = logging.getLogger(__name__)
class QPieButton(QtGui.QWidget):
- activated = QtCore.pyqtSignal(int)
- highlighted = QtCore.pyqtSignal(int)
- canceled = QtCore.pyqtSignal()
- aboutToShow = QtCore.pyqtSignal()
- aboutToHide = QtCore.pyqtSignal()
+ activated = qt_compat.Signal(int)
+ highlighted = qt_compat.Signal(int)
+ canceled = qt_compat.Signal()
+ aboutToShow = qt_compat.Signal()
+ aboutToHide = qt_compat.Signal()
BUTTON_RADIUS = 24
DELAY = 250
self._buttonFiling.setOuterRadius(self.BUTTON_RADIUS)
self._buttonArtist = PieArtist(self._buttonFiling, PieArtist.BACKGROUND_NOFILL)
self._poppedUp = False
+ self._pressed = False
self._delayPopupTimer = QtCore.QTimer()
self._delayPopupTimer.setInterval(self.DELAY)
self.highlighted.emit(self._selectionIndex)
self._display.selectAt(self._selectionIndex)
+ self._pressed = True
+ self.update()
self._popupLocation = mouseEvent.globalPos()
self._delayPopupTimer.start()
self._mousePosition = None
self._activate_at(self._selectionIndex)
+ self._pressed = False
+ self.update()
self._hide_child()
@misc_utils.log_exception(_moduleLogger)
screen.setRenderHint(QtGui.QPainter.Antialiasing, True)
option = QtGui.QStyleOptionButton()
option.initFrom(self)
- option.state = QtGui.QStyle.State_Sunken if self._poppedUp else QtGui.QStyle.State_Raised
+ option.state = QtGui.QStyle.State_Sunken if self._pressed else QtGui.QStyle.State_Raised
screen.drawControl(QtGui.QStyle.CE_PushButton, option)
self._buttonArtist.paintPainter(selectionIndex, screen)
class QPieMenu(QtGui.QWidget):
- activated = QtCore.pyqtSignal(int)
- highlighted = QtCore.pyqtSignal(int)
- canceled = QtCore.pyqtSignal()
- aboutToShow = QtCore.pyqtSignal()
- aboutToHide = QtCore.pyqtSignal()
+ activated = qt_compat.Signal(int)
+ highlighted = qt_compat.Signal(int)
+ canceled = qt_compat.Signal()
+ aboutToShow = qt_compat.Signal()
+ aboutToHide = qt_compat.Signal()
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)