本文整理汇总了Python中wx.TR_EDIT_LABELS属性的典型用法代码示例。如果您正苦于以下问题:Python wx.TR_EDIT_LABELS属性的具体用法?Python wx.TR_EDIT_LABELS怎么用?Python wx.TR_EDIT_LABELS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.TR_EDIT_LABELS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_EDIT_LABELS [as 别名]
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title, size=(600, 400))
w, h = self.GetClientSizeTuple()
self.tree = wx.TreeCtrl(
self,
wx.NewId(),
wx.DefaultPosition,
(w, h),
wx.TR_HAS_BUTTONS | wx.TR_EDIT_LABELS)
self.InitTree()
self.OnExpandAll()
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_EDIT_LABELS [as 别名]
def __init__(self, parent, application):
style = wx.TR_DEFAULT_STYLE|wx.TR_HAS_VARIABLE_ROW_HEIGHT
style |= wx.TR_EDIT_LABELS
if wx.Platform == '__WXGTK__': style |= wx.TR_NO_LINES|wx.TR_FULL_ROW_HIGHLIGHT
elif wx.Platform == '__WXMAC__': style &= ~wx.TR_ROW_LINES
wx.TreeCtrl.__init__(self, parent, -1, style=style)
self.cur_widget = None # reference to the selected widget
self.root = application
image_list = wx.ImageList(21, 21)
image_list.Add(wx.Bitmap(os.path.join(config.icons_path, 'application.xpm'), wx.BITMAP_TYPE_XPM))
for w in WidgetTree.images:
WidgetTree.images[w] = image_list.Add(misc.get_xpm_bitmap(WidgetTree.images[w]))
self.AssignImageList(image_list)
application.item = self.AddRoot(_('Application'), 0)
self._SetItemData(application.item, application)
self.skip_select = 0 # avoid an infinite loop on win32, as SelectItem fires an EVT_TREE_SEL_CHANGED event
self.drop_target = clipboard.DropTarget(self, toplevel=True)
self.SetDropTarget(self.drop_target)
self._drag_ongoing = False
self.auto_expand = True # this control the automatic expansion of nodes: it is set to False during xml loading
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.on_change_selection)
self.Bind(wx.EVT_RIGHT_DOWN, self.popup_menu)
self.Bind(wx.EVT_LEFT_DCLICK, self.on_left_dclick)
self.Bind(wx.EVT_LEFT_DOWN, self.on_left_click) # allow direct placement of widgets
self.Bind(wx.EVT_MENU, self.on_menu) # for handling the selection of the first item
self._popup_menu_widget = None # the widget for the popup menu
self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.begin_drag)
self.Bind(wx.EVT_LEAVE_WINDOW, self.on_leave_window)
self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_events)
self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.begin_edit_label)
self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.end_edit_label)
#self.Bind(wx.EVT_KEY_DOWN, misc.on_key_down_event)
self.Bind(wx.EVT_KEY_DOWN, self.on_key_down_event)
#self.Bind(wx.EVT_CHAR_HOOK, self.on_char) # on wx 2.8 the event will not be delivered to the child
self.Bind(wx.EVT_TREE_DELETE_ITEM, self.on_delete_item)
示例3: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_EDIT_LABELS [as 别名]
def __init__(self, parent, document, size=wx.DefaultSize):
self.document = document
self.root = None
self.editLabelId = None
self.insertionMark = None
self.editControl = EditControlProxy(self)
style = (
wx.TR_HAS_BUTTONS |
wx.TR_EDIT_LABELS |
wx.TR_ROW_LINES |
wx.CLIP_CHILDREN
)
wx.TreeCtrl.__init__(self, parent, size=size, style=style)
self.SetImageList(eg.Icons.gImageList)
self.hwnd = self.GetHandle()
self.normalfont = self.GetFont()
self.italicfont = self.GetFont()
self.italicfont.SetStyle(wx.FONTSTYLE_ITALIC)
self.Bind(wx.EVT_SET_FOCUS, self.OnGetFocusEvent)
self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocusEvent)
self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnItemExpandingEvent)
self.Bind(wx.EVT_TREE_ITEM_COLLAPSING, self.OnItemCollapsingEvent)
self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnBeginLabelEditEvent)
self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndLabelEditEvent)
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivateEvent)
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDoubleClickEvent)
self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnRightClickEvent)
self.Bind(wx.EVT_TREE_ITEM_MENU, self.OnItemMenuEvent)
self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDragEvent)
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChangedEvent)
self.visibleNodes = {}
self.expandedNodes = document.expandedNodes
self.dropTarget = DropTarget(self)
self.SetDropTarget(self.dropTarget)
eg.Bind("NodeAdded", self.OnNodeAdded)
eg.Bind("NodeDeleted", self.OnNodeDeleted)
eg.Bind("NodeChanged", self.OnNodeChanged)
eg.Bind("NodeSelected", self.OnNodeSelected)
eg.Bind("DocumentNewRoot", self.OnNewRoot)
if document.root:
self.OnNewRoot(document.root)
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_EDIT_LABELS [as 别名]
def __init__(self, parent, folder, filter=None, editable=True):
wx.Panel.__init__(self, parent, style=wx.TAB_TRAVERSAL)
main_sizer = wx.BoxSizer(wx.VERTICAL)
self.Tree = wx.TreeCtrl(self,
style=(wx.TR_HAS_BUTTONS |
wx.TR_SINGLE |
wx.SUNKEN_BORDER |
wx.TR_HIDE_ROOT |
wx.TR_LINES_AT_ROOT |
wx.TR_EDIT_LABELS))
if wx.Platform == '__WXMSW__':
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeItemExpanded, self.Tree)
self.Tree.Bind(wx.EVT_LEFT_DOWN, self.OnTreeLeftDown)
else:
self.Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnTreeItemExpanded, self.Tree)
self.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnTreeItemCollapsed, self.Tree)
self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnTreeBeginLabelEdit, self.Tree)
self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnTreeEndLabelEdit, self.Tree)
main_sizer.AddWindow(self.Tree, 1, flag=wx.GROW)
if filter is not None:
self.Filter = wx.ComboBox(self, style=wx.CB_READONLY)
self.Bind(wx.EVT_COMBOBOX, self.OnFilterChanged, self.Filter)
main_sizer.AddWindow(self.Filter, flag=wx.GROW)
else:
self.Filter = None
self.SetSizer(main_sizer)
self.Folder = folder
self.Editable = editable
self.TreeImageList = wx.ImageList(16, 16)
self.TreeImageDict = {}
for item_type, bitmap in [(DRIVE, "tree_drive"),
(FOLDER, "tree_folder"),
(FILE, "tree_file")]:
self.TreeImageDict[item_type] = self.TreeImageList.Add(GetBitmap(bitmap))
self.Tree.SetImageList(self.TreeImageList)
self.Filters = {}
if self.Filter is not None:
filter_parts = filter.split("|")
for idx in xrange(0, len(filter_parts), 2):
if filter_parts[idx + 1] == "*.*":
self.Filters[filter_parts[idx]] = ""
else:
self.Filters[filter_parts[idx]] = filter_parts[idx + 1].replace("*", "")
self.Filter.Append(filter_parts[idx])
if idx == 0:
self.Filter.SetStringSelection(filter_parts[idx])
self.CurrentFilter = self.Filters[self.Filter.GetStringSelection()]
else:
self.CurrentFilter = ""