flummoxed by DynamicSashWindow

I'm trying to decide between DynamicSashWindow and MultiSash to represent multiple views of a ListCtrl.
I'm in the DynamicSashWindow part of my exploration, and I am absolutely flummoxed by how to do
this. I have the layout something like approximately correct, and I have the OnSplit handler firing, but
I can't for the life of me figure out how to attach a new view of the same tree data. Any nudges in the right
direction would be greatly appreciated.

Thanks,
Danny

#%<-----------------------------------------------------------------------
import wx
import wx.gizmos

class MainFrame(wx.Frame):
  def __init__(self, *args, **kwargs):
    super(MainFrame,self).__init__(*args, **kwargs)
    self.comboPanel = ComboPanel(self,wx.ID_ANY)
    self.Show(True)
    
class ComboPanel(wx.Panel):
  def __init__(self, *args, **kwargs):
    super(ComboPanel, self).__init__(*args, **kwargs)
    self.splitter=wx.SplitterWindow(self, wx.ID_ANY)
    self.splitter.SetMinimumPaneSize(100)
    
    self.dsw = wx.gizmos.DynamicSashWindow(self.splitter,wx.ID_ANY)
    self.tree = MyTree(self.dsw)
    
    self.rightPanel=RightPanel(self.splitter, wx.ID_ANY)
    self.splitter.SplitVertically(self.dsw, self.rightPanel, -200)
    mainSizer = wx.BoxSizer(wx.VERTICAL)
    mainSizer.Add(self.splitter, proportion=1, flag=wx.EXPAND|wx.ALL, border=20)
    self.SetSizer(mainSizer)
    
class MyTree(wx.TreeCtrl):
  def __init__(self, parent):
    super(MyTree, self).__init__(parent, wx.ID_ANY, style=wx.TR_HAS_BUTTONS|wx.TR_EDIT_LABELS|wx.TR_LINES_AT_ROOT)
    self.AddRoot("root")
    font=self.GetFont()
    font.SetPointSize(10)
    self.SetFont(font)
    self.dyn_sash= parent
    self.Bind(wx.gizmos.EVT_DYNAMIC_SASH_SPLIT, self.OnSplit)
    
  def OnSplit(self, evt):
    # What do I do here to get a different view of "self"???
    
class RightPanel(wx.Panel):
  def __init__(self, *args, **kwargs):
    super(RightPanel, self).__init__(*args, **kwargs)
    bottomlabel = wx.StaticText(self, -1,"Properties Editor", (5,5))
        
class App(wx.App):
  def OnInit(self):
    self.title = 'Logic Model'
    self.mainFrame = MainFrame(None, wx.ID_ANY,self.title ,size=(750, 750),pos=(0,0),
              style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
    return True

app = App(0)
app.MainLoop()

Danny Shevitz wrote:

I'm trying to decide between DynamicSashWindow and MultiSash to represent multiple views of a ListCtrl.
I'm in the DynamicSashWindow part of my exploration, and I am absolutely flummoxed by how to do
this. I have the layout something like approximately correct, and I have the OnSplit handler firing, but
I can't for the life of me figure out how to attach a new view of the same tree data. Any nudges in the right
direction would be greatly appreciated.

You basically create a new tree ctrl like normal and let the DSW manage it as needed. The main difference though is that instead of just loading a new copy of the data into the new tree, you need to have the new tree pull the data it displays from the same place that the original tree does, and if one is updated then it would be good if the other(s) could show the change too. So this implies that there is some separation between the tree widget and the data it displays, and that it is possible for that data to be shared by multiple tree widgets. It sounds to me like this is just screaming for Frank's new treemixin module that he has been discussing and posting to this list.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Ok. This is kind of what I was expecting. The good news is that I already have a full MOVC architecture, so there is already a separate data object.
I make the view update by sending messages via pubsub. Adding the new tree control as a listener is trivial (in fact it happens automatically on initialization), so hopefully concurrency is no big deal.
The primary reason I wanted to know if you could use the *same* TreeCtrl was 1) to minimize resources (which really isn't such a big deal) and 2)
I have drag and drop implemented. I don't know if wx.EVT_TREE_BEGIN_DRAG/END_DRAG, drag and drop, works between independent TreeCtrl's or whether I'll now have to implement custom dropsource/droptarget.

As for using Franks TreeMixin's, I have an open mind, but I'm not sure what I would gain. Any thoughts would be appreciated.

Danny

···

At 11:56 AM 2/23/2007 -0800, you wrote:

Danny Shevitz wrote:

I'm trying to decide between DynamicSashWindow and MultiSash to represent multiple views of a ListCtrl.
I'm in the DynamicSashWindow part of my exploration, and I am absolutely flummoxed by how to do
this. I have the layout something like approximately correct, and I have the OnSplit handler firing, but
I can't for the life of me figure out how to attach a new view of the same tree data. Any nudges in the right
direction would be greatly appreciated.

You basically create a new tree ctrl like normal and let the DSW manage it as needed. The main difference though is that instead of just loading a new copy of the data into the new tree, you need to have the new tree pull the data it displays from the same place that the original tree does, and if one is updated then it would be good if the other(s) could show the change too. So this implies that there is some separation between the tree widget and the data it displays, and that it is possible for that data to be shared by multiple tree widgets. It sounds to me like this is just screaming for Frank's new treemixin module that he has been discussing and posting to this list.