Skip to content

Commit

Permalink
Merge pull request #13600 from goanpeca/fix/mainwidget-toolbar
Browse files Browse the repository at this point in the history
PR:  Refactor the toolbar handling on main widgets
  • Loading branch information
dalthviz committed Sep 1, 2020
2 parents 14e70b0 + d60ff10 commit 61a505e
Show file tree
Hide file tree
Showing 12 changed files with 275 additions and 185 deletions.
13 changes: 6 additions & 7 deletions spyder/api/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
# Standard library imports
from collections import OrderedDict
import inspect
import logging
import os

# Third party imports
Expand Down Expand Up @@ -51,6 +52,7 @@

# Localization
_ = get_translation('spyder')
logger = logging.getLogger(__name__)


# =============================================================================
Expand Down Expand Up @@ -816,8 +818,9 @@ def __init__(self, parent, configuration=None):
# ----------------------------------------------------------------
try:
container._setup(options=options)
except AttributeError:
pass
except Exception as error:
logger.debug(
"Running `_setup` on {0}: {1}".format(self, error))

if isinstance(container, SpyderWidgetMixin):
container.setup(options=options)
Expand Down Expand Up @@ -1602,14 +1605,10 @@ def __init__(self, parent, configuration):
widget.set_icon(self.get_icon())
widget.set_name(self.NAME)

# TODO: Streamline this by moving to postvisible setup
# Render all toolbars as a final separate step on the main window
# in case some plugins want to extend a toolbar. Since the rendering
# can only be done once!
widget.get_main_toolbar()._render()
for __, toolbars in widget._aux_toolbars.items():
for toolbar in toolbars:
toolbar._render()
widget.render_toolbars()

# Default Signals
# --------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 61a505e

Please sign in to comment.