# import PySide # # noinspection PyUnresolvedReferences # from PySide import QtCore # # noinspection PyUnresolvedReferences # from PySide.QtGui import * # # noinspection PyUnresolvedReferences # from PySide.QtCore import * # else: # print("USAGE:") # print(" qt.py pyqt4") # print(" qt.py pyqt5") # print(" qt.py pyside") # sys.exit(1) # Fix for PyCharm hints warnings when using static methods WindowUtils = cef.WindowUtils() # Platforms WINDOWS = (platform.system() == "Windows") LINUX = (platform.system() == "Linux") MAC = (platform.system() == "Darwin") # Configuration WIDTH = 800 HEIGHT = 600 # OS differences CefWidgetParent = QWidget if LINUX and (PYQT4 or PYSIDE): # noinspection PyUnresolvedReferences CefWidgetParent = QX11EmbedContainer
def focusInEvent(self, event): # This event seems to never get called on Linux, as CEF is # stealing all focus due to Issue #284. if self.browser: cef.WindowUtils().OnSetFocus(self.getHandle(), 0, 0, 0) self.browser.SetFocus(True)
def on_size(self, event): if not self.browser: return cef.WindowUtils().OnSize(self.browser_panel.GetHandle(), 0, 0, 0) self.browser.NotifyMoveOrResizeStarted()
def resizeEvent(self, event): size = event.size() if self.browser: if WINDOWS: cef.WindowUtils().OnSize(self.getHandle(), 0, 0, 0) self.browser.NotifyMoveOrResizeStarted()