当前位置: 首页>>代码示例>>Python>>正文


Python wx.EVT_TREE_SEL_CHANGED属性代码示例

本文整理汇总了Python中wx.EVT_TREE_SEL_CHANGED属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_TREE_SEL_CHANGED属性的具体用法?Python wx.EVT_TREE_SEL_CHANGED怎么用?Python wx.EVT_TREE_SEL_CHANGED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在wx的用法示例。


在下文中一共展示了wx.EVT_TREE_SEL_CHANGED属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OnSelectionChanged

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [as 别名]
def OnSelectionChanged(self, event):
        """
        Process wx.EVT_TREE_SEL_CHANGED events.
        """
        treeItem = event.GetItem()
        if not treeItem.IsOk():
            return
        itemData = self.tree.GetPyData(treeItem)
        if isinstance(itemData, eg.ActionGroup):
            self.resultData = None
            self.buttonRow.okButton.Enable(False)
        else:
            self.resultData = itemData
            self.buttonRow.okButton.Enable(True)
        self.nameText.SetLabel(itemData.name)
        self.docText.SetBasePath(itemData.plugin.info.path)
        self.docText.SetPage(itemData.description) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:19,代码来源:AddActionDialog.py

示例2: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [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() 
开发者ID:andreas-p,项目名称:admin4,代码行数:34,代码来源:_snippet.py

示例3: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [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) 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:39,代码来源:tree.py

示例4: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [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) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:43,代码来源:TreeCtrl.py

示例5: OnSelectionChangedEvent

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [as 别名]
def OnSelectionChangedEvent(self, event):
        """
        Handles wx.EVT_TREE_SEL_CHANGED
        """
        node = self.GetPyData(event.GetItem())
        self.document.selection = node
        eg.Notify("SelectionChange", node)
        event.Skip()

    #-------------------------------------------------------------------------
    # eg.Notify Handlers
    #------------------------------------------------------------------------- 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:14,代码来源:TreeCtrl.py

示例6: OnSelectionChanged

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [as 别名]
def OnSelectionChanged(self, event):
        """
        Handle the wx.EVT_TREE_SEL_CHANGED events.
        """
        item = event.GetItem()
        self.resultData = info = self.treeCtrl.GetPyData(item)
        if info is None:
            name = self.treeCtrl.GetItemText(item)
            description = Text.noInfo
            self.authorLabel.SetLabel("")
            self.authorText.SetLabel("")
            self.versionLabel.SetLabel("")
            self.versionText.SetLabel("")
            self.okButton.Enable(False)
            event.Skip()
        else:
            name = info.name
            description = info.description
            self.descrBox.SetBasePath(info.path)
            self.authorLabel.SetLabel(Text.author)
            self.authorText.SetLabel(info.author.replace("&", "&&"))
            self.versionLabel.SetLabel(Text.version)
            self.versionText.SetLabel(info.version)
            self.okButton.Enable(True)
        self.nameText.SetLabel(name)
        url = info.url if info else None
        self.descrBox.SetPage(eg.Utils.AppUrl(description, url)) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:29,代码来源:AddPluginDialog.py

示例7: Configure

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [as 别名]
def Configure(self):
        self.foundId = None
        style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        eg.TaskletDialog.__init__(self, None, -1, title="Export", style=style)
        staticText = wx.StaticText(self, -1, text.mesg)

        filterClasses = (eg.FolderItem, )  #eg.MacroItem)

        def filterFunc(obj):
            return isinstance(obj, filterClasses)

        tree = eg.TreeItemBrowseCtrl(self, filterFunc)  #, multiSelect=True)
        #tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        tree.UnselectAll()

        buttonRow = eg.ButtonRow(self, (wx.ID_OK, wx.ID_CANCEL), True)

        mainSizer = eg.VBoxSizer(
            (staticText, 0, wx.EXPAND | wx.ALL, 5),
            (tree, 1, wx.EXPAND),
            (buttonRow.sizer, 0, wx.EXPAND),
        )
        self.SetSizerAndFit(mainSizer)
        self.SetAutoLayout(True)
        #mainSizer.Fit(self)
        #self.SetMinSize(self.GetSize())
        self.SetSize((450, 400))
        while self.Affirmed():
            items = tree.GetSelections()
            GetPyData = tree.GetPyData
            self.SetResult([GetPyData(item) for item in items]) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:33,代码来源:ExportDialog.py

示例8: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [as 别名]
def __init__(self, parent, panel, *args, **kwargs):
        self.deviceId = 0
        self.panel = panel
        wx.TreeCtrl.__init__(self, parent, *args, **kwargs)
        self.FillTree()
        self.ExpandAll()
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:9,代码来源:SoundMixerTree.py

示例9: Configure

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [as 别名]
def Configure(
        self,
        title,
        text,
        searchItem,
        resultClasses,
        filterClasses=(eg.FolderItem, eg.MacroItem),
        parent=None,
    ):
        self.resultData = searchItem
        self.resultClasses = resultClasses
        self.foundId = None
        style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        eg.TaskletDialog.__init__(self, parent, -1, title=title, style=style)
        staticText = wx.StaticText(self, -1, text)
        staticText.Wrap(430)

        def filterFunc(obj):
            return isinstance(obj, filterClasses)

        tree = eg.TreeItemBrowseCtrl(self, filterFunc, selectItem=searchItem)
        tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        self.treeCtrl = tree

        self.buttonRow = eg.ButtonRow(self, (wx.ID_CANCEL, wx.ID_OK), True)
        mainSizer = eg.VBoxSizer(
            (staticText, 0, wx.EXPAND | wx.ALL, 5),
            (tree, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 5),
            (self.buttonRow.sizer, 0, wx.EXPAND),
        )

        self.SetSizerAndFit(mainSizer)
        self.SetSize((450, 400))

        if not searchItem:
            self.buttonRow.okButton.Enable(False)
        while self.Affirmed():
            self.SetResult(self.resultData) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:40,代码来源:TreeItemBrowseDialog.py

示例10: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [as 别名]
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 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:48,代码来源:DownloadManager.py

示例11: __init__

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [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) 
开发者ID:EventGhost,项目名称:EventGhost,代码行数:56,代码来源:Registry.py

示例12: _init_Editor

# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_TREE_SEL_CHANGED [as 别名]
def _init_Editor(self, parent):
        self.Editor = wx.Panel(parent)

        main_sizer = wx.BoxSizer(wx.HORIZONTAL)

        left_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.AddSizer(left_sizer, 1, border=5, flag=wx.GROW | wx.ALL)

        managed_dir_label = wx.StaticText(self.Editor, label=_(self.TagName) + ":")
        left_sizer.AddWindow(managed_dir_label, border=5, flag=wx.GROW | wx.BOTTOM)

        FILTER = _("All files (*.*)|*.*|CSV files (*.csv)|*.csv")
        self.ManagedDir = FolderTree(self.Editor, self.Folder, FILTER)
        left_sizer.AddWindow(self.ManagedDir, 1, flag=wx.GROW)

        managed_treectrl = self.ManagedDir.GetTreeCtrl()
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeItemChanged, managed_treectrl)
        if self.EnableDragNDrop:
            self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnTreeBeginDrag, managed_treectrl)

        button_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.AddSizer(button_sizer, border=5,
                            flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL)

        for idx, (name, bitmap, help) in enumerate([
                ("DeleteButton", "remove_element", _("Remove file from left folder")),
                ("LeftCopyButton", "LeftCopy", _("Copy file from right folder to left")),
                ("RightCopyButton", "RightCopy", _("Copy file from left folder to right")),
                ("EditButton", "edit", _("Edit file"))]):
            button = wx.lib.buttons.GenBitmapButton(
                self.Editor,
                bitmap=GetBitmap(bitmap),
                size=wx.Size(28, 28), style=wx.NO_BORDER)
            button.SetToolTipString(help)
            setattr(self, name, button)
            if idx > 0:
                flag = wx.TOP
            else:
                flag = 0
            self.Bind(wx.EVT_BUTTON, getattr(self, "On" + name), button)
            button_sizer.AddWindow(button, border=20, flag=flag)

        right_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.AddSizer(right_sizer, 1, border=5, flag=wx.GROW | wx.ALL)

        if wx.Platform == '__WXMSW__':
            system_dir_label = wx.StaticText(self.Editor, label=_("My Computer:"))
        else:
            system_dir_label = wx.StaticText(self.Editor, label=_("Home Directory:"))
        right_sizer.AddWindow(system_dir_label, border=5, flag=wx.GROW | wx.BOTTOM)

        self.SystemDir = FolderTree(self.Editor, self.HomeDirectory, FILTER, False)
        right_sizer.AddWindow(self.SystemDir, 1, flag=wx.GROW)

        system_treectrl = self.SystemDir.GetTreeCtrl()
        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnTreeItemChanged, system_treectrl)

        self.Editor.SetSizer(main_sizer) 
开发者ID:thiagoralves,项目名称:OpenPLC_Editor,代码行数:60,代码来源:FileManagementPanel.py


注:本文中的wx.EVT_TREE_SEL_CHANGED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。