[a37b2b]: plugins / window_management.py Maximize Restore History

Download this file

window_management.py    91 lines (72 with data), 2.6 kB

 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
'''
This software is licensed under the GPL (GNU General Public License) version 2
as it appears here: http://www.gnu.org/copyleft/gpl.html
It is also included with this archive as `gpl.txt <gpl.txt>`_.
'''
import wx
import codetree
import todo
import filtertable
import sourcetags
import tagger
possible = ('tree1', 'tree2', 'todo', 'filter')#, 'sourcetags', 'tagger')
enabled = dict.fromkeys(possible)
HIER, TODO, TAGS = 0, 1, 2
methods = {HIER:'new_hierarchy', TODO:'NewItemList', TAGS:'newTags'}
whicharg = {'tree1':HIER, 'tree2':HIER, 'todo':TODO, 'filter':HIER,
## 'sourcetags':TAGS, 'tagger':TAGS
}
class docstate:
def __init__(self, root, stc):
self.root = root
self.stc = stc
self.tree1 = codetree.hierCodeTreePanel(root, root.leftt, 1)
self.tree2 = codetree.hierCodeTreePanel(root, root.rightt, 0)
self.todo = todo.VirtualTodo(root.todot, root)
self.filter = filtertable.DefinitionList(root.filterl, root, stc)
## self.sourcetags = sourcetags.SourceTags(root.taglist, stc)
## self.tagger = tagger.TagManager(root.tagmanage, stc)
self.items = (self.tree1, self.tree2, self.todo, self.filter)
## self.items = (self.tree1, self.tree2, self.todo, self.filter, self.sourcetags, self.tagger)
self.isshown = -1
self.Add()
def Hide(self):
for i in self.items:
i.Hide()
i.parent.Layout()
self.isshown = 0
def Show(self):
for j in possible:
if j not in enabled:
continue
i = getattr(self, j)
i.Show()
i.parent.Layout()
self.isshown = 1
def Add(self):
for i in self.items:
i.parent.sizer.Add(i, 1, wx.EXPAND)
self.Hide()
def Destroy(self):
self.Hide()
for i in self.items:
ip = i.parent
i.parent.sizer.Detach(i)
i.Destroy()
ip.Layout()
del self.stc.docstate
def IsShown(self):
return self.isshown
def Update(self, hierarchy, todo, tags):
htt = hierarchy, todo, tags
for i in possible:
if i in enabled:
which = whicharg[i]
method = methods[which]
getattr(getattr(self, i), method)(htt[which])
def _choicebook(parent, id):
cp = wx.Panel(parent, id)
cp.sizer = wx.BoxSizer(wx.VERTICAL)
cp.SetSizer(cp.sizer)
cp.parent = parent
return cp