File: i_dock_pane.py

package info (click to toggle)
python-pyface 6.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,756 kB
  • sloc: python: 39,728; makefile: 79
file content (84 lines) | stat: -rw-r--r-- 2,579 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Enthought library imports.
from traits.api import Bool, Enum, HasTraits, Str, Tuple

# Local imports.
from pyface.tasks.i_task_pane import ITaskPane


class IDockPane(ITaskPane):
    """ A pane that is useful but unessential for a task.

    Dock panes are arranged around the central pane in dock areas, and can, in
    general, be moved, resized, and hidden by the user.
    """

    # If enabled, the pane will have a button to close it, and a visibility
    # toggle button will be added to the View menu. Otherwise, the pane's
    # visibility will only be adjustable programmatically, though the 'visible'
    # attribute.
    closable = Bool(True)

    # The dock area in which the pane is currently present.
    dock_area = Enum('left', 'right', 'top', 'bottom')

    # Whether the pane can be detached from the main window.
    floatable = Bool(True)

    # Whether the pane is currently detached from the main window.
    floating = Bool(False)

    # Whether the pane can be moved from one dock area to another.
    movable = Bool(True)

    # The size of the dock pane. Note that this value is read-only.
    size = Tuple

    # Whether the pane is currently visible.
    visible = Bool(False)

    ###########################################################################
    # 'IDockPane' interface.
    ###########################################################################

    def create_contents(self, parent):
        """ Create and return the toolkit-specific contents of the dock pane.
        """

    def hide(self):
        """ Convenience method to hide the dock pane.
        """

    def show(self):
        """ Convenience method to show the dock pane.
        """


class MDockPane(HasTraits):
    """ Mixin containing common code for toolkit-specific implementations.
    """

    #### 'IDockPane' interface ################################################

    closable = Bool(True)
    dock_area = Enum('left', 'right', 'top', 'bottom')
    floatable = Bool(True)
    floating = Bool(False)
    movable = Bool(True)
    size = Tuple
    visible = Bool(False)
    caption_visible = Bool(True)
    dock_layer = Bool(0)

    ###########################################################################
    # 'IDockPane' interface.
    ###########################################################################

    def hide(self):
        """ Convenience method to hide the dock pane.
        """
        self.visible = False

    def show(self):
        """ Convenience method to show the dock pane.
        """
        self.visible = True