Browser inside task panel

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
wmayer
Site Admin
Posts: 16315
Joined: Thu Feb 19, 2009 10:32 am

Re: Browser inside task panel

Postby wmayer » Tue Sep 15, 2020 3:32 pm

For me this seems to work without problems. The only thing I realized is an error message:
Failed to set referrer policy: The value 'strict-origin-when-cross-origin' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', or 'unsafe-url'. The referrer policy has been left unchanged.
OS: Ubuntu 18.04.5 LTS (XFCE/xubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22436 +2 (Git)
Build type: Debug
Branch: pr3757
Hash: 1c730a7f00c8ed066dc9857e1e637cf1c8ea3210
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
User avatar
Chris_G
Posts: 1428
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Browser inside task panel

Postby Chris_G » Tue Sep 15, 2020 4:29 pm

It worked fine for me. No error at all.
Only thing, is that the browser is not in the combo task panel , but in a new panel.
I am typing from this panel.

Code: Select all

OS: Manjaro Linux (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22315 +107 (Git)
Build type: Release
Branch: code_duplic
Hash: 0e2494d8963ea71abaeb41117daeb330e95da327
Python version: 3.8.5
Qt version: 5.15.0
Coin version: 4.0.0
OCC version: 7.4.0
Locale: French/France (fr_FR)
wmayer
Site Admin
Posts: 16315
Joined: Thu Feb 19, 2009 10:32 am

Re: Browser inside task panel

Postby wmayer » Wed Sep 16, 2020 6:13 am

But with the Windows build I can confirm the issue. No matter how I activate the password field the key events are handled as shortcuts. Maybe the behaviour depends on the Qt version because so far it works with 5.9.5, 5.15.0 but fails with 5.12.1. However, it can also be specific to Windows because only there the issue has been reproduced.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22417 (Git)
Build type: Release
Branch: master
Hash: f681b86abdddd55e2dcb80bc4612251570cc9b8b
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
wmayer
Site Admin
Posts: 16315
Joined: Thu Feb 19, 2009 10:32 am

Re: Browser inside task panel

Postby wmayer » Wed Sep 16, 2020 6:23 am

Here is a simple solution to fix the problem. The idea is to override the event() function and require all key events to be sent to the dialog if it has the focus:

Code: Select all

import FreeCADGui
from PySide2 import QtCore, QtWidgets, QtWebEngineWidgets
class TransWindow(QtWidgets.QDialog):
    def __init__(self):
        super(TransWindow, self).__init__()
        self.webView = QtWebEngineWidgets.QWebEngineView()
        self.webView.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        self.layout = QtWidgets.QVBoxLayout(self)
        self.layout.addWidget(self.webView)
    def showEvent(self, event):
        super(TransWindow, self).showEvent(event)
        self.webView.load(QtCore.QUrl("https://forum.freecadweb.org/ucp.php?mode=login"))
    def event(self, event):
        if event.type() == QtCore.QEvent.ShortcutOverride:
            event.accept()
        return super(TransWindow, self).event(event)

mw = FreeCADGui.getMainWindow()
d = QtWidgets.QDockWidget()
d.setWidget(TransWindow())
mw.addDockWidget(QtCore.Qt.RightDockWidgetArea, d)
User avatar
bernd
Posts: 10735
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Browser inside task panel

Postby bernd » Wed Sep 16, 2020 7:33 am

same here on Linux works like a sharm, on windows no matter if LibPack or Conda version is used the problem exist.

Code: Select all

OS: Debian GNU/Linux 10 (buster) (KDE//usr/share/xsessions/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22372 (Git)
Build type: Unknown
Branch: master
Hash: 3bdb812a7d8ba2685be0133e842d6281a0f0c20b
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Switzerland (de_CH)
User avatar
bernd
Posts: 10735
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Browser inside task panel

Postby bernd » Wed Sep 16, 2020 7:34 am

wmayer wrote:
Wed Sep 16, 2020 6:23 am
Here is a simple solution to fix the problem. The idea is to override the event() function and require all key events to be sent to the dialog if it has the focus:
works great here on windows
User avatar
Kunda1
Posts: 8045
Joined: Thu Jan 05, 2017 9:03 pm

Re: Browser inside task panel

Postby Kunda1 » Wed Sep 16, 2020 11:24 am

This together with Pinger macro would be sweet.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features