Skip to content

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

Open
mhdiop wants to merge 1 commit into
SoniaPujolLab:mainfrom
mhdiop:enable-findtext-at-start
Open

ENH: Enable Find text at Slicer start/restart#73
mhdiop wants to merge 1 commit into
SoniaPujolLab:mainfrom
mhdiop:enable-findtext-at-start

Conversation

@mhdiop

@mhdiop mhdiop commented Apr 17, 2024

Copy link
Copy Markdown
Collaborator

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

@lassoan lassoan left a comment

Copy link
Copy Markdown
Collaborator

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()


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

Copy link
Copy Markdown
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
Copy Markdown
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants