File: workbench_window.enaml

package info (click to toggle)
python-enaml 0.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,284 kB
  • sloc: python: 31,443; cpp: 4,499; makefile: 140; javascript: 68; lisp: 53; sh: 20
file content (35 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#------------------------------------------------------------------------------
# Copyright (c) 2013-2025, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from enaml.core.include import Include
from enaml.widgets.main_window import MainWindow
from enaml.widgets.menu_bar import MenuBar
from enaml.workbench.workbench import Workbench

from .window_model import WindowModel


def make_title(primary, workspace):
    return ' - '.join(filter(None, (primary, workspace)))


enamldef WorkbenchWindow(MainWindow):
    """ The custom MainWindow enamldef used by the Enaml studio.

    """
    attr workbench: Workbench
    attr window_model: WindowModel
    title << make_title(
        window_model.branding.title,
        window_model.workspace.window_title,
    )
    icon << window_model.branding.icon
    MenuBar:
        Include:
            objects << window_model.menus
    Include:
        objects << [w for w in [window_model.workspace.content] if w]