Ejemplo n.º 1
0
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, wx.ID_ANY, title="Attribute Editor", pos=wx.DefaultPosition,
                          size=wx.Size(650, 600),
                          style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_FLOAT_ON_PARENT | wx.TAB_TRAVERSAL)

        i = wx.IconFromBitmap(BitmapLoader.getBitmap("fit_rename_small", "gui"))
        self.SetIcon(i)

        self.mainFrame = parent

        menubar = wx.MenuBar()
        fileMenu = wx.Menu()
        fileImport = fileMenu.Append(wx.ID_ANY, 'Import', 'Import overrides')
        fileExport = fileMenu.Append(wx.ID_ANY, 'Export', 'Import overrides')
        fileClear = fileMenu.Append(wx.ID_ANY, 'Clear All', 'Clear all overrides')

        menubar.Append(fileMenu, '&File')
        self.SetMenuBar(menubar)

        self.Bind(wx.EVT_MENU, self.OnImport, fileImport)
        self.Bind(wx.EVT_MENU, self.OnExport, fileExport)
        self.Bind(wx.EVT_MENU, self.OnClear, fileClear)

        i = wx.IconFromBitmap(BitmapLoader.getBitmap("fit_rename_small", "gui"))
        self.SetIcon(i)

        self.mainFrame = parent
        self.panel = panel = wx.Panel(self, wx.ID_ANY)

        mainSizer = wx.BoxSizer(wx.HORIZONTAL)

        leftSizer = wx.BoxSizer(wx.VERTICAL)
        leftPanel = wx.Panel(panel, wx.ID_ANY,
                             style=wx.DOUBLE_BORDER if 'wxMSW' in wx.PlatformInfo else wx.SIMPLE_BORDER)

        self.searchBox = SearchBox(leftPanel)
        self.itemView = ItemView(leftPanel)

        leftSizer.Add(self.searchBox, 0, wx.EXPAND)
        leftSizer.Add(self.itemView, 1, wx.EXPAND)

        leftPanel.SetSizer(leftSizer)
        mainSizer.Add(leftPanel, 1, wx.ALL | wx.EXPAND, 5)

        rightSizer = wx.BoxSizer(wx.VERTICAL)
        self.btnRemoveOverrides = wx.Button(panel, wx.ID_ANY, u"Remove Overides for Item", wx.DefaultPosition,
                                            wx.DefaultSize, 0)
        self.pg = AttributeGrid(panel)
        rightSizer.Add(self.pg, 1, wx.ALL | wx.EXPAND, 5)
        rightSizer.Add(self.btnRemoveOverrides, 0, wx.ALL | wx.EXPAND, 5)
        self.btnRemoveOverrides.Bind(wx.EVT_BUTTON, self.pg.removeOverrides)
        self.btnRemoveOverrides.Enable(False)

        mainSizer.Add(rightSizer, 1, wx.EXPAND)

        panel.SetSizer(mainSizer)
        mainSizer.SetSizeHints(panel)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(panel, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)

        self.Bind(wx.EVT_CLOSE, self.OnClose)
Ejemplo n.º 2
0
    def __init__(self, parent):
        wx.Panel.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          pos=wx.DefaultPosition,
                          size=wx.DefaultSize,
                          style=wx.TAB_TRAVERSAL)
        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOW))

        pmainSizer = wx.BoxSizer(wx.HORIZONTAL)

        availableSizer = wx.BoxSizer(wx.VERTICAL)

        self.searchBox = SearchBox(self)
        self.itemView = ItemView(self)

        self.itemView.Hide()

        availableSizer.Add(self.searchBox, 0, wx.EXPAND)
        availableSizer.Add(self.itemView, 1, wx.EXPAND)

        self.availableImplantsTree = wx.TreeCtrl(self,
                                                 wx.ID_ANY,
                                                 style=wx.TR_DEFAULT_STYLE
                                                 | wx.TR_HIDE_ROOT)
        root = self.availableRoot = self.availableImplantsTree.AddRoot(
            "Available")
        self.availableImplantsImageList = wx.ImageList(16, 16)
        self.availableImplantsTree.SetImageList(
            self.availableImplantsImageList)

        availableSizer.Add(self.availableImplantsTree, 1, wx.EXPAND)

        pmainSizer.Add(availableSizer, 1, wx.ALL | wx.EXPAND, 5)

        buttonSizer = wx.BoxSizer(wx.VERTICAL)
        buttonSizer.AddStretchSpacer()

        self.btnAdd = GenBitmapButton(self,
                                      wx.ID_ADD,
                                      BitmapLoader.getBitmap(
                                          "fit_add_small", "gui"),
                                      style=wx.BORDER_NONE)
        buttonSizer.Add(self.btnAdd, 0)

        self.btnRemove = GenBitmapButton(self,
                                         wx.ID_REMOVE,
                                         BitmapLoader.getBitmap(
                                             "fit_delete_small", "gui"),
                                         style=wx.BORDER_NONE)
        buttonSizer.Add(self.btnRemove, 0)

        buttonSizer.AddStretchSpacer()
        pmainSizer.Add(buttonSizer, 0, wx.EXPAND, 0)

        characterImplantSizer = wx.BoxSizer(wx.VERTICAL)
        self.pluggedImplantsTree = AvailableImplantsView(self)
        characterImplantSizer.Add(self.pluggedImplantsTree, 1,
                                  wx.ALL | wx.EXPAND, 5)
        pmainSizer.Add(characterImplantSizer, 1, wx.EXPAND, 5)

        self.SetSizer(pmainSizer)

        self.hoveredLeftTreeTypeID = None
        self.hoveredRightListRow = None

        # Populate the market tree
        sMkt = Market.getInstance()
        for mktGrp in sMkt.getImplantTree():
            iconId = self.addMarketViewImage(sMkt.getIconByMarketGroup(mktGrp))
            childId = self.availableImplantsTree.AppendItem(root,
                                                            mktGrp.name,
                                                            iconId,
                                                            data=mktGrp.ID)
            if sMkt.marketGroupHasTypesCheck(mktGrp) is False:
                self.availableImplantsTree.AppendItem(childId, "dummy")

        self.availableImplantsTree.SortChildren(self.availableRoot)

        # Bind the event to replace dummies by real data
        self.availableImplantsTree.Bind(wx.EVT_TREE_ITEM_EXPANDING,
                                        self.expandLookup)
        self.availableImplantsTree.Bind(wx.EVT_TREE_ITEM_ACTIVATED,
                                        self.itemSelected)
        self.availableImplantsTree.Bind(wx.EVT_MOTION,
                                        self.OnLeftTreeMouseMove)
        self.availableImplantsTree.Bind(wx.EVT_LEAVE_WINDOW,
                                        self.OnLeftTreeMouseLeave)

        self.itemView.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.itemSelected)

        self.pluggedImplantsTree.Bind(wx.EVT_MOTION, self.OnRightListMouseMove)

        # Bind add & remove buttons
        self.btnAdd.Bind(wx.EVT_BUTTON, self.itemSelected)
        self.btnRemove.Bind(wx.EVT_BUTTON, self.removeItem)

        # We update with an empty list first to set the initial size for Layout(), then update later with actual
        # implants for character. This helps with sizing issues.
        self.pluggedImplantsTree.update([])
        self.bindContext()
        self.Layout()

        self.update()
Ejemplo n.º 3
0
    def __init__(self, parent):
        super().__init__(parent,
                         wx.ID_ANY,
                         title=_t("Attribute Editor"),
                         pos=wx.DefaultPosition,
                         size=wx.Size(650, 600),
                         resizeable=True)

        i = wx.Icon(BitmapLoader.getBitmap("fit_rename_small", "gui"))
        self.SetIcon(i)

        self.mainFrame = parent

        menubar = wx.MenuBar()
        fileMenu = wx.Menu()
        fileImport = fileMenu.Append(wx.ID_ANY, _t('Import'),
                                     _t('Import overrides'))
        fileExport = fileMenu.Append(wx.ID_ANY, _t('Export'),
                                     _t('Import overrides'))
        fileClear = fileMenu.Append(wx.ID_ANY, _t('Clear All'),
                                    _t('Clear all overrides'))

        menubar.Append(fileMenu, _t('&File'))
        self.SetMenuBar(menubar)

        self.Bind(wx.EVT_MENU, self.OnImport, fileImport)
        self.Bind(wx.EVT_MENU, self.OnExport, fileExport)
        self.Bind(wx.EVT_MENU, self.OnClear, fileClear)

        i = wx.Icon(BitmapLoader.getBitmap("fit_rename_small", "gui"))
        self.SetIcon(i)

        self.mainFrame = parent
        self.panel = panel = wx.Panel(self, wx.ID_ANY)

        mainSizer = wx.BoxSizer(wx.HORIZONTAL)

        leftSizer = wx.BoxSizer(wx.VERTICAL)
        leftPanel = wx.Panel(panel,
                             wx.ID_ANY,
                             style=wx.DOUBLE_BORDER if 'wxMSW'
                             in wx.PlatformInfo else wx.SIMPLE_BORDER)

        self.searchBox = SearchBox(leftPanel)
        self.itemView = ItemView(leftPanel)

        leftSizer.Add(self.searchBox, 0, wx.EXPAND)
        leftSizer.Add(self.itemView, 1, wx.EXPAND)

        leftPanel.SetSizer(leftSizer)
        mainSizer.Add(leftPanel, 1, wx.ALL | wx.EXPAND, 5)

        rightSizer = wx.BoxSizer(wx.VERTICAL)
        self.btnRemoveOverrides = wx.Button(panel, wx.ID_ANY,
                                            _t("Remove Overides for Item"),
                                            wx.DefaultPosition, wx.DefaultSize,
                                            0)
        self.pg = AttributeGrid(panel)
        rightSizer.Add(self.pg, 1, wx.ALL | wx.EXPAND, 5)
        rightSizer.Add(self.btnRemoveOverrides, 0, wx.ALL | wx.EXPAND, 5)
        self.btnRemoveOverrides.Bind(wx.EVT_BUTTON, self.pg.removeOverrides)
        self.btnRemoveOverrides.Enable(False)

        mainSizer.Add(rightSizer, 1, wx.EXPAND)

        panel.SetSizer(mainSizer)
        mainSizer.SetSizeHints(panel)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(panel, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        self.SetMinSize(self.GetSize())

        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)