pyloid 0.22.0.dev5__tar.gz → 0.22.1__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.
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/LICENSE +1 -1
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/PKG-INFO +1 -1
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/pyproject.toml +1 -1
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/pyloid.py +120 -83
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/README.md +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/__init__.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/api.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/autostart.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/browser_window.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/custom/titlebar.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/filewatcher.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/js_api/base.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/js_api/event_api.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/js_api/window_api.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/monitor.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/serve.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/thread_pool.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/timer.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/tray.py +0 -0
- {pyloid-0.22.0.dev5 → pyloid-0.22.1}/src/pyloid/utils.py +0 -0
@@ -198,4 +198,4 @@ Apache License
|
|
198
198
|
distributed under the License is distributed on an "AS IS" BASIS,
|
199
199
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
200
|
See the License for the specific language governing permissions and
|
201
|
-
limitations under the License.
|
201
|
+
limitations under the License.
|
@@ -78,7 +78,6 @@ class _WindowController(QObject):
|
|
78
78
|
)
|
79
79
|
|
80
80
|
|
81
|
-
|
82
81
|
# Only Work in Main Thread
|
83
82
|
class _Pyloid(QApplication):
|
84
83
|
def __init__(
|
@@ -111,7 +110,7 @@ class _Pyloid(QApplication):
|
|
111
110
|
```
|
112
111
|
"""
|
113
112
|
super().__init__(sys.argv)
|
114
|
-
|
113
|
+
|
115
114
|
self.data = data
|
116
115
|
|
117
116
|
self.windows_dict = {} # 윈도우 ID를 키로 사용하는 딕셔너리
|
@@ -396,12 +395,18 @@ class _Pyloid(QApplication):
|
|
396
395
|
if self.windows_dict:
|
397
396
|
# 첫 번째 윈도우 가져오기
|
398
397
|
main_window = next(iter(self.windows_dict.values()))
|
399
|
-
|
400
|
-
|
401
|
-
main_window._window.setWindowState(
|
402
|
-
main_window._window.windowState() & ~Qt.WindowMinimized
|
403
|
-
| Qt.WindowActive
|
398
|
+
was_on_top = bool(
|
399
|
+
main_window._window._window.windowFlags() & Qt.WindowStaysOnTopHint
|
404
400
|
)
|
401
|
+
if not was_on_top:
|
402
|
+
main_window._window._window.setWindowFlag(Qt.WindowStaysOnTopHint, True)
|
403
|
+
main_window._window._window.show()
|
404
|
+
main_window._window.activateWindow()
|
405
|
+
if not was_on_top:
|
406
|
+
main_window._window._window.setWindowFlag(
|
407
|
+
Qt.WindowStaysOnTopHint, False
|
408
|
+
)
|
409
|
+
main_window._window._window.show()
|
405
410
|
|
406
411
|
def show_and_focus_main_window(self):
|
407
412
|
"""
|
@@ -417,12 +422,19 @@ class _Pyloid(QApplication):
|
|
417
422
|
if self.windows_dict:
|
418
423
|
main_window = next(iter(self.windows_dict.values()))
|
419
424
|
main_window._window.show()
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
main_window._window.windowState() & ~Qt.WindowMinimized
|
424
|
-
| Qt.WindowActive
|
425
|
+
|
426
|
+
was_on_top = bool(
|
427
|
+
main_window._window._window.windowFlags() & Qt.WindowStaysOnTopHint
|
425
428
|
)
|
429
|
+
if not was_on_top:
|
430
|
+
main_window._window._window.setWindowFlag(Qt.WindowStaysOnTopHint, True)
|
431
|
+
main_window._window._window.show()
|
432
|
+
main_window._window._window.activateWindow()
|
433
|
+
if not was_on_top:
|
434
|
+
main_window._window._window.setWindowFlag(
|
435
|
+
Qt.WindowStaysOnTopHint, False
|
436
|
+
)
|
437
|
+
main_window._window._window.show()
|
426
438
|
|
427
439
|
def close_all_windows(self):
|
428
440
|
"""
|
@@ -449,7 +461,7 @@ class _Pyloid(QApplication):
|
|
449
461
|
app.quit()
|
450
462
|
```
|
451
463
|
"""
|
452
|
-
|
464
|
+
|
453
465
|
for window in self.windows_dict.values():
|
454
466
|
window._window.close()
|
455
467
|
window.web_page.deleteLater()
|
@@ -464,7 +476,7 @@ class _Pyloid(QApplication):
|
|
464
476
|
def get_window_by_id(self, window_id: str) -> Optional[BrowserWindow]:
|
465
477
|
"""
|
466
478
|
Returns the window with the given ID.
|
467
|
-
|
479
|
+
|
468
480
|
Parameters
|
469
481
|
----------
|
470
482
|
window_id : str
|
@@ -474,14 +486,14 @@ class _Pyloid(QApplication):
|
|
474
486
|
-------
|
475
487
|
Optional[BrowserWindow]
|
476
488
|
The window object with the given ID. Returns None if the window is not found.
|
477
|
-
|
489
|
+
|
478
490
|
Examples
|
479
491
|
--------
|
480
492
|
```python
|
481
493
|
app = Pyloid(app_name="Pyloid-App")
|
482
|
-
|
494
|
+
|
483
495
|
window = app.get_window_by_id("123e4567-e89b-12d3-a456-426614174000")
|
484
|
-
|
496
|
+
|
485
497
|
if window:
|
486
498
|
print("Window found:", window)
|
487
499
|
```
|
@@ -1409,13 +1421,18 @@ class _Pyloid(QApplication):
|
|
1409
1421
|
window.web_view.page().setBackgroundColor(
|
1410
1422
|
Qt.GlobalColor.black if self.theme == "dark" else Qt.GlobalColor.white
|
1411
1423
|
)
|
1412
|
-
|
1424
|
+
|
1413
1425
|
|
1414
1426
|
class Pyloid(QObject):
|
1415
1427
|
command_signal = Signal(str, str, object)
|
1416
1428
|
result_signal = Signal(str, object)
|
1417
|
-
|
1418
|
-
def __init__(
|
1429
|
+
|
1430
|
+
def __init__(
|
1431
|
+
self,
|
1432
|
+
app_name: str,
|
1433
|
+
single_instance: bool = True,
|
1434
|
+
data: Optional[Dict[str, Any]] = None,
|
1435
|
+
):
|
1419
1436
|
"""
|
1420
1437
|
Initialize the Pyloid application.
|
1421
1438
|
|
@@ -1438,13 +1455,13 @@ class Pyloid(QObject):
|
|
1438
1455
|
and is used as an API key to connect to the integrated backend FastAPI server.
|
1439
1456
|
"""
|
1440
1457
|
super().__init__()
|
1441
|
-
|
1458
|
+
|
1442
1459
|
self.data = data
|
1443
1460
|
|
1444
1461
|
self.app = _Pyloid(app_name, single_instance, self.data)
|
1445
|
-
|
1462
|
+
|
1446
1463
|
self.command_signal.connect(self._handle_command)
|
1447
|
-
|
1464
|
+
|
1448
1465
|
@Slot(str, str, object)
|
1449
1466
|
def _handle_command(self, command_id, command_type, params):
|
1450
1467
|
result = None
|
@@ -1461,7 +1478,7 @@ class Pyloid(QObject):
|
|
1461
1478
|
y=params.get("y", 200),
|
1462
1479
|
frame=params.get("frame", True),
|
1463
1480
|
context_menu=params.get("context_menu", False),
|
1464
|
-
dev_tools=params.get("dev_tools", False)
|
1481
|
+
dev_tools=params.get("dev_tools", False),
|
1465
1482
|
)
|
1466
1483
|
result = window
|
1467
1484
|
|
@@ -1502,7 +1519,9 @@ class Pyloid(QObject):
|
|
1502
1519
|
result = self.app.show_notification(params["title"], params["message"])
|
1503
1520
|
|
1504
1521
|
elif command_type == "set_tray_icon_animation":
|
1505
|
-
result = self.app.set_tray_icon_animation(
|
1522
|
+
result = self.app.set_tray_icon_animation(
|
1523
|
+
params["icon_frames"], params.get("interval", 200)
|
1524
|
+
)
|
1506
1525
|
|
1507
1526
|
elif command_type == "set_tray_tooltip":
|
1508
1527
|
result = self.app.set_tray_tooltip(params["message"])
|
@@ -1574,39 +1593,40 @@ class Pyloid(QObject):
|
|
1574
1593
|
return None
|
1575
1594
|
|
1576
1595
|
self.result_signal.emit(command_id, result)
|
1577
|
-
|
1578
|
-
def execute_command(
|
1596
|
+
|
1597
|
+
def execute_command(
|
1598
|
+
self, command_type: str, params: object, timeout: Optional[int] = None
|
1599
|
+
):
|
1579
1600
|
command_id = str(uuid.uuid4())
|
1580
|
-
|
1601
|
+
|
1581
1602
|
result_data = [None]
|
1582
1603
|
loop = QEventLoop()
|
1583
|
-
|
1604
|
+
|
1584
1605
|
if timeout:
|
1585
1606
|
timer = QTimer()
|
1586
1607
|
timer.setSingleShot(True)
|
1587
1608
|
timer.timeout.connect(loop.quit)
|
1588
1609
|
timer.start(timeout)
|
1589
|
-
|
1610
|
+
|
1590
1611
|
def on_result(received_id, result):
|
1591
1612
|
if received_id == command_id:
|
1592
|
-
result_data[0] = result
|
1613
|
+
result_data[0] = result
|
1593
1614
|
loop.quit()
|
1594
1615
|
|
1595
|
-
|
1596
1616
|
self.result_signal.connect(on_result, Qt.QueuedConnection)
|
1597
|
-
|
1617
|
+
|
1598
1618
|
self.command_signal.emit(command_id, command_type, params)
|
1599
|
-
|
1619
|
+
|
1600
1620
|
loop.exec()
|
1601
|
-
|
1621
|
+
|
1602
1622
|
self.result_signal.disconnect(on_result)
|
1603
|
-
|
1623
|
+
|
1604
1624
|
return result_data[0]
|
1605
|
-
|
1625
|
+
|
1606
1626
|
# -------------------------------------------------------------------
|
1607
1627
|
# Execute_command 래퍼 (wrapper) 함수들
|
1608
1628
|
# -------------------------------------------------------------------
|
1609
|
-
|
1629
|
+
|
1610
1630
|
def set_icon(self, icon_path: str) -> bool:
|
1611
1631
|
"""
|
1612
1632
|
Dynamically sets the application's icon.
|
@@ -1622,7 +1642,7 @@ class Pyloid(QObject):
|
|
1622
1642
|
>>> app.set_icon("icons/icon.png")
|
1623
1643
|
"""
|
1624
1644
|
return self.execute_command("set_icon", {"icon_path": icon_path})
|
1625
|
-
|
1645
|
+
|
1626
1646
|
def create_window(
|
1627
1647
|
self,
|
1628
1648
|
title: str,
|
@@ -1677,7 +1697,7 @@ class Pyloid(QObject):
|
|
1677
1697
|
"dev_tools": dev_tools,
|
1678
1698
|
}
|
1679
1699
|
return self.execute_command("create_window", params)
|
1680
|
-
|
1700
|
+
|
1681
1701
|
def run(self) -> None:
|
1682
1702
|
"""
|
1683
1703
|
Runs the application event loop.
|
@@ -1688,7 +1708,7 @@ class Pyloid(QObject):
|
|
1688
1708
|
>>> app.run()
|
1689
1709
|
"""
|
1690
1710
|
return self.app.run()
|
1691
|
-
|
1711
|
+
|
1692
1712
|
def get_windows(self) -> Dict[str, BrowserWindow]:
|
1693
1713
|
"""
|
1694
1714
|
Returns a list of all browser windows.
|
@@ -1704,7 +1724,7 @@ class Pyloid(QObject):
|
|
1704
1724
|
>>> windows = app.get_windows()
|
1705
1725
|
"""
|
1706
1726
|
return self.execute_command("get_windows", {})
|
1707
|
-
|
1727
|
+
|
1708
1728
|
def show_main_window(self) -> None:
|
1709
1729
|
"""
|
1710
1730
|
Shows and focuses the first window.
|
@@ -1715,7 +1735,7 @@ class Pyloid(QObject):
|
|
1715
1735
|
>>> app.show_main_window()
|
1716
1736
|
"""
|
1717
1737
|
return self.execute_command("show_main_window", {})
|
1718
|
-
|
1738
|
+
|
1719
1739
|
def focus_main_window(self) -> None:
|
1720
1740
|
"""
|
1721
1741
|
Focuses the first window.
|
@@ -1726,7 +1746,7 @@ class Pyloid(QObject):
|
|
1726
1746
|
>>> app.focus_main_window()
|
1727
1747
|
"""
|
1728
1748
|
return self.execute_command("focus_main_window", {})
|
1729
|
-
|
1749
|
+
|
1730
1750
|
def show_and_focus_main_window(self) -> None:
|
1731
1751
|
"""
|
1732
1752
|
Shows and focuses the first window.
|
@@ -1737,7 +1757,7 @@ class Pyloid(QObject):
|
|
1737
1757
|
>>> app.show_and_focus_main_window()
|
1738
1758
|
"""
|
1739
1759
|
return self.execute_command("show_and_focus_main_window", {})
|
1740
|
-
|
1760
|
+
|
1741
1761
|
def close_all_windows(self) -> None:
|
1742
1762
|
"""
|
1743
1763
|
Closes all windows.
|
@@ -1748,7 +1768,7 @@ class Pyloid(QObject):
|
|
1748
1768
|
>>> app.close_all_windows()
|
1749
1769
|
"""
|
1750
1770
|
return self.execute_command("close_all_windows", {})
|
1751
|
-
|
1771
|
+
|
1752
1772
|
def quit(self) -> None:
|
1753
1773
|
"""
|
1754
1774
|
Quits the application.
|
@@ -1759,7 +1779,7 @@ class Pyloid(QObject):
|
|
1759
1779
|
>>> app.quit()
|
1760
1780
|
"""
|
1761
1781
|
return self.execute_command("quit", {})
|
1762
|
-
|
1782
|
+
|
1763
1783
|
def get_window_by_id(self, window_id: str) -> Optional[BrowserWindow]:
|
1764
1784
|
"""
|
1765
1785
|
Returns the window with the given ID.
|
@@ -1780,7 +1800,7 @@ class Pyloid(QObject):
|
|
1780
1800
|
>>> window = app.get_window_by_id("some-window-id")
|
1781
1801
|
"""
|
1782
1802
|
return self.execute_command("get_window_by_id", {"window_id": window_id})
|
1783
|
-
|
1803
|
+
|
1784
1804
|
def set_tray_icon(self, tray_icon_path: str) -> bool:
|
1785
1805
|
"""
|
1786
1806
|
Dynamically sets the tray icon.
|
@@ -1796,8 +1816,10 @@ class Pyloid(QObject):
|
|
1796
1816
|
>>> app.set_tray_icon("icons/icon.png")
|
1797
1817
|
"""
|
1798
1818
|
return self.execute_command("set_tray_icon", {"tray_icon_path": tray_icon_path})
|
1799
|
-
|
1800
|
-
def set_tray_menu_items(
|
1819
|
+
|
1820
|
+
def set_tray_menu_items(
|
1821
|
+
self, tray_menu_items: List[Dict[str, Union[str, Callable]]]
|
1822
|
+
) -> bool:
|
1801
1823
|
"""
|
1802
1824
|
Dynamically sets the tray menu items.
|
1803
1825
|
|
@@ -1813,8 +1835,10 @@ class Pyloid(QObject):
|
|
1813
1835
|
>>> {"label": "Exit", "callback": app.quit}]
|
1814
1836
|
>>> app.set_tray_menu_items(menu_items)
|
1815
1837
|
"""
|
1816
|
-
return self.execute_command(
|
1817
|
-
|
1838
|
+
return self.execute_command(
|
1839
|
+
"set_tray_menu_items", {"tray_menu_items": tray_menu_items}
|
1840
|
+
)
|
1841
|
+
|
1818
1842
|
def set_tray_actions(self, actions: Dict[TrayEvent, Callable]) -> bool:
|
1819
1843
|
"""
|
1820
1844
|
Dynamically sets the actions for tray icon activation.
|
@@ -1830,7 +1854,7 @@ class Pyloid(QObject):
|
|
1830
1854
|
>>> app.set_tray_actions({TrayEvent.DoubleClick: lambda: print("Double-clicked")})
|
1831
1855
|
"""
|
1832
1856
|
return self.execute_command("set_tray_actions", {"actions": actions})
|
1833
|
-
|
1857
|
+
|
1834
1858
|
def show_notification(self, title: str, message: str) -> bool:
|
1835
1859
|
"""
|
1836
1860
|
Displays a notification in the system tray.
|
@@ -1847,9 +1871,13 @@ class Pyloid(QObject):
|
|
1847
1871
|
>>> app = Pyloid(app_name="Pyloid-App")
|
1848
1872
|
>>> app.show_notification("Update Available", "A new update is available for download.")
|
1849
1873
|
"""
|
1850
|
-
return self.execute_command(
|
1851
|
-
|
1852
|
-
|
1874
|
+
return self.execute_command(
|
1875
|
+
"show_notification", {"title": title, "message": message}
|
1876
|
+
)
|
1877
|
+
|
1878
|
+
def set_tray_icon_animation(
|
1879
|
+
self, icon_frames: List[str], interval: int = 200
|
1880
|
+
) -> bool:
|
1853
1881
|
"""
|
1854
1882
|
Dynamically sets and starts the animation for the tray icon.
|
1855
1883
|
|
@@ -1865,8 +1893,11 @@ class Pyloid(QObject):
|
|
1865
1893
|
>>> app = Pyloid(app_name="Pyloid-App")
|
1866
1894
|
>>> app.set_tray_icon_animation(["frame1.png", "frame2.png", "frame3.png"], 100)
|
1867
1895
|
"""
|
1868
|
-
return self.execute_command(
|
1869
|
-
|
1896
|
+
return self.execute_command(
|
1897
|
+
"set_tray_icon_animation",
|
1898
|
+
{"icon_frames": icon_frames, "interval": interval},
|
1899
|
+
)
|
1900
|
+
|
1870
1901
|
def set_tray_tooltip(self, message: str) -> bool:
|
1871
1902
|
"""
|
1872
1903
|
Dynamically sets the tooltip for the tray icon.
|
@@ -1882,7 +1913,7 @@ class Pyloid(QObject):
|
|
1882
1913
|
>>> app.set_tray_tooltip("Pyloid is running")
|
1883
1914
|
"""
|
1884
1915
|
return self.execute_command("set_tray_tooltip", {"message": message})
|
1885
|
-
|
1916
|
+
|
1886
1917
|
def set_notification_callback(self, callback: Callable[[str], None]) -> bool:
|
1887
1918
|
"""
|
1888
1919
|
Sets the callback function to be called when a notification is clicked.
|
@@ -1900,7 +1931,7 @@ class Pyloid(QObject):
|
|
1900
1931
|
>>> app.set_notification_callback(on_notification_click)
|
1901
1932
|
"""
|
1902
1933
|
return self.execute_command("set_notification_callback", {"callback": callback})
|
1903
|
-
|
1934
|
+
|
1904
1935
|
def get_all_monitors(self) -> List[Monitor]:
|
1905
1936
|
"""
|
1906
1937
|
Returns information about all connected monitors.
|
@@ -1918,7 +1949,7 @@ class Pyloid(QObject):
|
|
1918
1949
|
>>> print(monitor.info())
|
1919
1950
|
"""
|
1920
1951
|
return self.execute_command("get_all_monitors", {})
|
1921
|
-
|
1952
|
+
|
1922
1953
|
def get_primary_monitor(self) -> Monitor:
|
1923
1954
|
"""
|
1924
1955
|
Returns information about the primary monitor.
|
@@ -1935,7 +1966,7 @@ class Pyloid(QObject):
|
|
1935
1966
|
>>> print(primary_monitor.info())
|
1936
1967
|
"""
|
1937
1968
|
return self.execute_command("get_primary_monitor", {})
|
1938
|
-
|
1969
|
+
|
1939
1970
|
def set_clipboard_text(self, text: str) -> None:
|
1940
1971
|
"""
|
1941
1972
|
Copies text to the clipboard.
|
@@ -1951,7 +1982,7 @@ class Pyloid(QObject):
|
|
1951
1982
|
>>> app.set_clipboard_text("Hello, World!")
|
1952
1983
|
"""
|
1953
1984
|
return self.execute_command("set_clipboard_text", {"text": text})
|
1954
|
-
|
1985
|
+
|
1955
1986
|
def get_clipboard_text(self) -> str:
|
1956
1987
|
"""
|
1957
1988
|
Retrieves text from the clipboard.
|
@@ -1968,7 +1999,7 @@ class Pyloid(QObject):
|
|
1968
1999
|
>>> print(text)
|
1969
2000
|
"""
|
1970
2001
|
return self.execute_command("get_clipboard_text", {})
|
1971
|
-
|
2002
|
+
|
1972
2003
|
def set_clipboard_image(self, image: Union[str, bytes, os.PathLike]) -> None:
|
1973
2004
|
"""
|
1974
2005
|
Copies an image to the clipboard.
|
@@ -1984,7 +2015,7 @@ class Pyloid(QObject):
|
|
1984
2015
|
>>> app.set_clipboard_image("/path/to/image.png")
|
1985
2016
|
"""
|
1986
2017
|
return self.execute_command("set_clipboard_image", {"image": image})
|
1987
|
-
|
2018
|
+
|
1988
2019
|
def get_clipboard_image(self) -> QImage:
|
1989
2020
|
"""
|
1990
2021
|
Retrieves an image from the clipboard.
|
@@ -2002,7 +2033,7 @@ class Pyloid(QObject):
|
|
2002
2033
|
>>> image.save("/path/to/save/image.png")
|
2003
2034
|
"""
|
2004
2035
|
return self.execute_command("get_clipboard_image", {})
|
2005
|
-
|
2036
|
+
|
2006
2037
|
def set_auto_start(self, enable: bool) -> Union[bool, None]:
|
2007
2038
|
"""
|
2008
2039
|
Sets the application to start automatically at system startup.
|
@@ -2023,7 +2054,7 @@ class Pyloid(QObject):
|
|
2023
2054
|
>>> app.set_auto_start(True)
|
2024
2055
|
"""
|
2025
2056
|
return self.execute_command("set_auto_start", {"enable": enable})
|
2026
|
-
|
2057
|
+
|
2027
2058
|
def is_auto_start(self) -> bool:
|
2028
2059
|
"""
|
2029
2060
|
Checks if the application is set to start automatically at system startup.
|
@@ -2040,7 +2071,7 @@ class Pyloid(QObject):
|
|
2040
2071
|
>>> print(auto_start_enabled)
|
2041
2072
|
"""
|
2042
2073
|
return self.execute_command("is_auto_start", {})
|
2043
|
-
|
2074
|
+
|
2044
2075
|
def watch_file(self, file_path: str) -> bool:
|
2045
2076
|
"""
|
2046
2077
|
Adds a file to the watch list.
|
@@ -2061,7 +2092,7 @@ class Pyloid(QObject):
|
|
2061
2092
|
>>> app.watch_file("/path/to/file.txt")
|
2062
2093
|
"""
|
2063
2094
|
return self.execute_command("watch_file", {"file_path": file_path})
|
2064
|
-
|
2095
|
+
|
2065
2096
|
def watch_directory(self, dir_path: str) -> bool:
|
2066
2097
|
"""
|
2067
2098
|
Adds a directory to the watch list.
|
@@ -2082,7 +2113,7 @@ class Pyloid(QObject):
|
|
2082
2113
|
>>> app.watch_directory("/path/to/directory")
|
2083
2114
|
"""
|
2084
2115
|
return self.execute_command("watch_directory", {"dir_path": dir_path})
|
2085
|
-
|
2116
|
+
|
2086
2117
|
def stop_watching(self, path: str) -> bool:
|
2087
2118
|
"""
|
2088
2119
|
Removes a file or directory from the watch list.
|
@@ -2103,7 +2134,7 @@ class Pyloid(QObject):
|
|
2103
2134
|
>>> app.stop_watching("/path/to/file_or_directory")
|
2104
2135
|
"""
|
2105
2136
|
return self.execute_command("stop_watching", {"path": path})
|
2106
|
-
|
2137
|
+
|
2107
2138
|
def get_watched_paths(self) -> List[str]:
|
2108
2139
|
"""
|
2109
2140
|
Returns all currently watched paths.
|
@@ -2120,7 +2151,7 @@ class Pyloid(QObject):
|
|
2120
2151
|
['/path/to/file1.txt', '/path/to/directory']
|
2121
2152
|
"""
|
2122
2153
|
return self.execute_command("get_watched_paths", {})
|
2123
|
-
|
2154
|
+
|
2124
2155
|
def get_watched_files(self) -> List[str]:
|
2125
2156
|
"""
|
2126
2157
|
Returns all currently watched files.
|
@@ -2137,7 +2168,7 @@ class Pyloid(QObject):
|
|
2137
2168
|
['/path/to/file1.txt', '/path/to/file2.txt']
|
2138
2169
|
"""
|
2139
2170
|
return self.execute_command("get_watched_files", {})
|
2140
|
-
|
2171
|
+
|
2141
2172
|
def get_watched_directories(self) -> List[str]:
|
2142
2173
|
"""
|
2143
2174
|
Returns all currently watched directories.
|
@@ -2154,7 +2185,7 @@ class Pyloid(QObject):
|
|
2154
2185
|
['/path/to/directory1', '/path/to/directory2']
|
2155
2186
|
"""
|
2156
2187
|
return self.execute_command("get_watched_directories", {})
|
2157
|
-
|
2188
|
+
|
2158
2189
|
def remove_all_watched_paths(self) -> None:
|
2159
2190
|
"""
|
2160
2191
|
Removes all paths from the watch list.
|
@@ -2165,7 +2196,7 @@ class Pyloid(QObject):
|
|
2165
2196
|
>>> app.remove_all_watched_paths()
|
2166
2197
|
"""
|
2167
2198
|
return self.execute_command("remove_all_watched_paths", {})
|
2168
|
-
|
2199
|
+
|
2169
2200
|
def set_file_change_callback(self, callback: Callable[[str], None]) -> None:
|
2170
2201
|
"""
|
2171
2202
|
Sets the callback function to be called when a file is changed.
|
@@ -2183,7 +2214,7 @@ class Pyloid(QObject):
|
|
2183
2214
|
>>> app.set_file_change_callback(on_file_change)
|
2184
2215
|
"""
|
2185
2216
|
return self.execute_command("set_file_change_callback", {"callback": callback})
|
2186
|
-
|
2217
|
+
|
2187
2218
|
def set_directory_change_callback(self, callback: Callable[[str], None]) -> None:
|
2188
2219
|
"""
|
2189
2220
|
Sets the callback function to be called when a directory is changed.
|
@@ -2200,9 +2231,13 @@ class Pyloid(QObject):
|
|
2200
2231
|
>>> app = Pyloid(app_name="Pyloid-App")
|
2201
2232
|
>>> app.set_directory_change_callback(on_directory_change)
|
2202
2233
|
"""
|
2203
|
-
return self.execute_command(
|
2204
|
-
|
2205
|
-
|
2234
|
+
return self.execute_command(
|
2235
|
+
"set_directory_change_callback", {"callback": callback}
|
2236
|
+
)
|
2237
|
+
|
2238
|
+
def open_file_dialog(
|
2239
|
+
self, dir: Optional[str] = None, filter: Optional[str] = None
|
2240
|
+
) -> Optional[str]:
|
2206
2241
|
"""
|
2207
2242
|
Opens a file dialog to select a file to open.
|
2208
2243
|
|
@@ -2224,8 +2259,10 @@ class Pyloid(QObject):
|
|
2224
2259
|
>>> file_path = app.open_file_dialog(dir="/home/user", filter="Text Files (*.txt)")
|
2225
2260
|
"""
|
2226
2261
|
return self.execute_command("open_file_dialog", {"dir": dir, "filter": filter})
|
2227
|
-
|
2228
|
-
def save_file_dialog(
|
2262
|
+
|
2263
|
+
def save_file_dialog(
|
2264
|
+
self, dir: Optional[str] = None, filter: Optional[str] = None
|
2265
|
+
) -> Optional[str]:
|
2229
2266
|
"""
|
2230
2267
|
Opens a file dialog to select a file to save.
|
2231
2268
|
|
@@ -2247,7 +2284,7 @@ class Pyloid(QObject):
|
|
2247
2284
|
>>> file_path = app.save_file_dialog(dir="/home/user", filter="Text Files (*.txt)")
|
2248
2285
|
"""
|
2249
2286
|
return self.execute_command("save_file_dialog", {"dir": dir, "filter": filter})
|
2250
|
-
|
2287
|
+
|
2251
2288
|
def select_directory_dialog(self, dir: Optional[str] = None) -> Optional[str]:
|
2252
2289
|
"""
|
2253
2290
|
Opens a dialog to select a directory.
|
@@ -2267,4 +2304,4 @@ class Pyloid(QObject):
|
|
2267
2304
|
>>> app = Pyloid(app_name="Pyloid-App")
|
2268
2305
|
>>> directory_path = app.select_directory_dialog(dir="/home/user")
|
2269
2306
|
"""
|
2270
|
-
return self.execute_command("select_directory_dialog", {"dir": dir})
|
2307
|
+
return self.execute_command("select_directory_dialog", {"dir": dir})
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|