pyloid 0.16.1__tar.gz → 0.16.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyloid
3
- Version: 0.16.1
3
+ Version: 0.16.2
4
4
  Summary:
5
5
  Author: aesthetics-of-record
6
6
  Author-email: 111675679+aesthetics-of-record@users.noreply.github.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pyloid"
3
- version = "0.16.1"
3
+ version = "0.16.2"
4
4
  description = ""
5
5
  authors = ["aesthetics-of-record <111675679+aesthetics-of-record@users.noreply.github.com>"]
6
6
  readme = "README.md"
@@ -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 위에서 선언하자.
@@ -1395,6 +1396,7 @@ class BrowserWindow:
1395
1396
  close_on_load: bool = True,
1396
1397
  stay_on_top: bool = True,
1397
1398
  clickable: bool = True,
1399
+ position: str = "center",
1398
1400
  ):
1399
1401
  """
1400
1402
  Sets the static image splash screen of the window.
@@ -1410,6 +1412,8 @@ class BrowserWindow:
1410
1412
  clickable : bool, optional
1411
1413
  True to make the splash screen clickable, False otherwise (default is True)
1412
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')
1413
1417
 
1414
1418
  Examples
1415
1419
  --------
@@ -1435,6 +1439,7 @@ class BrowserWindow:
1435
1439
 
1436
1440
  self.close_on_load = close_on_load
1437
1441
  self.splash_screen = splash
1442
+ self._position_splash_screen(position)
1438
1443
  self.splash_screen.show()
1439
1444
 
1440
1445
  def set_gif_splash_screen(
@@ -1443,6 +1448,7 @@ class BrowserWindow:
1443
1448
  close_on_load: bool = True,
1444
1449
  stay_on_top: bool = True,
1445
1450
  clickable: bool = True,
1451
+ position: str = "center",
1446
1452
  ):
1447
1453
  """
1448
1454
  Sets the gif splash screen of the window.
@@ -1458,6 +1464,8 @@ class BrowserWindow:
1458
1464
  clickable : bool, optional
1459
1465
  True to make the splash screen clickable, False otherwise (default is True)
1460
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')
1461
1469
 
1462
1470
  Examples
1463
1471
  --------
@@ -1490,17 +1498,45 @@ class BrowserWindow:
1490
1498
  movie = QMovie(gif_path)
1491
1499
  label.setMovie(movie)
1492
1500
 
1493
- # Start animation and show splash screen
1494
- movie.start()
1495
- splash.show()
1496
-
1497
1501
  # Adjust splash screen size to match GIF size
1498
1502
  movie.frameChanged.connect(
1499
1503
  lambda: splash.setFixedSize(movie.currentPixmap().size())
1500
1504
  )
1501
1505
 
1506
+ # Start animation and show splash screen
1507
+ movie.start()
1502
1508
  self.close_on_load = close_on_load
1503
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)
1504
1540
 
1505
1541
  def close_splash_screen(self):
1506
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