/
Traits.py
32 lines (24 loc) · 866 Bytes
/
Traits.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
from contextlib import contextmanager
class TraitType: pass
# These types just say what a property/UserAttrib/object should behave like, i.e. what protocol it should support.
# This is not really defined yet/strictly. It is used for now by the GUI.
class List(TraitType):
def onInsert(self, index): pass
def onRemove(self, index): pass
@property
@contextmanager
def lock(self): yield
def insert(self, index, value): pass
def remove(self, index): pass
def __getitem__(self, index): pass
def __len__(self): pass
class OneLineText(TraitType): pass
class Enum(TraitType):
def __init__(self, enums):
self.enums = enums
class Object(TraitType): pass
class Action(TraitType): pass
class Image(TraitType): pass
# For now, it's just easier to have the song display (song thumbnail + play cursor)
# as a special type.
class SongDisplay(TraitType): pass