pyloid 0.11.2__py3-none-any.whl → 0.11.4__py3-none-any.whl

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.
pyloid/pyloid.py CHANGED
@@ -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,13 +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
- if window:
68
- return window.get_window_properties()
69
- return None
83
+ window_properties = window.get_window_properties()
84
+ return window_properties
70
85
 
71
86
  @Bridge()
72
87
  def close(self):
@@ -167,6 +182,44 @@ class WindowAPI(PyloidAPI):
167
182
  return window.capture(save_path)
168
183
  return None
169
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
+
170
223
 
171
224
  # class EventAPI(PylonAPI):
172
225
  # def __init__(self, window_id: str, app):
@@ -398,27 +451,21 @@ class BrowserWindow:
398
451
  self.dev_tools_window.resize(800, 600)
399
452
  self.dev_tools_window.show()
400
453
 
401
- def get_window_properties(self):
402
- """Returns the properties of the window."""
403
- return {
404
- "id": self.id,
405
- "title": self.title,
406
- "width": self.width,
407
- "height": self.height,
408
- "x": self.x,
409
- "y": self.y,
410
- "frame": self.frame,
411
- "context_menu": self.context_menu,
412
- "dev_tools": self.dev_tools,
413
- "js_apis": self.js_apis,
414
- }
415
-
416
- def get_id(self):
417
- """Returns the ID of the window."""
418
- 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
+ )
419
458
 
420
459
  def closeEvent(self, event):
421
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()
422
469
  self._remove_from_app_windows()
423
470
  event.accept() # Accept the event (allow the window to close)
424
471
 
@@ -558,14 +605,46 @@ class BrowserWindow:
558
605
  ###########################################################################################
559
606
  # Get Properties
560
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
+ }
561
621
 
562
-
563
-
564
-
565
-
566
-
567
-
568
-
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
+
569
648
 
570
649
 
571
650
  class _WindowController(QObject):
@@ -604,7 +683,7 @@ class Pyloid(QApplication):
604
683
 
605
684
  self.app_name = app_name
606
685
  self.app_path = sys.executable
607
-
686
+
608
687
  self.auto_start = AutoStart(self.app_name, self.app_path)
609
688
 
610
689
  self.animation_timer = None
@@ -749,8 +828,11 @@ class Pyloid(QApplication):
749
828
  window._window.close()
750
829
 
751
830
  def quit(self):
752
- """Quits the application."""
753
- 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()
754
836
  QApplication.quit()
755
837
 
756
838
  ###########################################################################################
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyloid
3
- Version: 0.11.2
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
 
@@ -3,11 +3,11 @@ pyloid/api.py,sha256=whgfvPr1A6iwZ1Ewo-0FnOUNnt1K58c-P7YjzuQHcUM,194
3
3
  pyloid/autostart.py,sha256=K7DQYl4LHItvPp0bt1V9WwaaZmVSTeGvadkcwG-KKrI,3899
4
4
  pyloid/filewatcher.py,sha256=n8N56D65le5TpsgxXb7z-FO_0lqv4UYD4yGq_UuMrAs,1285
5
5
  pyloid/monitor.py,sha256=fqDnZ_7dpxVZLVJ5gCluDRY2USrQ5YL_fw1AnYivhsk,12741
6
- pyloid/pyloid.py,sha256=kMhVZqlC9T_UoSU68PYK_EsfoQygMup7TYcqwQugLhM,40959
6
+ pyloid/pyloid.py,sha256=U5sj7eFQD2pHmGvZS7OEzp9t1ijFOvl9ocyxKRJeBxQ,43979
7
7
  pyloid/timer.py,sha256=1bYhqte3rV77vaeMUkcTgmx2ux7FtCqLCx9lIC2-COg,4360
8
8
  pyloid/tray.py,sha256=rXgdkvzGxtie_EIcTSA7fjuta4nJk5THhNkGFcfv5Ew,634
9
9
  pyloid/utils.py,sha256=DQerZWU_0o8dHcJ5y3yXf9i5OXn7KQZqU-hVBq3uPUA,711
10
- pyloid-0.11.2.dist-info/LICENSE,sha256=F96EzotgWhhpnQTW2TcdoqrMDir1jyEo6H915tGQ-QE,11524
11
- pyloid-0.11.2.dist-info/METADATA,sha256=NB8rY_y-RFUT7f-h6ncjuFGslx0lnbJks6fb9-5hJxs,6068
12
- pyloid-0.11.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
13
- pyloid-0.11.2.dist-info/RECORD,,
10
+ pyloid-0.11.4.dist-info/LICENSE,sha256=F96EzotgWhhpnQTW2TcdoqrMDir1jyEo6H915tGQ-QE,11524
11
+ pyloid-0.11.4.dist-info/METADATA,sha256=0SydL9Dkvkujxp9ekLEmsZrAGyUrNIiw_Rk_w4omhN4,6069
12
+ pyloid-0.11.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
13
+ pyloid-0.11.4.dist-info/RECORD,,