pyloid 0.11.3__tar.gz → 0.11.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.11.3
3
+ Version: 0.11.4
4
4
  Summary:
5
5
  Author: aesthetics-of-record
6
6
  Author-email: 111675679+aesthetics-of-record@users.noreply.github.com
@@ -48,7 +48,7 @@ With Pyloid, you can leverage the full power of Python in your desktop applicati
48
48
 
49
49
  #### Creating a React + Vite + Pyloid Project ⚛️
50
50
 
51
- [https://github.com/pylonic/pyloid_react_boilerplate](https://github.com/Pyloid/yloid_react_boilerplate)
51
+ [https://github.com/pylonic/pyloid_react_boilerplate](https://github.com/Pyloid/pyloid_react_boilerplate)
52
52
 
53
53
  ### Custom Your Boilerplate 🔨
54
54
 
@@ -33,7 +33,7 @@ With Pyloid, you can leverage the full power of Python in your desktop applicati
33
33
 
34
34
  #### Creating a React + Vite + Pyloid Project ⚛️
35
35
 
36
- [https://github.com/pylonic/pyloid_react_boilerplate](https://github.com/Pyloid/yloid_react_boilerplate)
36
+ [https://github.com/pylonic/pyloid_react_boilerplate](https://github.com/Pyloid/pyloid_react_boilerplate)
37
37
 
38
38
  ### Custom Your Boilerplate 🔨
39
39
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyloid"
3
- version = "0.11.3"
3
+ version = "0.11.4"
4
4
  description = ""
5
5
  authors = ["aesthetics-of-record <111675679+aesthetics-of-record@users.noreply.github.com>"]
6
6
  readme = "README.md"
@@ -8,7 +8,16 @@ from PySide6.QtWidgets import (
8
8
  )
9
9
  from PySide6.QtWebEngineWidgets import QWebEngineView
10
10
  from PySide6.QtWebChannel import QWebChannel
11
- from PySide6.QtGui import QIcon, QKeySequence, QShortcut, QClipboard, QImage, QAction, QPalette, QColor
11
+ from PySide6.QtGui import (
12
+ QIcon,
13
+ QKeySequence,
14
+ QShortcut,
15
+ QClipboard,
16
+ QImage,
17
+ QAction,
18
+ QPalette,
19
+ QColor,
20
+ )
12
21
  from PySide6.QtCore import Qt, Signal, QUrl, QObject, QTimer
13
22
  from PySide6.QtNetwork import QLocalServer, QLocalSocket
14
23
  from PySide6.QtWebEngineCore import QWebEnginePage, QWebEngineSettings
@@ -23,13 +32,14 @@ import json
23
32
  from .autostart import AutoStart
24
33
  from .filewatcher import FileWatcher
25
34
  import logging
26
- from PySide6.QtCore import QCoreApplication
35
+ from PySide6.QtCore import QCoreApplication, QtMsgType
27
36
 
28
37
  # for linux debug
29
38
  os.environ["QTWEBENGINE_DICTIONARIES_PATH"] = "/"
30
39
 
31
40
  # for macos debug
32
- logging.getLogger('Qt').setLevel(logging.ERROR)
41
+ logging.getLogger("Qt").setLevel(logging.ERROR)
42
+
33
43
 
34
44
  def custom_message_handler(mode, context, message):
35
45
  if not hasattr(custom_message_handler, "vulkan_warning_shown") and (
@@ -42,7 +52,13 @@ def custom_message_handler(mode, context, message):
42
52
  )
43
53
  os.environ["QT_QUICK_BACKEND"] = "software"
44
54
  custom_message_handler.vulkan_warning_shown = True
45
- if "vulkan" not in message.lower():
55
+
56
+ if "Autofill.enable failed" in message:
57
+ print(
58
+ "\033[93mPyloid Warning: Autofill is not enabled in developer tools.\033[0m"
59
+ )
60
+
61
+ if "vulkan" not in message.lower() and "Autofill.enable failed" not in message:
46
62
  print(message)
47
63
 
48
64
 
@@ -60,12 +76,12 @@ class WindowAPI(PyloidAPI):
60
76
  """Returns the current window ID."""
61
77
  return self.window_id
62
78
 
63
- @Bridge(result=str)
79
+ @Bridge(result=dict)
64
80
  def getWindowProperties(self):
65
81
  """Returns the properties of the window."""
66
82
  window = self.app.get_window_by_id(self.window_id)
67
83
  window_properties = window.get_window_properties()
68
- return json.dumps(window_properties)
84
+ return window_properties
69
85
 
70
86
  @Bridge()
71
87
  def close(self):
@@ -166,6 +182,44 @@ class WindowAPI(PyloidAPI):
166
182
  return window.capture(save_path)
167
183
  return None
168
184
 
185
+ @Bridge(result=bool)
186
+ def getFrame(self):
187
+ """Returns whether the window has a frame."""
188
+ window = self.app.get_window_by_id(self.window_id)
189
+ return window.frame if window else False
190
+
191
+ @Bridge(result=bool)
192
+ def getContextMenu(self):
193
+ """Returns whether the window has a context menu."""
194
+ window = self.app.get_window_by_id(self.window_id)
195
+ return window.context_menu if window else False
196
+
197
+ @Bridge(result=bool)
198
+ def getDevTools(self):
199
+ """Returns whether the window has developer tools."""
200
+ window = self.app.get_window_by_id(self.window_id)
201
+ return window.dev_tools if window else False
202
+
203
+ @Bridge(result=str)
204
+ def getTitle(self):
205
+ """Returns the title of the window."""
206
+ window = self.app.get_window_by_id(self.window_id)
207
+ return window.title if window else ""
208
+
209
+ @Bridge(result=dict)
210
+ def getSize(self):
211
+ """Returns the size of the window."""
212
+ window = self.app.get_window_by_id(self.window_id)
213
+ return {"width": window.width, "height": window.height} if window else {"width": 0, "height": 0}
214
+
215
+ @Bridge(result=dict)
216
+ def getPosition(self):
217
+ """Returns the position of the window."""
218
+ window = self.app.get_window_by_id(self.window_id)
219
+ return {"x": window.x, "y": window.y} if window else {"x": 0, "y": 0}
220
+
221
+
222
+
169
223
 
170
224
  # class EventAPI(PylonAPI):
171
225
  # def __init__(self, window_id: str, app):
@@ -397,26 +451,21 @@ class BrowserWindow:
397
451
  self.dev_tools_window.resize(800, 600)
398
452
  self.dev_tools_window.show()
399
453
 
400
- def get_window_properties(self):
401
- """Returns the properties of the window."""
402
- return {
403
- "id": self.id,
404
- "title": self.title,
405
- "width": self.width,
406
- "height": self.height,
407
- "x": self.x,
408
- "y": self.y,
409
- "frame": self.frame,
410
- "context_menu": self.context_menu,
411
- "dev_tools": self.dev_tools,
412
- }
413
-
414
- def get_id(self):
415
- """Returns the ID of the window."""
416
- return self.id
454
+ # Add this line to handle dev tools window closure
455
+ self.dev_tools_window.closeEvent = lambda event: setattr(
456
+ self, "dev_tools_window", None
457
+ )
417
458
 
418
459
  def closeEvent(self, event):
419
460
  """Handles the event when the window is closed."""
461
+ # Close developer tools if open
462
+ if hasattr(self, "dev_tools_window") and self.dev_tools_window:
463
+ self.dev_tools_window.close()
464
+ self.dev_tools_window = None
465
+
466
+ # Solve memory leak issue with web view engine
467
+ self.web_view.page().deleteLater()
468
+ self.web_view.deleteLater()
420
469
  self._remove_from_app_windows()
421
470
  event.accept() # Accept the event (allow the window to close)
422
471
 
@@ -556,14 +605,46 @@ class BrowserWindow:
556
605
  ###########################################################################################
557
606
  # Get Properties
558
607
  ###########################################################################################
608
+ def get_window_properties(self):
609
+ """Returns the properties of the window."""
610
+ return {
611
+ "id": self.id,
612
+ "title": self.title,
613
+ "width": self.width,
614
+ "height": self.height,
615
+ "x": self.x,
616
+ "y": self.y,
617
+ "frame": self.frame,
618
+ "context_menu": self.context_menu,
619
+ "dev_tools": self.dev_tools,
620
+ }
559
621
 
560
-
561
-
562
-
563
-
564
-
565
-
566
-
622
+ def get_id(self):
623
+ """Returns the ID of the window."""
624
+ return self.id
625
+
626
+ def get_size(self) -> Dict[str, int]:
627
+ """Returns the size of the window."""
628
+ return {"width": self.width, "height": self.height}
629
+
630
+ def get_position(self) -> Dict[str, int]:
631
+ """Returns the position of the window."""
632
+ return {"x": self.x, "y": self.y}
633
+
634
+ def get_title(self) -> str:
635
+ """Returns the title of the window."""
636
+ return self.title
637
+
638
+ def get_url(self) -> str:
639
+ """Returns the URL of the window."""
640
+ return self.web_view.url().toString()
641
+
642
+ def get_visible(self) -> bool:
643
+ """Returns the visibility of the window."""
644
+ return self._window.isVisible()
645
+
646
+
647
+
567
648
 
568
649
 
569
650
  class _WindowController(QObject):
@@ -602,7 +683,7 @@ class Pyloid(QApplication):
602
683
 
603
684
  self.app_name = app_name
604
685
  self.app_path = sys.executable
605
-
686
+
606
687
  self.auto_start = AutoStart(self.app_name, self.app_path)
607
688
 
608
689
  self.animation_timer = None
@@ -747,8 +828,11 @@ class Pyloid(QApplication):
747
828
  window._window.close()
748
829
 
749
830
  def quit(self):
750
- """Quits the application."""
751
- self.close_all_windows()
831
+ """애플리케이션을 종료합니다."""
832
+ for window in self.windows:
833
+ window._window.close()
834
+ window.web_page.deleteLater()
835
+ window.web_view.deleteLater()
752
836
  QApplication.quit()
753
837
 
754
838
  ###########################################################################################
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes