webview2 0.0.2__tar.gz → 0.0.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webview2
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Build immersive applications supported by WebView2 on Windows Operation Systems
5
5
  Home-page: https://github.com/aiyojun/pypi-repo
6
6
  Author: aiyojun
@@ -22,10 +22,33 @@ Dynamic: home-page
22
22
  Dynamic: requires-dist
23
23
  Dynamic: summary
24
24
 
25
- # Project description
25
+ # webview2
26
26
 
27
27
  Build immersive applications supported by WebView2 on Windows Operation Systems
28
28
 
29
+ ## GUI Framework
30
+
31
+ Instead of WinForms and WPF, Use native Win32 directly.
32
+
33
+ The reason for choosing Win32 is that only the native API provides full control over window functionality, including achieving an immersive visual effect.
34
+
35
+ This project uses Win32 in a unique way: the core functionality is built with pywin32 to fully leverage Python’s capabilities.
36
+
37
+ For the WebView2 component, which exposes COM interfaces, we adopted a C++-wrapped DLL approach, supported by WebView2Window.
38
+
39
+ Because WebView2’s default rendering mode blocks interaction with the operating system, WebView2Window employs the Composition rendering mode.
40
+
41
+ In Composition mode, the WebView window achieves the same level of immersive styling as seen in applications like Visual Studio and JetBrains IDEs.
42
+
43
+ WebView2Window provides the following features:
44
+
45
+ 1. Frameless
46
+ 2. Shadow
47
+ 3. Resizeable
48
+ 4. Vertical Maximize
49
+ 5. Restrict client area to workspace when window maximized
50
+ 6. Minimize, maximize, restore and close buttons consistent with the behavior of system windows
51
+
29
52
  ## Usage
30
53
 
31
54
  ```python
@@ -36,6 +59,9 @@ from webview2 import Window, webview2_api
36
59
  class MainWindow(Window):
37
60
  @webview2_api
38
61
  def greeting(self):
62
+ """
63
+ JavaScript side invoke `await window.webview2.api.greeting()`
64
+ """
39
65
  return "hello webview2"
40
66
 
41
67
 
@@ -0,0 +1,54 @@
1
+ # webview2
2
+
3
+ Build immersive applications supported by WebView2 on Windows Operation Systems
4
+
5
+ ## GUI Framework
6
+
7
+ Instead of WinForms and WPF, Use native Win32 directly.
8
+
9
+ The reason for choosing Win32 is that only the native API provides full control over window functionality, including achieving an immersive visual effect.
10
+
11
+ This project uses Win32 in a unique way: the core functionality is built with pywin32 to fully leverage Python’s capabilities.
12
+
13
+ For the WebView2 component, which exposes COM interfaces, we adopted a C++-wrapped DLL approach, supported by WebView2Window.
14
+
15
+ Because WebView2’s default rendering mode blocks interaction with the operating system, WebView2Window employs the Composition rendering mode.
16
+
17
+ In Composition mode, the WebView window achieves the same level of immersive styling as seen in applications like Visual Studio and JetBrains IDEs.
18
+
19
+ WebView2Window provides the following features:
20
+
21
+ 1. Frameless
22
+ 2. Shadow
23
+ 3. Resizeable
24
+ 4. Vertical Maximize
25
+ 5. Restrict client area to workspace when window maximized
26
+ 6. Minimize, maximize, restore and close buttons consistent with the behavior of system windows
27
+
28
+ ## Usage
29
+
30
+ ```python
31
+ import asyncio
32
+
33
+ from webview2 import Window, webview2_api
34
+
35
+ class MainWindow(Window):
36
+ @webview2_api
37
+ def greeting(self):
38
+ """
39
+ JavaScript side invoke `await window.webview2.api.greeting()`
40
+ """
41
+ return "hello webview2"
42
+
43
+
44
+ win = MainWindow(
45
+ title="My App", size="1480x960",# icon="logo.ico",
46
+ url="https://www.bing.com",# cache="PATH_OF_WEBVIEW2_CACHE"
47
+ )
48
+ asyncio.run(win.run())
49
+
50
+ ```
51
+
52
+ ## Titlebar
53
+
54
+ Mark the css `app-region:drag;` of the title bar element to achieve the effect of dragging the title bar.
@@ -10,7 +10,7 @@ with open("README.md", 'r', encoding='utf-8') as fp:
10
10
 
11
11
  setuptools.setup(
12
12
  name="webview2",
13
- version="0.0.2",
13
+ version="0.0.4",
14
14
  author="aiyojun",
15
15
  author_email="aiyojun@gmail.com",
16
16
  description="Build immersive applications supported by WebView2 on Windows Operation Systems",
@@ -1,6 +1,6 @@
1
1
  from .bridge import Window, webview2_api
2
2
 
3
- __version__ = "0.0.2"
3
+ __version__ = "0.0.4"
4
4
 
5
5
  __all__ = ["Window", "webview2_api"]
6
6
 
@@ -1,8 +1,11 @@
1
1
  import ctypes
2
2
  import os
3
3
 
4
- os.add_dll_directory(os.path.dirname(__file__))
5
- dll = ctypes.CDLL("WebView2Window.dll")
4
+
5
+ _dir_ = os.path.dirname(__file__)
6
+ os.add_dll_directory(_dir_)
7
+ dll_path = os.path.join(_dir_, "WebView2Window.dll")
8
+ dll = ctypes.CDLL(dll_path)
6
9
 
7
10
  listener = ctypes.CFUNCTYPE(None, ctypes.c_char_p)
8
11
  set_title = dll.set_title
@@ -14,7 +14,7 @@ import voxe
14
14
  import win32con
15
15
  import win32gui
16
16
 
17
- from .core import dll, listener
17
+ from .base import dll, listener
18
18
 
19
19
  _dir_ = os.path.dirname(__file__)
20
20
 
@@ -78,19 +78,19 @@ class Transport:
78
78
  if type(self.scopes) is dict:
79
79
  if method_name in self.scopes:
80
80
  r = self.scopes[method_name](*args)
81
- asyncio.create_task(self.post_packet(voxe.dumps(0, r), self.reqid))
81
+ asyncio.create_task(self.send(voxe.dumps(0, r), self.reqid))
82
82
  else:
83
- asyncio.create_task(self.post_packet(voxe.dumps(1, "no such method"), self.reqid))
83
+ asyncio.create_task(self.send(voxe.dumps(1, "no such method"), self.reqid))
84
84
  else:
85
85
  if method_name in dir(self.scopes):
86
86
  method = getattr(self.scopes, method_name)
87
87
  r = method(*args)
88
- asyncio.create_task(self.post_packet(voxe.dumps(0, r), self.reqid))
88
+ asyncio.create_task(self.send(voxe.dumps(0, r), self.reqid))
89
89
  else:
90
- asyncio.create_task(self.post_packet(voxe.dumps(1, "no such method"), self.reqid))
90
+ asyncio.create_task(self.send(voxe.dumps(1, "no such method"), self.reqid))
91
91
  except Exception as e:
92
92
  traceback.print_exc()
93
- asyncio.create_task(self.post_packet(voxe.dumps(1, str(e)), self.reqid))
93
+ asyncio.create_task(self.send(voxe.dumps(1, str(e)), self.reqid))
94
94
  pass
95
95
  if self.on_service:
96
96
  self.on_service(self.cache)
@@ -103,7 +103,7 @@ class Transport:
103
103
  except Exception as e:
104
104
  traceback.print_exc()
105
105
 
106
- async def post_packet(self, data: bytes, reqid=None):
106
+ async def send(self, data: bytes, reqid=None):
107
107
  if reqid is None:
108
108
  reqid = str(uuid.uuid4()).replace("-", "")
109
109
  size = len(data)
@@ -130,7 +130,7 @@ class Transport:
130
130
  reqid = str(uuid.uuid4()).replace("-", "")
131
131
  future = asyncio.Future()
132
132
  self.futures[reqid] = future
133
- await self.post_packet(data, reqid)
133
+ await self.send(data, reqid)
134
134
  r = await asyncio.wait_for(future, timeout=timeout)
135
135
  del self.futures[reqid]
136
136
  return r
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webview2
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Build immersive applications supported by WebView2 on Windows Operation Systems
5
5
  Home-page: https://github.com/aiyojun/pypi-repo
6
6
  Author: aiyojun
@@ -22,10 +22,33 @@ Dynamic: home-page
22
22
  Dynamic: requires-dist
23
23
  Dynamic: summary
24
24
 
25
- # Project description
25
+ # webview2
26
26
 
27
27
  Build immersive applications supported by WebView2 on Windows Operation Systems
28
28
 
29
+ ## GUI Framework
30
+
31
+ Instead of WinForms and WPF, Use native Win32 directly.
32
+
33
+ The reason for choosing Win32 is that only the native API provides full control over window functionality, including achieving an immersive visual effect.
34
+
35
+ This project uses Win32 in a unique way: the core functionality is built with pywin32 to fully leverage Python’s capabilities.
36
+
37
+ For the WebView2 component, which exposes COM interfaces, we adopted a C++-wrapped DLL approach, supported by WebView2Window.
38
+
39
+ Because WebView2’s default rendering mode blocks interaction with the operating system, WebView2Window employs the Composition rendering mode.
40
+
41
+ In Composition mode, the WebView window achieves the same level of immersive styling as seen in applications like Visual Studio and JetBrains IDEs.
42
+
43
+ WebView2Window provides the following features:
44
+
45
+ 1. Frameless
46
+ 2. Shadow
47
+ 3. Resizeable
48
+ 4. Vertical Maximize
49
+ 5. Restrict client area to workspace when window maximized
50
+ 6. Minimize, maximize, restore and close buttons consistent with the behavior of system windows
51
+
29
52
  ## Usage
30
53
 
31
54
  ```python
@@ -36,6 +59,9 @@ from webview2 import Window, webview2_api
36
59
  class MainWindow(Window):
37
60
  @webview2_api
38
61
  def greeting(self):
62
+ """
63
+ JavaScript side invoke `await window.webview2.api.greeting()`
64
+ """
39
65
  return "hello webview2"
40
66
 
41
67
 
@@ -1,4 +1,3 @@
1
- MANIFEST.in
2
1
  README.md
3
2
  pyproject.toml
4
3
  setup.py
@@ -6,8 +5,8 @@ webview2/WebView2Loader.dll
6
5
  webview2/Webview2Window.dll
7
6
  webview2/__init__.py
8
7
  webview2/__main__.py
8
+ webview2/base.py
9
9
  webview2/bridge.py
10
- webview2/core.py
11
10
  webview2/index.html
12
11
  webview2/webview2.js
13
12
  webview2.egg-info/PKG-INFO
@@ -1 +0,0 @@
1
- recursive-include yourpkg *.dll *.js *.html
webview2-0.0.2/README.md DELETED
@@ -1,28 +0,0 @@
1
- # Project description
2
-
3
- Build immersive applications supported by WebView2 on Windows Operation Systems
4
-
5
- ## Usage
6
-
7
- ```python
8
- import asyncio
9
-
10
- from webview2 import Window, webview2_api
11
-
12
- class MainWindow(Window):
13
- @webview2_api
14
- def greeting(self):
15
- return "hello webview2"
16
-
17
-
18
- win = MainWindow(
19
- title="My App", size="1480x960",# icon="logo.ico",
20
- url="https://www.bing.com",# cache="PATH_OF_WEBVIEW2_CACHE"
21
- )
22
- asyncio.run(win.run())
23
-
24
- ```
25
-
26
- ## Titlebar
27
-
28
- Mark the css `app-region:drag;` of the title bar element to achieve the effect of dragging the title bar.
Binary file
File without changes
File without changes
File without changes
File without changes
File without changes