feat: Add window title configuration and update related components and tests
This commit is contained in:
parent
c621e63a8d
commit
8e97f85c64
8 changed files with 13 additions and 1 deletions
|
|
@ -20,3 +20,4 @@ ALLOWED_URLS=
|
|||
# UI
|
||||
WINDOW_WIDTH=1024
|
||||
WINDOW_HEIGHT=768
|
||||
# WINDOW_TITLE= (leave empty to use: "{APP_NAME} v{APP_VERSION}")
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class Config:
|
|||
webapp_url: URL to load in embedded web application
|
||||
window_width: Initial window width in pixels
|
||||
window_height: Initial window height in pixels
|
||||
window_title: Main window title (default: "{app_name} v{app_version}")
|
||||
enable_logging: Whether to write logs to file
|
||||
|
||||
Raises:
|
||||
|
|
@ -46,6 +47,7 @@ class Config:
|
|||
webapp_url: str
|
||||
window_width: int
|
||||
window_height: int
|
||||
window_title: str
|
||||
enable_logging: bool
|
||||
|
||||
@classmethod
|
||||
|
|
@ -82,6 +84,9 @@ class Config:
|
|||
webapp_url = os.getenv("WEBAPP_URL", "file:///./webapp/index.html")
|
||||
window_width = int(os.getenv("WINDOW_WIDTH", "1024"))
|
||||
window_height = int(os.getenv("WINDOW_HEIGHT", "768"))
|
||||
# Window title defaults to app_name + version if not specified
|
||||
default_title = f"{app_name} v{app_version}"
|
||||
window_title = os.getenv("WINDOW_TITLE", default_title)
|
||||
enable_logging = os.getenv("ENABLE_LOGGING", "true").lower() == "true"
|
||||
|
||||
# Validate log level
|
||||
|
|
@ -145,6 +150,7 @@ class Config:
|
|||
webapp_url=webapp_url,
|
||||
window_width=window_width,
|
||||
window_height=window_height,
|
||||
window_title=window_title,
|
||||
enable_logging=enable_logging,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ class MainWindow(QMainWindow):
|
|||
self._is_manual_check = False # Track if this is a manual check (for UI feedback)
|
||||
|
||||
# Set window properties
|
||||
self.setWindowTitle(f"{config.app_name} v{config.app_version}")
|
||||
self.setWindowTitle(config.window_title)
|
||||
self.setGeometry(
|
||||
100,
|
||||
100,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ def config(tmp_path):
|
|||
webapp_url="file:///./webapp/index.html",
|
||||
window_width=800,
|
||||
window_height=600,
|
||||
window_title="Test WebDrop v0.0.1",
|
||||
enable_logging=False,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -246,6 +246,7 @@ class TestConfigExporter:
|
|||
webapp_url="http://localhost:8080",
|
||||
window_width=800,
|
||||
window_height=600,
|
||||
window_title="WebDrop Bridge v1.0.0",
|
||||
enable_logging=True,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ def sample_config(tmp_path):
|
|||
webapp_url=str(webapp_file),
|
||||
window_width=800,
|
||||
window_height=600,
|
||||
window_title="Test WebDrop v1.0.0",
|
||||
enable_logging=False,
|
||||
)
|
||||
return config
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ def sample_config(tmp_path):
|
|||
webapp_url="http://localhost:8080",
|
||||
window_width=800,
|
||||
window_height=600,
|
||||
window_title="WebDrop Bridge v1.0.0",
|
||||
enable_logging=True,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ def sample_config(tmp_path):
|
|||
webapp_url="file:///./webapp/index.html",
|
||||
window_width=800,
|
||||
window_height=600,
|
||||
window_title="Test WebDrop v1.0.0",
|
||||
enable_logging=False,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue