本文整理汇总了Python中wx.TR_HAS_BUTTONS属性的典型用法代码示例。如果您正苦于以下问题:Python wx.TR_HAS_BUTTONS属性的具体用法?Python wx.TR_HAS_BUTTONS怎么用?Python wx.TR_HAS_BUTTONS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.TR_HAS_BUTTONS属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [as 别名]
def __init__(self, parentWin, size=wx.DefaultSize, style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT):
DragTreeCtrl.__init__(self, parentWin, "Server", size=size, style=style)
self.groups={}
self.nodes=[]
self.Bind(wx.EVT_RIGHT_DOWN, self.OnTreeRightClick)
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeActivate)
self.currentNode=None
self.currentItem=None
for groupName in adm.config.Read("ServerGroups", []):
self.addGroup(groupName)
for server in adm.config.getServers():
settings=adm.config.getServerSettings(server)
if settings:
logger.debug("Registering %s", server)
self.RegisterServer(settings, True)
else:
logger.debug("Registration for %s missing", server)
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [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()
示例3: OnInit
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [as 别名]
def OnInit(self):
f = wx.Frame(None)
t = wx.TreeCtrl(f, style=0
| wx.TR_HAS_BUTTONS
| wx.TR_TWIST_BUTTONS
| wx.TR_FULL_ROW_HIGHLIGHT
#| wx.TR_HIDE_ROOT
#| wx.TR_ROW_LINES
| wx.TR_MULTIPLE
| wx.TR_EXTENDED
#| wx.TR_NO_LINES
#| wx.NO_FULL_REPAINT_ON_RESIZE
| wx.CLIP_CHILDREN
,)
r = t.AddRoot("Profile")
g = GuiStats(sys.argv[1])
g.gui_print(t, r)
t.Expand(r)
f.Show(True)
return True
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [as 别名]
def __init__(self, parentWin, server, editor):
DragTreeCtrl.__init__(self, parentWin, "Snippets", style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)
self.editor=editor
self.server=server
self.frame=parentWin
self.snippets={}
self.Bind(wx.EVT_RIGHT_DOWN, self.OnTreeRightClick)
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeSelChanged)
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeActivate)
rootSnippets=[]
if self.frame.snippet_table:
set=self.server.GetCursor().ExecuteSet("SELECT * FROM %s ORDER BY parent, sort" % self.frame.snippet_table)
for row in set:
snippet=Snippet(row['id'], row['parent'], row['name'], row['snippet'], row['sort'])
self.snippets[snippet.id]=snippet
if not snippet.parent:
rootSnippets.append(snippet)
for snippet in rootSnippets:
if not snippet.parent:
self.AppendSnippet(snippet, parentItem=self.GetRootItem())
self.checkChildren(snippet)
for snippet in self.snippets.values():
if not snippet.treeitem:
self.AppendSnippet(snippet, parentItem=self.GetRootItem())
else:
item=self.AppendItem(self.GetRootItem(), xlt("Snippets not available:"))
item=self.AppendItem(item, xlt("Server not instrumented."))
self.ExpandAll()
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [as 别名]
def __init__(self, name, parent, index, style=wx.TR_HAS_BUTTONS|wx.BORDER_SUNKEN):
ManagedBase.__init__(self, name, parent, index)
EditStylesMixin.__init__(self)
# initialise instance properties
if style: self.properties["style"].set(style)
self._item_with_name = None # a Tree item for visualization
示例6: create_widget
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [as 别名]
def create_widget(self):
self.widget = wx.TreeCtrl(self.parent_window.widget, self.id, style=self.style) # wx.TR_HAS_BUTTONS|wx.BORDER_SUNKEN)
# add a couple of items just for a better appearance
root = self.widget.AddRoot(_(' Tree Control:'))
self._item_with_name = self.widget.AppendItem(root, ' ' + self.name)
self.widget.AppendItem(self._item_with_name, _(' on wxGlade version %s') % config.version )
self.widget.Expand(root)
self.widget.Expand(self._item_with_name)
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [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)
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [as 别名]
def __init__(self, parent, name, library, default=None):
wx.Dialog.__init__(self,
name='BrowseValueDialog', parent=parent,
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER,
title=_('Browse %s values library') % name)
self.staticText1 = wx.StaticText(
label=_('Choose a value for %s:') % name,
name='staticText1', parent=self,
pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
self.ValuesLibrary = wx.TreeCtrl(
name='ValuesLibrary', parent=self, pos=wx.Point(0, 0),
size=wx.Size(400, 200),
style=wx.TR_HAS_BUTTONS | wx.TR_SINGLE | wx.SUNKEN_BORDER | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT)
self.ButtonSizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
self.flexGridSizer1 = wx.FlexGridSizer(cols=1, hgap=0, rows=3, vgap=10)
self.flexGridSizer1.AddWindow(self.staticText1, 0, border=20, flag=wx.GROW | wx.TOP | wx.LEFT | wx.RIGHT)
self.flexGridSizer1.AddWindow(self.ValuesLibrary, 0, border=20, flag=wx.GROW | wx.LEFT | wx.RIGHT)
self.flexGridSizer1.AddSizer(self.ButtonSizer, 0, border=20, flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)
self.flexGridSizer1.AddGrowableCol(0)
self.flexGridSizer1.AddGrowableRow(1)
self.SetSizer(self.flexGridSizer1)
self.Fit()
root = self.ValuesLibrary.AddRoot("")
self.GenerateValuesLibraryBranch(root, library, default)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [as 别名]
def __init__(
self,
parent,
id=-1,
key = _winreg.HKEY_CURRENT_USER,
subkey = "Software",
valueName = None,
pos = wx.DefaultPosition,
size = wx.DefaultSize,
style = wx.TR_HAS_BUTTONS,
validator = wx.DefaultValidator,
name="RegistryLazyTree",
text = None
):
self.text = text
wx.TreeCtrl.__init__(
self, parent, id, pos, size, style, validator, name
)
self.imageList = imageList = wx.ImageList(16, 16)
rootIcon = imageList.Add(eg.Icons.GetInternalBitmap("root"))
self.folderIcon = imageList.Add(eg.Icons.GetInternalBitmap("folder"))
self.valueIcon = imageList.Add(eg.Icons.GetInternalBitmap("action"))
self.SetImageList(imageList)
self.SetMinSize((-1, 200))
self.treeRoot = self.AddRoot(
"Registry",
image = rootIcon,
data = wx.TreeItemData((True, None, None, None))
)
#Adding keys
for item in regKeys:
#a tupel of 4 values is assigned to every item
#1) stores if the key has yet to be queried for subkey, when
# selected
#2) _winreg.hkey constant
#3) name of the key
#4) value name, None if just a key, empty string for default value
tmp = self.AppendItem(
self.treeRoot,
item[1],
image = self.folderIcon,
data =wx.TreeItemData((False, item[0], "", None))
)
self.SetItemHasChildren(tmp, True)
if item[0] == key:
self.SelectItem(tmp)
#select old value in tree
self.OnTreeChange(wx.CommandEvent(), key, subkey, valueName)
self.EnsureVisible(self.GetSelection())
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeChange)
self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnExpandNode)
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import TR_HAS_BUTTONS [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 = ""