pyloid 0.16.2__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
@@ -25,6 +25,10 @@ from .js_api.window_api import WindowAPI
|
|
25
25
|
from PySide6.QtGui import QPixmap, QMovie
|
26
26
|
from PySide6.QtWidgets import QSplashScreen, QLabel
|
27
27
|
from PySide6.QtCore import QSize
|
28
|
+
from typing import TYPE_CHECKING
|
29
|
+
|
30
|
+
if TYPE_CHECKING:
|
31
|
+
from ..pyloid import Pyloid
|
28
32
|
|
29
33
|
|
30
34
|
# 어차피 load 부분에만 쓰이니까 나중에 분리해서 load 위에서 선언하자.
|
@@ -164,7 +168,7 @@ class CustomWebEngineView(QWebEngineView):
|
|
164
168
|
class BrowserWindow:
|
165
169
|
def __init__(
|
166
170
|
self,
|
167
|
-
app,
|
171
|
+
app: "Pyloid",
|
168
172
|
title: str = "pyloid app",
|
169
173
|
width: int = 800,
|
170
174
|
height: int = 600,
|
@@ -481,6 +485,57 @@ class BrowserWindow:
|
|
481
485
|
self.y = y
|
482
486
|
self._window.setGeometry(self.x, self.y, self.width, self.height)
|
483
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
|
+
|
484
539
|
def set_frame(self, frame: bool):
|
485
540
|
"""
|
486
541
|
Sets the frame of the window.
|
@@ -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
|