Skip to content

Commit

Permalink
Merge pull request #21483 from mrclary/cbi-updater-plugin
Browse files Browse the repository at this point in the history
PR: Create UpdateManager Plugin
  • Loading branch information
ccordoba12 authored Dec 16, 2023
2 parents efc9c05 + 2d9d5de commit e40ed64
Show file tree
Hide file tree
Showing 27 changed files with 1,684 additions and 1,219 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,13 @@ jobs:
- name: Run tests with gdb
if: env.USE_GDB == 'true'
shell: bash -l {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: xvfb-run --auto-servernum gdb -return-child-result -batch -ex r -ex py-bt --args python runtests.py -s
- name: Run tests
shell: bash -l {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rm -f pytest_log.txt # Must remove any log file from a previous run
.github/scripts/run_tests.sh || \
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ jobs:
run: check-manifest
- name: Run tests
shell: bash -l {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rm -f pytest_log.txt # Must remove any log file from a previous run
.github/scripts/run_tests.sh || \
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ jobs:
run: check-manifest
- name: Run tests
shell: bash -l {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
rm -f pytest_log.txt # Must remove any log file from a previous run
.github/scripts/run_tests.sh || \
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def run(self):
'switcher = spyder.plugins.switcher.plugin:Switcher',
'toolbar = spyder.plugins.toolbar.plugin:Toolbar',
'tours = spyder.plugins.tours.plugin:Tours',
'update_manager = spyder.plugins.updatemanager.plugin:UpdateManager',
'variable_explorer = spyder.plugins.variableexplorer.plugin:VariableExplorer',
'workingdir = spyder.plugins.workingdirectory.plugin:WorkingDirectory',
]
Expand Down
1 change: 1 addition & 0 deletions spyder/api/plugins/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Plugins:
Switcher = 'switcher'
Toolbar = "toolbar"
Tours = 'tours'
UpdateManager = 'update_manager'
VariableExplorer = 'variable_explorer'
WorkingDirectory = 'workingdir'

Expand Down
8 changes: 6 additions & 2 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,16 @@
'custom_margin': 0,
'use_custom_cursor_blinking': False,
'show_internal_errors': True,
'check_updates_on_startup': True,
'cursor/width': 2,
'completion/size': (300, 180),
'report_error/remember_token': False,
'show_dpi_message': True,
}),
('update_manager',
{
'check_updates_on_startup': True,
'check_stable_only': True,
}),
('toolbar',
{
'enable': True,
Expand Down Expand Up @@ -663,4 +667,4 @@
# or if you want to *rename* options, then you need to do a MAJOR update in
# version, e.g. from 3.0.0 to 4.0.0
# 3. You don't need to touch this value if you're just adding a new option
CONF_VERSION = '81.0.0'
CONF_VERSION = '82.0.0'
24 changes: 21 additions & 3 deletions spyder/plugins/application/confpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

from spyder.config.base import (_, DISABLED_LANGUAGES, LANGUAGE_CODES,
is_conda_based_app, save_lang_conf)
from spyder.api.plugins import Plugins
from spyder.api.preferences import PluginConfigPage
from spyder.py3compat import to_text_string

Expand Down Expand Up @@ -65,8 +66,16 @@ def setup_page(self):
prompt_box = newcb(_("Prompt when exiting"), 'prompt_on_exit')
popup_console_box = newcb(_("Show internal Spyder errors to report "
"them to Github"), 'show_internal_errors')
check_updates = newcb(_("Check for updates on startup"),
'check_updates_on_startup')
check_update_cb = newcb(
_("Check for updates on startup"),
'check_updates_on_startup',
section='update_manager'
)
stable_only_cb = newcb(
_("Check for stable releases only"),
'check_stable_only',
section='update_manager'
)

# Decide if it's possible to activate or not single instance mode
# ??? Should we allow multiple instances for macOS?
Expand All @@ -88,7 +97,8 @@ def setup_page(self):
advanced_layout.addWidget(single_instance_box)
advanced_layout.addWidget(prompt_box)
advanced_layout.addWidget(popup_console_box)
advanced_layout.addWidget(check_updates)
advanced_layout.addWidget(check_update_cb)
advanced_layout.addWidget(stable_only_cb)

advanced_widget = QWidget()
advanced_widget.setLayout(advanced_layout)
Expand Down Expand Up @@ -272,6 +282,14 @@ def apply_settings(self, options):
self.set_option(
'high_dpi_custom_scale_factors', scale_factors_text)
self.changed_options.add('high_dpi_custom_scale_factors')

um = self.plugin.get_plugin(Plugins.UpdateManager, error=False)
if (
um
and ('update_manager', 'check_stable_only') in self.changed_options
):
um.update_manager_status.set_no_status()

self.plugin.apply_settings()

def _save_lang(self):
Expand Down
Loading

0 comments on commit e40ed64

Please sign in to comment.