194 |
# |
# |
195 |
# restore window information |
# restore window information |
196 |
# |
# |
197 |
#if self.__floatPosition is not None: self.SetPosition(self.__floatPosition) |
if self.__floatPosition is not None: self.SetPosition(self.__floatPosition) |
198 |
#if self.__floatSize is not None: self.SetSize(self.__floatSize) |
if self.__floatSize is not None: self.SetSize(self.__floatSize) |
199 |
|
|
200 |
|
self.__dockPanel.SetSize(self.__topWindow.GetClientSize()) |
201 |
|
|
202 |
self.issue(DOCKABLE_UNDOCKED, self.__id, self) |
self.issue(DOCKABLE_UNDOCKED, self.__id, self) |
203 |
|
|
243 |
self.__dockWindow.SetDefaultSize(wxSize(rw, rh)) |
self.__dockWindow.SetDefaultSize(wxSize(rw, rh)) |
244 |
|
|
245 |
|
|
246 |
def Close(self): |
def Destroy(self): |
247 |
self.__panel.Close(True) |
self.__panel.Destroy() |
248 |
self.__floatWindow.Destroy() |
self.__floatWindow.Destroy() |
249 |
self.__dockWindow.Destroy() |
self.__dockWindow.Destroy() |
250 |
self.__parent.OnDockClose(self) |
self.__parent.OnDockDestroy(self) |
251 |
|
|
252 |
## |
## |
253 |
# Event handlers |
# Event handlers |
254 |
# |
# |
255 |
|
|
256 |
def _OnButtonClose(self, event): |
def _OnButtonClose(self, event): |
257 |
self.Close() |
#self.Close() |
258 |
|
self.Show(False) |
259 |
|
|
260 |
def _OnClose(self, force = False): |
def _OnClose(self, force = False): |
261 |
self.Close() |
self.Show(False) |
262 |
|
|
263 |
def _OnToggleDock(self, event): |
def _OnToggleDock(self, event): |
264 |
self.__CheckAllGood() |
self.__CheckAllGood() |
319 |
# our orientation |
# our orientation |
320 |
# |
# |
321 |
text = wxStaticText(self.__dockPanel, -1, self.GetTitle(), |
text = wxStaticText(self.__dockPanel, -1, self.GetTitle(), |
322 |
style = wxSIMPLE_BORDER | wxALIGN_CENTRE) |
style = wxALIGN_CENTRE) |
323 |
|
|
324 |
# |
# |
325 |
# Perhaps using wxToggleButton would be better, but it's only |
# Perhaps using wxToggleButton would be better, but it's only |
367 |
|
|
368 |
self.openWindows = {} |
self.openWindows = {} |
369 |
|
|
370 |
EVT_SIZE(self, self._OnSashSize) |
self.__update_lock = 0 |
371 |
|
|
372 |
self.SetMainWindow(None) |
self.SetMainWindow(None) |
373 |
|
|
374 |
|
|
375 |
|
EVT_SIZE(self, self._OnSashSize) |
376 |
|
EVT_CLOSE(self, self._OnClose) |
377 |
|
|
378 |
layout2oppSash = { |
layout2oppSash = { |
379 |
wxLAYOUT_NONE : wxSASH_NONE, |
wxLAYOUT_NONE : wxSASH_NONE, |
380 |
wxLAYOUT_TOP : wxSASH_BOTTOM, |
wxLAYOUT_TOP : wxSASH_BOTTOM, |
382 |
wxLAYOUT_RIGHT : wxSASH_LEFT, |
wxLAYOUT_RIGHT : wxSASH_LEFT, |
383 |
wxLAYOUT_BOTTOM : wxSASH_TOP } |
wxLAYOUT_BOTTOM : wxSASH_TOP } |
384 |
|
|
385 |
|
|
386 |
|
def _OnClose(self, event): |
387 |
|
|
388 |
|
self.__update_lock += 1 |
389 |
|
|
390 |
|
# |
391 |
|
# child windows are not notified when the parent is destroyed |
392 |
|
# as of v2.4.0.3 so we need to interate over our children |
393 |
|
# and tell them to go away. |
394 |
|
# |
395 |
|
for key in self.openWindows.keys(): |
396 |
|
win = self.openWindows[key] |
397 |
|
win.Destroy() |
398 |
|
|
399 |
|
self.__update_lock -= 1 |
400 |
|
|
401 |
|
# should really call _UpdateDocks() here but we don't need to |
402 |
|
# since we're going away |
403 |
|
|
404 |
def CreateDock(self, name, id, title, align): |
def CreateDock(self, name, id, title, align): |
405 |
|
|
406 |
if align in (wxLAYOUT_NONE, wxLAYOUT_LEFT, wxLAYOUT_RIGHT): |
if align in (wxLAYOUT_NONE, wxLAYOUT_LEFT, wxLAYOUT_RIGHT): |
425 |
def FindRegisteredDock(self, name): |
def FindRegisteredDock(self, name): |
426 |
return self.openWindows.get(name) |
return self.openWindows.get(name) |
427 |
|
|
428 |
def OnDockClose(self, win): |
def OnDockDestroy(self, win): |
429 |
del self.openWindows[win.GetName()] |
del self.openWindows[win.GetName()] |
430 |
self._UpdateDocks() |
self._UpdateDocks() |
431 |
|
|
435 |
|
|
436 |
def _UpdateDocks(self): |
def _UpdateDocks(self): |
437 |
#print "_UpdateDocks()" |
#print "_UpdateDocks()" |
438 |
wxLayoutAlgorithm().LayoutWindow(self, self.__mainWindow) |
if self.__update_lock == 0: |
439 |
|
wxLayoutAlgorithm().LayoutWindow(self, self.__mainWindow) |
440 |
|
|
441 |
def _OnSashDragged(self, event): |
def _OnSashDragged(self, event): |
442 |
if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE: |
if event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE: |
449 |
#print dockPanel |
#print dockPanel |
450 |
panel = dockPanel.FindWindowById(PANEL_ID) |
panel = dockPanel.FindWindowById(PANEL_ID) |
451 |
#print panel |
#print panel |
452 |
assert(isinstance(panel, DockPanel)) |
assert isinstance(panel, DockPanel) |
453 |
win = panel.GetDockParent() |
win = panel.GetDockParent() |
454 |
#print win |
#print win |
455 |
assert(isinstance(win, DockableWindow)) |
assert isinstance(win, DockableWindow) |
456 |
|
|
457 |
assert(win.IsDocked()) |
assert win.IsDocked() |
458 |
|
|
459 |
rect = event.GetDragRect() |
rect = event.GetDragRect() |
460 |
|
|