pyloid 0.17.3__tar.gz → 0.17.4__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyloid
3
- Version: 0.17.3
3
+ Version: 0.17.4
4
4
  Summary:
5
5
  Author: aesthetics-of-record
6
6
  Author-email: 111675679+aesthetics-of-record@users.noreply.github.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyloid"
3
- version = "0.17.3"
3
+ version = "0.17.4"
4
4
  description = ""
5
5
  authors = ["aesthetics-of-record <111675679+aesthetics-of-record@users.noreply.github.com>"]
6
6
  readme = "README.md"
@@ -1,4 +1,9 @@
1
1
  from PySide6.QtCore import QObject, Slot
2
+ from typing import TYPE_CHECKING
3
+
4
+ if TYPE_CHECKING:
5
+ from pyloid.pyloid import Pyloid
6
+ from pyloid.browser_window import BrowserWindow
2
7
 
3
8
 
4
9
  class PyloidAPI(QObject):
@@ -45,6 +50,9 @@ class PyloidAPI(QObject):
45
50
 
46
51
  def __init__(self):
47
52
  super().__init__()
53
+ self.window_id: str = None
54
+ self.window: "BrowserWindow" = None
55
+ self.app: "Pyloid" = None
48
56
 
49
57
 
50
58
  def Bridge(*args, **kwargs):
@@ -72,7 +72,7 @@ class CustomWebEngineView(QWebEngineView):
72
72
  super().__init__(parent._window)
73
73
  self.parent: "BrowserWindow" = parent
74
74
 
75
- # 커스텀 페이지 설정
75
+ # Custom Web Page
76
76
  self.custom_page = CustomWebPage()
77
77
  self.setPage(self.custom_page)
78
78
 
@@ -97,7 +97,7 @@ class CustomWebEngineView(QWebEngineView):
97
97
  self.resize_start_pos = event.globalPos()
98
98
 
99
99
  def start_system_drag(self):
100
- """네이티브 시스템 이동 시작"""
100
+ """Start system window move"""
101
101
  if self.parent._window.windowHandle():
102
102
  self.parent._window.windowHandle().startSystemMove()
103
103
 
@@ -105,7 +105,7 @@ class CustomWebEngineView(QWebEngineView):
105
105
  if self.parent.frame or not self.is_resizing_enabled:
106
106
  return
107
107
 
108
- # 리사이징 방향 확인
108
+ # Check resize direction
109
109
  was_in_resize_area = self.is_in_resize_area
110
110
  resize_direction = self.get_resize_direction(event.pos())
111
111
  self.is_in_resize_area = bool(resize_direction)
@@ -117,7 +117,7 @@ class CustomWebEngineView(QWebEngineView):
117
117
  self.resize_window(event.globalPos())
118
118
  return
119
119
 
120
- # 리사이징 영역 진입/이탈 시에만 커서 변경
120
+ # Change cursor when entering/leaving resize area
121
121
  if self.is_in_resize_area != was_in_resize_area:
122
122
  if self.is_in_resize_area:
123
123
  # self.setAttribute(Qt.WA_SetCursor, True)
@@ -239,7 +239,7 @@ class BrowserWindow:
239
239
  self.frame = frame
240
240
  self.context_menu = context_menu
241
241
  self.dev_tools = dev_tools
242
- self.js_apis = [WindowAPI(self.id, self.app)]
242
+ self.js_apis = [WindowAPI()]
243
243
  for js_api in js_apis:
244
244
  self.js_apis.append(js_api)
245
245
  self.shortcuts = {}
@@ -374,6 +374,11 @@ class BrowserWindow:
374
374
  # Register additional JS APIs
375
375
  if self.js_apis:
376
376
  for js_api in self.js_apis:
377
+ # Define window_id, window, and app for each JS API
378
+ js_api.window_id = self.id
379
+ js_api.window = self
380
+ js_api.app = self.app
381
+
377
382
  self.channel.registerObject(js_api.__class__.__name__, js_api)
378
383
 
379
384
  self.web_view.page().setWebChannel(self.channel)
@@ -8,10 +8,10 @@ if TYPE_CHECKING:
8
8
  from ..pyloid import Pyloid
9
9
 
10
10
  class WindowAPI(PyloidAPI):
11
- def __init__(self, window_id: str, app: 'Pyloid'):
12
- super().__init__()
13
- self.window_id: str = window_id
14
- self.app: 'Pyloid' = app
11
+ # def __init__(self, window_id: str, app: 'Pyloid'):
12
+ # super().__init__()
13
+ # self.window_id: str = window_id
14
+ # self.app: 'Pyloid' = app
15
15
 
16
16
  @Bridge(result=str)
17
17
  def getWindowId(self):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes