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

Backport PR #22476 on branch 6.x (PR: Fix issues showing the in-app appeal message) #22477

Merged
Merged
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,10 +847,11 @@ def post_visible_setup(self):
assert 'pandas' not in sys.modules
assert 'matplotlib' not in sys.modules

# Call on_mainwindow_visible for all plugins, except Layout because it
# needs to be called first (see above).
# Call on_mainwindow_visible for all plugins, except Layout and
# Application because they need to be called first (see above) and last
# (see below), respectively.
for plugin_name in PLUGIN_REGISTRY:
if plugin_name != Plugins.Layout:
if plugin_name not in (Plugins.Layout, Plugins.Application):
plugin = PLUGIN_REGISTRY.get_plugin(plugin_name)
try:
plugin.on_mainwindow_visible()
Expand All @@ -860,6 +861,12 @@ def post_visible_setup(self):

self.restore_scrollbar_position.emit()

# This must be called after restore_scrollbar_position.emit so that
# the in-app appeal dialog has focus on macOS.
# Fixes spyder-ide/spyder#22454.
self.get_plugin(Plugins.Application).on_mainwindow_visible()
QApplication.processEvents()

# Server to maintain just one Spyder instance and open files in it if
# the user tries to start other instances with
# $ spyder foo.py
Expand Down
10 changes: 7 additions & 3 deletions spyder/plugins/application/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,16 @@ def on_mainwindow_visible(self):
screen.logicalDotsPerInchChanged.connect(
container.show_dpi_change_message)

# Show appeal the fifth time Spyder starts
# Show appeal the fifth and 25th time Spyder starts
spyder_runs = self.get_conf("spyder_runs_for_appeal", default=1)
if spyder_runs == 5:
if spyder_runs in [5, 25]:
container.inapp_appeal_status.show_appeal()

# Increase counting in one to not get stuck at this point.
# Fixes spyder-ide/spyder#22457
self.set_conf("spyder_runs_for_appeal", spyder_runs + 1)
else:
if spyder_runs < 5:
if spyder_runs < 25:
self.set_conf("spyder_runs_for_appeal", spyder_runs + 1)

# ---- Private API
Expand Down