def is_x11_compositing_enabled(): """Is X11 compositing manager running. """ try: from PyQt4.QtGui import QX11Info except ImportError: return False return QX11Info.isCompositingManagerRunning()
def __init__(self, keyPressHandler, parent=None): QDialog.__init__(self, parent) self.keyPressHandler = keyPressHandler self.setWindowFlags(Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint) self.setFocusPolicy(Qt.NoFocus) # Causes issues in some non-compositing WM's (notably Fluxbox) if QX11Info.isCompositingManagerRunning(): self.setAttribute(Qt.WA_TranslucentBackground) self.timer = QTimer() self.timer.setSingleShot(True) self.timer.timeout.connect(self.hide)
def from_qt(cls): """ Create and return a :class:`Display` object from the Qt display connection, as available in :meth:`PyQt4.QtGui.QX11Info.display()`. Raise :exc:`~exceptions.DisplayError`, if no Qt display connection is available. Raise :exc:`~exceptions.ImportError`, if either :mod:`sip` or :mod:`PyQt4.QtGui` are not available. """ import sip from PyQt4.QtGui import QX11Info display = QX11Info.display() if not display: raise DisplayError() display_address = sip.unwrapinstance(display) return cls(cast(display_address, xlib.Display_p))