pyloid 0.16.1__py3-none-any.whl → 0.16.3__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/browser_window.py
CHANGED
@@ -24,6 +24,11 @@ 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
|
28
|
+
from typing import TYPE_CHECKING
|
29
|
+
|
30
|
+
if TYPE_CHECKING:
|
31
|
+
from ..pyloid import Pyloid
|
27
32
|
|
28
33
|
|
29
34
|
# 어차피 load 부분에만 쓰이니까 나중에 분리해서 load 위에서 선언하자.
|
@@ -163,7 +168,7 @@ class CustomWebEngineView(QWebEngineView):
|
|
163
168
|
class BrowserWindow:
|
164
169
|
def __init__(
|
165
170
|
self,
|
166
|
-
app,
|
171
|
+
app: "Pyloid",
|
167
172
|
title: str = "pyloid app",
|
168
173
|
width: int = 800,
|
169
174
|
height: int = 600,
|
@@ -480,6 +485,57 @@ class BrowserWindow:
|
|
480
485
|
self.y = y
|
481
486
|
self._window.setGeometry(self.x, self.y, self.width, self.height)
|
482
487
|
|
488
|
+
def set_position_by_anchor(self, anchor: str):
|
489
|
+
"""
|
490
|
+
Positions the window at a specific location on the screen.
|
491
|
+
|
492
|
+
Parameters
|
493
|
+
----------
|
494
|
+
anchor : str
|
495
|
+
The anchor point indicating where to position the window.
|
496
|
+
Possible values: 'center', 'top', 'bottom', 'left', 'right',
|
497
|
+
'top-left', 'top-right', 'bottom-left', 'bottom-right'
|
498
|
+
|
499
|
+
Examples
|
500
|
+
--------
|
501
|
+
>>> window.set_position_by_anchor('center')
|
502
|
+
>>> window.set_position_by_anchor('top-right')
|
503
|
+
"""
|
504
|
+
screen = self.app.primaryScreen().availableGeometry()
|
505
|
+
window_size = self.get_size()
|
506
|
+
|
507
|
+
if anchor == "center":
|
508
|
+
x = (screen.width() - window_size["width"]) // 2
|
509
|
+
y = (screen.height() - window_size["height"]) // 2
|
510
|
+
elif anchor == "top":
|
511
|
+
x = (screen.width() - window_size["width"]) // 2
|
512
|
+
y = screen.top()
|
513
|
+
elif anchor == "bottom":
|
514
|
+
x = (screen.width() - window_size["width"]) // 2
|
515
|
+
y = screen.bottom() - window_size["height"]
|
516
|
+
elif anchor == "left":
|
517
|
+
x = screen.left()
|
518
|
+
y = (screen.height() - window_size["height"]) // 2
|
519
|
+
elif anchor == "right":
|
520
|
+
x = screen.right() - window_size["width"]
|
521
|
+
y = (screen.height() - window_size["height"]) // 2
|
522
|
+
elif anchor == "top-left":
|
523
|
+
x = screen.left()
|
524
|
+
y = screen.top()
|
525
|
+
elif anchor == "top-right":
|
526
|
+
x = screen.right() - window_size["width"]
|
527
|
+
y = screen.top()
|
528
|
+
elif anchor == "bottom-left":
|
529
|
+
x = screen.left()
|
530
|
+
y = screen.bottom() - window_size["height"]
|
531
|
+
elif anchor == "bottom-right":
|
532
|
+
x = screen.right() - window_size["width"]
|
533
|
+
y = screen.bottom() - window_size["height"]
|
534
|
+
else:
|
535
|
+
raise ValueError("Invalid anchor point.")
|
536
|
+
|
537
|
+
self.set_position(x, y)
|
538
|
+
|
483
539
|
def set_frame(self, frame: bool):
|
484
540
|
"""
|
485
541
|
Sets the frame of the window.
|
@@ -1395,6 +1451,7 @@ class BrowserWindow:
|
|
1395
1451
|
close_on_load: bool = True,
|
1396
1452
|
stay_on_top: bool = True,
|
1397
1453
|
clickable: bool = True,
|
1454
|
+
position: str = "center",
|
1398
1455
|
):
|
1399
1456
|
"""
|
1400
1457
|
Sets the static image splash screen of the window.
|
@@ -1410,6 +1467,8 @@ class BrowserWindow:
|
|
1410
1467
|
clickable : bool, optional
|
1411
1468
|
True to make the splash screen clickable, False otherwise (default is True)
|
1412
1469
|
if clickable is True, you can click the splash screen to close it.
|
1470
|
+
position : str, optional
|
1471
|
+
Position of the splash screen. Options are 'center', 'top-left', 'top-right', 'bottom-left', 'bottom-right' (default is 'center')
|
1413
1472
|
|
1414
1473
|
Examples
|
1415
1474
|
--------
|
@@ -1435,6 +1494,7 @@ class BrowserWindow:
|
|
1435
1494
|
|
1436
1495
|
self.close_on_load = close_on_load
|
1437
1496
|
self.splash_screen = splash
|
1497
|
+
self._position_splash_screen(position)
|
1438
1498
|
self.splash_screen.show()
|
1439
1499
|
|
1440
1500
|
def set_gif_splash_screen(
|
@@ -1443,6 +1503,7 @@ class BrowserWindow:
|
|
1443
1503
|
close_on_load: bool = True,
|
1444
1504
|
stay_on_top: bool = True,
|
1445
1505
|
clickable: bool = True,
|
1506
|
+
position: str = "center",
|
1446
1507
|
):
|
1447
1508
|
"""
|
1448
1509
|
Sets the gif splash screen of the window.
|
@@ -1458,6 +1519,8 @@ class BrowserWindow:
|
|
1458
1519
|
clickable : bool, optional
|
1459
1520
|
True to make the splash screen clickable, False otherwise (default is True)
|
1460
1521
|
if clickable is True, you can click the splash screen to close it.
|
1522
|
+
position : str, optional
|
1523
|
+
Position of the splash screen. Options are 'center', 'top-left', 'top-right', 'bottom-left', 'bottom-right' (default is 'center')
|
1461
1524
|
|
1462
1525
|
Examples
|
1463
1526
|
--------
|
@@ -1490,17 +1553,45 @@ class BrowserWindow:
|
|
1490
1553
|
movie = QMovie(gif_path)
|
1491
1554
|
label.setMovie(movie)
|
1492
1555
|
|
1493
|
-
# Start animation and show splash screen
|
1494
|
-
movie.start()
|
1495
|
-
splash.show()
|
1496
|
-
|
1497
1556
|
# Adjust splash screen size to match GIF size
|
1498
1557
|
movie.frameChanged.connect(
|
1499
1558
|
lambda: splash.setFixedSize(movie.currentPixmap().size())
|
1500
1559
|
)
|
1501
1560
|
|
1561
|
+
# Start animation and show splash screen
|
1562
|
+
movie.start()
|
1502
1563
|
self.close_on_load = close_on_load
|
1503
1564
|
self.splash_screen = splash
|
1565
|
+
self._position_splash_screen(position)
|
1566
|
+
splash.show()
|
1567
|
+
|
1568
|
+
def _position_splash_screen(self, position: str):
|
1569
|
+
if not self.splash_screen:
|
1570
|
+
return
|
1571
|
+
|
1572
|
+
screen = self.app.primaryScreen().geometry()
|
1573
|
+
splash_size = self.splash_screen.size()
|
1574
|
+
|
1575
|
+
if position == "center":
|
1576
|
+
new_position = screen.center() - QPoint(
|
1577
|
+
splash_size.width() // 2, splash_size.height() // 2
|
1578
|
+
)
|
1579
|
+
elif position == "top-left":
|
1580
|
+
new_position = screen.topLeft()
|
1581
|
+
elif position == "top-right":
|
1582
|
+
new_position = screen.topRight() - QPoint(splash_size.width(), 0)
|
1583
|
+
elif position == "bottom-left":
|
1584
|
+
new_position = screen.bottomLeft() - QPoint(0, splash_size.height())
|
1585
|
+
elif position == "bottom-right":
|
1586
|
+
new_position = screen.bottomRight() - QPoint(
|
1587
|
+
splash_size.width(), splash_size.height()
|
1588
|
+
)
|
1589
|
+
else:
|
1590
|
+
new_position = screen.center() - QPoint(
|
1591
|
+
splash_size.width() // 2, splash_size.height() // 2
|
1592
|
+
)
|
1593
|
+
|
1594
|
+
self.splash_screen.move(new_position)
|
1504
1595
|
|
1505
1596
|
def close_splash_screen(self):
|
1506
1597
|
"""
|
@@ -1,7 +1,7 @@
|
|
1
1
|
pyloid/__init__.py,sha256=OOPhOKNQVmAM8hnfTeE7lHzxb8LsFNcgegBAvDrA-vY,293
|
2
2
|
pyloid/api.py,sha256=np0pFVUlen_GpN0svY0A3awY_ZjVFk-RpHQZZKFUMuo,2157
|
3
3
|
pyloid/autostart.py,sha256=K7DQYl4LHItvPp0bt1V9WwaaZmVSTeGvadkcwG-KKrI,3899
|
4
|
-
pyloid/browser_window.py,sha256=
|
4
|
+
pyloid/browser_window.py,sha256=EijndlAGEnw375vRItl4hc9DlxjxUl8koaAR5xzYsA4,51878
|
5
5
|
pyloid/custom/titlebar.py,sha256=itzK9pJbZMQ7BKca9kdbuHMffurrw15UijR6OU03Xsk,3894
|
6
6
|
pyloid/filewatcher.py,sha256=3M5zWVUf1OhlkWJcDFC8ZA9agO4Q-U8WdgGpy6kaVz0,4601
|
7
7
|
pyloid/js_api/event_api.py,sha256=_52yyBonqecmMvJpFW7OMNi_jX8Nrteqw_kI6r-DGG0,951
|
@@ -11,7 +11,7 @@ pyloid/pyloid.py,sha256=3YymePkpM_hKPzvHSSgELuSHkmbDsKW60HnRwwBMY7A,41178
|
|
11
11
|
pyloid/timer.py,sha256=RqMsChFUd93cxMVgkHWiIKrci0QDTBgJSTULnAtYT8M,8712
|
12
12
|
pyloid/tray.py,sha256=D12opVEc2wc2T4tK9epaN1oOdeziScsIVNM2uCN7C-A,1710
|
13
13
|
pyloid/utils.py,sha256=VGZE2liY8_AElEqxVe1YLbk3fWlcAevpRc6oOTTgi-U,1927
|
14
|
-
pyloid-0.16.
|
15
|
-
pyloid-0.16.
|
16
|
-
pyloid-0.16.
|
17
|
-
pyloid-0.16.
|
14
|
+
pyloid-0.16.3.dist-info/LICENSE,sha256=MTYF-6xpRekyTUglRweWtbfbwBL1I_3Bgfbm_SNOuI8,11525
|
15
|
+
pyloid-0.16.3.dist-info/METADATA,sha256=pGn2JSKZ4lhcqcf1oTOZ0efy7oMKMBpFCc_MFoUAzWc,3050
|
16
|
+
pyloid-0.16.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
17
|
+
pyloid-0.16.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|