msys2 PyQtWebEngine
I am trying to install PyQtWebEngine. How can i do that?
Thanks in advance, Chris Pappas
Qtwebengine itself doesn't build on Mingw, so you won't be able to install it via msys2's mingw packages, at best you'd be able to install the Python bindings for qtwebkit. It's primarily a build issue for webengine, ergo the chromium engine to build on Mingw that I'm aware of.
Was there any previous attempt to build it?
Was there any previous attempt to build it?
I think so, but that was years ago, not so sure about now though.
However I think it's hard coded build scripts still says mingw is not supported
https://packages.msys2.org/package/mingw-w64-x86_64-qtwebkit
that's all i need (
and works as expected!!!
Any updates? I want to display a page with RTCPeerConnection (which is not available in QtWebKit).
@el07694 no one working on porting QWebEngine for Mingw
Is there any alternative? (like sellenium, geckodriver) ?
From qt wiki
The following packages are required to install Qt WebEngine:
sudo apt-get install libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libxtst-dev libxss-dev libdbus-1-dev libevent-dev libfontconfig1-dev libcap-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libegl1-mesa-dev gperf bison nodejs
The libevent package is ready: https://packages.msys2.org/search?t=pkg&q=libevent . The gperf package is ready: https://packages.msys2.org/search?t=pkg&q=gperf . The bison package is ready: https://packages.msys2.org/search?t=pkg&q=bison .
All the other packages have to be prepared...
@el07694 stop spamming. Problem is not in dependencies (most deps that you write is Linux only). Problem in building QWebEngine itself. You can try to do it yourself before posting here
Yes and no, you only need the x development headers if you're compiling a native Linux app. Same with a few of the other dependencies. Currently the issue with qtwebengine is that right now it checks for a specific clang environment, and I mean one that's found in visual studio, not the mingw one. And that's just only the beginning.
I make an alternative choice using selenium as internal pyqt5 application.
Code:
import win32gui
import win32con
import winxpgui
import win32api
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
import time
import ctypes
user32 = ctypes.windll.user32
width,height = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.frame = QtWidgets.QFrame(self.centralwidget)
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
#self.verticalLayout.addWidget(self.frame)
MainWindow.setCentralWidget(self.centralwidget)
self.chrome_options = Options()
self.chrome_options.add_argument("disable-infobars")
#self.chrome_options.add_argument("--window-size=0,0")
self.chrome_options.add_argument("--kiosk")
self.chrome_options.add_argument("--window-size="+str(int(2*width))+","+str(int(2*height)))
self.chrome_options.add_argument("--window-position=-10,-10")
self.chrome_options.add_argument("--app=http://www.in.gr/");
self.s=Service(ChromeDriverManager().install())
self.driver = webdriver.Chrome(service=self.s,options=self.chrome_options,service_log_path='NUL')
self.driver.get("http://www.in.gr")
time.sleep(0.5)
self.hwnd = 0
self.tries = 30
self.total_tries = 0
while(self.hwnd==0 and self.total_tries<=self.tries):
try:
win32gui.EnumWindows(self.hwnd_method, None)
#win32gui.SetWindowLong (self.hwnd, win32con.GWL_EXSTYLE, win32gui.GetWindowLong (self.hwnd, win32con.GWL_EXSTYLE ) | win32con.WS_EX_LAYERED )
#winxpgui.SetLayeredWindowAttributes(self.hwnd, win32api.RGB(0,0,0), 255, win32con.LWA_ALPHA)
self.embed_window = QtGui.QWindow.fromWinId(self.hwnd)
self.embed_widget = QtWidgets.QWidget.createWindowContainer(self.embed_window)
self.verticalLayout.addWidget(self.embed_widget)
#self.driver.execute_script("document.documentElement.requestFullscreen();")
self.tries+= 1
break
time.sleep(1)
except Exception as e:
print(e)
self.tries += 1
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def hwnd_method(self, hwnd, ctx):
window_title = win32gui.GetWindowText(hwnd)
if "in.gr" in window_title.lower():
self.hwnd = hwnd
'''
old_style = win32gui.GetWindowLong(hwnd, -16)
# building the new style(old style AND NOT Maximize AND NOT Minimize)
new_style = old_style & ~win32con.WS_MAXIMIZEBOX & ~win32con.WS_MINIMIZEBOX
# setting new style
win32gui.SetWindowLong(hwnd, -16, new_style)
# updating non - client area
win32gui.SetWindowPos(hwnd, 0, 0, 0, 0, 0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE | win32con.SWP_NOZORDER | win32con.SWP_FRAMECHANGED)
win32gui.UpdateWindow(hwnd)
'''
#win32gui.ShowWindow(hwnd , win32con.SW_HIDE)
#win32gui.SetWindowLong (hwnd, win32con.GWL_EXSTYLE, win32gui.GetWindowLong (hwnd, win32con.GWL_EXSTYLE ) | win32con.WS_EX_LAYERED )
#winxpgui.SetLayeredWindowAttributes(hwnd, win32api.RGB(0,0,0), 0, win32con.LWA_ALPHA)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())```
It is needed to use emacs-application-frame with mingw x64 emacs.
And yet can't be provided as currently qtwebengine is only compilable on msvc not mingw-w64 yet
And yet can't be provided as currently qtwebengine is only compilable on msvc not mingw-w64 yet
noo propietary compiler :(
Anyway i am trying to switch off python/pyqt5 an use C++/Qt/Qtcreator/cmake instead
@el07694 no one working on porting QWebEngine for Mingw
In progress: https://github.com/msys2/MINGW-packages/pull/21914