pyloid 0.16.2__tar.gz → 0.16.3__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pyloid-0.16.2 → pyloid-0.16.3}/PKG-INFO +1 -1
- {pyloid-0.16.2 → pyloid-0.16.3}/pyproject.toml +1 -1
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/browser_window.py +56 -1
- {pyloid-0.16.2 → pyloid-0.16.3}/LICENSE +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/README.md +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/__init__.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/api.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/autostart.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/custom/titlebar.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/filewatcher.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/js_api/event_api.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/js_api/window_api.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/monitor.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/pyloid.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/timer.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/tray.py +0 -0
- {pyloid-0.16.2 → pyloid-0.16.3}/src/pyloid/utils.py +0 -0
@@ -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.
|
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
|