示例#1
0
文件: control.py 项目: vpaeder/terapy
 def InsertItem(self, ev, root = None, expand=True):
     """
     
         Insert given event in tree.
         
         Parameters:
             ev        -    event to insert (ScanEvent)
             root      -    parent item (wx.TreeItem, root item if None)
             expand    -    if True, expand parent folder
     
     """
     if root == None:
         root = self.list_events.GetRootItem()
     nitm = self.list_events.AppendItem(root,ev.__extname__)
     idx = modules.index(ev.__class__)
     self.list_events.SetItemImage(nitm,idx)
     f = self.list_events.GetItemFont(nitm)
     f.SetPointSize(10)
     f.SetWeight(wx.FONTWEIGHT_BOLD)
     self.list_events.SetItemFont(nitm,f)
     self.list_events.SetItemPyData(nitm,ev)
     if expand:
         self.list_events.Expand(root)
     ev.refresh()
     ev.populate()
     return nitm
示例#2
0
文件: control.py 项目: vpaeder/terapy
 def InsertItem(self, ev, root = None, expand=True):
     """
     
         Insert given event in tree.
         
         Parameters:
             ev        -    event to insert (ScanEvent)
             root      -    parent item (wx.TreeItem, root item if None)
             expand    -    if True, expand parent folder
     
     """
     if root == None:
         root = self.list_events.GetRootItem()
     nitm = self.list_events.AppendItem(root,ev.__extname__)
     idx = modules.index(ev.__class__)
     self.list_events.SetItemImage(nitm,idx)
     f = self.list_events.GetItemFont(nitm)
     f.SetPointSize(10)
     f.SetWeight(wx.FONTWEIGHT_BOLD)
     self.list_events.SetItemFont(nitm,f)
     self.list_events.SetItemPyData(nitm,ev)
     if expand:
         if wx.Platform == '__WXMSW__': # can't expand/collapse hidden root node with Windows
             pass # TODO: implement a "manual" expand of children
         else:
             self.list_events.Expand(root)
     ev.refresh()
     ev.populate()
     return nitm