App window now tries to fit the screen

This commit is contained in:
Deniz Şafak
2025-07-16 06:26:59 +03:00
parent d16c7603ce
commit 8bc51dd270
2 changed files with 8 additions and 4 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
# 1.1.3 (pre-release) # 1.1.3
- `M4B (with chapters)` generation is not faster now, as it directly generates `m4b` files instead of converting from `wav`, which significantly reduces processing time. - `M4B (with chapters)` generation is faster now, as it directly generates `m4b` files instead of converting from `wav`, which significantly reduces processing time.
- Better sleep state handling for Linux. - Better sleep state handling for Linux.
- The app window now tries to fit the screen if its height would exceed the available display area.
- Fixed issue where the app would not restart properly on Windows. - Fixed issue where the app would not restart properly on Windows.
- Fixed last sentence/subtitle entry timing in generated subtitles, the end time of the final subtitle entry now correctly matches the end of the audio chunk, preventing zero or invalid timings at the end. - Fixed last sentence/subtitle entry timing in generated subtitles, the end time of the final subtitle entry now correctly matches the end of the audio chunk, preventing zero or invalid timings at the end.
+5 -2
View File
@@ -763,7 +763,11 @@ class abogen(QWidget):
self.setWindowTitle(f"{PROGRAM_NAME} v{VERSION}") self.setWindowTitle(f"{PROGRAM_NAME} v{VERSION}")
screen = QApplication.primaryScreen().geometry() screen = QApplication.primaryScreen().geometry()
width, height = 500, 800 width, height = 500, 800
x, y = (screen.width() - width) // 2, (screen.height() - height) // 2 x = (screen.width() - width) // 2
# If desired height is larger than screen, fit to screen height
if height > screen.height() - 65:
height = screen.height() - 100 # Leave a margin for window borders
y = max((screen.height() - height) // 2, 0)
self.setGeometry(x, y, width, height) self.setGeometry(x, y, width, height)
outer_layout = QVBoxLayout() outer_layout = QVBoxLayout()
outer_layout.setContentsMargins(15, 15, 15, 15) outer_layout.setContentsMargins(15, 15, 15, 15)
@@ -2871,7 +2875,6 @@ class abogen(QWidget):
) )
if reply == QMessageBox.Yes: if reply == QMessageBox.Yes:
from abogen.utils import get_user_config_path from abogen.utils import get_user_config_path
import sys
config_path = get_user_config_path() config_path = get_user_config_path()
try: try: