fit-webview-bridge 0.2.2a2__tar.gz → 0.2.2a4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fit-webview-bridge might be problematic. Click here for more details.
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/PKG-INFO +1 -1
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/pyproject.toml +1 -1
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/src/macos/WKWebViewWidget.mm +48 -1
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/.github/workflows/wheels-macos.yml +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/.gitignore +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/.vscode/settings.json +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/CMakeLists.txt +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/README.md +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/bindings/pyside6/macos/CMakeLists.txt +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/bindings/pyside6/macos/typesystem_wkwebview.xml +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/examples/macos/wkwebview_demo.py +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/fit_webview_bridge/__init__.py +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/src/macos/CMakeLists.txt +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/src/macos/DownloadInfo.h +0 -0
- {fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/src/macos/WKWebViewWidget.h +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "fit-webview-bridge"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2a4"
|
|
4
4
|
description = "Qt native WebView bridge with PySide6 bindings"
|
|
5
5
|
requires-python = ">=3.11,<3.14"
|
|
6
6
|
dependencies = ["PySide6==6.9.0", "shiboken6==6.9.0", "shiboken6-generator==6.9.0"]
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#import <Cocoa/Cocoa.h>
|
|
2
2
|
#import <WebKit/WebKit.h>
|
|
3
|
+
#import <objc/message.h>
|
|
3
4
|
|
|
4
5
|
#include "WKWebViewWidget.h"
|
|
5
6
|
#include "DownloadInfo.h"
|
|
6
7
|
|
|
8
|
+
|
|
7
9
|
#include <QtWidgets>
|
|
8
10
|
#include <QString>
|
|
9
11
|
#include <QUrl>
|
|
@@ -47,7 +49,7 @@ static NSURL* toNSURL(QUrl u);
|
|
|
47
49
|
@end
|
|
48
50
|
|
|
49
51
|
// ===== WKNavDelegate =====
|
|
50
|
-
@interface WKNavDelegate : NSObject <WKNavigationDelegate, WKDownloadDelegate>
|
|
52
|
+
@interface WKNavDelegate : NSObject <WKNavigationDelegate, WKDownloadDelegate, WKUIDelegate>
|
|
51
53
|
@property(nonatomic, assign) WKWebViewWidget* owner;
|
|
52
54
|
// mappe per download
|
|
53
55
|
@property(nonatomic, strong) NSMapTable<WKDownload*, NSString*>* downloadPaths; // weak key -> strong value
|
|
@@ -74,6 +76,34 @@ static NSURL* toNSURL(QUrl u);
|
|
|
74
76
|
|
|
75
77
|
#pragma mark - Navigazione
|
|
76
78
|
|
|
79
|
+
|
|
80
|
+
// 1a) Navigation: intercetta click con targetFrame == nil (tipico di _blank)
|
|
81
|
+
- (void)webView:(WKWebView *)webView
|
|
82
|
+
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
|
|
83
|
+
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
|
|
84
|
+
{
|
|
85
|
+
// targetFrame == nil => richiesta per nuova finestra (target="_blank" o window.open)
|
|
86
|
+
if (navigationAction.targetFrame == nil || !navigationAction.targetFrame.isMainFrame) {
|
|
87
|
+
[webView loadRequest:navigationAction.request]; // carica QUI
|
|
88
|
+
decisionHandler(WKNavigationActionPolicyCancel); // cancella la creazione nuova finestra
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
decisionHandler(WKNavigationActionPolicyAllow);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// 1b) UI: invocato quando la pagina chiede esplicitamente una nuova webview
|
|
95
|
+
- (WKWebView *)webView:(WKWebView *)webView
|
|
96
|
+
createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration
|
|
97
|
+
forNavigationAction:(WKNavigationAction *)navigationAction
|
|
98
|
+
windowFeatures:(WKWindowFeatures *)windowFeatures
|
|
99
|
+
{
|
|
100
|
+
if (navigationAction.targetFrame == nil || !navigationAction.targetFrame.isMainFrame) {
|
|
101
|
+
[webView loadRequest:navigationAction.request]; // apri nella stessa webview
|
|
102
|
+
}
|
|
103
|
+
return nil; // restituisci nil per NON creare una nuova finestra
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
77
107
|
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
|
|
78
108
|
if (!self.owner) return;
|
|
79
109
|
if (webView.URL)
|
|
@@ -390,6 +420,21 @@ WKWebViewWidget::WKWebViewWidget(QWidget* parent)
|
|
|
390
420
|
cfg.defaultWebpagePreferences.allowsContentJavaScript = YES;
|
|
391
421
|
}
|
|
392
422
|
|
|
423
|
+
// --- Fullscreen HTML5 (via KVC tollerante) ---
|
|
424
|
+
@try {
|
|
425
|
+
[cfg.preferences setValue:@YES forKey:@"fullScreenEnabled"];
|
|
426
|
+
} @catch (NSException *e) {
|
|
427
|
+
// ignore if not available
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// --- AirPlay & PiP via selector per compatibilità SDK ---
|
|
431
|
+
if ([cfg respondsToSelector:@selector(setAllowsAirPlayForMediaPlayback:)]) {
|
|
432
|
+
((void(*)(id, SEL, BOOL))objc_msgSend)(cfg, @selector(setAllowsAirPlayForMediaPlayback:), YES);
|
|
433
|
+
}
|
|
434
|
+
if ([cfg respondsToSelector:@selector(setAllowsPictureInPictureMediaPlayback:)]) {
|
|
435
|
+
((void(*)(id, SEL, BOOL))objc_msgSend)(cfg, @selector(setAllowsPictureInPictureMediaPlayback:), YES);
|
|
436
|
+
}
|
|
437
|
+
|
|
393
438
|
// SPA: intercetta pushState/replaceState/popstate/click
|
|
394
439
|
d->ucc = [WKUserContentController new];
|
|
395
440
|
d->msg = [FitUrlMsgHandler new];
|
|
@@ -423,6 +468,8 @@ WKWebViewWidget::WKWebViewWidget(QWidget* parent)
|
|
|
423
468
|
d->delegate = [WKNavDelegate new];
|
|
424
469
|
d->delegate.owner = this;
|
|
425
470
|
[d->wk setNavigationDelegate:d->delegate];
|
|
471
|
+
|
|
472
|
+
[d->wk setUIDelegate:d->delegate];
|
|
426
473
|
}
|
|
427
474
|
|
|
428
475
|
WKWebViewWidget::~WKWebViewWidget() {
|
{fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/.github/workflows/wheels-macos.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fit_webview_bridge-0.2.2a2 → fit_webview_bridge-0.2.2a4}/bindings/pyside6/macos/CMakeLists.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|