/
manager.py
49 lines (37 loc) · 1.45 KB
/
manager.py
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
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2013-2016 Colin Duquesnoy and others (see pyqode/AUTHORS.rst)
# Copyright (c) 2016- Spyder Project Contributors (see AUTHORS.txt)
#
# Distributed under the terms of the MIT License
# (see NOTICE.txt in the Spyder root directory for details)
# -----------------------------------------------------------------------------
"""
This module contains the Manager API.
Adapted from pyqode/core/api/manager.py of the
`PyQode project <https://github.com/pyQode/pyQode>`_.
Original file:
<https://github.com/pyQode/pyqode.core/blob/master/pyqode/core/api/manager.py>
"""
# Standard library imports
import weakref
class Manager(object):
"""
A manager manages a specific aspect of a CodeEditor instance:
- panels management and drawing
Managers are typically created internally when you create a CodeEditor.
You interact with them later.
::
editor = CodeEditor()
# use the panels controller to install a panel
editor.panels.install(MyPanel(), MyPanel.Position.Right)
my_panel = editor.panels.get(MyPanel)
# and so on
"""
@property
def editor(self):
"""Return a reference to the parent CodeEditor widget."""
return self._editor()
def __init__(self, editor):
""":param editor: CodeEditor instance to control."""
self._editor = weakref.ref(editor)