/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/tree.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/tree.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 383 by jonathan, Tue Jan 28 18:38:03 2003 UTC revision 488 by jonathan, Fri Mar 7 18:21:25 2003 UTC
# Line 14  from types import StringType, UnicodeTyp Line 14  from types import StringType, UnicodeTyp
14  from wxPython.wx import *  from wxPython.wx import *
15    
16  from Thuban import _  from Thuban import _
17    from Thuban.UI.common import *
18    
19  from Thuban.Model.color import Color  from Thuban.Model.color import Color
20    
# Line 106  class SessionTreeCtrl(wxTreeCtrl): Line 107  class SessionTreeCtrl(wxTreeCtrl):
107                  self.SelectItem(item)                  self.SelectItem(item)
108    
109      def add_items(self, parent, items):      def add_items(self, parent, items):
         # print "\n---\n", items  
110    
111          if items is None: return          if items is None: return
112    
# Line 127  class SessionTreeCtrl(wxTreeCtrl): Line 127  class SessionTreeCtrl(wxTreeCtrl):
127              else:              else:
128                  # assume its a sequence (title, items)                  # assume its a sequence (title, items)
129                  if isinstance(item[1], Color):                  if isinstance(item[1], Color):
130                      treeitem = self.AppendItem(parent, _("(%s)") % item[0])  
131                        treeitem = self.AppendItem(parent, "(%s)" % item[0])
132    
133                      bmp = wxEmptyBitmap(BMP_SIZE, BMP_SIZE)                      bmp = wxEmptyBitmap(BMP_SIZE, BMP_SIZE)
134                      brush = wxBrush(wxColour(item[1].red * 255,                      brush = wxBrush(Color2wxColour(item[1]), wxSOLID)
                                              item[1].green * 255,  
                                              item[1].blue * 255),  
                                     wxSOLID)  
135                      dc = wxMemoryDC()                      dc = wxMemoryDC()
136                      dc.SelectObject(bmp)                      dc.SelectObject(bmp)
137                      dc.SetBrush(brush)                      dc.SetBrush(brush)
# Line 214  class SessionTreeView(NonModalDialog): Line 212  class SessionTreeView(NonModalDialog):
212                                  _("Session"))                                  _("Session"))
213          self.tree = SessionTreeCtrl(self, -1, app)          self.tree = SessionTreeCtrl(self, -1, app)
214    
215      def OnClose(self, event):      def Shutdown(self):
         #self.interactor.Unsubscribe(SELECTED_SHAPE, self.select_shape)  
         NonModalDialog.OnClose(self, event)  
   
216          # if there were a way to get notified when the tree control          # if there were a way to get notified when the tree control
217          # itself is destroyed we could use that to unsubscribe instead          # itself is destroyed we could use that to unsubscribe instead
218          # of doing it here. (EVT_WINDOW_DESTROY doesn't seem to sent at          # of doing it here. (EVT_WINDOW_DESTROY doesn't seem to sent at
219          # all)          # all)
220          self.tree.unsubscribe_all()          self.tree.unsubscribe_all()
221    
222            # this needs to come last because Destroy will be called
223            NonModalDialog.Shutdown(self)
224    

Legend:
Removed from v.383  
changed lines
  Added in v.488

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26