示例#1
0
    def __init__(
        self,
        parent=None,
        title=eg.APP_NAME,
        basePath=None,
        pluginData=None,
        message="",
    ):
        Dialog.__init__(
            self,
            None,  #eg.document.frame,
            -1,
            title,
            size=(400, 300),
            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        )
        self.text = TEMPLATE.format(**pluginData)
        headerCtrl = eg.HtmlWindow(self, style=wx.html.HW_SCROLLBAR_NEVER)
        headerCtrl.SetBorders(2)
        headerCtrl.SetBasePath(basePath)
        headerCtrl.SetPage(self.text)
        self.headerCtrl = headerCtrl
        #height = headerCtrl.GetInternalRepresentation().GetHeight()
        #headerCtrl.SetMinSize((-1, height + 4))
        #headerCtrl.Layout()
        descriptionCtrl = eg.HtmlWindow(self)
        descriptionCtrl.SetBorders(2)
        descriptionCtrl.SetBasePath(basePath)
        descriptionCtrl.SetPage(pluginData['description'])
        questionCtrl = self.StaticText(message)
        self.buttonRow = eg.ButtonRow(
            self, (wx.ID_OK, wx.ID_CANCEL), True, True
        )
        mainSizer = eg.VBoxSizer(
            (headerCtrl, 0, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, 5),
            (wx.StaticLine(self), 0, wx.EXPAND, 0),
            (descriptionCtrl, 1, wx.EXPAND | wx.ALL, 5),
            (wx.StaticLine(self), 0, wx.EXPAND, 0),
            (questionCtrl, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL, 5),
            (self.buttonRow.sizer, 0, wx.EXPAND),
        )
        self.SetSizer(mainSizer)
        self.SetAutoLayout(True)
        mainSizer.Fit(self)
        mainSizer.Layout()
        self.Layout()
        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.SetSize((400, 500))
        self.SetMinSize(self.GetSize())
        self.Center()
示例#2
0
 def __init__(self,
              parent=None,
              title=eg.APP_NAME,
              source="",
              icon=None,
              basePath=None,
              style=wx.OK):
     eg.Dialog.__init__(self,
                        parent,
                        -1,
                        title,
                        style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
     if icon:
         self.SetIcon(icon)
     htmlCtrl = eg.HtmlWindow(self, -1, style=wx.SUNKEN_BORDER)
     htmlCtrl.SetBorders(2)
     htmlCtrl.SetBasePath(basePath)
     htmlCtrl.SetPage(source)
     buttonIds = []
     if style & wx.OK:
         buttonIds.append(wx.ID_OK)
     if style & wx.CANCEL:
         buttonIds.append(wx.ID_CANCEL)
     self.buttonRow = eg.ButtonRow(self, buttonIds, True, True)
     mainSizer = eg.VBoxSizer(
         (htmlCtrl, 1, wx.EXPAND | wx.ALL, 5),
         (self.buttonRow.sizer, 0, wx.EXPAND),
     )
     self.SetSizerAndFit(mainSizer)
     if Config.position is not None:
         self.SetPosition(Config.position)
     self.SetSize(Config.size)
示例#3
0
 def CreateHelpPanel(self):
     helpPanel = wx.Panel(self.notebook)
     helpPanel.SetBackgroundColour((255, 255, 255))
     htmlWindow = eg.HtmlWindow(helpPanel)
     htmlWindow.SetBasePath(self.treeItem.GetBasePath())
     htmlWindow.SetPage(self.description)
     sizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(htmlWindow, 1, wx.EXPAND)
     helpPanel.SetSizer(sizer)
     self.notebook.AddPage(helpPanel, "Description")
     return helpPanel
示例#4
0
 def __init__(self, parent, html):
     wx.Panel.__init__(self, parent)
     htmlWindow = eg.HtmlWindow(self,
                                style=wx.SUNKEN_BORDER
                                | wx.html.HW_NO_SELECTION)
     htmlWindow.SetForegroundColour(eg.colour.windowText)
     htmlWindow.SetBackgroundColour(eg.colour.windowBackground)
     htmlWindow.SetPage(html)
     htmlWindow.SetMinSize((490, 270))
     htmlWindow.SetScrollbars(1, 1, 1000, 1000)
     self.SetSizerAndFit(eg.VBoxSizer((htmlWindow, 1, wx.EXPAND, 5), ))
     self.htmlWindow = htmlWindow
    def __init__(self, parent, name="", text="", icon=None, url = None):
        text = REPLACE_BR_TAG.sub('\n', text)
        text = REMOVE_HTML_PATTERN.sub('', text).strip()
        if text == name:
            text = ""
        self.parent = parent
        wx.PyWindow.__init__(self, parent, -1)
        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW)
        )

        nameBox = wx.StaticText(self, -1, name)
        font = wx.Font(8, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD)
        nameBox.SetFont(font)

        self.text = '<html><body bgcolor="%s" text="%s">%s</body></html>' % (
            self.GetBackgroundColour().GetAsString(wx.C2S_HTML_SYNTAX),
            self.GetForegroundColour().GetAsString(wx.C2S_HTML_SYNTAX),
            text
        )
        if url:
            self.text = eg.Utils.AppUrl(self.text, url)
        descBox = eg.HtmlWindow(self, style=wx.html.HW_NO_SELECTION)
        descBox.SetBorders(1)
        descBox.SetFonts("Arial", "Times New Roman", [8, 8, 8, 8, 8, 8, 8])
        descBox.Bind(wx.html.EVT_HTML_LINK_CLICKED, self.OnLinkClicked)
        self.descBox = descBox

        staticBitmap = wx.StaticBitmap(self)
        staticBitmap.SetIcon(icon.GetWxIcon())

        mainSizer = eg.HBoxSizer(
            ((4, 4)),
            (staticBitmap, 0, wx.TOP, 5),
            ((4, 4)),
            (eg.VBoxSizer(
                ((4, 4)),
                (eg.HBoxSizer(
                    (nameBox, 1, wx.EXPAND | wx.ALIGN_BOTTOM),
                ), 0, wx.EXPAND | wx.TOP, 2),
                (descBox, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 8),
            ), 1, wx.EXPAND),
        )
        # odd sequence to setup the window, but all other ways seem
        # to wrap the text wrong
        self.SetSizer(mainSizer)
        self.SetAutoLayout(True)
        mainSizer.Fit(self)
        mainSizer.Layout()
        self.Layout()
        self.Bind(wx.EVT_SIZE, self.OnSize)
示例#6
0
    def Configure(self, parent, checkMultiLoad=True, title=None):
        if title is None:
            title = Text.title
        self.checkMultiLoad = checkMultiLoad
        if self.__class__.instance:
            self.__class__.instance.Raise()
            return
        self.__class__.instance = self

        self.resultData = None

        eg.TaskletDialog.__init__(self,
                                  parent,
                                  -1,
                                  title,
                                  style=wx.DEFAULT_DIALOG_STYLE
                                  | wx.RESIZE_BORDER)

        splitterWindow = wx.SplitterWindow(
            self,
            style=(wx.SP_LIVE_UPDATE | wx.CLIP_CHILDREN
                   | wx.NO_FULL_REPAINT_ON_RESIZE))

        self.treeCtrl = treeCtrl = wx.TreeCtrl(
            splitterWindow,
            style=(wx.TR_SINGLE | wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT
                   | wx.TR_LINES_AT_ROOT))

        treeCtrl.SetMinSize((170, 200))

        imageList = wx.ImageList(16, 16)
        imageList.Add(eg.Icons.PLUGIN_ICON.GetBitmap())
        imageList.Add(eg.Icons.FOLDER_ICON.GetBitmap())
        treeCtrl.SetImageList(imageList)

        root = treeCtrl.AddRoot("")
        typeIds = {
            KIND_TAGS[0]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[0] + "Plugins"),
                                1),
            KIND_TAGS[1]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[1] + "Plugins"),
                                1),
            KIND_TAGS[2]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[2] + "Plugins"),
                                1),
            KIND_TAGS[3]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[3] + "Plugins"),
                                1),
        }
        self.typeIds = typeIds
        itemToSelect = typeIds[KIND_TAGS[0]]

        for info in eg.pluginManager.GetPluginInfoList():
            if info.kind in ("hidden", "core"):
                continue
            if info.icon and info.icon != eg.Icons.PLUGIN_ICON:
                idx = imageList.Add(
                    eg.Icons.PluginSubIcon(info.icon).GetBitmap())
            else:
                idx = 0

            treeId = treeCtrl.AppendItem(typeIds[info.kind], info.name, idx)
            if not info.valid:
                treeCtrl.SetItemTextColour(treeId, eg.colour.pluginError)
            treeCtrl.SetPyData(treeId, info)
            if info.path == Config.lastSelection:
                itemToSelect = treeId

        for kind, treeId in typeIds.iteritems():
            if kind in Config.collapsed:
                treeCtrl.Collapse(treeId)
            else:
                treeCtrl.Expand(treeId)

        treeCtrl.ScrollTo(itemToSelect)

        def OnCmdExport(dummyEvent=None):
            info = self.treeCtrl.GetPyData(self.treeCtrl.GetSelection())
            if info:
                eg.PluginInstall.Export(info)

        menu = wx.Menu()
        menuId = wx.NewId()
        menu.Append(menuId, eg.text.MainFrame.Menu.Export)
        self.Bind(wx.EVT_MENU, OnCmdExport, id=menuId)
        self.contextMenu = menu
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnItemRightClick)

        rightPanel = wx.Panel(splitterWindow)
        rightSizer = wx.BoxSizer(wx.VERTICAL)
        rightPanel.SetSizer(rightSizer)

        self.nameText = nameText = wx.StaticText(rightPanel)
        nameText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD))
        rightSizer.Add(nameText, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        subSizer = wx.FlexGridSizer(2, 2)
        self.authorLabel = wx.StaticText(rightPanel, label=Text.author)
        subSizer.Add(self.authorLabel)
        self.authorText = wx.StaticText(rightPanel)
        subSizer.Add(self.authorText, 0, wx.EXPAND | wx.LEFT, 5)
        self.versionLabel = wx.StaticText(rightPanel, label=Text.version)
        subSizer.Add(self.versionLabel)
        self.versionText = wx.StaticText(rightPanel)
        subSizer.Add(self.versionText, 0, wx.EXPAND | wx.LEFT, 5)
        rightSizer.Add(subSizer, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        staticBoxSizer = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label=Text.descriptionBox))

        self.descrBox = eg.HtmlWindow(rightPanel)
        staticBoxSizer.Add(self.descrBox, 1, wx.EXPAND)

        rightSizer.Add(staticBoxSizer, 1, wx.EXPAND | wx.LEFT, 5)

        splitterWindow.SplitVertically(self.treeCtrl, rightPanel)
        splitterWindow.SetMinimumPaneSize(60)
        splitterWindow.SetSashGravity(0.0)
        splitterWindow.UpdateSize()

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

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(splitterWindow, 1, wx.EXPAND | wx.ALL, 5)
        mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND)

        self.SetSizerAndFit(mainSizer)
        #minSize = mainSizer.GetMinSize()
        #self.SetMinSize(minSize)
        self.SetSize(Config.size)
        splitterWindow.SetSashPosition(Config.splitPosition)
        if Config.position:
            self.SetPosition(Config.position)
        treeCtrl.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        treeCtrl.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated)
        treeCtrl.SelectItem(itemToSelect)

        # -------- This code is for setting the use GUID instead of XmlIdLink ---------
        self.click_count = 0

        def on_left_down(evt):
            x, y = evt.GetPosition()
            width, height = self.GetClientSize()

            start_x = width - 20
            stary_y = 0

            stop_x = start_x + 20
            stop_y = stary_y + 20

            if stop_x > x > start_x and stop_y > y > stary_y:
                if not self.click_count:
                    self.CaptureMouse()

            start_x = 0
            stary_y = height - 20

            stop_x = start_x + 20
            stop_y = stary_y + 20

            if stop_x > x > start_x and stop_y > y > stary_y:
                if self.click_count:
                    self.CaptureMouse()

            evt.Skip()

        def on_left_up(evt):
            if self.HasCapture():

                self.ReleaseMouse()
                self.click_count += 1

                if self.click_count == 2:
                    self.click_count = 0
                    dialog = eg.MessageDialog(
                        parent=None,
                        message=
                        ('Warning: This process cannot be undone so make\n'
                         '                  a backup copy of your save file now.\n\n'
                         'This process will modify and save all EventGhost Data!!\n'
                         'Enable using GUID\'s?\n\n'),
                        style=wx.YES_NO | wx.STAY_ON_TOP)
                    if dialog.ShowModal() == wx.ID_YES:
                        eg.useTreeItemGUID = True
                        eg.document.SetIsDirty(True)
                        eg.document.Save()
                        eg.config.Save()

                    dialog.Destroy()

            evt.Skip()

        if eg.useTreeItemGUID is False:
            self.Bind(wx.EVT_LEFT_DOWN, on_left_down)
            self.Bind(wx.EVT_LEFT_UP, on_left_up)

# -----------------------------------------------------------------------------

        while self.Affirmed():
            if self.CheckMultiload():
                self.SetResult(self.resultData)
        Config.size = self.GetSizeTuple()
        Config.position = self.GetPositionTuple()
        Config.splitPosition = splitterWindow.GetSashPosition()
        Config.collapsed = set(kind for kind, treeId in typeIds.iteritems()
                               if not treeCtrl.IsExpanded(treeId))
        self.__class__.instance = None
示例#7
0
    def Configure(self, parent):
        self.resultData = None
        self.lastSelectedTreeItem = None
        eg.TaskletDialog.__init__(self,
                                  parent,
                                  -1,
                                  Text.title,
                                  style=(wx.DEFAULT_DIALOG_STYLE
                                         | wx.RESIZE_BORDER | wx.THICK_FRAME))
        splitterWindow = wx.SplitterWindow(
            self,
            -1,
            style=(wx.SP_LIVE_UPDATE | wx.CLIP_CHILDREN
                   | wx.NO_FULL_REPAINT_ON_RESIZE))

        style = wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT | wx.TR_FULL_ROW_HIGHLIGHT
        tree = wx.TreeCtrl(splitterWindow, -1, style=style)
        tree.SetMinSize((100, 100))
        tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivated)
        tree.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnCollapsed)
        tree.Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnExpanded)
        self.tree = tree

        rightPanel = wx.Panel(splitterWindow)
        rightSizer = wx.BoxSizer(wx.VERTICAL)
        rightPanel.SetSizer(rightSizer)
        rightPanel.SetAutoLayout(True)

        self.nameText = nameText = wx.StaticText(rightPanel)
        nameText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD))
        rightSizer.Add(nameText, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        staticBoxSizer = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label=Text.descriptionLabel), wx.VERTICAL)
        self.docText = eg.HtmlWindow(rightPanel)
        self.docText.SetBorders(2)

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

        staticBoxSizer.Add(self.docText, 1, wx.EXPAND)
        rightSizer.Add(staticBoxSizer, 1, wx.EXPAND, 5)

        splitterWindow.SplitVertically(self.tree, rightPanel)
        splitterWindow.SetMinimumPaneSize(60)
        splitterWindow.UpdateSize()

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(splitterWindow, 1, wx.EXPAND | wx.ALL, 5)
        mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND)

        self.SetSizerAndFit(mainSizer)
        minSize = mainSizer.GetMinSize()
        self.SetMinSize(minSize)
        self.SetSize(Config.size)
        splitterWindow.SetSashPosition(Config.splitPosition)
        self.FillTree()
        if Config.position is not None:
            self.SetPosition(Config.position)
        while self.Affirmed():
            self.SetResult(self.resultData)

        item = self.tree.GetSelection()
        self.__class__.lastSelectedDataItem = self.tree.GetPyData(item)
        Config.size = self.GetSizeTuple()
        Config.position = self.GetPositionTuple()
        Config.splitPosition = splitterWindow.GetSashPosition()
示例#8
0
    def Configure(self, parent):
        global gLastSelected
        self.resultData = None
        super(AddEventDialog, self).__init__(
            parent=parent, id=wx.ID_ANY, title=Text.title,
            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER
        )
        splitterWindow = wx.SplitterWindow(
            self,
            -1,
            style=(
                wx.SP_LIVE_UPDATE |
                wx.CLIP_CHILDREN |
                wx.NO_FULL_REPAINT_ON_RESIZE
            )
        )

        leftPanel = wx.Panel(splitterWindow)
        self.tree = tree = wx.TreeCtrl(leftPanel, -1,
                           style=wx.TR_DEFAULT_STYLE |
                                 wx.TR_HIDE_ROOT |
                                 wx.TR_FULL_ROW_HIGHLIGHT
                           )
        tree.SetMinSize((100, 100))
        tree.SetImageList(eg.Icons.gImageList)

        tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivated)
        tree.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnCollapsed)
        tree.Bind(wx.EVT_TREE_ITEM_EXPANDED, self.OnExpanded)
        tree.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnStartDrag)
        tree.Bind(wx.EVT_SET_FOCUS, self.OnFocusTree)

        self.userEvent = wx.TextCtrl(leftPanel, wx.ID_ANY,
                                     style=wx.TE_PROCESS_ENTER)
        self.userEvent.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter)
        self.userEvent.Bind(wx.EVT_SET_FOCUS, self.OnFocusUserEvent)

        leftSizer =  wx.BoxSizer(wx.VERTICAL)
        leftSizer.Add(tree, 1, wx.EXPAND)
        leftSizer.Add(self.userEvent, 0, wx.EXPAND)
        leftPanel.SetSizer(leftSizer)

        rightPanel = self.rightPanel = wx.Panel(splitterWindow)
        rightSizer = self.rightSizer = wx.BoxSizer(wx.VERTICAL)
        rightPanel.SetSizer(rightSizer)
        rightPanel.SetAutoLayout(True)

        self.nameText = nameText = wx.StaticText(rightPanel)
        nameText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD))
        rightSizer.Add(nameText, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        staticBoxSizer = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label=Text.descriptionLabel),
            wx.VERTICAL
        )
        self.docText = eg.HtmlWindow(rightPanel)
        self.docText.SetBorders(2)

        staticBoxSizer.Add(self.docText, 1, wx.EXPAND)
        rightSizer.Add(staticBoxSizer, 1, wx.EXPAND, 5)

        splitterWindow.SplitVertically(leftPanel, rightPanel)
        splitterWindow.SetMinimumPaneSize(60)
        splitterWindow.UpdateSize()

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

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(splitterWindow, 1, wx.EXPAND | wx.ALL, 5)
        mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND)

        self.SetSizerAndFit(mainSizer)
        minSize = mainSizer.GetMinSize()
        self.SetMinSize(minSize)
        self.SetSize(Config.size)
        splitterWindow.SetSashPosition(Config.splitPosition)
        if Config.position is not None:
            self.SetPosition(Config.position)
        self.ReloadTree()
        while self.Affirmed():
            self.SetResult(self.resultData)
        item = tree.GetSelection()
        gLastSelected = tree.GetPyData(item)
        Config.size = self.GetSizeTuple()
        Config.position = self.GetPositionTuple()
        Config.splitPosition = splitterWindow.GetSashPosition()
示例#9
0
    def Configure(self, parent, checkMultiLoad=True, title=None):
        if title is None:
            title = Text.title
        self.checkMultiLoad = checkMultiLoad
        if self.__class__.instance:
            self.__class__.instance.Raise()
            return
        self.__class__.instance = self

        self.resultData = None

        eg.TaskletDialog.__init__(self,
                                  parent,
                                  -1,
                                  title,
                                  style=wx.DEFAULT_DIALOG_STYLE
                                  | wx.RESIZE_BORDER)

        splitterWindow = wx.SplitterWindow(
            self,
            style=(wx.SP_LIVE_UPDATE | wx.CLIP_CHILDREN
                   | wx.NO_FULL_REPAINT_ON_RESIZE))

        self.treeCtrl = treeCtrl = wx.TreeCtrl(
            splitterWindow,
            style=(wx.TR_SINGLE | wx.TR_HAS_BUTTONS | wx.TR_HIDE_ROOT
                   | wx.TR_LINES_AT_ROOT))

        treeCtrl.SetMinSize((170, 200))

        imageList = wx.ImageList(16, 16)
        imageList.Add(eg.Icons.PLUGIN_ICON.GetBitmap())
        imageList.Add(eg.Icons.FOLDER_ICON.GetBitmap())
        treeCtrl.SetImageList(imageList)

        root = treeCtrl.AddRoot("")
        typeIds = {
            KIND_TAGS[0]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[0] + "Plugins"),
                                1),
            KIND_TAGS[1]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[1] + "Plugins"),
                                1),
            KIND_TAGS[2]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[2] + "Plugins"),
                                1),
            KIND_TAGS[3]:
            treeCtrl.AppendItem(root, getattr(Text, KIND_TAGS[3] + "Plugins"),
                                1),
        }
        self.typeIds = typeIds
        itemToSelect = typeIds[KIND_TAGS[0]]

        for info in eg.pluginManager.GetPluginInfoList():
            if info.kind in ("hidden", "core"):
                continue
            if info.icon and info.icon != eg.Icons.PLUGIN_ICON:
                idx = imageList.Add(
                    eg.Icons.PluginSubIcon(info.icon).GetBitmap())
            else:
                idx = 0

            treeId = treeCtrl.AppendItem(typeIds[info.kind], info.name, idx)
            if not info.valid:
                treeCtrl.SetItemTextColour(treeId, eg.colour.pluginError)
            treeCtrl.SetPyData(treeId, info)
            if info.path == Config.lastSelection:
                itemToSelect = treeId

        for kind, treeId in typeIds.iteritems():
            if kind in Config.collapsed:
                treeCtrl.Collapse(treeId)
            else:
                treeCtrl.Expand(treeId)

        treeCtrl.ScrollTo(itemToSelect)

        def OnCmdExport(dummyEvent=None):
            info = self.treeCtrl.GetPyData(self.treeCtrl.GetSelection())
            if info:
                eg.PluginInstall.Export(info)

        menu = wx.Menu()
        menuId = wx.NewId()
        menu.Append(menuId, eg.text.MainFrame.Menu.Export)
        self.Bind(wx.EVT_MENU, OnCmdExport, id=menuId)
        self.contextMenu = menu
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnItemRightClick)

        rightPanel = wx.Panel(splitterWindow)
        rightSizer = wx.BoxSizer(wx.VERTICAL)
        rightPanel.SetSizer(rightSizer)

        self.nameText = nameText = wx.StaticText(rightPanel)
        nameText.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.FONTWEIGHT_BOLD))
        rightSizer.Add(nameText, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        subSizer = wx.FlexGridSizer(2, 2)
        self.authorLabel = wx.StaticText(rightPanel, label=Text.author)
        subSizer.Add(self.authorLabel)
        self.authorText = wx.StaticText(rightPanel)
        subSizer.Add(self.authorText, 0, wx.EXPAND | wx.LEFT, 5)
        self.versionLabel = wx.StaticText(rightPanel, label=Text.version)
        subSizer.Add(self.versionLabel)
        self.versionText = wx.StaticText(rightPanel)
        subSizer.Add(self.versionText, 0, wx.EXPAND | wx.LEFT, 5)
        rightSizer.Add(subSizer, 0, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)

        staticBoxSizer = wx.StaticBoxSizer(
            wx.StaticBox(rightPanel, label=Text.descriptionBox))

        self.descrBox = eg.HtmlWindow(rightPanel)
        staticBoxSizer.Add(self.descrBox, 1, wx.EXPAND)

        rightSizer.Add(staticBoxSizer, 1, wx.EXPAND | wx.LEFT, 5)

        splitterWindow.SplitVertically(self.treeCtrl, rightPanel)
        splitterWindow.SetMinimumPaneSize(60)
        splitterWindow.SetSashGravity(0.0)
        splitterWindow.UpdateSize()

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

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(splitterWindow, 1, wx.EXPAND | wx.ALL, 5)
        mainSizer.Add(self.buttonRow.sizer, 0, wx.EXPAND)

        self.SetSizerAndFit(mainSizer)
        #minSize = mainSizer.GetMinSize()
        #self.SetMinSize(minSize)
        self.SetSize(Config.size)
        splitterWindow.SetSashPosition(Config.splitPosition)
        if Config.position:
            self.SetPosition(Config.position)
        treeCtrl.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectionChanged)
        treeCtrl.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnItemActivated)
        treeCtrl.SelectItem(itemToSelect)

        while self.Affirmed():
            if self.CheckMultiload():
                self.SetResult(self.resultData)
        Config.size = self.GetSizeTuple()
        Config.position = self.GetPositionTuple()
        Config.splitPosition = splitterWindow.GetSashPosition()
        Config.collapsed = set(kind for kind, treeId in typeIds.iteritems()
                               if not treeCtrl.IsExpanded(treeId))
        self.__class__.instance = None