|
4 | 4 | import flet as ft |
5 | 5 |
|
6 | 6 | __all__ = [ |
7 | | - "WebviewRequestMethod", |
8 | | - "WebviewLogLevelSeverity", |
| 7 | + "RequestMethod", |
| 8 | + "LogLevelSeverity", |
9 | 9 | "WebviewScrollEvent", |
10 | 10 | "WebviewConsoleMessageEvent", |
11 | 11 | "WebviewJavaScriptEvent", |
12 | 12 | ] |
13 | 13 |
|
14 | 14 |
|
15 | | -class WebviewRequestMethod(Enum): |
| 15 | +class RequestMethod(Enum): |
| 16 | + """Defines the supported HTTP methods for loading a page in a `WebView`.""" |
| 17 | + |
16 | 18 | GET = "get" |
| 19 | + """HTTP GET method.""" |
| 20 | + |
17 | 21 | POST = "post" |
| 22 | + """HTTP POST method.""" |
| 23 | + |
18 | 24 |
|
| 25 | +class LogLevelSeverity(Enum): |
| 26 | + """Represents the severity of a JavaScript log message.""" |
19 | 27 |
|
20 | | -class WebviewLogLevelSeverity(Enum): |
21 | 28 | ERROR = "error" |
| 29 | + """ |
| 30 | + Indicates an error message was logged via an "error" event of the |
| 31 | + `console.error` method. |
| 32 | + """ |
| 33 | + |
22 | 34 | WARNING = "warning" |
| 35 | + """Indicates a warning message was logged using the `console.warning` method.""" |
| 36 | + |
23 | 37 | DEBUG = "debug" |
| 38 | + """Indicates a debug message was logged using the `console.debug` method.""" |
| 39 | + |
24 | 40 | INFO = "info" |
| 41 | + """Indicates an informational message was logged using the `console.info` method.""" |
| 42 | + |
25 | 43 | LOG = "log" |
| 44 | + """Indicates a log message was logged using the `console.log` method.""" |
26 | 45 |
|
27 | 46 |
|
28 | 47 | @dataclass |
29 | 48 | class WebviewScrollEvent(ft.ControlEvent): |
30 | 49 | x: float |
| 50 | + """The value of the horizontal offset with the origin being at the leftmost of the `WebView`.""" |
| 51 | + |
31 | 52 | y: float |
| 53 | + """The value of the vertical offset with the origin being at the topmost of the `WebView`.""" |
32 | 54 |
|
33 | 55 |
|
34 | 56 | @dataclass |
35 | 57 | class WebviewConsoleMessageEvent(ft.ControlEvent): |
36 | 58 | message: str |
37 | | - severity_level: WebviewLogLevelSeverity |
| 59 | + """The message written to the console.""" |
| 60 | + |
| 61 | + severity_level: LogLevelSeverity |
| 62 | + """The severity of a JavaScript log message.""" |
38 | 63 |
|
39 | 64 |
|
40 | 65 | @dataclass |
41 | 66 | class WebviewJavaScriptEvent(ft.ControlEvent): |
42 | 67 | message: str |
| 68 | + """The message to be displayed in the window.""" |
| 69 | + |
43 | 70 | url: str |
| 71 | + """The URL of the page requesting the dialog.""" |
0 commit comments