-
-
Notifications
You must be signed in to change notification settings - Fork 685
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 App.focus() method #3034
base: main
Are you sure you want to change the base?
Add App.focus() method #3034
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -352,7 +352,7 @@ def show_about_dialog(self): | |||||
if self.interface.author is None: | ||||||
options["Copyright"] = "" | ||||||
else: | ||||||
options["Copyright"] = f"Copyright © {self.interface.author}" | ||||||
options["Copyright"] = f"Copyright {self.interface.author}" | ||||||
|
||||||
self.native.orderFrontStandardAboutPanelWithOptions(options) | ||||||
|
||||||
|
@@ -385,3 +385,6 @@ def get_current_window(self): | |||||
|
||||||
def set_current_window(self, window): | ||||||
window._impl.native.makeKeyAndOrderFront(window._impl.native) | ||||||
|
||||||
def focus(self): | ||||||
self.native.activateIgnoringOtherApps_(True) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The trailing underscore isn't needed here; it's a valid but historical syntax.
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1020,6 +1020,16 @@ def set_full_screen(self, *windows: Window) -> None: | |||||||||||||||||||||||||||||
# End backwards compatibility | ||||||||||||||||||||||||||||||
###################################################################### | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
def focus(self): | ||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The methods on this class are sorted; this should be added to the "Window control" section, alphabetically sorted in that section. |
||||||||||||||||||||||||||||||
"""Bring the application into focus. | ||||||||||||||||||||||||||||||
This method will attempt to bring the application window into focus. Note that | ||||||||||||||||||||||||||||||
it is generally considered poor practice for applications to steal focus from | ||||||||||||||||||||||||||||||
the user, so use this method sparingly. | ||||||||||||||||||||||||||||||
This is a no-op on mobile and console platforms. | ||||||||||||||||||||||||||||||
Comment on lines
+1024
to
+1030
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We try not to call out specific platforms in docstrings; we put platform specific notes in the Notes section for the class in question.
Suggested change
(This will also require adding a |
||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||
self._impl.focus() | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
###################################################################### | ||||||||||||||||||||||||||||||
# 2024-08: Backwards compatibility | ||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ def show_about_dialog(self): | |
name_and_version += f" v{self.interface.version}" | ||
|
||
if self.interface.author is not None: | ||
copyright = f"\n\nCopyright © {self.interface.author}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again - why this change? |
||
copyright = f"\n\nCopyright {self.interface.author}" | ||
|
||
close_button = create_element( | ||
"sl-button", slot="footer", variant="primary", content="Ok" | ||
|
@@ -156,3 +156,6 @@ def enter_presentation_mode(self, screen_window_dict): | |
|
||
def exit_presentation_mode(self): | ||
self.interface.factory.not_implemented("App.exit_presentation_mode()") | ||
|
||
def focus(self): | ||
pass # No-op on web platform |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have you made this change? The copyright is a valid symbol, and it displays correctly in my testing.