Skip to content

Commit

Permalink
Backport PR #22476 on branch 6.x (PR: Fix issues showing the in-app a…
Browse files Browse the repository at this point in the history
…ppeal message) (#22477)

Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
  • Loading branch information
meeseeksmachine and ccordoba12 authored Sep 10, 2024
1 parent 7913ca8 commit b1f96ae
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
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

0 comments on commit b1f96ae

Please sign in to comment.