Python wx.EVT_TREE_ITEM_ACTIVATED Examples
The following are 10
code examples of wx.EVT_TREE_ITEM_ACTIVATED().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: tree.py From admin4 with Apache License 2.0 | 6 votes |
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)
Example #2
Source File: SearchResultPanel.py From OpenPLC_Editor with GNU General Public License v3.0 | 6 votes |
def _init_ctrls(self, prnt): self.HeaderLabel = wx.StaticText(id=ID_SEARCHRESULTPANELHEADERLABEL, name='HeaderLabel', parent=self, pos=wx.Point(0, 0), size=wx.Size(0, 17), style=0) search_results_tree_style = CT.TR_HAS_BUTTONS | CT.TR_NO_LINES | CT.TR_HAS_VARIABLE_ROW_HEIGHT self.SearchResultsTree = CT.CustomTreeCtrl(id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE, name="SearchResultsTree", parent=self, pos=wx.Point(0, 0), style=search_results_tree_style) if wx.VERSION >= (2, 8, 11): self.SearchResultsTree.SetAGWWindowStyleFlag(search_results_tree_style) self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnSearchResultsTreeItemActivated, id=ID_SEARCHRESULTPANELSEARCHRESULTSTREE) self.ResetButton = wx.lib.buttons.GenBitmapButton( self, bitmap=GetBitmap("reset"), size=wx.Size(28, 28), style=wx.NO_BORDER) self.ResetButton.SetToolTipString(_("Reset search result")) self.Bind(wx.EVT_BUTTON, self.OnResetButton, self.ResetButton) self._init_sizers()
Example #3
Source File: tree.py From admin4 with Apache License 2.0 | 5 votes |
def __init__(self, parentWin, name, size=wx.DefaultSize, style=wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT | wx.TR_LINES_AT_ROOT): TreeCtrl.__init__(self, parentWin, name, size=size, style=style) self.name=name if name: adm.trees[name]=self self.autoChildren=True self.Bind(wx.EVT_RIGHT_DOWN, self.OnTreeRightClick) self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnTreeExpand) self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnTreeActivate)
Example #4
Source File: _snippet.py From admin4 with Apache License 2.0 | 5 votes |
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()
Example #5
Source File: main_frame.py From Rule-based_Expert_System with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, id, title, size): wx.Frame.__init__(self, parent, id, title, style=wx.DEFAULT_FRAME_STYLE ^ (wx.RESIZE_BORDER | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX)) self.SetSize(size) self.Center() self.sourceLabel = wx.StaticText(self, label='Source Image', pos=(150, 10), size=(40, 25)) self.detectionLabel = wx.StaticText(self, label='Detection Image', pos=(550, 10), size=(40, 25)) self.openPicButton = wx.Button(self, label='Open Image', pos=(830, 30), size=(150, 30)) self.openPicButton.Bind(wx.EVT_BUTTON, self.open_picture) self.openEditorButton = wx.Button(self, label='Open Rule Editor', pos=(830, 70), size=(150, 30)) self.openEditorButton.Bind(wx.EVT_BUTTON, self.open_rule_editor) self.showRuleButton = wx.Button(self, label='Show Rules', pos=(830, 110), size=(150, 30)) self.showRuleButton.Bind(wx.EVT_BUTTON, self.show_rules) self.showFactButton = wx.Button(self, label='Show Facts', pos=(830, 150), size=(150, 30)) self.showFactButton.Bind(wx.EVT_BUTTON, self.show_facts) self.treeLabel = wx.StaticText(self, label='What shape do you want', pos=(830, 200), size=(40, 25)) self.shapeTree = wx.TreeCtrl(self, pos=(830, 220), size=(160, 210)) root = self.shapeTree.AddRoot('All Shapes') self.add_tree_nodes(root, shape_items.tree) self.shapeTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.shape_chosen) self.shapeTree.Expand(root) self.show_picture('init_source.png', (10, 30)) self.show_picture('init_detection.png', (420, 30)) self.resultLabel = wx.StaticText(self, label='Detection Result', pos=(100, 450), size=(40, 25)) self.resultText = wx.TextCtrl(self, pos=(10, 480), size=(310, 280), style=wx.TE_MULTILINE | wx.TE_READONLY) self.matchedFactLabel = wx.StaticText(self, label='Matched Facts', pos=(430, 450), size=(40, 25)) self.matchedFactText = wx.TextCtrl(self, pos=(340, 480), size=(310, 280), style=wx.TE_MULTILINE | wx.TE_READONLY) self.hitRuleLabel = wx.StaticText(self, label='Hit Rules', pos=(780, 450), size=(40, 25)) self.hitRuleText = wx.TextCtrl(self, pos=(670, 480), size=(310, 280), style=wx.TE_MULTILINE | wx.TE_READONLY) self.title = title self.pic_path = None self.engine = None self.contour_num = None self.Show()
Example #6
Source File: TreeCtrl.py From EventGhost with GNU General Public License v2.0 | 5 votes |
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)
Example #7
Source File: TreeCtrl.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnItemActivateEvent(self, event): """ Handles wx.EVT_TREE_ITEM_ACTIVATED """ itemId = event.GetItem() if itemId.IsOk(): node = self.GetPyData(itemId) if node.isConfigurable: wx.CallAfter(self.document.OnCmdConfigure, node) event.Skip()
Example #8
Source File: AddActionDialog.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def OnActivated(self, event): """ Process wx.EVT_TREE_ITEM_ACTIVATED events. """ treeItem = self.tree.GetSelection() itemData = self.tree.GetPyData(treeItem) if isinstance(itemData, eg.ActionGroup): event.Skip() else: self.OnOK(wx.CommandEvent())
Example #9
Source File: DownloadManager.py From BitTorrent with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent, torrent, *a, **k): BTPanel.__init__(self, parent, *a, **k) self.torrent = torrent app = wx.the_app self.file_ops = [ EventProperties(self.FIRST_ID, ('fileops', 'first'), self.set_file_priority_first, _("First"), _("Download first")), EventProperties(self.NORMAL_ID, ('fileops', 'normal'), self.set_file_priority_normal, _("Normal"), _("Download normally")), ## # BUG: uncomment this once we implement NEVER ## EventProperties(self.NEVER_ID, ## ('fileops', 'never'), ## self.set_file_priority_never, ## _("Never"), _("Never download")), EventProperties(self.OPEN_ID, ('torrentops', 'launch'), self.open_items, _("Launch"), _("Launch file")), ] self.context_menu = BTMenu() self.event_table = {} for e in self.file_ops: self.event_table[e.id] = e self.Bind(wx.EVT_MENU, self.OnFileEvent, id=e.id) self.context_menu.Append(e.id, e.shorthelp) self.context_menu.InsertSeparator(len(self.file_ops)-1) self._build_tool_bar() self.file_list = FileListView(self, torrent) self.sizer.Add(self.file_list, flag=wx.GROW, proportion=1) self.SetSizerAndFit(self.sizer) self.check_file_selection() self.file_list.Bind(wx.EVT_TREE_SEL_CHANGED, self.check_file_selection) self.file_list.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.file_double_clicked) self.file_list.context_menu = self.context_menu
Example #10
Source File: FolderTree.py From OpenPLC_Editor with GNU General Public License v3.0 | 4 votes |
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 = ""