wryview 0.3.2__tar.gz → 0.4.0__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.
- {wryview-0.3.2 → wryview-0.4.0}/Cargo.lock +1 -1
- {wryview-0.3.2 → wryview-0.4.0}/Cargo.toml +1 -1
- {wryview-0.3.2 → wryview-0.4.0}/PKG-INFO +1 -1
- {wryview-0.3.2 → wryview-0.4.0}/pyproject.toml +1 -1
- {wryview-0.3.2 → wryview-0.4.0}/python/wryview/__init__.py +11 -4
- {wryview-0.3.2 → wryview-0.4.0}/python/wryview/_core.pyi +67 -13
- {wryview-0.3.2 → wryview-0.4.0}/src/lib.rs +123 -12
- {wryview-0.3.2 → wryview-0.4.0}/.github/workflows/publish-to-pypi.yml +0 -0
- {wryview-0.3.2 → wryview-0.4.0}/.gitignore +0 -0
- {wryview-0.3.2 → wryview-0.4.0}/.vscode/settings.json +0 -0
- {wryview-0.3.2 → wryview-0.4.0}/LICENSE +0 -0
- {wryview-0.3.2 → wryview-0.4.0}/README.md +0 -0
- {wryview-0.3.2 → wryview-0.4.0}/README_ZH.md +0 -0
|
@@ -9,7 +9,7 @@ authors = [
|
|
|
9
9
|
]
|
|
10
10
|
description = "Comprehensive Python binding for wry — cross-platform embeddable webview, no event loop required."
|
|
11
11
|
readme = "README.md"
|
|
12
|
-
version = "0.
|
|
12
|
+
version = "0.4.0"
|
|
13
13
|
requires-python = ">=3.10"
|
|
14
14
|
license = "MPL-2.0"
|
|
15
15
|
license-files = ["LICENSE"]
|
|
@@ -26,7 +26,14 @@ Usage:
|
|
|
26
26
|
print(f"{c.name} = {c.value}")
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
|
-
from wryview._core import
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
from wryview._core import (
|
|
30
|
+
WebView, CookieDict, PageLoadEvent, NewWindowResponse, DragDropEvent,
|
|
31
|
+
pump_events, ensure_gtk_init,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
__version__ = "0.4.0"
|
|
35
|
+
__all__ = [
|
|
36
|
+
"WebView", "CookieDict",
|
|
37
|
+
"PageLoadEvent", "NewWindowResponse", "DragDropEvent",
|
|
38
|
+
"pump_events", "ensure_gtk_init",
|
|
39
|
+
]
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
"""Type stubs for wryview._core — the native WebView binding."""
|
|
2
2
|
|
|
3
3
|
from typing import Callable, Optional, Union
|
|
4
|
+
from enum import Enum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class PageLoadEvent(Enum):
|
|
8
|
+
Started = 0
|
|
9
|
+
Finished = 1
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class NewWindowResponse(Enum):
|
|
13
|
+
Allow = 0
|
|
14
|
+
Deny = 1
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DragDropEvent(Enum):
|
|
18
|
+
Enter = 0
|
|
19
|
+
Over = 1
|
|
20
|
+
Drop = 2
|
|
21
|
+
Leave = 3
|
|
22
|
+
Unknown = 4
|
|
4
23
|
|
|
5
24
|
|
|
6
25
|
class CookieDict:
|
|
@@ -59,10 +78,10 @@ class WebView:
|
|
|
59
78
|
initialization_script: Optional[str] = None,
|
|
60
79
|
ipc_handler: Optional[Callable[[str], None]] = None,
|
|
61
80
|
on_navigation: Optional[Callable[[str], bool]] = None,
|
|
62
|
-
on_page_load: Optional[Callable[[
|
|
81
|
+
on_page_load: Optional[Callable[[PageLoadEvent, str], None]] = None,
|
|
63
82
|
on_title_changed: Optional[Callable[[str], None]] = None,
|
|
64
|
-
on_new_window: Optional[Callable[[str], str]] = None,
|
|
65
|
-
drag_drop_handler: Optional[Callable[[
|
|
83
|
+
on_new_window: Optional[Callable[[str], Union[NewWindowResponse, str]]] = None,
|
|
84
|
+
drag_drop_handler: Optional[Callable[[DragDropEvent, list[str], tuple[int, int]], bool]] = None,
|
|
66
85
|
custom_protocols: Optional[
|
|
67
86
|
dict[str, Callable[[str, str, list[tuple[str, str]], bytes,
|
|
68
87
|
Callable[[int, list[tuple[str, str]], bytes], None]], None]]
|
|
@@ -72,6 +91,10 @@ class WebView:
|
|
|
72
91
|
clipboard: bool = True,
|
|
73
92
|
data_directory: Optional[str] = None,
|
|
74
93
|
headers: Optional[Union[dict[str, str], list[tuple[str, str]]]] = None,
|
|
94
|
+
https_scheme: bool = False,
|
|
95
|
+
default_context_menus: bool = True,
|
|
96
|
+
on_download_started: Optional[Callable[[str, str], Union[bool, str]]] = None,
|
|
97
|
+
on_download_completed: Optional[Callable[[str, Optional[str], bool], None]] = None,
|
|
75
98
|
as_child: bool = True,
|
|
76
99
|
) -> None:
|
|
77
100
|
"""Create a WebView.
|
|
@@ -87,13 +110,16 @@ class WebView:
|
|
|
87
110
|
white page background.
|
|
88
111
|
background_color: RGBA tuple, e.g. ``(255, 255, 255, 255)``.
|
|
89
112
|
visible: Whether the webview is initially visible.
|
|
90
|
-
devtools: Enable browser DevTools (
|
|
113
|
+
devtools: Enable browser DevTools (right-click → Inspect, F12).
|
|
91
114
|
incognito: Incognito / private mode — no persistent storage.
|
|
115
|
+
Windows: requires WebView2 Runtime ≥ 101.0.1210.39.
|
|
92
116
|
user_agent: Custom User-Agent string.
|
|
93
117
|
focused: Whether the webview should receive keyboard focus.
|
|
94
|
-
|
|
118
|
+
Windows/Linux only; macOS unsupported.
|
|
119
|
+
autoplay: Allow media autoplay without user interaction.
|
|
95
120
|
javascript_enabled: Enable JavaScript execution. Default ``True``.
|
|
96
121
|
hotkeys_zoom: Enable ``Ctrl +`` / ``Ctrl -`` zoom shortcuts.
|
|
122
|
+
Windows only.
|
|
97
123
|
initialization_script: JavaScript injected on every page load
|
|
98
124
|
(before any page scripts run).
|
|
99
125
|
ipc_handler: Callable ``(message: str)`` — receives messages from
|
|
@@ -113,8 +139,19 @@ class WebView:
|
|
|
113
139
|
Call ``respond(status, headers, body)`` to reply (any thread OK).
|
|
114
140
|
proxy: Dict with ``"type"`` (``"http"`` or ``"socks5"``), ``"host"``,
|
|
115
141
|
and ``"port"``.
|
|
116
|
-
back_forward_gestures: Enable swipe
|
|
117
|
-
|
|
142
|
+
back_forward_gestures: Enable two-finger swipe for back/forward
|
|
143
|
+
navigation.
|
|
144
|
+
clipboard: Enable clipboard access (Windows/Linux). Default ``True``.
|
|
145
|
+
macOS always enabled, regardless of this setting.
|
|
146
|
+
https_scheme: Use ``https://`` instead of ``http://`` for custom
|
|
147
|
+
protocol workaround (Windows only). Makes the page a secure
|
|
148
|
+
context, enabling Service Workers, Geolocation, Web Crypto, etc.
|
|
149
|
+
default_context_menus: Enable native right-click context menu.
|
|
150
|
+
Windows only. Default ``True``.
|
|
151
|
+
on_download_started: Callable ``(url, suggested_path) -> bool|str``.
|
|
152
|
+
Return ``False`` to cancel, or a new path string to redirect.
|
|
153
|
+
on_download_completed: Callable ``(url, saved_path, success)``.
|
|
154
|
+
*saved_path* is ``None`` if the download was cancelled.
|
|
118
155
|
data_directory: Path for persistent user data (cache, cookies, etc.).
|
|
119
156
|
Creates the directory if it doesn't exist.
|
|
120
157
|
headers: Custom HTTP headers sent with every request. Accepts
|
|
@@ -165,17 +202,25 @@ class WebView:
|
|
|
165
202
|
def set_on_navigation(self, handler: Callable[[str], bool]) -> None:
|
|
166
203
|
"""Set navigation handler. Return ``False`` to block."""
|
|
167
204
|
|
|
168
|
-
def set_on_page_load(self, handler: Callable[[
|
|
169
|
-
"""Set page-load handler. Receives ``(event, url)``."""
|
|
205
|
+
def set_on_page_load(self, handler: Callable[[PageLoadEvent, str], None]) -> None:
|
|
206
|
+
"""Set page-load handler. Receives ``(event: PageLoadEvent, url)``."""
|
|
170
207
|
|
|
171
208
|
def set_on_title_changed(self, handler: Callable[[str], None]) -> None:
|
|
172
209
|
"""Set title-changed handler."""
|
|
173
210
|
|
|
174
|
-
def set_on_new_window(self, handler: Callable[[str], str]) -> None:
|
|
175
|
-
"""Set new-window handler. Return ``
|
|
211
|
+
def set_on_new_window(self, handler: Callable[[str], Union[NewWindowResponse, str]]) -> None:
|
|
212
|
+
"""Set new-window handler. Return ``NewWindowResponse`` or ``"allow"/"deny"`` (backward compat)."""
|
|
176
213
|
|
|
177
|
-
def set_drag_drop_handler(self, handler: Callable[[
|
|
178
|
-
"""Set drag-drop handler. Receives ``(
|
|
214
|
+
def set_drag_drop_handler(self, handler: Callable[[DragDropEvent, list[str], tuple[int, int]], bool]) -> None:
|
|
215
|
+
"""Set drag-drop handler. Receives ``(event: DragDropEvent, paths, position)``."""
|
|
216
|
+
|
|
217
|
+
def set_on_download_started(self, handler: Callable[[str, str], Union[bool, str]]) -> None:
|
|
218
|
+
"""Set download-started handler. Receives ``(url, suggested_path)``.
|
|
219
|
+
Return ``False`` to cancel, a new path string to redirect."""
|
|
220
|
+
|
|
221
|
+
def set_on_download_completed(self, handler: Callable[[str, Optional[str], bool], None]) -> None:
|
|
222
|
+
"""Set download-completed handler. Receives ``(url, saved_path, success)``.
|
|
223
|
+
*saved_path* is ``None`` if cancelled."""
|
|
179
224
|
|
|
180
225
|
# ── Reparent ───────────────────────────────────────────────────────────
|
|
181
226
|
|
|
@@ -245,3 +290,12 @@ class WebView:
|
|
|
245
290
|
|
|
246
291
|
def clear_all_browsing_data(self) -> None:
|
|
247
292
|
"""Clear all browsing data (cache, cookies, storage)."""
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
# ── Module-level functions ────────────────────────────────────────────────
|
|
296
|
+
|
|
297
|
+
def pump_events() -> None:
|
|
298
|
+
"""Pump pending GTK/GLib events (Linux only, no-op elsewhere)."""
|
|
299
|
+
|
|
300
|
+
def ensure_gtk_init() -> None:
|
|
301
|
+
"""Initialise GTK from Rust's perspective (Linux only, no-op elsewhere)."""
|
|
@@ -33,6 +33,8 @@ struct WebView {
|
|
|
33
33
|
title_cb: Arc<Mutex<Option<pyo3::Py<pyo3::PyAny>>>>,
|
|
34
34
|
newwin_cb: Arc<Mutex<Option<pyo3::Py<pyo3::PyAny>>>>,
|
|
35
35
|
drag_drop_cb: Arc<Mutex<Option<pyo3::Py<pyo3::PyAny>>>>,
|
|
36
|
+
download_started_cb: Arc<Mutex<Option<pyo3::Py<pyo3::PyAny>>>>,
|
|
37
|
+
download_completed_cb: Arc<Mutex<Option<pyo3::Py<pyo3::PyAny>>>>,
|
|
36
38
|
_web_context: Option<wry::WebContext>,
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -75,8 +77,12 @@ impl WebView {
|
|
|
75
77
|
proxy = None,
|
|
76
78
|
back_forward_gestures = false,
|
|
77
79
|
clipboard = true,
|
|
80
|
+
https_scheme = false,
|
|
81
|
+
default_context_menus = true,
|
|
78
82
|
data_directory = None,
|
|
79
83
|
headers = None,
|
|
84
|
+
on_download_started = None,
|
|
85
|
+
on_download_completed = None,
|
|
80
86
|
as_child = true,
|
|
81
87
|
))]
|
|
82
88
|
fn new(
|
|
@@ -106,8 +112,12 @@ impl WebView {
|
|
|
106
112
|
proxy: Option<HashMap<String, String>>,
|
|
107
113
|
back_forward_gestures: bool,
|
|
108
114
|
clipboard: bool,
|
|
115
|
+
https_scheme: bool,
|
|
116
|
+
default_context_menus: bool,
|
|
109
117
|
data_directory: Option<String>,
|
|
110
118
|
headers: Option<pyo3::Py<pyo3::PyAny>>,
|
|
119
|
+
on_download_started: Option<pyo3::Py<pyo3::PyAny>>,
|
|
120
|
+
on_download_completed: Option<pyo3::Py<pyo3::PyAny>>,
|
|
111
121
|
as_child: bool,
|
|
112
122
|
) -> PyResult<Self> {
|
|
113
123
|
// ── Build native window handle (platform-specific) ───────────
|
|
@@ -157,6 +167,10 @@ impl WebView {
|
|
|
157
167
|
Arc::new(Mutex::new(on_new_window));
|
|
158
168
|
let drag_drop_cb: Arc<Mutex<Option<pyo3::Py<pyo3::PyAny>>>> =
|
|
159
169
|
Arc::new(Mutex::new(drag_drop_handler));
|
|
170
|
+
let download_started_cb: Arc<Mutex<Option<pyo3::Py<pyo3::PyAny>>>> =
|
|
171
|
+
Arc::new(Mutex::new(on_download_started));
|
|
172
|
+
let download_completed_cb: Arc<Mutex<Option<pyo3::Py<pyo3::PyAny>>>> =
|
|
173
|
+
Arc::new(Mutex::new(on_download_completed));
|
|
160
174
|
let protocols: Arc<Mutex<HashMap<String, pyo3::Py<pyo3::PyAny>>>> =
|
|
161
175
|
Arc::new(Mutex::new(custom_protocols.unwrap_or_default()));
|
|
162
176
|
|
|
@@ -190,8 +204,8 @@ impl WebView {
|
|
|
190
204
|
let pageload_cb_clone = pageload_cb.clone();
|
|
191
205
|
let pageload_handler = move |event: wry::PageLoadEvent, url: String| {
|
|
192
206
|
let evt = match event {
|
|
193
|
-
wry::PageLoadEvent::Started =>
|
|
194
|
-
wry::PageLoadEvent::Finished =>
|
|
207
|
+
wry::PageLoadEvent::Started => PageLoadEvent::Started,
|
|
208
|
+
wry::PageLoadEvent::Finished => PageLoadEvent::Finished,
|
|
195
209
|
};
|
|
196
210
|
Python::attach(|py| {
|
|
197
211
|
if let Ok(guard) = pageload_cb_clone.lock() {
|
|
@@ -220,10 +234,10 @@ impl WebView {
|
|
|
220
234
|
if let Ok(guard) = newwin_cb_clone.lock() {
|
|
221
235
|
if let Some(ref func) = *guard {
|
|
222
236
|
if let Ok(result) = func.call1(py, (url.as_str(),)) {
|
|
223
|
-
if let Ok(
|
|
224
|
-
return match
|
|
225
|
-
|
|
226
|
-
|
|
237
|
+
if let Ok(resp) = result.extract::<NewWindowResponse>(py) {
|
|
238
|
+
return match resp {
|
|
239
|
+
NewWindowResponse::Deny => wry::NewWindowResponse::Deny,
|
|
240
|
+
NewWindowResponse::Allow => wry::NewWindowResponse::Allow,
|
|
227
241
|
};
|
|
228
242
|
}
|
|
229
243
|
}
|
|
@@ -241,14 +255,14 @@ impl WebView {
|
|
|
241
255
|
if let Some(ref func) = *guard {
|
|
242
256
|
let (evt_type, paths, position) = match &event {
|
|
243
257
|
wry::DragDropEvent::Enter { paths: p, position } => {
|
|
244
|
-
(
|
|
258
|
+
(DragDropEvent::Enter, p.clone(), *position)
|
|
245
259
|
}
|
|
246
|
-
wry::DragDropEvent::Over { position } => (
|
|
260
|
+
wry::DragDropEvent::Over { position } => (DragDropEvent::Over, vec![], *position),
|
|
247
261
|
wry::DragDropEvent::Drop { paths: p, position } => {
|
|
248
|
-
(
|
|
262
|
+
(DragDropEvent::Drop, p.clone(), *position)
|
|
249
263
|
}
|
|
250
|
-
wry::DragDropEvent::Leave => (
|
|
251
|
-
_ =>
|
|
264
|
+
wry::DragDropEvent::Leave => (DragDropEvent::Leave, vec![], (0, 0)),
|
|
265
|
+
_ => (DragDropEvent::Unknown, vec![], (0, 0)),
|
|
252
266
|
};
|
|
253
267
|
let paths_str: Vec<String> = paths
|
|
254
268
|
.iter()
|
|
@@ -264,6 +278,38 @@ impl WebView {
|
|
|
264
278
|
})
|
|
265
279
|
};
|
|
266
280
|
|
|
281
|
+
// download started handler
|
|
282
|
+
let download_started_cb_clone = download_started_cb.clone();
|
|
283
|
+
let download_started_handler = move |url: String, path: &mut std::path::PathBuf| -> bool {
|
|
284
|
+
Python::attach(|py| {
|
|
285
|
+
if let Ok(guard) = download_started_cb_clone.lock() {
|
|
286
|
+
if let Some(ref func) = *guard {
|
|
287
|
+
let path_str = path.to_string_lossy().to_string();
|
|
288
|
+
if let Ok(result) = func.call1(py, (url.as_str(), path_str)) {
|
|
289
|
+
if let Ok(new_path) = result.extract::<String>(py) {
|
|
290
|
+
*path = std::path::PathBuf::from(new_path);
|
|
291
|
+
}
|
|
292
|
+
return result.extract::<bool>(py).unwrap_or(true);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
true // default: allow download
|
|
297
|
+
})
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// download completed handler
|
|
301
|
+
let download_completed_cb_clone = download_completed_cb.clone();
|
|
302
|
+
let download_completed_handler = move |url: String, path: Option<std::path::PathBuf>, success: bool| {
|
|
303
|
+
Python::attach(|py| {
|
|
304
|
+
if let Ok(guard) = download_completed_cb_clone.lock() {
|
|
305
|
+
if let Some(ref func) = *guard {
|
|
306
|
+
let path_str = path.map(|p| p.to_string_lossy().to_string());
|
|
307
|
+
let _ = func.call1(py, (url.as_str(), path_str, success));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
};
|
|
312
|
+
|
|
267
313
|
// ── Build ──────────────────────────────────────────────────────
|
|
268
314
|
let mut web_context = data_directory
|
|
269
315
|
.map(|d| wry::WebContext::new(Some(std::path::PathBuf::from(d))));
|
|
@@ -288,7 +334,9 @@ impl WebView {
|
|
|
288
334
|
.with_on_page_load_handler(pageload_handler)
|
|
289
335
|
.with_document_title_changed_handler(title_handler)
|
|
290
336
|
.with_new_window_req_handler(newwin_handler)
|
|
291
|
-
.with_drag_drop_handler(drag_drop_handler)
|
|
337
|
+
.with_drag_drop_handler(drag_drop_handler)
|
|
338
|
+
.with_download_started_handler(download_started_handler)
|
|
339
|
+
.with_download_completed_handler(download_completed_handler);
|
|
292
340
|
|
|
293
341
|
// custom protocols — extract before iterating to avoid borrow conflict
|
|
294
342
|
let protocol_handlers: Vec<(String, pyo3::Py<pyo3::PyAny>)> = {
|
|
@@ -367,6 +415,26 @@ impl WebView {
|
|
|
367
415
|
if !javascript_enabled {
|
|
368
416
|
builder = builder.with_javascript_disabled();
|
|
369
417
|
}
|
|
418
|
+
// https_scheme: custom protocol uses https:// prefix → secure context.
|
|
419
|
+
// Windows (WebView2) only — WebView2 converts custom schemes to
|
|
420
|
+
// http://{name}.{path} by default; https_scheme makes it https://.
|
|
421
|
+
// macOS / Linux use native <scheme>://{path} and don't need this.
|
|
422
|
+
if https_scheme {
|
|
423
|
+
#[cfg(target_os = "windows")]
|
|
424
|
+
{
|
|
425
|
+
use wry::WebViewBuilderExtWindows;
|
|
426
|
+
builder = builder.with_https_scheme(true);
|
|
427
|
+
}
|
|
428
|
+
// non-Windows: silently ignored (already native scheme, no workaround)
|
|
429
|
+
}
|
|
430
|
+
// default_context_menus: Windows only — enable/disable native right-click menu.
|
|
431
|
+
if !default_context_menus {
|
|
432
|
+
#[cfg(target_os = "windows")]
|
|
433
|
+
{
|
|
434
|
+
use wry::WebViewBuilderExtWindows;
|
|
435
|
+
builder = builder.with_default_context_menus(false);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
370
438
|
if let Some(bg) = background_color {
|
|
371
439
|
builder = builder.with_background_color(bg);
|
|
372
440
|
}
|
|
@@ -435,6 +503,8 @@ impl WebView {
|
|
|
435
503
|
title_cb,
|
|
436
504
|
newwin_cb,
|
|
437
505
|
drag_drop_cb,
|
|
506
|
+
download_started_cb,
|
|
507
|
+
download_completed_cb,
|
|
438
508
|
_web_context: web_context,
|
|
439
509
|
})
|
|
440
510
|
}
|
|
@@ -564,6 +634,18 @@ impl WebView {
|
|
|
564
634
|
}
|
|
565
635
|
}
|
|
566
636
|
|
|
637
|
+
fn set_on_download_started(&self, handler: pyo3::Py<pyo3::PyAny>) {
|
|
638
|
+
if let Ok(mut g) = self.download_started_cb.lock() {
|
|
639
|
+
*g = Some(handler);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
fn set_on_download_completed(&self, handler: pyo3::Py<pyo3::PyAny>) {
|
|
644
|
+
if let Ok(mut g) = self.download_completed_cb.lock() {
|
|
645
|
+
*g = Some(handler);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
567
649
|
// ── Reparent ────────────────────────────────────────────────────────────
|
|
568
650
|
|
|
569
651
|
/// Re-attach the webview to a different parent window.
|
|
@@ -768,6 +850,32 @@ impl WebView {
|
|
|
768
850
|
}
|
|
769
851
|
}
|
|
770
852
|
|
|
853
|
+
// ── Enums ──────────────────────────────────────────────────────────────────
|
|
854
|
+
|
|
855
|
+
#[pyclass(eq, frozen, skip_from_py_object)]
|
|
856
|
+
#[derive(Clone, PartialEq)]
|
|
857
|
+
enum PageLoadEvent {
|
|
858
|
+
Started,
|
|
859
|
+
Finished,
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
#[pyclass(eq, frozen, from_py_object)]
|
|
863
|
+
#[derive(Clone, PartialEq)]
|
|
864
|
+
enum NewWindowResponse {
|
|
865
|
+
Allow,
|
|
866
|
+
Deny,
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
#[pyclass(eq, frozen, skip_from_py_object)]
|
|
870
|
+
#[derive(Clone, PartialEq)]
|
|
871
|
+
enum DragDropEvent {
|
|
872
|
+
Enter,
|
|
873
|
+
Over,
|
|
874
|
+
Drop,
|
|
875
|
+
Leave,
|
|
876
|
+
Unknown,
|
|
877
|
+
}
|
|
878
|
+
|
|
771
879
|
// ── Cookie dict helper ────────────────────────────────────────────────────
|
|
772
880
|
|
|
773
881
|
#[pyclass(skip_from_py_object)]
|
|
@@ -849,6 +957,9 @@ fn ensure_gtk_init() {
|
|
|
849
957
|
fn _core(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
850
958
|
m.add_class::<WebView>()?;
|
|
851
959
|
m.add_class::<CookieDict>()?;
|
|
960
|
+
m.add_class::<PageLoadEvent>()?;
|
|
961
|
+
m.add_class::<NewWindowResponse>()?;
|
|
962
|
+
m.add_class::<DragDropEvent>()?;
|
|
852
963
|
m.add_function(wrap_pyfunction!(pump_events, m)?)?;
|
|
853
964
|
m.add_function(wrap_pyfunction!(ensure_gtk_init, m)?)?;
|
|
854
965
|
Ok(())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|