Skip to content

Commit

Permalink
Layout: Reapply dock tabbar style if previous session was a Spyder 6 one
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Apr 6, 2024
1 parent 3ed56d2 commit 98bacf6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions spyder/plugins/layout/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ def on_mainwindow_visible(self):
# interface.
self.restore_visible_plugins()

# This is necessary to correctly display dock tabbars when the previous
# seesion was a Spyder 6 one.
self._reapply_docktabbar_style()

# Update panes and toolbars lock status
self.toggle_lock(self._interface_locked)

Expand Down Expand Up @@ -241,6 +245,24 @@ def _update_lock_interface_action(self):
self.lock_interface_action.setIcon(icon)
self.lock_interface_action.setText(text)

def _reapply_docktabbar_style(self):
"""Reapply dock tabbar style if necessary."""
saved_state_version = self.get_conf(
"window_state_version", default=WINDOW_STATE_VERSION
)

# Reapplying style if the previous session was a Spyder 6 one, which
# has a higher window state version.
if saved_state_version > WINDOW_STATE_VERSION:
plugins = self.get_dockable_plugins()
for plugin in plugins:
if plugin.dockwidget.dock_tabbar is not None:
plugin.dockwidget.dock_tabbar.setStyleSheet(
plugin.dockwidget.dock_tabbar.filter._tabbar_stylesheet
)

self.set_conf("window_state_version", WINDOW_STATE_VERSION)

# ---- Helper methods
# -------------------------------------------------------------------------
def get_last_plugin(self):
Expand Down

0 comments on commit 98bacf6

Please sign in to comment.