fit-webview-bridge 0.2.1a4__tar.gz → 0.2.1a5__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.1a4 → fit_webview_bridge-0.2.1a5}/PKG-INFO +1 -1
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/pyproject.toml +1 -1
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/src/macos/WKWebViewWidget.mm +32 -4
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/.github/workflows/wheels-macos.yml +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/.gitignore +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/.vscode/settings.json +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/CMakeLists.txt +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/README.md +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/bindings/pyside6/macos/CMakeLists.txt +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/bindings/pyside6/macos/typesystem_wkwebview.xml +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/examples/macos/wkwebview_demo.py +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/fit_webview_bridge/__init__.py +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/src/macos/CMakeLists.txt +0 -0
- {fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/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.1a5"
|
|
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"]
|
|
@@ -52,6 +52,7 @@ static NSURL* toNSURL(QUrl u);
|
|
|
52
52
|
@property(nonatomic, strong) NSMapTable<WKDownload*, NSString*>* downloadPaths; // weak key -> strong value
|
|
53
53
|
@property(nonatomic, strong) NSMapTable<NSProgress*, WKDownload*>* progressToDownload; // weak->weak
|
|
54
54
|
@property(nonatomic, strong) NSHashTable<NSProgress*>* completedProgresses; // weak set
|
|
55
|
+
@property(nonatomic, strong) NSMapTable<WKDownload*, NSNumber*>* expectedTotals; // weak->strong
|
|
55
56
|
@end
|
|
56
57
|
|
|
57
58
|
@implementation WKNavDelegate
|
|
@@ -61,6 +62,7 @@ static NSURL* toNSURL(QUrl u);
|
|
|
61
62
|
_downloadPaths = [NSMapTable weakToStrongObjectsMapTable];
|
|
62
63
|
_progressToDownload = [NSMapTable weakToWeakObjectsMapTable];
|
|
63
64
|
_completedProgresses = [NSHashTable weakObjectsHashTable];
|
|
65
|
+
_expectedTotals = [NSMapTable weakToStrongObjectsMapTable];
|
|
64
66
|
}
|
|
65
67
|
return self;
|
|
66
68
|
}
|
|
@@ -216,6 +218,16 @@ completionHandler:(void (^)(NSURL * _Nullable destination))completionHandler
|
|
|
216
218
|
QString::fromUtf8(finalPath.UTF8String)
|
|
217
219
|
);
|
|
218
220
|
|
|
221
|
+
// Leggi il Content-Length se disponibile e salvalo
|
|
222
|
+
long long expected = response.expectedContentLength; // -1 se sconosciuto
|
|
223
|
+
if (expected >= 0) {
|
|
224
|
+
[self.expectedTotals setObject:@(expected) forKey:download];
|
|
225
|
+
if (self.owner) {
|
|
226
|
+
// progress iniziale (0 di total)
|
|
227
|
+
emit self.owner->downloadProgress(0, expected);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
219
231
|
completionHandler([NSURL fileURLWithPath:finalPath]);
|
|
220
232
|
}
|
|
221
233
|
|
|
@@ -230,15 +242,28 @@ completionHandler:(void (^)(NSURL * _Nullable destination))completionHandler
|
|
|
230
242
|
}
|
|
231
243
|
NSProgress* prog = (NSProgress*)obj;
|
|
232
244
|
|
|
233
|
-
//
|
|
234
|
-
if ([self.completedProgresses containsObject:prog]) return;
|
|
235
|
-
|
|
245
|
+
// Calcolo grezzo fuori dal main
|
|
236
246
|
int64_t total = prog.totalUnitCount; // -1 se sconosciuto
|
|
237
247
|
int64_t done = prog.completedUnitCount;
|
|
238
248
|
|
|
249
|
+
// Dispatch su main, ma **ricontrolla** lo stato "completed" dentro al blocco
|
|
250
|
+
// DOPO (compatibile MRC)
|
|
251
|
+
__unsafe_unretained WKNavDelegate* weakSelf = self;
|
|
239
252
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
240
|
-
|
|
253
|
+
WKNavDelegate* strongSelf = weakSelf;
|
|
254
|
+
if (!strongSelf || !strongSelf.owner) return;
|
|
255
|
+
|
|
256
|
+
// blocca update tardivi dopo finished/failed
|
|
257
|
+
if ([strongSelf.completedProgresses containsObject:prog]) return;
|
|
258
|
+
|
|
259
|
+
WKDownload* dl = [strongSelf.progressToDownload objectForKey:prog];
|
|
260
|
+
NSNumber* exp = dl ? [strongSelf.expectedTotals objectForKey:dl] : nil;
|
|
261
|
+
|
|
262
|
+
int64_t totalEff = (total >= 0 ? total : (exp ? exp.longLongValue : -1));
|
|
263
|
+
emit strongSelf.owner->downloadProgress(done, totalEff);
|
|
241
264
|
});
|
|
265
|
+
|
|
266
|
+
|
|
242
267
|
}
|
|
243
268
|
|
|
244
269
|
- (void)downloadDidFinish:(WKDownload *)download {
|
|
@@ -252,10 +277,12 @@ completionHandler:(void (^)(NSURL * _Nullable destination))completionHandler
|
|
|
252
277
|
|
|
253
278
|
[self.completedProgresses addObject:download.progress];
|
|
254
279
|
|
|
280
|
+
|
|
255
281
|
NSString* finalPath = [self.downloadPaths objectForKey:download];
|
|
256
282
|
emit self.owner->downloadFinished(finalPath ? QString::fromUtf8(finalPath.UTF8String) : QString());
|
|
257
283
|
if (finalPath) [self.downloadPaths removeObjectForKey:download];
|
|
258
284
|
[self.progressToDownload removeObjectForKey:download.progress];
|
|
285
|
+
[self.expectedTotals removeObjectForKey:download];
|
|
259
286
|
}
|
|
260
287
|
|
|
261
288
|
- (void)download:(WKDownload *)download didFailWithError:(NSError *)error resumeData:(NSData *)resumeData {
|
|
@@ -276,6 +303,7 @@ completionHandler:(void (^)(NSURL * _Nullable destination))completionHandler
|
|
|
276
303
|
);
|
|
277
304
|
if (finalPath) [self.downloadPaths removeObjectForKey:download];
|
|
278
305
|
[self.progressToDownload removeObjectForKey:download.progress];
|
|
306
|
+
[self.expectedTotals removeObjectForKey:download];
|
|
279
307
|
}
|
|
280
308
|
|
|
281
309
|
@end
|
{fit_webview_bridge-0.2.1a4 → fit_webview_bridge-0.2.1a5}/.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.1a4 → fit_webview_bridge-0.2.1a5}/bindings/pyside6/macos/CMakeLists.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|