def init_tree(self, label): tree = gizmos.TreeListCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_ROW_LINES | wx.TR_COLUMN_LINES | wx.TR_NO_LINES | wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | wx.NO_BORDER) tree.AddColumn(label) tree.AddColumn("Value") tree.SetColumnWidth(0, 50) tree.SetColumnWidth(1, 60) tree.SetColumnEditable(1, True) tree.AddRoot("The Root Item") window = tree.GetMainWindow() window.Bind(wx.EVT_MOUSEWHEEL, partial(self.OnWheel, tree)) window.Bind(wx.EVT_KEY_UP, partial(self.OnKeyUp, tree)) window.Bind(wx.EVT_LEFT_DCLICK, partial(self.OnLeftDClick, tree)) window.Bind(wx.EVT_KEY_DOWN, partial(self.OnKeyDown, tree)) self.Bind(wx.EVT_TREE_END_LABEL_EDIT, partial(self.OnEndEdit, tree), tree) return tree
def __init__(self): self.xrcRootItem = None xrcSetFile("../buildsys3/gui/xrc/renderpath.xrc") xrcLoadFrame(self, None, 'RenderPathFrame') # extracting controls self.treePanel = xrcCTRLUnpack(self, "RPTreePanel") self.workPanel = xrcCTRLUnpack(self, "RPWorkPanel") self.tree = gizmos.TreeListCtrl(self.treePanel, -1, style = wx.TR_TWIST_BUTTONS|wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT|wx.TR_NO_BUTTONS) # configuring controls self.InitTree() ## self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.GetMainWindow().Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged) w = self.treePanel.GetMinWidth() h = self.treePanel.GetMinHeight() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.tree, 1, wx.EXPAND|wx.ALL) self.treePanel.SetSizer(sizer) self.treePanel.SetAutoLayout(True) sizer.Fit(self.treePanel) self.treePanel.SetSizeWH(w - 2, h - 2) self.tree.SetSizeWH(w - 2, h - 2) self.workSubPanel = None self.rootRPEl = None self.globalShaders = [] self.globalRenderTargets = [] self.globalVariables = []
def _init_ui(self): """ Init the UI elements """ # A TreeListCtrl contains all of the XML tree_style = (wx.TR_DEFAULT_STYLE | wx.TR_ROW_LINES | wx.TR_COLUMN_LINES | wx.TR_FULL_ROW_HIGHLIGHT) self.tree = wxdv.TreeListCtrl( self, wx.ID_ANY, style=tree_style, ) # Add the columns that always exist. self.tree.AddColumn("Item") self.tree.AddColumn("DataType") self.tree.SetMainColumn(0) # contains the tree self.tree.SetColumnWidth(0, 325) self.tree.SetColumnWidth(1, 140) self.root = self.tree.AddRoot("root") # Expand some items by default self.tree.ExpandAll(self.root) self.vbox = wx.BoxSizer(wx.VERTICAL) self.vbox.Add(self.tree, 1, wx.EXPAND) self.SetSizer(self.vbox)
def __init__(self, parent, name, pnlitems=[]): """ Keyword arguments: parent : parent panel (guiWidgets.PnLTabPanel) pnlitems : pandas.DataFrame consisting of all PnL items (FrontPnL > DailyPnL.pnlitems) """ wx.Panel.__init__(self, parent, wx.ID_ANY)#-1 self.Bind(wx.EVT_SIZE, self.OnSize) self.pnlitems=pnlitems self.parent=parent self.name = name self.tree = gizmos.TreeListCtrl(self, wx.ID_ANY) isz = (16,16) il = wx.ImageList(isz[0], isz[1]) self.fldridx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) self.fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) self.fileidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) #smileidx = il.Add(images.Smiles.GetBitmap()) self.tree.SetImageList(il) self.il = il # create some columns self.tree.AddColumn("Book / item") #0 self.tree.AddColumn("Total USD P&L")#1 self.tree.AddColumn("SOD pos.") #2 self.tree.AddColumn("EOD pos.") #3 self.tree.AddColumn("P(yday)") #4 self.tree.AddColumn("P(tday)") #5 self.tree.AddColumn("SOD P&L") #6 self.tree.AddColumn("Trade P&L") #7 for i in range(1,8): self.tree.SetColumnAlignment(i,wx.ALIGN_RIGHT) self.tree.SetMainColumn(0) # self.the one wiself.th self.the tree in it... self.tree.SetColumnWidth(0, 175) self.root = self.tree.AddRoot("Total") self.treeKeyDc={} self.treeCountryDc={} self.treeIssuerDc={} self.treeBookDc={} #self.onFillTree() self.onUpdateTree() self.tree.Expand(self.root) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) if self.name == 'live': pub.subscribe(self.onRefreshTree, "REFRESH_TREE") else: pass
def __init__(self): wx.Frame.__init__(self, None, title=u"树表控件", size=(400, 400)) # 创建树表控件 self.tree = gizmos.TreeListCtrl(self, -1, style = wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.il = wx.ImageList(16, 16, True) # 给树表添加图标 self.il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16,16))) self.il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, (16,16))) self.il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, (16,16))) self.tree.SetImageList(self.il) # 添加树表的列 self.tree.AddColumn(u"第1列") self.tree.AddColumn(u"第2列") self.tree.AddColumn(u"第3列") self.tree.SetColumnWidth(0, 186) self.root = self.tree.AddRoot("root") self.tree.SetItemText(self.root, "", 1) # 设置第2列第1行单元格的文本 self.tree.SetItemText(self.root, "", 2) # 设置第3列第1行单元格的文本 for x in range(5): # 设置子节点的文本和图标 child = self.tree.AppendItem(self.root, str(x)) self.tree.SetItemText(child, str(x), 0) self.tree.SetItemText(child, str(x), 1) self.tree.SetItemText(child, str(x), 2) self.tree.SetItemImage(child, 0, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(child, 1, which = wx.TreeItemIcon_Expanded) for y in range(5): last = self.tree.AppendItem(child, str(y)) self.tree.SetItemText(last, str(x) + "-" + str(y), 0) self.tree.SetItemText(last, str(x) + "-" + str(y), 1) self.tree.SetItemText(last, str(x) + "-" + str(y), 2) self.tree.SetItemImage(last, 0, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(last, 1, which = wx.TreeItemIcon_Expanded) self.tree.Expand(self.root)
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) self.Bind(wx.EVT_SIZE, self.OnSize) self.tree = gizmos.TreeListCtrl( self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_HAS_BUTTONS #| wx.TR_TWIST_BUTTONS #| wx.TR_ROW_LINES | wx.TR_COLUMN_LINES #| wx.TR_NO_LINES | wx.TR_FULL_ROW_HIGHLIGHT) # create some columns self.tree.AddColumn("Books") self.tree.AddColumn("Buyer") self.tree.AddColumn("Seller") self.tree.AddColumn("Date") self.tree.AddColumn("No") self.tree.AddColumn("Price") self.tree.SetMainColumn(0) # the one with the tree in it... self.tree.SetColumnWidth(0, 200) self.tree.SetColumnWidth(1, 200) self.tree.SetColumnWidth(2, 100) self.tree.SetColumnWidth(3, 100) self.tree.SetColumnWidth(4, 50) self._populate() # self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1, style=0) self.parent = parent self.frame = self.parent.parent self.db = self.parent.parent.db self.dbx = datamodel.CategoryData(self.db) sizer = wx.BoxSizer(wx.VERTICAL) self.tree = gizmos.TreeListCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_HIDE_ROOT) sizer.Add(self.tree, 1, wx.EXPAND | wx.ALL) self.init() self.SetSizer(sizer) self.SetAutoLayout(True) self.currentItem = None self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated, self.tree) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnPopupMenu) self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnItemSelected, self.tree)
def DoCreateResource(self): assert self.GetInstance() is None w = gizmos.TreeListCtrl(self.GetParentAsWindow(), self.GetID(), style=self.GetStyle(), name=self.GetName()) return w
def __init__(self, *args, **kw): wx.Panel.__init__(self, *args, **kw) #sizers vbox = wx.BoxSizer(wx.VERTICAL) text_hbox = wx.BoxSizer(wx.HORIZONTAL) self.tree = gizmos.TreeListCtrl( self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_HAS_BUTTONS | wx.TR_TWIST_BUTTONS | wx.TR_ROW_LINES #| wx.TR_COLUMN_LINES | wx.TR_NO_LINES | wx.TR_FULL_ROW_HIGHLIGHT) # Create columns. self.tree.AddColumn("Model") self.tree.AddColumn("Parameter") self.tree.AddColumn("Value") self.tree.AddColumn("Minimum") self.tree.AddColumn("Maximum") self.tree.AddColumn("Fit?") # Align the textctrl box with treelistctrl. self.tree.SetMainColumn(0) # the one with the tree in it... self.tree.SetColumnWidth(0, 180) self.tree.SetColumnWidth(1, 150) self.tree.SetColumnWidth(2, 73) self.tree.SetColumnWidth(3, 73) self.tree.SetColumnWidth(4, 73) self.tree.SetColumnWidth(5, 40) # Determine which colunms are editable. self.tree.SetColumnEditable(0, False) self.tree.SetColumnEditable(1, False) self.tree.SetColumnEditable(2, True) self.tree.SetColumnEditable(3, True) self.tree.SetColumnEditable(4, True) self.tree.SetColumnEditable(5, False) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndEdit) ''' self.tree.Bind(wx.EVT_TREE_ITEM_GETTOOLTIP,self.OnTreeTooltip) wx.EVT_MOTION(self.tree, self.OnMouseMotion) ''' vbox.Add(self.tree, 1, wx.EXPAND) self.SetSizer(vbox) self.SetAutoLayout(True) self._need_update_parameters = self._need_update_model = False self.Bind(wx.EVT_SHOW, self.OnShow)
def __init__(self, parent, propeditor, log): self.log = log self.propeditor = propeditor self.designer = None self.highlighting = None self.selected_obj = None # used by the toolbox as default drop target wx.Panel.__init__(self, parent, -1) self.Bind(wx.EVT_SIZE, self.OnSize) self.tree = gizmos.TreeListCtrl( self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_HAS_BUTTONS #| wx.TR_TWIST_BUTTONS | wx.TR_ROW_LINES | wx.TR_COLUMN_LINES #| wx.TR_NO_LINES | wx.TR_FULL_ROW_HIGHLIGHT) isz = (16, 16) il = wx.ImageList(isz[0], isz[1]) fldridx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) fldropenidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) fileidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) self.images_map = {} for name, ctrl in registry.CONTROLS.items() + registry.WINDOWS.items( ) + registry.MENU.items(): if ctrl._image: #bmp = wx.Bitmap(os.path.join(path, filename), wx.BITMAP_TYPE_XPM) self.images_map[name] = il.Add( ctrl._image.GetBitmap().ConvertToImage().Scale( 16, 16).ConvertToBitmap()) self.tree.SetImageList(il) self.il = il # create some columns self.tree.AddColumn("Object name") self.tree.AddColumn("Class") #self.tree.AddColumn("Column 2") self.tree.SetMainColumn(0) # the one with the tree in it... self.tree.SetColumnWidth(0, 175) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelect)
def __init__(self, parent, df, groupList, treeHeader, treeHeaderWidth, columnHeaders, columnList, columnWidths, columnAlignment, columnFormats, strTreeID): """Keyword arguments: parent : parent th = trade history (defaults to empty array if not specified) #groupedData in a multiindex Dataframe, typically the result of a df.groupby[columnList].sum() """ wx.Panel.__init__(self, parent, wx.ID_ANY) #-1 self.parent = parent self.df = df self.groupList = groupList self.treeHeader = treeHeader self.treeHeaderWidth = treeHeaderWidth self.columnHeaders = columnHeaders self.columnList = columnList self.columnWidths = columnWidths self.columnAlignment = columnAlignment self.columnFormats = columnFormats self.strTreeID = strTreeID #self.groupedData = df.groupby(self.groupList) #self.groupedDataSum = self.groupedData[columnList].sum() self.tree = gizmos.TreeListCtrl(self, wx.ID_ANY) isz = (16, 16) il = wx.ImageList(isz[0], isz[1]) self.fldridx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) self.fldropenidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) self.fileidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) self.il = il self.tree.SetImageList(il) # create some columns self.tree.AddColumn(self.treeHeader) self.tree.SetColumnAlignment(0, wx.ALIGN_LEFT) self.tree.SetColumnWidth(0, self.treeHeaderWidth) for i, (c, w, a) in enumerate( zip(columnHeaders, columnWidths, columnAlignment)): self.tree.AddColumn(c) self.tree.SetColumnAlignment(i + 1, a) self.tree.SetColumnWidth(i + 1, w) self.tree.SetMainColumn(0) #Bind events self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.onRightUp) self.Bind(wx.EVT_SIZE, self.onSize) self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.onActivate) pub.subscribe(self.onUpdateTree, "REDRAW_TREE") #First draw self.onUpdateTree(MessageContainer('empty'))
def CreateTreeListCtrl(self): tree = gizmos.TreeListCtrl( self.Notebook1, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_EDIT_LABELS #| wx.TR_TWIST_BUTTONS | wx.TR_ROW_LINES | wx.TR_COLUMN_LINES | wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT) tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.treeOnSelChanged) tree.GetMainWindow().Bind(wx.EVT_RIGHT_DOWN, self.test) self.tree = tree return tree
def DoCreateResource(self): assert self.GetInstance() is None w = gizmos.TreeListCtrl(self.GetParentAsWindow(), self.GetID(), style=self.GetStyle(), name=self.GetName()) w.AddColumn("Main column") w.AddColumn('Column 1') w.SetMainColumn(0) w.SetColumnWidth(0, 50) w.SetColumnWidth(1, 50) root = w.AddRoot('Root') w.SetItemText(root, "col 1", 1) item1 = w.AppendItem(root, 'item 1') w.SetItemText(item1, "col 1", 1) w.Expand(root) return w
def __init__(self, parent, df, groupList, treeHeader, treeHeaderWidth, columnHeaders, columnList, columnWidths, columnAlignment, columnFormats, strTreeID): wx.Panel.__init__(self, parent, wx.ID_ANY) #-1 self.parent = parent self.df = df self.groupList = groupList self.treeHeader = treeHeader self.treeHeaderWidth = treeHeaderWidth self.columnHeaders = columnHeaders self.columnList = columnList self.columnWidths = columnWidths self.columnAlignment = columnAlignment self.columnFormats = columnFormats self.strTreeID = strTreeID self.tree = gizmos.TreeListCtrl(self, wx.ID_ANY) isz = (16, 16) il = wx.ImageList(isz[0], isz[1]) self.fldridx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) self.fldropenidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) self.fileidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) self.il = il self.tree.SetImageList(il) # create some columns self.tree.AddColumn(self.treeHeader) self.tree.SetColumnAlignment(0, wx.ALIGN_LEFT) self.tree.SetColumnWidth(0, self.treeHeaderWidth) for i, (c, w, a) in enumerate( zip(columnHeaders, columnWidths, columnAlignment)): self.tree.AddColumn(c) self.tree.SetColumnAlignment(i + 1, a) self.tree.SetColumnWidth(i + 1, w) self.tree.SetMainColumn(0) #Bind events self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.onRightUp) self.Bind(wx.EVT_SIZE, self.OnSize) self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.onActivate) pub.subscribe(self.onUpdateTree, "REDRAW_TREE") #First draw self.onUpdateTree(MessageContainer('empty'))
def __init__(self, parent, buildSys): self.buildSys = buildSys self.codeDir = buildSys.GetAbsPathFromRel('code') self.xrcRootItem = None xrcLoadPanel(self, parent, 'CmdEditorPanel') # extracting controls treePanel = xrcCTRLUnpack(self, "TreePanel") self.fileName = xrcCTRLUnpack(self, "FileName") self.previewBtn = xrcCTRLUnpack(self, "Preview", {wx.EVT_BUTTON:self.OnPreview}) self.convertBtn = xrcCTRLUnpack(self, "Convert", {wx.EVT_BUTTON:self.OnConvert}) self.applyBtn = xrcCTRLUnpack(self, "Apply", {wx.EVT_BUTTON:self.OnApply}) self.workPanel = xrcCTRLUnpack(self, "WorkPanel") self.statusLine = xrcCTRLUnpack(self, "StatusLine") self.tree = gizmos.TreeListCtrl(treePanel, -1, style = wx.TR_HIDE_ROOT|wx.TR_FULL_ROW_HIGHLIGHT|wx.TR_NO_BUTTONS) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.tree, 1, wx.EXPAND|wx.ALL) sizer.Fit(treePanel) treePanel.SetSizer(sizer) # configuring controls self.InitTree() self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.GetMainWindow().Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged) self.tree.GetMainWindow().Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnItemExpanded) #self.tree.GetMainWindow().Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick) self.workSubPanel = None # popup stuff self.popupParseID = wx.NewId() self.Bind(wx.EVT_MENU, self.OnPopupParse, id=self.popupParseID) # cmd parser & configs self.parser = CmdFileProcessor(self.codeDir) self.cmd_configs = [] self.active_cmdfile = None self.parsing_dlg = None
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) self.parent = parent.parent self.tree = gizmos.TreeListCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_ROW_LINES | wx.TR_COLUMN_LINES | wx.TR_NO_LINES | wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT) self.tree.AddColumn("Var") self.tree.AddColumn("Value") ## self.tree.SetMainColumn(0) self.tree.SetColumnWidth(0, 160) self.tree.SetColumnWidth(1, 60) self.tree.SetColumnEditable(1, True) self.root = self.tree.AddRoot("The Root Item") self.item = self.root for i in pyflam3.variation_list: child = self.tree.AppendItem(self.root, i) for k, v in pyflam3.variables[i]: item = self.tree.AppendItem(child, k) self.SetItemText(item, str(float(v())), 1) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.tree, 1, wx.EXPAND) self.SetSizer(sizer) window = self.tree.GetMainWindow() window.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) window.Bind(wx.EVT_KEY_UP, self.OnKeyUp) window.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick) window.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.HasChanged = False
def __init_gui(self): tree = gizmos.TreeListCtrl( self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT | wx.TR_ROW_LINES # | wx.TR_COLUMN_LINES | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_SINGLE) tree.AddColumn(_("Patient name")) tree.AddColumn(_("Patient ID")) tree.AddColumn(_("Age")) tree.AddColumn(_("Gender")) tree.AddColumn(_("Study description")) tree.AddColumn(_("Modality")) tree.AddColumn(_("Date acquired")) tree.AddColumn(_("# Images")) tree.AddColumn(_("Institution")) tree.AddColumn(_("Date of birth")) tree.AddColumn(_("Accession Number")) tree.AddColumn(_("Referring physician")) tree.SetMainColumn(0) # the one with the tree in it... tree.SetColumnWidth(0, 280) # Patient name tree.SetColumnWidth(1, 110) # Patient ID tree.SetColumnWidth(2, 40) # Age tree.SetColumnWidth(3, 60) # Gender tree.SetColumnWidth(4, 160) # Study description tree.SetColumnWidth(5, 70) # Modality tree.SetColumnWidth(6, 200) # Date acquired tree.SetColumnWidth(7, 70) # Number Images tree.SetColumnWidth(8, 130) # Institution tree.SetColumnWidth(9, 100) # Date of birth tree.SetColumnWidth(10, 140) # Accession Number tree.SetColumnWidth(11, 160) # Referring physician self.root = tree.AddRoot(_("InVesalius Database")) self.tree = tree
def __init_gui(self): tree = gizmos.TreeListCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT | wx.TR_ROW_LINES | wx.TR_COLUMN_LINES | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_MULTIPLE | wx.TR_HIDE_ROOT) tree.AddColumn(_("Path")) tree.AddColumn(_("Type")) tree.AddColumn(_("Width x Height")) tree.SetMainColumn(0) tree.SetColumnWidth(0, 880) tree.SetColumnWidth(1, 60) tree.SetColumnWidth(2, 130) self.root = tree.AddRoot(_("InVesalius Database")) self.tree = tree
def __init__(self, parent, title, *args): wx.Frame.__init__(self, parent, -1, title) mb = wx.MenuBar() menu = wx.Menu() menu.Append(wx.ID_FILE, "&Open directrories ...") menu.Append(wx.ID_EXIT, "E&xit") mb.Append(menu, "&File") self.SetMenuBar(mb) wx.EVT_MENU(self, wx.ID_FILE, self.OnCmd_File) wx.EVT_MENU(self, wx.ID_EXIT, self.OnCmd_Exit) self.tree = gizmos.TreeListCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.tree.AddColumn('Mixed', width=300) self.tree.AddColumn('LR', width=50) self.tree.AddColumn('Comment', width=500) if len(args) > 0 and len(args[0]) > 1: wx.CallAfter(self.UpdateView, args[0][0], args[0][1])
def __init__(self, parent, frame, lst): wx.Dialog.__init__(self, frame, -1, title="Manage Favorites") self.parent = parent self.lst = lst[:] self.tree = gizmos.TreeListCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_NO_LINES | wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT) self.tree.AddColumn("Script") self.tree.AddColumn("Shortcut") self.tree.SetColumnWidth(0, 300) self.tree.SetColumnWidth(1, 90) self.tree.SetMinSize((400, 300)) self.UpdateSelector(0) buttons = [ wx.Button(self, i, name, style=wx.BU_EXACTFIT) for (i, name) in ((ID.EDIT, 'Choose Script...'), (ID.REMOVE, 'Remove'), (ID.MOVEUP, 'Move Up'), (ID.MOVEDOWN, 'Move Down')) ] btn_szr = wx.BoxSizer(wx.HORIZONTAL) btn_szr.AddMany(buttons) szr = wx.BoxSizer(wx.VERTICAL) szr.Add(btn_szr) szr.Add(self.tree, 0, wx.EXPAND) btnsizer = self.CreateButtonSizer(wx.OK | wx.CANCEL) if btnsizer: szr.Add(btnsizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) self.SetSizerAndFit(szr)
def __init__(self, parent, title, size, pos): wx.MDIChildFrame.__init__(self, parent, -1, title, size=size, pos=pos) self.tree = gizmos.TreeListCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) # create some columns self.tree.AddColumn("Connection") self.tree.AddColumn("Alarm") self.tree.AddColumn("Value") self.tree.SetMainColumn(0) self.root = self.tree.AddRoot("Connections") self.tree.Expand(self.root) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.Show() child = self.tree.AppendItem(self.root, 'name') self.tree.SetItemText(child, 'name') child2 = self.tree.AppendItem(child, 'name2') ## x = self.tree.AppendItem(child2, "") x = self.tree.AppendItem(child2, "XXX") self.tree.SetItemText(x, 'alarm', 1) self.tree.SetItemText(x, 'value', 2)
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) self.Bind(wx.EVT_SIZE, self.OnSize) self.tree = gizmos.TreeListCtrl(self, -1, style = wx.TR_DEFAULT_STYLE #wx.TR_TWIST_BUTTONS #| wx.TR_ROW_LINES #| wx.TR_NO_LINES | wx.TR_FULL_ROW_HIGHLIGHT # By default the style will be adjusted on # Mac to use twisty buttons and no lines. If # you would rather control this yourself then # add this style. #| wx.TR_DONT_ADJUST_MAC ) isz = (16,16) il = wx.ImageList(isz[0], isz[1]) fldridx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) fileidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_REPORT_VIEW, wx.ART_OTHER, isz)) smileidx = il.Add(images.getSmilesBitmap()) self.tree.SetImageList(il) self.il = il # create some columns self.tree.AddColumn("Main column") self.tree.AddColumn("Column 1") self.tree.AddColumn("Column 2") self.tree.SetMainColumn(0) # the one with the tree in it... self.tree.SetColumnWidth(0, 175) self.root = self.tree.AddRoot("The Root Item") self.tree.SetItemText(self.root, "col 1 root", 1) self.tree.SetItemText(self.root, "col 2 root", 2) self.tree.SetItemImage(self.root, fldridx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(self.root, fldropenidx, which = wx.TreeItemIcon_Expanded) for x in range(15): txt = "Item %d" % x child = self.tree.AppendItem(self.root, txt) self.tree.SetItemText(child, txt + "(c1)", 1) self.tree.SetItemText(child, txt + "(c2)", 2) self.tree.SetItemImage(child, fldridx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(child, fldropenidx, which = wx.TreeItemIcon_Expanded) for y in range(5): txt = "item %d-%s" % (x, chr(ord("a")+y)) last = self.tree.AppendItem(child, txt) self.tree.SetItemText(last, txt + "(c1)", 1) self.tree.SetItemText(last, txt + "(c2)", 2) self.tree.SetItemImage(last, fldridx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(last, fldropenidx, which = wx.TreeItemIcon_Expanded) for z in range(5): txt = "item %d-%s-%d" % (x, chr(ord("a")+y), z) item = self.tree.AppendItem(last, txt) self.tree.SetItemText(item, txt + "(c1)", 1) self.tree.SetItemText(item, txt + "(c2)", 2) self.tree.SetItemImage(item, fileidx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(item, smileidx, which = wx.TreeItemIcon_Selected) self.tree.Expand(self.root) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp)
def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) self.Bind(wx.EVT_SIZE, self.OnSize) self.tree = gizmos.TreeListCtrl(self, -1, style = wx.TR_DEFAULT_STYLE #| wx.TR_HAS_BUTTONS #| wx.TR_TWIST_BUTTONS #| wx.TR_ROW_LINES #| wx.TR_COLUMN_LINES #| wx.TR_NO_LINES | wx.TR_FULL_ROW_HIGHLIGHT ) isz = (16,16) il = wx.ImageList(isz[0], isz[1]) fldridx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) fldropenidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) fileidx = il.Add(wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) smileidx = il.Add(images.getSmilesBitmap()) self.tree.SetImageList(il) self.il = il # create some columns self.tree.AddColumn("Main column") self.tree.AddColumn("Column 1") self.tree.AddColumn("Column 2") self.tree.SetMainColumn(0) # the one with the tree in it... self.tree.SetColumnWidth(0, 175) self.root = self.tree.AddRoot("The Root Item") self.tree.SetItemText(self.root, "col 1 root", 1) self.tree.SetItemText(self.root, "col 2 root", 2) self.tree.SetItemImage(self.root, fldridx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(self.root, fldropenidx, which = wx.TreeItemIcon_Expanded) for x in range(15): txt = "Item %d" % x child = self.tree.AppendItem(self.root, txt) self.tree.SetItemText(child, txt + "(c1)", 1) self.tree.SetItemText(child, txt + "(c2)", 2) self.tree.SetItemImage(child, fldridx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(child, fldropenidx, which = wx.TreeItemIcon_Expanded) for y in range(5): txt = "item %d-%s" % (x, chr(ord("a")+y)) last = self.tree.AppendItem(child, txt) self.tree.SetItemText(last, txt + "(c1)", 1) self.tree.SetItemText(last, txt + "(c2)", 2) self.tree.SetItemImage(last, fldridx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(last, fldropenidx, which = wx.TreeItemIcon_Expanded) for z in range(5): txt = "item %d-%s-%d" % (x, chr(ord("a")+y), z) item = self.tree.AppendItem(last, txt) self.tree.SetItemText(item, txt + "(c1)", 1) self.tree.SetItemText(item, txt + "(c2)", 2) self.tree.SetItemImage(item, fileidx, which = wx.TreeItemIcon_Normal) self.tree.SetItemImage(item, smileidx, which = wx.TreeItemIcon_Selected) self.tree.Expand(self.root) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate)
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) # Resize the TreeListCtrl self.Bind(wx.EVT_SIZE, self.OnSize) self.tree = gizmos.TreeListCtrl(self, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_HAS_BUTTONS | wx.TR_ROW_LINES | wx.TR_FULL_ROW_HIGHLIGHT) isz = (16, 16) il = wx.ImageList(isz[0], isz[1]) fldridx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) fldropenidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) fileidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) self.tree.SetImageList(il) self.il = il # create some columns self.tree.AddColumn("Reserved keywords") self.tree.AddColumn("Comment") self.tree.SetMainColumn(0) # the one with the tree in it... self.root = self.tree.AddRoot("Class") self.tree.SetItemImage(self.root, fldridx, which=wx.TreeItemIcon_Normal) self.tree.SetItemImage(self.root, fldropenidx, which=wx.TreeItemIcon_Expanded) child = self.tree.AppendItem(self.root, 'Keywords') self.tree.SetItemText(child, 'Lua 5.1 keywords', 1) self.tree.SetItemImage(child, fldridx, which=wx.TreeItemIcon_Normal) self.tree.SetItemImage(child, fldropenidx, which=wx.TreeItemIcon_Expanded) for k in LuaLexParser.KEYWORDS: self.tree.AppendItem(child, k) child = self.tree.AppendItem(self.root, 'Operators') self.tree.SetItemText(child, 'Lua 5.1 operators', 1) self.tree.SetItemImage(child, fldridx, which=wx.TreeItemIcon_Normal) self.tree.SetItemImage(child, fldropenidx, which=wx.TreeItemIcon_Expanded) for k in LuaLexParser.OPS: self.tree.AppendItem(child, k) child = self.tree.AppendItem(self.root, 'Delimiters') self.tree.SetItemText(child, 'Lua 5.1 delimiters', 1) self.tree.SetItemImage(child, fldridx, which=wx.TreeItemIcon_Normal) self.tree.SetItemImage(child, fldropenidx, which=wx.TreeItemIcon_Expanded) for k in LuaLexParser.DELIMITERS: self.tree.AppendItem(child, k) self.tree.Expand(self.root) self.tree.SetColumnWidth(0, 200)
def __init__(self, parent, id=wx.ID_ANY, size=(1100, 500)): super(RaceDB, self).__init__(parent, id, style=wx.DEFAULT_DIALOG_STYLE | wx.THICK_FRAME, size=size, title=_('Open RaceDB Event')) fontPixels = 20 font = wx.FontFromPixelSize(wx.Size(0, fontPixels), wx.DEFAULT, wx.NORMAL, wx.NORMAL) explain = wx.StaticText( self, label=(u'{}:').format( _('Drag and Drop any RaceDB URL from the browser.\n\nDrag the small icon just to the left of the URL\non the browser page to the RaceDB logo below' ))) explain.SetFont(font) raceDBLogo = wx.StaticBitmap(self, bitmap=wx.Bitmap( os.path.join(Utils.getImageFolder(), 'RaceDB_big.png'), wx.BITMAP_TYPE_PNG)) self.raceFolder = wx.DirPickerCtrl(self, path=CrossMgrFolderDefault()) self.raceDBUrl = wx.TextCtrl(self, value=RaceDBUrlDefault(), style=wx.TE_PROCESS_ENTER) self.raceDBUrl.Bind(wx.EVT_TEXT_ENTER, self.onChange) self.raceDBUrl.SetDropTarget( URLDropTarget(self.raceDBUrl, self.refresh)) raceDBLogo.SetDropTarget(URLDropTarget(self.raceDBUrl, self.refresh)) self.datePicker = wx.DatePickerCtrl(self, size=(120, -1), style=wx.DP_DROPDOWN | wx.DP_SHOWCENTURY) self.datePicker.Bind(wx.EVT_DATE_CHANGED, self.onChange) fgs = wx.FlexGridSizer(cols=2, rows=0, vgap=4, hgap=4) fgs.AddGrowableCol(1, 1) fgs.Add(wx.StaticText(self, label=_('Race Folder Base')), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) fgs.Add(self.raceFolder, 1, flag=wx.EXPAND) fgs.Add(wx.StaticText(self, label=_('RaceDB URL')), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) fgs.Add(self.raceDBUrl, 1, flag=wx.EXPAND) fgs.Add(wx.StaticText(self, label=_('All Events On')), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) hs = wx.BoxSizer(wx.HORIZONTAL) hs.Add(self.datePicker, flag=wx.ALIGN_CENTER_VERTICAL) self.updateButton = wx.Button(self, label=_('Update')) self.updateButton.Bind(wx.EVT_BUTTON, self.onChange) hs.Add(self.updateButton, flag=wx.LEFT, border=16) fgs.Add(hs) vsHeader = wx.BoxSizer(wx.VERTICAL) vsHeader.Add(raceDBLogo, flag=wx.ALIGN_CENTRE) vsHeader.Add(fgs, 1, flag=wx.EXPAND) self.tree = gizmos.TreeListCtrl(self, style=wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_ROW_LINES) self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.onEventSelect) isz = (16, 16) self.il = wx.ImageList(*isz) self.closedIdx = self.il.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) self.expandedIdx = self.il.Add( wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) self.fileIdx = self.il.Add( wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) self.selectedIdx = self.il.Add( wx.ArtProvider_GetBitmap(wx.ART_LIST_VIEW, wx.ART_OTHER, isz)) self.tree.SetImageList(self.il) self.tree.AddColumn(_('Event Info')) self.tree.AddColumn(_('Event Type'), flag=wx.ALIGN_LEFT) self.eventTypeCol = 1 self.tree.AddColumn(_('Start Time'), flag=wx.ALIGN_RIGHT) self.startTimeCol = 2 self.tree.AddColumn(_('Participants'), flag=wx.ALIGN_RIGHT) self.participantCountCol = 3 self.tree.SetMainColumn(0) self.tree.SetColumnWidth(0, 320) self.tree.SetColumnWidth(self.eventTypeCol, 80) self.tree.SetColumnWidth(self.startTimeCol, 80) self.tree.SetColumnWidth(self.participantCountCol, 80) self.tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.selectChangedCB) self.dataSelect = None hs = wx.BoxSizer(wx.HORIZONTAL) self.okButton = wx.Button(self, label=_("Open Event")) self.okButton.Bind(wx.EVT_BUTTON, self.doOK) self.cancelButton = wx.Button(self, id=wx.ID_CANCEL) hs.Add(self.okButton) hs.AddStretchSpacer() hs.Add(self.cancelButton, flag=wx.LEFT, border=4) hsMain = wx.BoxSizer(wx.HORIZONTAL) vs1 = wx.BoxSizer(wx.VERTICAL) vs1.Add(explain, flag=wx.ALL, border=8) vs1.Add(vsHeader, flag=wx.ALL | wx.EXPAND, border=8) vs2 = wx.BoxSizer(wx.VERTICAL) vs2.Add(self.tree, 1, flag=wx.EXPAND) vs2.Add(hs, 0, flag=wx.EXPAND | wx.ALL, border=8) hsMain.Add(vs1) hsMain.Add(vs2, 1, flag=wx.EXPAND) self.SetSizer(hsMain) self.refresh()
def __init__(self, parent, buildSys): self.buildSys = buildSys self.codeDir = buildSys.GetAbsPathFromRel('code') ## self.tree = gizmos.TreeListCtrl(self, -1, style = ## #wx.TR_DEFAULT_STYLE ## wx.TR_TWIST_BUTTONS ## #| wx.TR_ROW_LINES ## #| wx.TR_NO_LINES ## #| wx.TR_AQUA_BUTTONS ## | wx.TR_HIDE_ROOT ## | wx.TR_FULL_ROW_HIGHLIGHT ## | wx.TR_NO_BUTTONS ## ## # By default the style will be adjusted on ## # Mac to use twisty buttons and no lines. If ## # you would rather control this yourself then ## # add this style. ## #| wx.TR_DONT_ADJUST_MAC ## ) self.xrcRootItem = None xrcLoadPanel(self, parent, 'CmdEditorPanel') # extracting controls treePanel = xrcCTRLUnpack(self, "TreePanel") self.fileName = xrcCTRLUnpack(self, "FileName") self.previewBtn = xrcCTRLUnpack(self, "Preview", {EVT_BUTTON: self.OnPreview}) self.convertBtn = xrcCTRLUnpack(self, "Convert", {EVT_BUTTON: self.OnConvert}) self.applyBtn = xrcCTRLUnpack(self, "Apply", {EVT_BUTTON: self.OnApply}) self.workPanel = xrcCTRLUnpack(self, "WorkPanel") self.statusLine = xrcCTRLUnpack(self, "StatusLine") self.tree = gizmos.TreeListCtrl( treePanel, -1, style=wx.TR_TWIST_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT | wx.TR_NO_BUTTONS) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.tree, 1, wx.EXPAND | wx.ALL) sizer.Fit(treePanel) treePanel.SetSizer(sizer) # configuring controls self.InitTree() self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.GetMainWindow().Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelChanged) self.tree.GetMainWindow().Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnItemExpanded) #self.tree.GetMainWindow().Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick) self.workSubPanel = None # popup stuff self.popupParseID = wx.NewId() self.Bind(wx.EVT_MENU, self.OnPopupParse, id=self.popupParseID) # cmd parser & configs self.parser = CmdFileProcessor(self.codeDir) self.cmd_configs = [] self.active_cmdfile = None self.parsing_dlg = None
def Init_Left(self): self.Label3 = wx.StaticText(self.LeftPanel, -1, "设置客户端链接") self.Label3.SetForegroundColour('white') self.Label3.SetBackgroundColour('black') self.Boxv1.Add(self.Label3, 0, wx.ALIGN_CENTRE, 10) self.Label1 = wx.StaticText(self.LeftPanel, -1, "服务器:") # 服务器ip输入文本框 self.inputText = wx.TextCtrl(self.LeftPanel, -1, "", pos=(80, 10), size=(150, -1)) self.inputText.SetInsertionPoint(0) # 设置焦点位置 self.Boxv1.Add(self.Label1, 0, wx.EXPAND | wx.ALL, 0) self.Boxv1.Add(self.inputText, 0, wx.EXPAND | wx.ALL, 0) self.Label2 = wx.StaticText(self.LeftPanel, -1, "端口:") # 服务器端口输入框 self.pwdText = wx.TextCtrl(self.LeftPanel, -1, "", pos=(80, 50), size=(150, -1)) self.Boxv1.Add(self.Label2, 0, wx.EXPAND | wx.ALL,0) self.Boxv1.Add(self.pwdText, 0, wx.EXPAND | wx.ALL,2) self.ButtonC = wx.Button(self.LeftPanel, -1, "确认连接") self.Bind(wx.EVT_BUTTON, self.ButtonConclick, self.ButtonC) self.Boxv1.Add(self.ButtonC, 0, wx.EXPAND | wx.ALL, 5) self.Labellamp = wx.StaticText(self.LeftPanel, -1, "灯管理") self.Labellamp.SetForegroundColour('white') self.Labellamp.SetBackgroundColour('black') self.Boxv1.Add(self.Labellamp, 0, wx.ALIGN_CENTRE, 5) #创建树表控件 self.tree = gizmos.TreeListCtrl(self.LeftPanel,-1) #添加树表的列 self.tree.AddColumn("灯名") self.tree.AddColumn("灯状态") # self.tree.SetColumnWidth(0,186) self.root = self.tree.AddRoot("灯") self.tree.Expand(self.root) self.Boxv1.Add(self.tree, 0, wx.EXPAND | wx.ALL, 5) self.lamp = [] child1 = self.tree.AppendItem(self.root, "led1") # 添加一行 self.tree.SetItemText(child1, "led1", 0) # 按照索引设置每一列的数据 self.tree.SetItemText(child1, "关闭", 1) # 按照索引设置每一列的数据 self.tree.Expand(self.root) self.lamp.append(child1) child2 = self.tree.AppendItem(self.root, "led2") # 添加一行 self.tree.SetItemText(child2, "led2", 0) # 按照索引设置每一列的数据 self.tree.SetItemText(child2, "关闭", 1) # 按照索引设置每一列的数据 self.tree.Expand(self.root) self.lamp.append(child2) #添加灯管理 self.Label3 = wx.StaticText(self.LeftPanel, -1, "添加灯:") self.lampText1 = wx.TextCtrl(self.LeftPanel, -1, "", pos=(80, 10), size=(150, -1)) self.lampText1.SetInsertionPoint(0) # 设置焦点位置 self.Boxv1.Add(self.Label3, 0, wx.EXPAND | wx.ALL, 0) self.Boxv1.Add(self.lampText1, 0, wx.EXPAND | wx.ALL, 0) self.ButtonD = wx.Button(self.LeftPanel, -1, "确认") self.Bind(wx.EVT_BUTTON, self.ButtonDonclick, self.ButtonD) self.Boxv1.Add(self.ButtonD, 0, wx.EXPAND | wx.ALL, 5) # 添加灯管理 self.Label4 = wx.StaticText(self.LeftPanel, -1, "删除灯:") self.lampText2 = wx.TextCtrl(self.LeftPanel, -1, "", pos=(80, 10), size=(150, -1)) self.lampText2.SetInsertionPoint(0) # 设置焦点位置 self.Boxv1.Add(self.Label4, 0, wx.EXPAND | wx.ALL, 0) self.Boxv1.Add(self.lampText2, 0, wx.EXPAND | wx.ALL, 0) self.ButtonF = wx.Button(self.LeftPanel, -1, "确认") self.Bind(wx.EVT_BUTTON, self.ButtonFonclick, self.ButtonF) self.Boxv1.Add(self.ButtonF, 0, wx.EXPAND | wx.ALL, 5) self.logLabel = wx.StaticText(self.LeftPanel, -1, "日志") self.logLabel.SetForegroundColour('white') self.logLabel.SetBackgroundColour('black') self.Boxv1.Add(self.logLabel,0, wx.ALIGN_CENTRE, 10) # 创建文本域 self.logmultiText = wx.TextCtrl(self.LeftPanel, -1, style=wx.TE_MULTILINE) # 创建一个文本控件 self.logmultiText.SetInsertionPoint(0) # 设置插入点 # 在垂直盒子里添加StaticBoxSizer盒子 self.Boxv1.Add(self.logmultiText,5, wx.EXPAND | wx.ALL, 10) #把垂直盒子与LeftPanel关联起来 self.LeftPanel.SetSizer(self.Boxv1)
def __init__(self, parent, mdh, editable=True, refreshable=True): self.mdh=mdh wx.Panel.__init__(self, parent, -1) #self.Bind(wx.EVT_SIZE, self.OnSize) sizer1 = wx.BoxSizer(wx.VERTICAL) self.tree = gizmos.TreeListCtrl(self, -1, style = wx.TR_DEFAULT_STYLE #| wx.TR_HAS_BUTTONS #| wx.TR_TWIST_BUTTONS #| wx.TR_ROW_LINES #| wx.TR_EDIT_LABELS #| wx.TR_COLUMN_LINES #| wx.TR_NO_LINES | wx.TR_FULL_ROW_HIGHLIGHT ) # create some columns self.tree.AddColumn("Entry") self.tree.AddColumn("Value") self.tree.SetMainColumn(0) # the one with the tree in it... self.tree.SetColumnWidth(0, 300) self.tree.SetColumnWidth(1, 300) self.root = self.tree.AddRoot("Metadata") self.tree.SetItemText(self.root, "root", 0) self.paths = {} nmdh = NestedClassMDHandler(mdh) self.addEntries(nmdh, self.root) if editable: self.editableCols = [1] else: self.editableCols = [] #entryNames = self.mdh.getEntryNames() # for k in nmdh.__dict__.keys(): # #txt = "Item %d" % x # child = self.tree.AppendItem(self.root, k) # self.tree.SetItemText(child, txt + "(c1)", 1) if wx.__version__ > '4': self.tree.ExpandAll()#self.root) else: self.tree.ExpandAll(self.root) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) self.tree.GetMainWindow().Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.tree.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndEdit) self.tree.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnBeginEdit) #self.tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivate) sizer1.Add(self.tree, 1, wx.EXPAND, 0) if refreshable: bRefresh = wx.Button(self, -1, 'Refresh') bRefresh.Bind(wx.EVT_BUTTON, self.rebuild) sizer1.Add(bRefresh, 0, wx.ALL|wx.ALIGN_RIGHT, 5) self.SetSizerAndFit(sizer1)
def _init_ui(self): """ """ tree_style = ( wx.TR_DEFAULT_STYLE # | wx.TR_HAS_BUTTONS | wx.TR_ROW_LINES | wx.TR_COLUMN_LINES | wx.TR_FULL_ROW_HIGHLIGHT) self.tree = wxdv.TreeListCtrl( self, wx.ID_ANY, style=tree_style, ) self.tree.AddColumn("MainColumn") self.tree.AddColumn("DataType") self.tree.AddColumn("TestProgram 1") self.tree.AddColumn("TestProgram 2") self.tree.AddColumn("TestProgram 3") self.tree.SetMainColumn(0) # contains the tree self.tree.SetColumnWidth(0, 325) self.tree.SetColumnWidth(1, 200) self.tree.SetColumnWidth(2, 220) self.tree.SetColumnWidth(3, 220) self.tree.SetColumnWidth(4, 220) self.root = self.tree.AddRoot("Flow") # self.root = self.tree.GetRootItem() # add buncha items add_attribute(self.tree, self.root, "FlowType", "", "FTI.Flows6.Flows") properties = self.tree.AppendItem(self.root, "Properties") add_attribute(self.tree, properties, "DeviceType", "DeviceType", "Default") add_attribute(self.tree, properties, "ExceptionHandlingMethod", "ExceptionHandlingMethod", "Exceptions") add_attribute(self.tree, properties, "Name", "String", "ScreeningFlow") add_attribute(self.tree, properties, "Sites", "Sites:Values:UnsignedInt", "1") child = self.tree.AppendItem(properties, "StopOnFail") self.tree.SetItemText(child, "Boolean", 1) self.tree.SetItemText(child, "False", 2) self.tree.SetItemText(child, "True", 3) self.tree.SetItemText(child, "True", 4) self.tree.SetItemBackgroundColour(child, YELLOW) coordinators = self.tree.AppendItem(self.root, "Coordinators") add_attribute(self.tree, coordinators, "<placeholder>", "", "<placeholder>") root_test = self.tree.AppendItem(self.root, "Sequence (name of Root flow)") self.root_test = root_test properties = self.tree.AppendItem(root_test, "Properties") add_attribute(self.tree, properties, "Name", "String", "Sequence") add_attribute(self.tree, properties, "Channel", "DUTChannel", "None") ### Steps steps = self.tree.AppendItem(root_test, "Block: ConfigureDRDSBoard") self.block1 = steps add_attribute(self.tree, steps, "StepType", "", "FTI.Standards.SequenceStep") method = self.tree.AppendItem(steps, "Method") add_attribute(self.tree, method, "MethodType", "", "GanFETLibrary.ConfigureDRDSBoard") add_attribute(self.tree, method, "Shared", "Boolean", "True") method = self.tree.AppendItem(steps, "Properties (PropertyData)") add_attribute(self.tree, method, "Name", "String", "ConfigureDRDSBoard") add_attribute(self.tree, method, "Channel", "DUTChannel", "None") parameters = self.tree.AppendItem(steps, "Parameters") self.block1_params = parameters add_attribute(self.tree, parameters, "SenseConnect", "SenseConnectEnum", "Open") add_attribute(self.tree, parameters, "TabConnect", "Boolean", "True") add_attribute(self.tree, parameters, "VSense", "Double", "0") add_attribute(self.tree, parameters, "ISense", "Double", "1u") add_attribute(self.tree, parameters, "VTab", "Double", "0") add_attribute(self.tree, parameters, "ITab", "Double", "1u") ### KELVIN step = self.tree.AppendItem(steps, "1: KELVIN [TestNumber: Name] (Step)") self.step1 = step add_attribute(self.tree, step, "StepType", "", "FTI.Standards.MethodStep") method = self.tree.AppendItem(step, "Method") add_attribute(self.tree, method, "MethodType", "", "FETDCLibrary6.KELVIN") add_attribute(self.tree, method, "Shared", "Boolean", "True") method = self.tree.AppendItem(step, "Properties (PropertyData)") add_attribute(self.tree, method, "Skip", "Boolean", "False") add_attribute(self.tree, method, "IgnoreFail", "Boolean", "True") add_attribute(self.tree, method, "TestNumber", "UInt32", "1") add_attribute(self.tree, method, "Name", "String", "KELVIN") add_attribute(self.tree, method, "RendezvousingStep", "Booealn", "False") add_attribute(self.tree, method, "UseGoldenUnitData", "Booealn", "False") parameters = self.tree.AppendItem(step, "Parameters") self.step1_params = parameters add_attribute(self.tree, parameters, "PulseWidth", "Double", "300u") add_attribute(self.tree, parameters, "Samples", "Int32", "5") add_attribute(self.tree, parameters, "I_Apply", "IApplyEnum", "R25mA") add_attribute(self.tree, parameters, "EngMode", "Boolean", "True") add_attribute(self.tree, parameters, "RKELVIN_MAX", "", "RKELVIN_MAX") ### RDSON_LC step = self.tree.AppendItem(steps, "2: RDSON_LC [TestNumber: Name] (Step)") self.step2 = step add_attribute(self.tree, step, "StepType", "", "FTI.Standards.MethodStep") method = self.tree.AppendItem(step, "Method") add_attribute(self.tree, method, "MethodType", "", "FETDCLibrary6.RDSON") add_attribute(self.tree, method, "Shared", "Boolean", "True") method = self.tree.AppendItem(step, "Properties (PropertyData)") add_attribute(self.tree, method, "Skip", "Boolean", "False") child = self.tree.AppendItem(method, "IgnoreFail") self.tree.SetItemBackgroundColour(child, YELLOW) self.tree.SetItemText(child, "Boolean", 1) self.tree.SetItemText(child, "True", 2) self.tree.SetItemText(child, "True", 3) self.tree.SetItemText(child, "False", 4) add_attribute(self.tree, method, "TestNumber", "UInt32", "2") add_attribute(self.tree, method, "Name", "String", "RDSON_LC") add_attribute(self.tree, method, "RendezvousingStep", "Booealn", "False") add_attribute(self.tree, method, "UseGoldenUnitData", "Booealn", "False") parameters = self.tree.AppendItem(step, "Parameters") self.step2_params = parameters add_attribute(self.tree, parameters, "PulseWidth", "Double", "300u") child = self.tree.AppendItem(parameters, "ID") self.tree.SetItemBackgroundColour(child, YELLOW) self.tree.SetItemText(child, "Double", 1) self.tree.SetItemText(child, "4", 2) self.tree.SetItemText(child, "3", 3) self.tree.SetItemText(child, "4", 4) add_attribute(self.tree, parameters, "VGS", "Double", "0") add_attribute(self.tree, parameters, "Samples", "Int32", "5") add_attribute(self.tree, parameters, "DisconnectSense", "Boolean", "True") add_attribute(self.tree, parameters, "CurrentRange", "CurrentRangeEnum", "RangeAuto") add_attribute(self.tree, parameters, "GateRes10K", "Boolean", "False") add_attribute(self.tree, parameters, "StabilityCompensation", "StabilityCompensationEnum", "MediumFast") add_attribute(self.tree, parameters, "OneSiteAtATime", "OneSiteAtATimeEnum", "Normal_Behavior") add_attribute(self.tree, parameters, "RDSON_Max", "Double", "200m") add_attribute(self.tree, parameters, "RDSON_Min", "Double", "80m") ### Step not in block step = self.tree.AppendItem( root_test, "5: DynamicRDS_600V [TestNumber: Name] (Step)") self.step3 = step add_attribute(self.tree, step, "StepType", "", "FTI.Standards.MethodStep") method = self.tree.AppendItem(step, "Method") add_attribute(self.tree, method, "MethodType", "", "GaNFETLibrary.DynamicRDS") add_attribute(self.tree, method, "Shared", "Boolean", "True") method = self.tree.AppendItem(step, "Properties (PropertyData)") add_attribute(self.tree, method, "Skip", "Boolean", "False") add_attribute(self.tree, method, "IgnoreFail", "Boolean", "True") add_attribute(self.tree, method, "TestNumber", "UInt32", "5") add_attribute(self.tree, method, "Name", "String", "DynamicRDS_600V") add_attribute(self.tree, method, "RendezvousingStep", "Boolean", "False") add_attribute(self.tree, method, "UseGoldenUnitData", "Boolean", "False") parameters = self.tree.AppendItem( step, "Parameters (ConfigurationPropertyData.PropertyData)") self.step3_params = parameters add_attribute(self.tree, parameters, "VGSH", "Double", "0") add_attribute(self.tree, parameters, "VGSL", "Double", "-30") add_attribute(self.tree, parameters, "VDS_Stress", "Double", "600") add_attribute(self.tree, parameters, "IRangeX10", "Boolean", "False") add_attribute(self.tree, parameters, "ID_Meas", "Double", "6") add_attribute(self.tree, parameters, "ID_Adjust", "Double", "0") add_attribute(self.tree, parameters, "VDS_Meas", "Double", "0") add_attribute(self.tree, parameters, "VForce", "Boolean", "False") add_attribute(self.tree, parameters, "MeasDelay", "Double", "5u") add_attribute(self.tree, parameters, "MeasTime", "Double", "5u") add_attribute(self.tree, parameters, "StressTime", "Double", "100m") add_attribute(self.tree, parameters, "DischargeTime", "Double", "800n") add_attribute(self.tree, parameters, "WriteFile", "Boolean", "False") add_attribute(self.tree, parameters, "SampleRate", "Int32", "1") add_attribute(self.tree, parameters, "RDS_MAX", "Double", "250m") add_attribute(self.tree, parameters, "RDS_MIN", "Double", "80m") child = self.tree.AppendItem(parameters, "RDS_Shift_Max") self.tree.SetItemBackgroundColour(child, YELLOW) self.tree.SetItemText(child, "Double", 1) self.tree.SetItemText(child, "25", 2) self.tree.SetItemText(child, "20", 3) self.tree.SetItemText(child, "25", 4) add_attribute(self.tree, parameters, "RDS_Shift_Min", "Double", "-15") # Expand some items by default self.tree.Expand(self.root) self.tree.Expand(self.root_test) self.tree.Expand(self.block1) self.tree.Expand(self.step1) self.tree.Expand(self.step1_params) self.tree.Expand(self.step2) self.tree.Expand(self.step2_params) self.tree.Expand(self.step3) self.tree.Expand(self.step3_params) # Add a logging window log_style = (wx.TE_MULTILINE | wx.TE_PROCESS_ENTER) self.log = wx.TextCtrl(self, wx.ID_ANY, style=log_style) self.vbox = wx.BoxSizer(wx.VERTICAL) self.vbox.Add(self.tree, 4, wx.EXPAND) self.vbox.Add(self.log, 1, wx.EXPAND) self.SetSizer(self.vbox) self._bind_events()
def populate(self, refresh=False): do = True if refresh: do = self.pmu.Retrieve() and self.pmu.refresh == 1 if not do: return if self.tree: self.tree.Destroy() isz = (16, 16) il = wx.ImageList(isz[0], isz[1]) fldridx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, isz)) fldropenidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_FILE_OPEN, wx.ART_OTHER, isz)) fileidx = il.Add( wx.ArtProvider_GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, isz)) pr = self.FindWindowByName('_panelriep') self.tree = gizmos.TreeListCtrl(pr, -1, style=wx.TR_DEFAULT_STYLE | wx.TR_FULL_ROW_HIGHLIGHT) self.Bind(wx.EVT_SIZE, self.OnSize) self.tree.GetMainWindow().Bind(wx.EVT_LEFT_DCLICK, self.OnDblClick) self.tree.SetImageList(il) self.il = il self.tree.AddColumn("Scadenza") self.tree.AddColumn("Oggetto") self.tree.SetMainColumn(0) # the one with the tree in it... self.tree.SetColumnWidth(0, 175) self.root = self.tree.AddRoot("Promemoria") self.tree.SetItemText(self.root, "", 1) self.tree.SetItemImage(self.root, fldridx, which=wx.TreeItemIcon_Normal) self.tree.SetItemImage(self.root, fldropenidx, which=wx.TreeItemIcon_Expanded) pm = self.pm pm.StoreFilters() if self.soloatt: pm.AddFilter("promem.status<>1") pm.Retrieve() pm.ResumeFilters() for pm in pm: txt = Env.StrDate(pm.datasca) if not txt: txt = '-' child = self.tree.AppendItem(self.root, txt) self.tree.SetItemText(child, pm.oggetto, 1) self.tree.SetItemImage(child, fldridx, which=wx.TreeItemIcon_Normal) self.tree.SetItemImage(child, fldropenidx, which=wx.TreeItemIcon_Expanded) last = child txt = "-" item = self.tree.AppendItem(last, txt) self.tree.SetItemText(item, pm.descriz, 1) self.tree.SetPyData(item, pm.id) self.tree.SetItemImage(item, fileidx, which=wx.TreeItemIcon_Normal) #self.tree.SetItemImage(item, smileidx, which = wx.TreeItemIcon_Selected) if self.pmu.Retrieve(): if self.pmu.refresh: self.pmu.refresh = 0 self.pmu.Save() self._SetSize() self.tree.Expand(self.root)