コード例 #1
0
    def Configure(self, link=None):
        panel = eg.ConfigPanel(resizable=True)
        if link is not None:
            searchItem = link.target
        else:
            searchItem = None
        link = eg.TreeLink(panel.dialog.treeItem)

        tree = eg.TreeItemBrowseCtrl(
            panel,
            self.FilterFunc,
            #searchFunc,
            selectItem=searchItem)
        tree.SetFocus()
        panel.sizer.Add(panel.StaticText(self.text.text1), 0, wx.BOTTOM, 5)
        panel.sizer.Add(tree, 1, wx.EXPAND)
        while panel.Affirmed():
            treeItem = tree.GetSelection()
            if treeItem.IsOk():
                obj = tree.GetPyData(treeItem)
                if self.IsSelectableItem(obj):
                    link.SetTarget(obj)
                    panel.SetResult(link)
                    continue
            eg.MessageBox(self.text.cantSelect, parent=panel)
コード例 #2
0
    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])
コード例 #3
0
    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)