|
@@ -18,7 +18,8 @@ pb_node_table = Table('pb_nodes', metadata,
|
18
|
18
|
Column('node_id', Integer, Sequence('pb_nodes__node_id__sequence'), primary_key=True),
|
19
|
19
|
Column('parent_id', Integer, ForeignKey('pb_nodes.node_id'), nullable=True, default=None),
|
20
|
20
|
Column('node_order', Integer, nullable=True, default=1),
|
21
|
|
- Column('node_type', Unicode(16), unique=False, nullable=False, default=u'data'),
|
|
21
|
+ Column('node_type', Unicode(16), unique=False, nullable=False, default=u'data'),
|
|
22
|
+ Column('node_status', Unicode(16), unique=False, nullable=False, default=u'open'),
|
22
|
23
|
|
23
|
24
|
Column('created_at', DateTime, unique=False, nullable=False),
|
24
|
25
|
Column('updated_at', DateTime, unique=False, nullable=False),
|
|
@@ -39,6 +40,41 @@ pb_node_table = Table('pb_nodes', metadata,
|
39
|
40
|
- data_status_id
|
40
|
41
|
"""
|
41
|
42
|
|
|
43
|
+class PBNodeStatusItem(object):
|
|
44
|
+ def __init__(self, psStatusId, psStatusLabel, psStatusFamily, psForegroundColor): #, psBackgroundColor):
|
|
45
|
+ self._sStatusId = psStatusId
|
|
46
|
+ self._sStatusLabel = psStatusLabel
|
|
47
|
+ self._sStatusFamily = psStatusFamily
|
|
48
|
+ self._sForegroundColor = psForegroundColor
|
|
49
|
+ # self._sBackgroundColor = psBackgroundColor
|
|
50
|
+
|
|
51
|
+ @property
|
|
52
|
+ def label(self):
|
|
53
|
+ return self._sStatusLabel
|
|
54
|
+
|
|
55
|
+ def getId(self):
|
|
56
|
+ return self._sStatusId
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+class PBNodeStatus(object):
|
|
60
|
+
|
|
61
|
+ StatusList = dict()
|
|
62
|
+ StatusList['immortal'] = PBNodeStatusItem('immortal', 'Information', 'normal', 'rgb(51,51,51)')
|
|
63
|
+ StatusList['open'] = PBNodeStatusItem('open', 'Open', 'normal', 'rgb(91,183,91)')
|
|
64
|
+ StatusList['standby'] = PBNodeStatusItem('standby', 'in Standby', 'normal', 'rgb(250, 167, 50)')
|
|
65
|
+ StatusList['hot'] = PBNodeStatusItem('hot', 'Hot', 'normal', 'rgb(218, 79, 73)')
|
|
66
|
+ StatusList['done'] = PBNodeStatusItem('done', 'Done', 'closed', 'rgb(51, 51, 51)')
|
|
67
|
+ StatusList['closed'] = PBNodeStatusItem('closed', 'Closed', 'closed', 'rgb(51, 51, 51)')
|
|
68
|
+ StatusList['archived'] = PBNodeStatusItem('archived', 'Archived', 'invisible', 'rgb(51, 51, 51)')
|
|
69
|
+ StatusList['deleted'] = PBNodeStatusItem('deleted', 'Deleted', 'invisible', 'rgb(51, 51, 51)')
|
|
70
|
+
|
|
71
|
+ @classmethod
|
|
72
|
+ def getList(cls):
|
|
73
|
+ return PBNodeStatus.StatusList.iteritems()
|
|
74
|
+
|
|
75
|
+ def getStatusItem(cls, psStatusId):
|
|
76
|
+ return PBNodeStatus.StatusList[psStatusId]
|
|
77
|
+
|
42
|
78
|
class PBNodeType(object):
|
43
|
79
|
Node = 'node'
|
44
|
80
|
Folder = 'folder'
|
|
@@ -111,6 +147,8 @@ class PBNode(object):
|
111
|
147
|
def getFormattedTime(self, poDateTime, psDateTimeFormat = '%H:%M'):
|
112
|
148
|
return poDateTime.strftime(psDateTimeFormat)
|
113
|
149
|
|
|
150
|
+ def getStatus(self):
|
|
151
|
+ return PBNodeStatus.getStatusItem(self.node_status)
|
114
|
152
|
|
115
|
153
|
from sqlalchemy.orm import mapper
|
116
|
154
|
mapper(PBNode, pb_node_table)
|