Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add focus switch on welcome dialog #1968

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions novelwriter/tools/welcome.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def _showNewProjectPage(self) -> None:
"""Show the create new project page."""
self.mainStack.setCurrentWidget(self.tabNew)
self._setButtonVisibility()
self.tabNew.enterForm()
return

@pyqtSlot()
Expand Down Expand Up @@ -503,6 +504,8 @@ def __init__(self, parent: QWidget) -> None:
self.scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded)
self.scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded)

self.enterForm = self.projectForm.enterForm

# Assemble
# ========

Expand Down Expand Up @@ -696,6 +699,12 @@ def __init__(self, parent: QWidget) -> None:

return

def enterForm(self) -> None:
"""Focus the project name field when entering the form."""
self.projName.setFocus()
self.projName.selectAll()
return

def getProjectData(self) -> dict:
"""Collect form data and return it as a dictionary."""
roots = []
Expand Down