feat: Client 启动时默认最大化 (#147)
This commit is contained in:
@@ -148,7 +148,7 @@ def ui_main():
|
|||||||
setTheme(Theme.AUTO)
|
setTheme(Theme.AUTO)
|
||||||
|
|
||||||
window = MainWindow()
|
window = MainWindow()
|
||||||
window.show()
|
window.showMaximized()
|
||||||
try:
|
try:
|
||||||
mark_current_version_healthy()
|
mark_current_version_healthy()
|
||||||
except OSError:
|
except OSError:
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ from src.task_models import (
|
|||||||
TaskType,
|
TaskType,
|
||||||
)
|
)
|
||||||
from src.task_repository import TaskRepository
|
from src.task_repository import TaskRepository
|
||||||
from src.ui_main import MainWindow
|
from src.ui_main import MainWindow, ui_main
|
||||||
|
|
||||||
|
|
||||||
class BrokenRepository:
|
class BrokenRepository:
|
||||||
@@ -1144,6 +1144,36 @@ class PDDTaskPageEventTest(unittest.TestCase):
|
|||||||
window.close()
|
window.close()
|
||||||
window.deleteLater()
|
window.deleteLater()
|
||||||
|
|
||||||
|
def test_application_startup_shows_main_window_maximized(self):
|
||||||
|
class FakeApplication:
|
||||||
|
@staticmethod
|
||||||
|
def setAttribute(*_args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def __init__(self, _args):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def exec_(self):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
class FakeWindow:
|
||||||
|
def __init__(self):
|
||||||
|
self.maximized = False
|
||||||
|
|
||||||
|
def showMaximized(self):
|
||||||
|
self.maximized = True
|
||||||
|
|
||||||
|
window = FakeWindow()
|
||||||
|
with patch("src.ui_main.QApplication", FakeApplication), patch(
|
||||||
|
"src.ui_main.MainWindow", return_value=window
|
||||||
|
), patch("src.ui_main.setTheme"), patch(
|
||||||
|
"src.ui_main.mark_current_version_healthy"
|
||||||
|
):
|
||||||
|
result = ui_main()
|
||||||
|
|
||||||
|
self.assertEqual(result, 0)
|
||||||
|
self.assertTrue(window.maximized)
|
||||||
|
|
||||||
def test_main_window_marks_and_clears_update_navigation(self):
|
def test_main_window_marks_and_clears_update_navigation(self):
|
||||||
window = MainWindow(
|
window = MainWindow(
|
||||||
task_repository=self.repository,
|
task_repository=self.repository,
|
||||||
|
|||||||
@@ -32,7 +32,9 @@
|
|||||||
|
|
||||||
> **现状提醒:** 当前代码里是 3 个导航项(pdd / 设备 / 设置),和这里写的 2 个不一样。这是已知差异,见 [02 架构 §3.1](02-architecture.md)。设备相关设置最终要并入设置页,但要按工单单独做,不要顺手改。
|
> **现状提醒:** 当前代码里是 3 个导航项(pdd / 设备 / 设置),和这里写的 2 个不一样。这是已知差异,见 [02 架构 §3.1](02-architecture.md)。设备相关设置最终要并入设置页,但要按工单单独做,不要顺手改。
|
||||||
|
|
||||||
窗口建议默认尺寸为 1280×800,有效最小尺寸不低于 960×600。窗口变窄时允许表格水平滚动和顶部命令换行,不能隐藏主要任务入口。
|
Client 首次显示主窗口时使用标准 Windows 最大化状态,不使用全屏模式。用户仍可通过标题栏
|
||||||
|
最小化、还原、调整大小、再次最大化或关闭窗口。窗口变窄时允许表格水平滚动和顶部命令
|
||||||
|
换行,不能隐藏主要任务入口。
|
||||||
|
|
||||||
## 3. PDD 任务页布局
|
## 3. PDD 任务页布局
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user