예제 #1
0
 def __init__(self,parent,rootlabel,treelist=ProjectList,icon1=None,icon2=None):
     TreeCtrl.__init__(self,parent,agwStyle=wx.TR_HIDE_ROOT)
     self.parent=parent
     self.projroot=self.AddRoot(rootlabel)
     self.projitem=[]
     font = wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.BOLD)
     self.SetItemFont(self.projroot,font)
     self.SetBackgroundColour((255,255,255))       
     self.AssignImageList(self.parent.imagelist)         
     self.GrowTree(self.projroot,treelist,self.parent.imagelist.icon1)        
     
     ## Bind event of double click on the tree item.
     self.Bind(wx.EVT_TREE_ITEM_ACTIVATED,self.OnDClick,self)
     # create popmenu for the tree
     self.mea_menu=wx.Menu()
     self.data_menu=wx.Menu()
     ## Bind popmenu events for Measurement leaf.
     for each in ['Open','Close','Delete','Spawn']:
         item=self.mea_menu.Append(-1,each)
         parent.Bind(wx.EVT_MENU,self.On_MeaMenu,item)  ## Only the wx.Panel or (wx.Frame) instance can binds menu events.
     ## Bind popmenu events for Data leaf.
     for each in ['Open','Close', 'Export', 'Delete']:
         item=self.data_menu.Append(-1,each)
         parent.Bind(wx.EVT_MENU,self.On_DataMenu,item) ## Only the wx.Panel or (wx.Frame) instance can binds menu events.
     parent.Bind(wx.EVT_TREE_ITEM_MENU,self.On_ClickOutPopMenu)
예제 #2
0
파일: CrtWidget.py 프로젝트: antopenrf/ART
 def __init__(self,panel,rootlabel,treelist,icon1=None,icon2=None):
     TreeCtrl.__init__(self,panel)
     root=self.AddRoot(rootlabel)
     self.GrowTree(root,treelist,icon1,icon2)
     self.ExpandAll()