Package muntjac :: Package addon :: Package codemirror :: Package client :: Module code_theme
[hide private]
[frames] | no frames]

Source Code for Module muntjac.addon.codemirror.client.code_theme

1 # Copyright (C) 2012 Vaadin Ltd. 2 # Copyright (C) 2012 Richard Lincoln 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 16 17 -class CodeTheme(object):
18 19 DEFAULT = None 20 COBALT = None 21 ECLIPSE = None 22 ELEGANT = None 23 MONOKAI = None 24 NEAT = None 25 NIGHT = None 26 RUBYBLUE = None 27
28 - def __init__(self, name, Id, theme):
29 self._name = name 30 self._id = Id 31 self._theme = None 32 33 self.setTheme(theme)
34
35 - def __str__(self):
36 return self._name
37 38 @classmethod
39 - def byId(cls, Id):
40 for s in CodeTheme.values(): 41 if s.getId() == Id: 42 return s 43 return None
44
45 - def setTheme(self, theme):
46 self._theme = theme
47
48 - def getTheme(self):
49 return self._theme
50
51 - def getId(self):
52 return self._id
53 54 _values = [] 55 56 @classmethod
57 - def values(cls):
58 return cls._values
59 60 61 CodeTheme.DEFAULT = CodeTheme('Default', 1, 'default') 62 CodeTheme.COBALT = CodeTheme('Cobalt', 2, 'cobalt') 63 CodeTheme.ECLIPSE = CodeTheme('Eclipse', 3, 'eclipse') 64 CodeTheme.ELEGANT = CodeTheme('Elegant', 4, 'elegant') 65 CodeTheme.MONOKAI = CodeTheme('Monokai', 5, 'monokai') 66 CodeTheme.NEAT = CodeTheme('Neat', 6, 'neat') 67 CodeTheme.NIGHT = CodeTheme('Night', 7, 'night') 68 CodeTheme.RUBYBLUE = CodeTheme('Ruby Blue', 8, 'rubyblue') 69 70 71 CodeTheme._values = [CodeTheme.DEFAULT, CodeTheme.COBALT, CodeTheme.ECLIPSE, 72 CodeTheme.ELEGANT, CodeTheme.MONOKAI, CodeTheme.NEAT, CodeTheme.NIGHT, 73 CodeTheme.RUBYBLUE] 74