pyloid 0.16.0__tar.gz → 0.16.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pyloid-0.16.0 → pyloid-0.16.2}/PKG-INFO +1 -1
- {pyloid-0.16.0 → pyloid-0.16.2}/pyproject.toml +1 -1
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/browser_window.py +65 -6
- {pyloid-0.16.0 → pyloid-0.16.2}/LICENSE +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/README.md +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/__init__.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/api.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/autostart.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/custom/titlebar.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/filewatcher.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/js_api/event_api.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/js_api/window_api.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/monitor.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/pyloid.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/timer.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/tray.py +0 -0
- {pyloid-0.16.0 → pyloid-0.16.2}/src/pyloid/utils.py +0 -0
@@ -24,6 +24,7 @@ from .custom.titlebar import CustomTitleBar
|
|
24
24
|
from .js_api.window_api import WindowAPI
|
25
25
|
from PySide6.QtGui import QPixmap, QMovie
|
26
26
|
from PySide6.QtWidgets import QSplashScreen, QLabel
|
27
|
+
from PySide6.QtCore import QSize
|
27
28
|
|
28
29
|
|
29
30
|
# 어차피 load 부분에만 쓰이니까 나중에 분리해서 load 위에서 선언하자.
|
@@ -353,7 +354,7 @@ class BrowserWindow:
|
|
353
354
|
###########################################################################################
|
354
355
|
# Load
|
355
356
|
###########################################################################################
|
356
|
-
def load_file(self, file_path):
|
357
|
+
def load_file(self, file_path: str):
|
357
358
|
"""
|
358
359
|
Loads a local HTML file into the web view.
|
359
360
|
|
@@ -374,7 +375,7 @@ class BrowserWindow:
|
|
374
375
|
self.web_view.setUrl(QUrl.fromLocalFile(file_path))
|
375
376
|
self.web_view.focusProxy().installEventFilter(self.web_view)
|
376
377
|
|
377
|
-
def load_url(self, url):
|
378
|
+
def load_url(self, url: str):
|
378
379
|
"""
|
379
380
|
Sets the URL of the window.
|
380
381
|
|
@@ -394,6 +395,29 @@ class BrowserWindow:
|
|
394
395
|
self.web_view.setUrl(QUrl(url))
|
395
396
|
self.web_view.focusProxy().installEventFilter(self.web_view)
|
396
397
|
|
398
|
+
def load_html(self, html_content: str, base_url: str = ""):
|
399
|
+
"""
|
400
|
+
Loads HTML content directly into the web view.
|
401
|
+
|
402
|
+
Parameters
|
403
|
+
----------
|
404
|
+
html_content : str
|
405
|
+
The HTML content to be loaded.
|
406
|
+
base_url : str, optional
|
407
|
+
The base URL to use for resolving relative URLs (default is "").
|
408
|
+
|
409
|
+
Examples
|
410
|
+
--------
|
411
|
+
>>> app = Pyloid(app_name="Pyloid-App")
|
412
|
+
>>> window = app.create_window("pyloid-window")
|
413
|
+
>>> html_content = "<html><body><h1>Hello, Pyloid!</h1></body></html>"
|
414
|
+
>>> window.load_html(html_content)
|
415
|
+
>>> window.show()
|
416
|
+
"""
|
417
|
+
self._load()
|
418
|
+
self.web_view.setHtml(html_content, QUrl(base_url))
|
419
|
+
self.web_view.focusProxy().installEventFilter(self.web_view)
|
420
|
+
|
397
421
|
###########################################################################################
|
398
422
|
# Set Parameters
|
399
423
|
###########################################################################################
|
@@ -1372,6 +1396,7 @@ class BrowserWindow:
|
|
1372
1396
|
close_on_load: bool = True,
|
1373
1397
|
stay_on_top: bool = True,
|
1374
1398
|
clickable: bool = True,
|
1399
|
+
position: str = "center",
|
1375
1400
|
):
|
1376
1401
|
"""
|
1377
1402
|
Sets the static image splash screen of the window.
|
@@ -1387,6 +1412,8 @@ class BrowserWindow:
|
|
1387
1412
|
clickable : bool, optional
|
1388
1413
|
True to make the splash screen clickable, False otherwise (default is True)
|
1389
1414
|
if clickable is True, you can click the splash screen to close it.
|
1415
|
+
position : str, optional
|
1416
|
+
Position of the splash screen. Options are 'center', 'top-left', 'top-right', 'bottom-left', 'bottom-right' (default is 'center')
|
1390
1417
|
|
1391
1418
|
Examples
|
1392
1419
|
--------
|
@@ -1412,6 +1439,7 @@ class BrowserWindow:
|
|
1412
1439
|
|
1413
1440
|
self.close_on_load = close_on_load
|
1414
1441
|
self.splash_screen = splash
|
1442
|
+
self._position_splash_screen(position)
|
1415
1443
|
self.splash_screen.show()
|
1416
1444
|
|
1417
1445
|
def set_gif_splash_screen(
|
@@ -1420,6 +1448,7 @@ class BrowserWindow:
|
|
1420
1448
|
close_on_load: bool = True,
|
1421
1449
|
stay_on_top: bool = True,
|
1422
1450
|
clickable: bool = True,
|
1451
|
+
position: str = "center",
|
1423
1452
|
):
|
1424
1453
|
"""
|
1425
1454
|
Sets the gif splash screen of the window.
|
@@ -1435,6 +1464,8 @@ class BrowserWindow:
|
|
1435
1464
|
clickable : bool, optional
|
1436
1465
|
True to make the splash screen clickable, False otherwise (default is True)
|
1437
1466
|
if clickable is True, you can click the splash screen to close it.
|
1467
|
+
position : str, optional
|
1468
|
+
Position of the splash screen. Options are 'center', 'top-left', 'top-right', 'bottom-left', 'bottom-right' (default is 'center')
|
1438
1469
|
|
1439
1470
|
Examples
|
1440
1471
|
--------
|
@@ -1467,17 +1498,45 @@ class BrowserWindow:
|
|
1467
1498
|
movie = QMovie(gif_path)
|
1468
1499
|
label.setMovie(movie)
|
1469
1500
|
|
1470
|
-
# Start animation and show splash screen
|
1471
|
-
movie.start()
|
1472
|
-
splash.show()
|
1473
|
-
|
1474
1501
|
# Adjust splash screen size to match GIF size
|
1475
1502
|
movie.frameChanged.connect(
|
1476
1503
|
lambda: splash.setFixedSize(movie.currentPixmap().size())
|
1477
1504
|
)
|
1478
1505
|
|
1506
|
+
# Start animation and show splash screen
|
1507
|
+
movie.start()
|
1479
1508
|
self.close_on_load = close_on_load
|
1480
1509
|
self.splash_screen = splash
|
1510
|
+
self._position_splash_screen(position)
|
1511
|
+
splash.show()
|
1512
|
+
|
1513
|
+
def _position_splash_screen(self, position: str):
|
1514
|
+
if not self.splash_screen:
|
1515
|
+
return
|
1516
|
+
|
1517
|
+
screen = self.app.primaryScreen().geometry()
|
1518
|
+
splash_size = self.splash_screen.size()
|
1519
|
+
|
1520
|
+
if position == "center":
|
1521
|
+
new_position = screen.center() - QPoint(
|
1522
|
+
splash_size.width() // 2, splash_size.height() // 2
|
1523
|
+
)
|
1524
|
+
elif position == "top-left":
|
1525
|
+
new_position = screen.topLeft()
|
1526
|
+
elif position == "top-right":
|
1527
|
+
new_position = screen.topRight() - QPoint(splash_size.width(), 0)
|
1528
|
+
elif position == "bottom-left":
|
1529
|
+
new_position = screen.bottomLeft() - QPoint(0, splash_size.height())
|
1530
|
+
elif position == "bottom-right":
|
1531
|
+
new_position = screen.bottomRight() - QPoint(
|
1532
|
+
splash_size.width(), splash_size.height()
|
1533
|
+
)
|
1534
|
+
else:
|
1535
|
+
new_position = screen.center() - QPoint(
|
1536
|
+
splash_size.width() // 2, splash_size.height() // 2
|
1537
|
+
)
|
1538
|
+
|
1539
|
+
self.splash_screen.move(new_position)
|
1481
1540
|
|
1482
1541
|
def close_splash_screen(self):
|
1483
1542
|
"""
|
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
|