-
Notifications
You must be signed in to change notification settings - Fork 25
/
frame.py
677 lines (547 loc) · 20.3 KB
/
frame.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
# The Admin4 Project
# (c) 2013-2022 Andreas Pflug
#
# Licensed under the Apache License,
# see LICENSE.TXT for conditions of usage
import wx.aui
import adm
import logger
from wh import xlt, StringType, GetIcon, Menu, ToolBar, restoreSize, GetBitmap, AcceleratorHelper
from tree import NodeTreeCtrl, ServerTreeCtrl
from notebook import Notebook
from LoggingDialog import LoggingDialog
from AdmDialogs import PreferencesDlg, AboutDlg
from Update import CheckAutoUpdate
class Frame(wx.Frame, adm.MenuOwner):
allFrames=[]
def __init__(self, parentWin, title, style, _size, _pos):
size,pos = restoreSize("main", (600,400), None)
wx.Frame.__init__(self, parentWin, title=title, style=style, size=size, pos=pos)
Frame.allFrames.append(self)
self.tree=None
self.currentNode=None
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.messageLayer=0
size, pos=adm.config.getWindowPositions(self)
if pos:
self.Move(pos)
if size and self.HasFlag(wx.RESIZE_BORDER):
self.SetSize(size)
@classmethod
def CloseAll(cls):
for frame in cls.allFrames:
frame.Destroy()
def GetToolBar(self):
if hasattr(self, 'toolbar'):
return self.toolbar
return None
def registerToggles(self, toolbar, statusbar):
""" have toolbar and/or statusbar toggle in viewmenu """
if toolbar:
self.viewmenu.AddCheck(self.OnToggleToolBar, xlt("Toolbar"), xlt("Show or hide tool bar"), adm.config.Read("ToolbarShown", True, self))
if statusbar:
self.viewmenu.AddCheck(self.OnToggleStatusBar, xlt("Statusbar"), xlt("Show or hide status bar"), adm.config.Read("StatusbarShown", True, self))
def OnToggleToolBar(self, evt=None):
show=self.viewmenu.IsChecked(self.OnToggleToolBar)
self.GetToolBar().Show(show)
if evt:
self.manager.Update()
adm.config.Write("ToolbarShown", show, self)
def OnToggleStatusBar(self, evt=None):
show=self.viewmenu.IsChecked(self.OnToggleStatusBar)
self.GetStatusBar().Show(show)
if evt:
self.manager.Update()
adm.config.Write("StatusbarShown", show, self)
def SetIcon(self, icon, mod=None):
if isinstance(icon, int):
icon=adm.images.GetBitmap(icon)
elif isinstance(icon, StringType):
icon=GetIcon(icon, mod)
if isinstance(icon, wx.Bitmap):
icon=wx.Icon.FromBitmap(icon)
if icon:
wx.Frame.SetIcon(self, icon)
return True
return False
def OnCall(self, evt):
"""
OnCall(wx.Event)
calls registered procedures from an event using appropriate arguments
It handles:
@staticmethod DoSomething(parentWindow, node) -> bool to refresh node
@staticmethod DoSomething(node)
@staticmethod Register(parentWindow)
Edit(self, parentWindow)
HandleEvent(self, evt)
"""
pid=evt.GetId()
proc=self.GetMenuProc(pid)
if proc:
args = self.GetCallArgs(proc)
if len(args) and args[0] == "self":
del args[0]
isStatic=False
else:
isStatic=True
ci=[proc.__module__]
if hasattr(proc, "_classname_"):
ci.append(proc._classname_)
ci.append(proc.__name__)
adm.logger.debug("Calling ID %d: %s", pid, ".".join(ci))
node=self.currentNode
if not node and self.tree:
node=self.tree.GetNode()
if len(args) == 2:
if proc(self, node) and node:
node.DoRefresh()
else:
if isStatic:
if proc.__name__ in ['Register']:
proc(self)
else:
proc(node)
else:
proc(evt)
def OnClose(self, evt):
adm.config.storeWindowPositions(self)
try: Frame.allFrames.remove(self)
except: pass
evt.Skip()
def SetStatus(self, text=None):
sb=self.GetStatusBar()
if sb:
if text:
sb.SetStatusText(text, 0)
else:
sb.SetStatusText("", 0)
def PushStatus(self, text, field=0):
sb=self.GetStatusBar()
if sb:
self.messageLayer += 1
sb.PushStatusText(text, field)
def PopStatus(self):
sb=self.GetStatusBar()
if sb:
if self.messageLayer:
self.messageLayer -= 1
try: sb.PopStatusText()
except: pass
class FindPanel(adm.NotebookPanel):
def __init__(self, dlg):
adm.NotebookPanel.__init__(self, dlg, dlg, "./FindPanel")
self.Bind('FindClose', self.OnFindClose)
self.Bind('Find', wx.EVT_CHAR, self.OnFindChar)
self.Bind('Find', wx.EVT_TEXT_ENTER, self.OnFindEnter)
def DoShow(self, how):
self.ShowControls("Find FindNext FindClose", how)
if hasattr(self.dialog, 'manager'):
self.dialog.manager.Update()
def OnFindClose(self, _evt):
self.DoShow(False)
def OnFindChar(self, evt):
if evt.KeyCode == 27:
self.OnFindClose(evt)
else:
evt.Skip()
def OnFindEnter(self, _evt):
if not self['FindNext'].IsEnabled():
return
s,e=self['Find'].GetSelection()
self.OnFindNext(None)
self['Find'].SetFocus()
self['Find'].SetSelection(s,e)
class NodeTreePanel(FindPanel):
def __init__(self, dlg, name):
self.SetAttr('treeName', name)
FindPanel.__init__(self, dlg)
self.Bind('Find', self.OnFind)
self.Bind('FindNext', self.OnFindNext)
def AddExtraControls(self, res):
self.tree=NodeTreeCtrl(self, self.treeName)
res.AttachUnknownControl("ValueGrid", self.tree)
self['FindClose'].SetBitmapCurrent(GetBitmap('close'))
# we'd like wx.BitmapButton.NewCloseButton here...
# TODO
# self.OnFind(None)
def OnFindClose(self, _evt):
self.DoShow(False)
self.tree.SetFocus()
def OnFind(self, evt):
find=self.Find.strip()
valid=find != ""
if valid:
node= self.tree.GetNode()
if node:
server=node.GetServer()
valid=server.FindStringValid(find)
else: valid=False
self['FindNext'].Enable(valid)
if not valid:
return
if server.findObjectIncremental:
self.OnFindEnter(evt)
else:
self['Find'].SetForegroundColour(wx.BLUE)
def OnFindNext(self, evt):
self['Find'].SetForegroundColour(wx.BLACK)
find=self.Find.lower().strip()
if not find:
return
node=self.tree.GetNode()
if node:
server=node.GetServer()
if evt: startItem=self.tree.GetSelection()
else: startItem=server.treeitems[self.tree.name][0]
item=server.FindObject(self.tree, startItem, find)
if item:
self.tree.SelectItem(item)
self.tree.EnsureVisible(item)
else:
self['Find'].SetForegroundColour(wx.RED)
class DetailFrame(Frame):
def __init__(self, parentWin, name, args=None, title=None):
if not title:
title=name
style=wx.MAXIMIZE_BOX|wx.RESIZE_BORDER|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX
adm.Frame.__init__(self, parentWin, title, style, (600,400), None)
self.SetIcon(name)
self.name=name
self.lastNode=None
self.appArgs=args
self.manager=wx.aui.AuiManager(self)
self.manager.SetFlags(wx.aui.AUI_MGR_ALLOW_FLOATING|wx.aui.AUI_MGR_TRANSPARENT_HINT | \
wx.aui.AUI_MGR_HINT_FADE| wx.aui.AUI_MGR_TRANSPARENT_DRAG)
self.toolbar=ToolBar(self, 32);
self.toolbar.Add(self.OnShowServers, xlt("Show registered servers"), "connect")
self.toolbar.Add(self.OnDetach, xlt("Detach view"), "detach")
self.toolbar.Add(self.OnRefresh, xlt("Refresh"), "refresh")
self.toolbar.AddSeparator()
self.toolbar.Add(self.OnEdit, xlt("Edit"), "edit")
self.toolbar.Add(self.OnNew, xlt("New"), "new")
self.toolbar.Add(self.OnDelete, xlt("Delete"), "delete")
self.toolbar.Add(self.OnFindObject, xlt("Find"), "edit_find")
self.toolbar.AddSeparator()
self.standardToolsCount=self.toolbar.GetToolsCount()
self.toolbar.Realize()
menubar=wx.MenuBar()
self.filemenu=menu=Menu(self)
self.registermenu=Menu(self)
for modulename in adm.modules.keys():
moduleinfo=adm.modules[modulename].moduleinfo
registerproc=moduleinfo['serverclass'].Register
self.registermenu.Add(registerproc, xlt("Register new %s") % moduleinfo['name'])
self.filemenu.AppendOneMenu(self.registermenu, xlt("Register Server"))
if wx.Platform != "__WXMAC__":
menu.AppendSeparator()
menu.Add(self.OnPreferences, xlt("Preferences"), xlt("Preferences"), wx.ID_PREFERENCES, adm.app.SetMacPreferencesMenuItemId)
menu.Add(self.OnQuit, xlt("Quit"), xlt("Quit Admin4"), wx.ID_EXIT, adm.app.SetMacExitMenuItemId)
menubar.Append(menu, xlt("&File"))
self.viewmenu=menu=Menu(self)
menu.Add(self.OnShowServers, xlt("Show Servers"), xlt("Show registered servers to connect"))
menu.AddCheck(self.OnToggleTree, xlt("Tree"), xlt("Show or hide tree"), adm.config.Read("TreeShown", True, self))
self.registerToggles(True, True)
menubar.Append(menu, xlt("&View"))
self.editmenu=menu=Menu(self)
menu.Add(self.OnEdit, xlt("Edit"), xlt("edit"))
menu.Add(self.OnNew, xlt("New"), xlt("new object"))
menu.Add(self.OnDelete, xlt("Delete"), xlt("delete object"))
menu.Add(self.OnFindObject, xlt("Find"), xlt("find object"))
menubar.Append(menu, xlt("&Edit"))
self.helpmenu=menu=Menu(self)
menu.Add(self.OnHelp, xlt("Help"), xlt("Show help"), wx.ID_HELP)
menu.Add(self.OnLogging, xlt("Logging"), xlt("Show logged problems"))
menu.Add(self.OnAbout, xlt("About"), xlt("About %s") % adm.appTitle, wx.ID_ABOUT, adm.app.SetMacAboutMenuItemId)
menubar.Append(menu, xlt("&Help"))
self.SetMenuBar(menubar)
self.CreateStatusBar()
self.details = Notebook(self)
self.manager.AddPane(self.details, wx.aui.AuiPaneInfo().Center().CloseButton(False) \
.Name("objectDetails").Caption(xlt("Object details")))
self.nodePanel=NodeTreePanel(self, name)
self.tree=self.nodePanel.tree
self.nodePanel.DoShow(False)
self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeSelChange)
self.manager.AddPane(self.nodePanel, wx.aui.AuiPaneInfo().Left().Layer(1).Floatable() \
.Name("objectBrowser").Caption(xlt("Object browser")) \
.MinSize((200,300)).BestSize((250,350)))
self.servers=ServerTreeCtrl(self)
self.manager.AddPane(self.servers, wx.aui.AuiPaneInfo().Bottom().Layer(1).Float() \
.Name("servers").Caption(xlt("Registered Servers")) \
.MinSize((70,70)).BestSize((100,80)))
pers=adm.config.GetPerspective(self)
if pers:
self.manager.LoadPerspective(pers)
ah=AcceleratorHelper(self)
ah.Add(wx.ACCEL_CTRL, 'F', self.OnFindObject)
ah.Add(wx.ACCEL_NORMAL, wx.WXK_F5, self.OnRefresh)
ah.Realize()
self.OnToggleTree()
self.OnToggleToolBar()
self.OnToggleStatusBar()
self.manager.Update()
self.manager.Bind(wx.aui.EVT_AUI_PANE_CLOSE, self.OnAuiCloseEvent)
self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
self.activated=False
def OnFindObject(self, _evt):
self.nodePanel.DoShow(True)
self.nodePanel['Find'].SetFocus()
def OnActivate(self, evt):
if not self.activated:
self.activated=True
CheckAutoUpdate(self)
if not wx.GetKeyState(wx.WXK_SHIFT):
self.AutoConnect(evt)
evt.Skip()
def AutoConnect(self, _evt):
haveOne=False
if self.appArgs:
for server in self.servers.nodes:
if "%s/%s" % (server.module, server.name) in self.appArgs:
rc=self.servers.ConnectServer(server, self.tree.name)
haveOne = haveOne or rc
else:
for server in self.servers.nodes:
if server.settings.get("autoconnect"):
#try:
rc=self.servers.ConnectServer(server, self.tree.name)
haveOne = haveOne or rc
# except StringException:
# pass
if not haveOne:
self.OnShowServers(None)
self.servers.ExpandFirst()
def OnAuiCloseEvent(self, evt):
if evt.GetPane().name == "objectBrowser":
self.viewmenu.Check(self.OnToggleTree, False)
def OnQuit(self, _evt):
self.details=None # this is for Win C++ dtor
self.Close()
def OnToggleTree(self, evt=None):
show=self.viewmenu.IsChecked(self.OnToggleTree)
self.manager.GetPane("objectBrowser").Show(show)
if evt:
self.manager.Update()
adm.config.Write("TreeShown", show, self)
def OnLogging(self, _evt):
dlg=LoggingDialog(self)
dlg.Go()
dlg.Show()
def GetNode(self):
if self.currentNode:
return self.currentNode
else:
return self.tree.GetNode()
def OnHelp(self, _evt):
wx.LaunchDefaultBrowser("http://www.admin4.org/docs")
def OnPreferences(self, _evt):
dlg=PreferencesDlg(self)
dlg.Go()
dlg.Show()
def OnAbout(self, _evt):
about=AboutDlg(self)
about.ShowModal()
def OnShowServers(self, _evt):
self.manager.GetPane("servers").Show(True)
self.manager.Update()
def OnDetach(self, _evt):
node=self.GetNode()
if node:
if not node.detachedWindow:
node.detachedWindow = DetachFrame(self, node)
node.detachedWindow.Show()
node.detachedWindow.Raise()
def OnRefresh(self, _evt):
node=self.GetNode()
if node:
node.Refresh()
node.PopulateChildren()
info=node.GetInfo()
self.SetStatus(info)
def OnNew(self, _evt):
node=self.GetNode()
if node:
newcls=self.getNewClass(node)
if newcls:
newcls.New(self, node.parentNode)
def OnEdit(self, _evt):
node=self.GetNode()
if node and hasattr(node, "Edit"):
node.Edit(self)
def OnDelete(self, _evt):
node=self.tree.GetNode()
if node and hasattr(node, "Delete"):
if not adm.ConfirmDelete(xlt("Delete \"%s\"?") % node.name, xlt("Deleting %s") % node.typename):
return
if node.Delete():
node.RemoveFromTree()
self.SetStatus(xlt("%s \"%s\" deleted.") % (node.typename, node.name))
else:
self.SetStatus(xlt("%s \"%s\" NOT deleted: %s.") % (node.typename, node.name, node.GetServer().GetLastError()))
def OnDisconnect(self, _evt):
node=self.tree.GetNode()
if node and hasattr(node, "Disconnect"):
node.Disconnect()
node.RemoveFromTree()
self.SetStatus(xlt("%s \"%s\" disconnected.") % (node.typename, node.name))
def GetNodePath(self, item):
node=self.tree.GetNode(item)
if not node:
return None
parentItem=self.tree.GetItemParent(item)
if parentItem:
pp=self.GetNodePath(parentItem)
if pp:
return "%s/%s" % (pp, node.id.path())
return node.id.path()
def OnTreeSelChange(self, evt):
if not self.details:
return
item=evt.GetItem()
if item != self.tree.GetSelection():
self.tree.SelectItem(item)
self.tree.EnsureVisible(item)
return
node=self.tree.GetNode(item)
self.details.Set(node)
if node and hasattr(node, "GetHint"):
hint=node.GetHint()
if hint:
if not hasattr(node, 'hintShown'):
node.hintShown=True
if isinstance(hint, tuple):
title=hint[1]
args=hint[2]
hint=hint[0]
else:
title=None
args=None
adm.ShowHint(self, hint, node, title, args)
self.manager.Update()
if not self.lastNode or not node or self.lastNode.moduleClass() != node.moduleClass():
for _i in range(self.standardToolsCount, self.toolbar.GetToolsCount()):
self.toolbar.DeleteToolByPos(self.standardToolsCount)
if node:
for mi in node.moduleinfo()['tools']:
cls=mi['class']
self.toolbar.Add(cls)
self.toolbar.Realize()
self.lastNode=node
if node:
self.EnableMenu(self.editmenu, self.OnEdit, hasattr(node, "Edit"))
self.EnableMenu(self.editmenu, self.OnDelete, hasattr(node, "Delete"))
self.EnableMenu(self.editmenu, self.OnNew, self.getNewClass(node) != None)
for mi in node.moduleinfo()['tools']:
en=self.menuAvailableOnNode(mi, node)
cls=mi['class']
if en:
if hasattr(cls, 'CheckEnabled'):
en=cls.CheckEnabled(node)
self.toolbar.Enable(cls.OnExecute, en)
server=node.GetServer()
if server != node: # don't store a server's nodePath, this would overwrite the desired nodePath on disconnect
nodePath=self.GetNodePath(item)
if nodePath:
server.settings['nodePath'] = nodePath
adm.config.storeServerSettings(server, server.settings)
self.tree.SetFocus()
if not node:
self.SetStatus("")
return
self.SetStatus(node.GetInfo())
def getNewClass(self, node):
if hasattr(node, "New"):
return node.__class__
elif isinstance(node, adm.Group) and node.memberclass and hasattr(node.memberclass, "New"):
return node.memberclass
elif isinstance(node, adm.Collection) and node.nodeclass and hasattr(node.nodeclass, "New"):
return node.nodeclass
return None
def menuAvailableOnNode(self, mi, node):
cls=mi['class']
if hasattr(cls, "CheckAvailableOn"):
return cls.CheckAvailableOn(node)
nodeclasses=mi.get('nodeclasses')
if nodeclasses:
for nc in nodeclasses:
if isinstance(node, nc):
return True
else:
logger.debug("no nodeclasses for %s", cls.__name__)
return False
def GetContextMenu(self, node):
contextMenu=Menu(self)
if not len(node.properties):
node.GetProperties()
newcls=self.getNewClass(node)
newmenu=Menu(self)
if newcls:
newmenu.Add(newcls.New, xlt("New %s") % newcls.shortname, xlt("Create new %s") % newcls.typename)
morenew=node.nodeinfo().get('new', [])
if isinstance(morenew, list):
morenew=list(morenew) # copy
else:
morenew=[morenew]
children=node.nodeinfo().get('children', [])
for child in children:
childnodeinfo=node.nodeinfo(child)
childclass=childnodeinfo['class']
if childclass not in morenew:
morenew.append(childclass)
childnew=childnodeinfo.get('new', [])
if not isinstance(childnew, list):
childnew=[childnew]
for childclass in childnew:
if childclass not in morenew:
morenew.append(childclass)
for cls in morenew:
if cls == newcls:
continue
if hasattr(cls, "New"):
newmenu.Add(cls.New, xlt("New %s") % cls.shortname, xlt("Create new %s") % cls.typename)
contextMenu.AppendOneMenu(newmenu, xlt("New Object"), xlt("Creates a new object"))
if hasattr(node, "Delete"):
if not hasattr(node, "deleteDisable") or not node.deleteDisable:
contextMenu.Add(self.OnDelete, xlt("Delete %s") % node.shortname, xlt("Delete %s %s") % (node.typename,node.name))
if hasattr(node, "Disconnect"):
contextMenu.Add(self.OnDisconnect, xlt("Disconnect %s") % node.name, xlt("Disconnect %s \"%s\"") % (node.typename,node.name))
if contextMenu.GetMenuItemCount():
contextMenu.AppendSeparator()
contextMenu.Add(self.OnRefresh, xlt("Refresh"), xlt("Refresh %s") % node.typename)
contextMenu.Add(self.OnDetach, xlt("Detach view"), xlt("Show %s in detached window") % node.typename)
needSeparator=True
for mi in node.menuinfos():
if self.menuAvailableOnNode(mi, node):
if needSeparator:
contextMenu.AppendSeparator()
needSeparator=False
cls=mi['class']
item=contextMenu.Add(cls.OnExecute, cls.name, cls.help)
if hasattr(cls, "CheckEnabled") and not cls.CheckEnabled(node):
contextMenu.Enable(item, False)
if hasattr(node, "Edit"):
contextMenu.AppendSeparator()
contextMenu.Add(self.OnEdit, xlt("Properties"), xlt("Edit properties of %s") % node.typename)
return contextMenu
class DetachFrame(Frame):
def __init__(self, parentWin, node):
self.node=node
title=xlt("%(type)s %(name)s") % {'type': node.typename, 'name': node.name}
style=wx.MAXIMIZE_BOX|wx.RESIZE_BORDER|wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX
adm.Frame.__init__(self, parentWin, title, style, (400,300), None)
self.SetIcon(node.GetIcon())
ah=AcceleratorHelper(self)
ah.Add(wx.ACCEL_NORMAL, wx.WXK_F5, self.OnRefresh)
ah.Realize()
self.details = Notebook(self)
self.details.detached=True
self.details.Set(node)
def OnRefresh(self, _evt):
self.node.Refresh()
self.node.PopulateChildren()
def OnClose(self, evt):
if self.node:
self.node.CleanupDetached()
self.node.detachedWindow=None
self.node=None
Frame.OnClose(self, evt)