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

ENH: Enable Find text at Slicer start/restart #73

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mhdiop
Copy link
Collaborator

@mhdiop mhdiop commented Apr 17, 2024

@mhdiop mhdiop requested a review from lassoan April 17, 2024 16:56
Copy link
Collaborator

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It mostly looks good. See some trivial tweaks in inline comments.
If the shortcut is enabled then I think it should not be necessary to open the LanguageTools module, but instead you can enable the shortcut in a callback function that is connected to application startupCompleted signal:

slicer.app.connect("startupCompleted()", self.setupFindTextShortcut()

@@ -347,6 +347,10 @@ def updateGUIFromSettings(self):
self.ui.weblateDownloadUrlEdit.text = settings.value("WeblateDownloadUrl", "https://hosted.weblate.org/download/3d-slicer")
self.ui.githubRepositoryUrlEdit.text = settings.value("GitRepository", "https://github.com/Slicer/SlicerLanguageTranslations")

# Boolean values are stored as strings in the settings.
# False becomes 'false' and True becomes 'true'
textFinderIsEnabled = settings.value("EnableFindText", True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make it disabled by default.
Use slicer.util.toBool to always get Boolean.

Suggested change
textFinderIsEnabled = settings.value("EnableFindText", True)
textFinderIsEnabled = slicer.util.toBool(settings().value("EnableFindText", False))

# Boolean values are stored as strings in the settings.
# False becomes 'false' and True becomes 'true'
textFinderIsEnabled = settings.value("EnableFindText", True)
self.ui.enableTextFindercheckBox.checked = True if (textFinderIsEnabled in [True, 'true']) else False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.ui.enableTextFindercheckBox.checked = True if (textFinderIsEnabled in [True, 'true']) else False
self.ui.enableTextFindercheckBox.checked = textFinderIsEnabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants