Skip to content

Commit

Permalink
Merge pull request #15149 from andfoy/fix_apply_settings
Browse files Browse the repository at this point in the history
PR: Fix some issues when applying Run/Help settings in the Preferences dialog
  • Loading branch information
ccordoba12 committed Apr 7, 2021
2 parents 95ce215 + 00c7026 commit 6648e86
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 44 deletions.
2 changes: 1 addition & 1 deletion spyder/api/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _wrap_apply_settings(self, func):
call.
"""
def wrapper(self, options):
opts = self.previous_apply_settings()
opts = self.previous_apply_settings() or set({})
opts |= options
self.aggregate_sections_partials(opts)
func(opts)
Expand Down
7 changes: 0 additions & 7 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1930,13 +1930,6 @@ def apply_settings(self):
qapp.setStyle('gtk+')
except:
pass
else:
style_name = CONF.get('appearance', 'windows_style',
self.default_style)
style = QStyleFactory.create(style_name)
if style is not None:
style.setProperty('name', style_name)
qapp.setStyle(style)

default = self.DOCKOPTIONS
if CONF.get('main', 'vertical_tabs'):
Expand Down
6 changes: 1 addition & 5 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,10 +546,6 @@
'last_visible_toolbars',
]
),
('appearance', [
'windows_style',
]
),
('editor', [
'autosave_mapping',
'bookmarks',
Expand Down Expand Up @@ -623,4 +619,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 = '68.0.0'
CONF_VERSION = '69.0.0'
31 changes: 2 additions & 29 deletions spyder/plugins/appearance/confpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,6 @@ def setup_page(self):
'ui_theme',
restart=True)

styles = [str(txt) for txt in list(QStyleFactory.keys())]
# Don't offer users the possibility to change to a different
# style in Gtk-based desktops
# See spyder-ide/spyder#2036.
if is_gtk_desktop() and ('GTK+' in styles):
styles = ['GTK+']
choices = list(zip(styles, [style.lower() for style in styles]))
style_combo = self.create_combobox(_('Qt windows style'), choices,
'windows_style',
default=self.main.default_style)
self.style_combobox = style_combo.combobox

themes = ['Spyder 2', 'Spyder 3']
icon_choices = list(zip(themes, [theme.lower() for theme in themes]))
icons_combo = self.create_combobox(_('Icon theme'), icon_choices,
Expand All @@ -68,10 +56,8 @@ def setup_page(self):
theme_comboboxes_layout = QGridLayout()
theme_comboboxes_layout.addWidget(ui_theme_combo.label, 0, 0)
theme_comboboxes_layout.addWidget(ui_theme_combo.combobox, 0, 1)
theme_comboboxes_layout.addWidget(style_combo.label, 1, 0)
theme_comboboxes_layout.addWidget(self.style_combobox, 1, 1)
theme_comboboxes_layout.addWidget(icons_combo.label, 2, 0)
theme_comboboxes_layout.addWidget(icons_combo.combobox, 2, 1)
theme_comboboxes_layout.addWidget(icons_combo.label, 1, 0)
theme_comboboxes_layout.addWidget(icons_combo.combobox, 1, 1)

theme_layout = QVBoxLayout()
theme_layout.addLayout(theme_comboboxes_layout)
Expand Down Expand Up @@ -171,7 +157,6 @@ def setup_page(self):

self.update_combobox()
self.update_preview()
self.update_qt_style_combobox()

def get_font(self, option):
"""Return global font used in Spyder."""
Expand Down Expand Up @@ -236,14 +221,6 @@ def apply_settings(self, options):
self.update_combobox()
self.update_preview()

qapp = QApplication.instance()
if 'windows_style' in options:
style_name = self.get_option('windows_style')
style = QStyleFactory.create(style_name)
if style is not None:
style.setProperty('name', style_name)
qapp.setStyle(style)

if self.main.historylog is not None:
self.main.historylog.apply_conf(['color_scheme_name'])

Expand All @@ -261,10 +238,6 @@ def current_scheme(self):
def current_scheme_index(self):
return self.schemes_combobox.currentIndex()

def update_qt_style_combobox(self):
"""Enable/disable the Qt style combobox."""
self.style_combobox.setEnabled(False)

def update_combobox(self):
"""Recreates the combobox contents."""
index = self.current_scheme_index
Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/help/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def on_close(self, cancelable=False):
self.save_history()
return True

def apply_conf(self, options_set):
def apply_conf(self, options_set, notify=False):
super().apply_conf(options_set)
widget = self.get_widget()

Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/run/confpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,5 @@ def setup_page(self):
vlayout.addWidget(firstrun_cb)
vlayout.addStretch(1)

def apply_settings(self, options):
def apply_settings(self):
pass

0 comments on commit 6648e86

Please sign in to comment.