-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
plugin.py
67 lines (56 loc) · 2.11 KB
/
plugin.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2009- Spyder Project Contributors
#
# Distributed under the terms of the MIT License
# (see spyder/__init__.py for details)
# -----------------------------------------------------------------------------
"""
Appearance Plugin.
"""
# Local imports
from spyder.api.plugins import Plugins, SpyderPluginV2
from spyder.api.plugin_registration.decorators import (
on_plugin_available, on_plugin_teardown)
from spyder.api.translations import _
from spyder.plugins.appearance.confpage import AppearanceConfigPage
# --- Plugin
# ----------------------------------------------------------------------------
class Appearance(SpyderPluginV2):
"""
Appearance Plugin.
"""
NAME = "appearance"
# TODO: Fix requires to reflect the desired order in the preferences
REQUIRES = [Plugins.Preferences]
CONTAINER_CLASS = None
CONF_SECTION = NAME
CONF_WIDGET_CLASS = AppearanceConfigPage
CONF_FILE = False
CAN_BE_DISABLED = False
# ---- SpyderPluginV2 API
# -------------------------------------------------------------------------
@staticmethod
def get_name():
return _("Appearance")
@staticmethod
def get_description():
return _("Manage application appearance and themes.")
@classmethod
def get_icon(cls):
return cls.create_icon('eyedropper')
def on_initialize(self):
# NOTES:
# 1. This avoids applying the color scheme twice at startup, which is
# quite resource intensive.
# 2. Notifications for this option are restored when creating the
# config page.
self.disable_conf('ui_theme')
@on_plugin_available(plugin=Plugins.Preferences)
def register_preferences(self):
preferences = self.get_plugin(Plugins.Preferences)
preferences.register_plugin_preferences(self)
@on_plugin_teardown(plugin=Plugins.Preferences)
def deregister_preferences(self):
preferences = self.get_plugin(Plugins.Preferences)
preferences.deregister_plugin_preferences(self)