Adding Panels to the WorkbenchΒΆ

You may want to write an extension that adds a panel which displays information to the user. Builder provides API for this via the “Editor Perspective”.

At a high level, the design of the editor is broken into four parts.

  • The code editors in the center of the perspective
  • The left panel, which contains the “sources” of actions
  • The bottom panel, which contains utilities
  • The right panel, which is transient and contextual to the operation at hand

The easiest way to add a panel is to register an Ide.EditorAddin which adds the panels in the do_load() function. You’ll be provided access to the editor perspective with the editor variable.


import gi

from gi.repository import GObject
from gi.repository import Ide
from gi.repository import Gtk
from gi.repository import Dazzle

class MyEditorAddin(GObject.Object, Ide.EditorAddin):

    def do_load(self, editor):

        # Add a widget to the left panel (aka Sidebar)
        self.panel = Gtk.Label(visible=True, label='My Left Panel')
        left_panel = editor.get_sidebar()
                               'My Section Title',
                               None, # Menu id if necessary
                               None, # Menu icon name if necessary
                               100)  # Sort priority

        # To add a utility section
        self.bottom = Dazzle.DockWidget(title='My Bottom Panel', icon_name='gtk-missing', visible=True)
        self.bottom.add(Gtk.Label(lable='Hello, Bottom Panel', visible=True))

    def do_unload(self, editor):

        # Remove our widgets

        self.bottom = None
        self.panel = None