def __init__(self, parent, size = (0,0)): wx.gizmos.TreeListCtrl.__init__(self, parent, size = size) self.tabManager = parent self.fleetId = None self.fleetImg = BitmapLoader.getImage("53_16", "icons") self.imageList = wx.ImageList(16, 16) self.SetImageList(self.imageList) for col in ("", "Fit", "Shiptype", "Character", "Bonusses"): self.AddColumn(col) self.SetMainColumn(1) self.icons = {} self.addImage = self.imageList.Add(BitmapLoader.getBitmap("add_small", "gui")) for icon in ("fb", "fc", "sb", "sc", "wb", "wc"): self.icons[icon] = self.imageList.Add(BitmapLoader.getBitmap("fleet_%s_small" % icon, "gui")) self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.checkNew) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.mainFrame.Bind(gui.fleetBrowser.EVT_FLEET_RENAMED, self.fleetRenamed) self.mainFrame.Bind(gui.fleetBrowser.EVT_FLEET_REMOVED, self.fleetRemoved)
def __init__(self, parent, **kwargs): SBox.PFSearchBox.__init__(self, parent, **kwargs) cancelBitmap = BitmapLoader.getBitmap("fit_delete_small", "gui") searchBitmap = BitmapLoader.getBitmap("fsearch_small", "gui") self.SetSearchBitmap(searchBitmap) self.SetCancelBitmap(cancelBitmap) self.ShowSearchButton() self.ShowCancelButton()
def __init__(self, parent): wx.Panel.__init__ (self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.TAB_TRAVERSAL) pmainSizer = wx.BoxSizer(wx.HORIZONTAL) availableSizer = wx.BoxSizer(wx.VERTICAL) pmainSizer.Add(availableSizer, 1, wx.ALL | wx.EXPAND, 5) self.availableImplantsSearch = wx.SearchCtrl(self, wx.ID_ANY, style=wx.TE_PROCESS_ENTER) self.availableImplantsSearch.ShowCancelButton(True) availableSizer.Add(self.availableImplantsSearch, 0, wx.BOTTOM | wx.EXPAND, 2) 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) buttonSizer = wx.BoxSizer(wx.VERTICAL) pmainSizer.Add(buttonSizer, 0, wx.TOP, 5) 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) self.pluggedImplantsTree = AvailableImplantsView(self, style=wx.LC_SINGLE_SEL) pmainSizer.Add(self.pluggedImplantsTree, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(pmainSizer) # Populate the market tree sMkt = service.Market.getInstance() for mktGrp in sMkt.getImplantTree(): iconId = self.addMarketViewImage(sMkt.getIconByMarketGroup(mktGrp)) childId = self.availableImplantsTree.AppendItem(root, mktGrp.name, iconId, data=wx.TreeItemData(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) #Bind add & remove buttons self.btnAdd.Bind(wx.EVT_BUTTON, self.addImplant) self.btnRemove.Bind(wx.EVT_BUTTON, self.removeImplant) #Bind the change of a character* self.Parent.Parent.Bind(GE.CHAR_CHANGED, self.charChanged) self.Enable(False) self.Layout()
def __init__(self, parent, fleetID, fleetName, fleetCount, id=wx.ID_ANY, pos=wx.DefaultPosition, size=(0,40), style=0): SFItem.SFBrowserItem.__init__(self, parent, size = size) self.fleetBrowser = self.Parent self.fleetID = fleetID self.fleetName = fleetName self.fleetCount = fleetCount self.padding = 4 self.fontBig = wx.FontFromPixelSize((0,15),wx.SWISS, wx.NORMAL, wx.BOLD, False) self.fontNormal = wx.FontFromPixelSize((0,14),wx.SWISS, wx.NORMAL, wx.NORMAL, False) self.fontSmall = wx.FontFromPixelSize((0,12),wx.SWISS, wx.NORMAL, wx.NORMAL, False) self.copyBmp = BitmapLoader.getBitmap("fit_add_small", "gui") self.renameBmp = BitmapLoader.getBitmap("fit_rename_small", "gui") self.deleteBmp = BitmapLoader.getBitmap("fit_delete_small","gui") self.acceptBmp = BitmapLoader.getBitmap("faccept_small", "gui") self.fleetBmp = BitmapLoader.getBitmap("fleet_item_big", "gui") fleetImg = self.fleetBmp.ConvertToImage() fleetImg = fleetImg.Blur(2) if not fleetImg.HasAlpha(): fleetImg.InitAlpha() fleetImg = fleetImg.AdjustChannels(1, 1, 1, 0.5) self.fleetEffBmp = wx.BitmapFromImage(fleetImg) self.toolbar.AddButton(self.copyBmp, "Copy", self.CopyFleetCB) self.renameBtn = self.toolbar.AddButton(self.renameBmp, "Rename", self.RenameFleetCB) self.toolbar.AddButton(self.deleteBmp, "Delete", self.DeleteFleetCB) self.editWidth = 150 self.tcFleetName = wx.TextCtrl(self, wx.ID_ANY, "%s" % self.fleetName, wx.DefaultPosition, (self.editWidth,-1), wx.TE_PROCESS_ENTER) if self.fleetBrowser.fleetIDMustEditName != self.fleetID: self.tcFleetName.Show(False) else: self.tcFleetName.SetFocus() self.tcFleetName.SelectAll() self.fleetBrowser.fleetIDMustEditName = -1 self.renameBtn.SetBitmap(self.acceptBmp) self.selected = True self.tcFleetName.Bind(wx.EVT_KILL_FOCUS, self.OnEditLostFocus) self.tcFleetName.Bind(wx.EVT_TEXT_ENTER, self.RenameFleet) self.tcFleetName.Bind(wx.EVT_KEY_DOWN, self.EditCheckEsc) self.animCount = 0
def __init__(self, parent): self.mainFrame = gui.mainFrame.MainFrame.getInstance() wx.Panel.__init__(self, parent) mainSizer = wx.BoxSizer(wx.HORIZONTAL) self.SetSizer(mainSizer) mainSizer.Add(wx.StaticText(self, wx.ID_ANY, "Character: "), 0, wx.CENTER | wx.RIGHT | wx.LEFT, 3) # cache current selection to fall back in case we choose to open char editor self.charCache = None self.charChoice = wx.Choice(self) mainSizer.Add(self.charChoice, 1, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.LEFT, 3) self.refreshCharacterList() self.cleanSkills = BitmapLoader.getBitmap("skill_big", "gui") self.redSkills = BitmapLoader.getBitmap("skillRed_big", "gui") self.greenSkills = BitmapLoader.getBitmap("skillGreen_big", "gui") self.refresh = BitmapLoader.getBitmap("refresh", "gui") self.needsSkills = False self.btnRefresh = wx.BitmapButton(self, wx.ID_ANY, self.refresh) size = self.btnRefresh.GetSize() self.btnRefresh.SetMinSize(size) self.btnRefresh.SetMaxSize(size) self.btnRefresh.SetToolTipString("Refresh API") self.btnRefresh.Bind(wx.EVT_BUTTON, self.refreshApi) self.btnRefresh.Enable(False) mainSizer.Add(self.btnRefresh, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.LEFT, 2) self.skillReqsStaticBitmap = wx.StaticBitmap(self) self.skillReqsStaticBitmap.SetBitmap(self.cleanSkills) mainSizer.Add(self.skillReqsStaticBitmap, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.LEFT, 3) self.skillReqsStaticBitmap.Bind(wx.EVT_RIGHT_UP, self.OnContextMenu) self.Bind(wx.EVT_CHOICE, self.charChanged) self.mainFrame.Bind(GE.CHAR_LIST_UPDATED, self.refreshCharacterList) self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged) self.SetMinSize(wx.Size(25, -1)) self.charChoice.Enable(False)
def populatePanel(self, contentPanel, headerPanel): contentSizer = contentPanel.GetSizer() self.panel = contentPanel self.headerPanel = headerPanel headerContentSizer = wx.BoxSizer(wx.HORIZONTAL) hsizer = headerPanel.GetSizer() hsizer.Add(headerContentSizer, 0, 0, 0) self.labelEMStatus = wx.StaticText(headerPanel, wx.ID_ANY, "") headerContentSizer.Add(self.labelEMStatus) headerPanel.GetParent().AddToggleItem(self.labelEMStatus) gridPrice = wx.GridSizer(1, 3) contentSizer.Add(gridPrice, 0, wx.EXPAND | wx.ALL, 0) for type in ("ship", "fittings", "total"): image = "%sPrice_big" % type if type != "ship" else "ship_big" box = wx.BoxSizer(wx.HORIZONTAL) gridPrice.Add(box, 0, wx.ALIGN_TOP) box.Add(BitmapLoader.getStaticBitmap(image, contentPanel, "gui"), 0, wx.ALIGN_CENTER) vbox = wx.BoxSizer(wx.VERTICAL) box.Add(vbox, 1, wx.EXPAND) vbox.Add(wx.StaticText(contentPanel, wx.ID_ANY, type.capitalize()), 0, wx.ALIGN_LEFT) hbox = wx.BoxSizer(wx.HORIZONTAL) vbox.Add(hbox) lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0.00 ISK") setattr(self, "labelPrice%s" % type.capitalize(), lbl) hbox.Add(lbl, 0, wx.ALIGN_LEFT)
def __init__(self, parent, categoryID, fittingInfo, size=(0, 16)): SFBrowserItem.__init__(self, parent, size=size) if categoryID: self.shipBmp = BitmapLoader.getBitmap("ship_small", "gui") else: self.shipBmp = wx.EmptyBitmap(16, 16) self.dropShadowBitmap = drawUtils.CreateDropShadowBitmap(self.shipBmp, 0.2) self.categoryID = categoryID self.fittingInfo = fittingInfo self.shipBrowser = self.Parent.Parent self.padding = 4 self.fontBig = wx.Font(fonts.BIG, wx.SWISS, wx.NORMAL, wx.NORMAL) self.animTimerId = wx.NewId() self.animTimer = wx.Timer(self, self.animTimerId) self.animStep = 0 self.animPeriod = 10 self.animDuration = 100 self.Bind(wx.EVT_TIMER, self.OnTimer) # ===================================================================== # Disabled - it will be added as an option to Preferences self.animCount = 0
def __init__(self, parent, entityName): wx.Panel.__init__(self, parent, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.entityName = entityName self.validator = None self.navSizer = wx.BoxSizer(wx.HORIZONTAL) self.choices = [] self.choices.sort(key=lambda p: p.name) self.entityChoices = wx.Choice(self, choices=map(lambda p: p.name, self.choices)) self.navSizer.Add(self.entityChoices, 1, wx.ALL, 5) buttons = (("new", wx.ART_NEW, self.OnNew), ("rename", BitmapLoader.getBitmap("rename", "gui"), self.OnRename), ("copy", wx.ART_COPY, self.OnCopy), ("delete", wx.ART_DELETE, self.OnDelete)) size = None for name, art, func in buttons: bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) if name != "rename" else art btn = wx.BitmapButton(self, wx.ID_ANY, bitmap) if size is None: size = btn.GetSize() btn.SetMinSize(size) btn.SetMaxSize(size) btn.SetToolTipString("{} {}".format(name.capitalize(), self.entityName)) btn.Bind(wx.EVT_BUTTON, func) setattr(self, "btn%s" % name.capitalize(), btn) self.navSizer.Add(btn, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 2) self.SetSizer(self.navSizer) self.Layout() self.refreshEntityList()
def __init__(self, parent, stuff, item): wx.Panel.__init__ (self, parent, style = wx.TAB_TRAVERSAL) #itemId is set by the parent. self.romanNb = ["0","I","II","III","IV","V","VI","VII","VIII","IX","X"] self.skillIdHistory=[] mainSizer = wx.BoxSizer( wx.VERTICAL ) self.reqTree = wx.TreeCtrl(self, style = wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT | wx.NO_BORDER) mainSizer.Add(self.reqTree, 1, wx.ALL|wx.EXPAND, 0) self.SetSizer(mainSizer) self.root = self.reqTree.AddRoot("WINRARZOR") self.reqTree.SetPyData(self.root, None) self.imageList = wx.ImageList(16, 16) self.reqTree.SetImageList(self.imageList) skillBookId = self.imageList.Add(BitmapLoader.getBitmap("skill_small", "gui")) self.getFullSkillTree(item,self.root,skillBookId) self.reqTree.ExpandAll() self.Layout()
def RebuildRaces(self, races): self.raceBmps = [] for race in races: if race: self.raceBmps.append(BitmapLoader.getBitmap("race_%s_small" % race, "gui")) self.raceNames = races self.CalcButtonsBarPos() self.Refresh()
def populatePanel(self, contentPanel, headerPanel): contentSizer = contentPanel.GetSizer() self.panel = contentPanel self.headerPanel = headerPanel sizerTankStats = wx.FlexGridSizer(3, 5) for i in range(4): sizerTankStats.AddGrowableCol(i + 1) contentSizer.Add(sizerTankStats, 0, wx.EXPAND, 0) # Add an empty label first for correct alignment. sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""), 0) toolTipText = {"shieldPassive": "Passive shield recharge", "shieldActive": "Active shield boost", "armorActive": "Armor repair amount", "hullActive": "Hull repair amount"} for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"): bitmap = BitmapLoader.getStaticBitmap("%s_big" % tankType, contentPanel, "gui") tooltip = wx.ToolTip(toolTipText[tankType]) bitmap.SetToolTip(tooltip) sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER) toolTipText = {"reinforced": "Reinforced", "sustained": "Sustained"} for stability in ("reinforced", "sustained"): bitmap = BitmapLoader.getStaticBitmap("regen%s_big" % stability.capitalize(), contentPanel, "gui") tooltip = wx.ToolTip(toolTipText[stability]) bitmap.SetToolTip(tooltip) sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER) for tankType in ("shieldPassive", "shieldActive", "armorActive", "hullActive"): if stability == "reinforced" and tankType == "shieldPassive": sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, "")) continue tankTypeCap = tankType[0].capitalize() + tankType[1:] lbl = wx.StaticText(contentPanel, wx.ID_ANY, "0.0", style=wx.ALIGN_RIGHT) setattr(self, "labelTank%s%s" % (stability.capitalize(), tankTypeCap), lbl) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(lbl, 0, wx.EXPAND) unitlbl = wx.StaticText(contentPanel, wx.ID_ANY, " EHP/s") setattr(self, "unitLabelTank%s%s" % (stability.capitalize(), tankTypeCap), unitlbl) box.Add(unitlbl, 0, wx.EXPAND) sizerTankStats.Add(box, 0, wx.ALIGN_CENTRE) contentPanel.Layout()
def addMarketViewImage(self, iconFile): if iconFile is None: return -1 bitmap = BitmapLoader.getBitmap(iconFile, "icons") if bitmap is None: return -1 else: return self.availableImplantsImageList.Add(bitmap)
def GetImageIndex(self, *loaderArgs): id = self.map.get(loaderArgs) if id is None: bitmap = BitmapLoader.getBitmap(*loaderArgs) if bitmap is None: return -1 id = self.map[loaderArgs] = wx.ImageList.Add(self,bitmap) return id
def getBitmap(self, context, selection): sFit = Fit.getInstance() fitID = self.mainFrame.getActiveFit() fit = sFit.getFit(fitID) if fit.factorReload: return BitmapLoader.getBitmap("state_active_small", "gui") else: return None
def __init__(self, fittingView, params): ViewColumn.__init__(self, fittingView) self.mask = wx.LIST_MASK_IMAGE Attribute.getInstance().getAttributeInfo("capacitorNeed") self.imageId = fittingView.imageList.GetImageIndex("capacitorRecharge_small", "gui") self.bitmap = BitmapLoader.getBitmap("capacitorRecharge_small", "gui")
def __init__(self, parent): wx.Panel.__init__ (self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(500, 300), style=wx.TAB_TRAVERSAL) self.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) pmainSizer = wx.BoxSizer(wx.VERTICAL) tree = self.skillTreeListCtrl = wx.gizmos.TreeListCtrl(self, wx.ID_ANY, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT) pmainSizer.Add(tree, 1, wx.EXPAND | wx.ALL, 5) self.imageList = wx.ImageList(16, 16) tree.SetImageList(self.imageList) self.skillBookImageId = self.imageList.Add(BitmapLoader.getBitmap("skill_small", "gui")) tree.AddColumn("Skill") tree.AddColumn("Level") tree.SetMainColumn(0) self.root = tree.AddRoot("Skills") tree.SetItemText(self.root, "Levels", 1) tree.SetColumnWidth(0, 500) self.populateSkillTree() tree.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.expandLookup) tree.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.scheduleMenu) srcContext = "skillItem" itemContext = "Skill" context = (srcContext, itemContext) self.statsMenu = ContextMenu.getMenu(None, context) self.levelChangeMenu = ContextMenu.getMenu(None, context) or wx.Menu() self.levelChangeMenu.AppendSeparator() self.levelIds = {} idUnlearned = wx.NewId() self.levelIds[idUnlearned] = "Not learned" self.levelChangeMenu.Append(idUnlearned, "Unlearn") for level in xrange(6): id = wx.NewId() self.levelIds[id] = level self.levelChangeMenu.Append(id, "Level %d" % level) self.levelChangeMenu.AppendSeparator() self.revertID = wx.NewId() self.levelChangeMenu.Append(self.revertID, "Revert") self.saveID = wx.NewId() self.levelChangeMenu.Append(self.saveID, "Save") self.levelChangeMenu.Bind(wx.EVT_MENU, self.changeLevel) self.SetSizer(pmainSizer) self.Layout()
def __init__(self, size=(36, 24), text=wx.EmptyString, img=None, inclination=6 , closeButton=True): """ Renders a new tab text -- tab label img -- wxImage of tab icon inclination -- does not seem to affect class, maybe used to be a variable for custom drawn tab inclinations before there were bitmaps? closeButton -- True if tab can be closed """ # tab left/right zones inclination self.ctabLeft = BitmapLoader.getImage("ctableft", "gui") self.ctabMiddle = BitmapLoader.getImage("ctabmiddle", "gui") self.ctabRight = BitmapLoader.getImage("ctabright", "gui") self.ctabClose = BitmapLoader.getImage("ctabclose", "gui") self.leftWidth = self.ctabLeft.GetWidth() self.rightWidth = self.ctabRight.GetWidth() self.middleWidth = self.ctabMiddle.GetWidth() self.closeBtnWidth = self.ctabClose.GetWidth() width, height = size if width < self.leftWidth + self.rightWidth + self.middleWidth: width = self.leftWidth + self.rightWidth + self.middleWidth if height < self.ctabMiddle.GetHeight(): height = self.ctabMiddle.GetHeight() self.inclination = inclination self.text = text self.disabled = False self.tabSize = (width, height) self.closeButton = closeButton self.selected = False self.closeBtnHovering = False self.tabBitmap = None self.tabBackBitmap = None self.cbSize = 5 self.padding = 4 self.font = wx.Font(fonts.NORMAL, wx.SWISS, wx.NORMAL, wx.NORMAL, False) self.tabImg = img self.position = (0, 0) # Not used internally for rendering - helper for tab container self.InitTab()
def updateTab(self): sFit = service.Fit.getInstance() fit = sFit.getFit(self.getActiveFit(), basic=True) bitmap = BitmapLoader.getImage("race_%s_small" % fit.ship.item.race, "gui") text = "%s: %s" % (fit.ship.item.name, fit.name) pageIndex = self.parent.GetPageIndex(self) if pageIndex is not None: self.parent.SetPageTextIcon(pageIndex, text, bitmap)
def getIcons(self): icons = {} sAttr = service.Attribute.getInstance() for key, attrName in self.propertyAttributeMap.iteritems(): iconFile = sAttr.getAttributeInfo(attrName).icon.iconFile bitmap = BitmapLoader.getBitmap(iconFile, "icons") if bitmap: icons[key] = bitmap return icons
def __init__(self, parent): TogglePanel.__init__(self, parent, forceLayout=1) self.SetLabel("Additions") pane = self.GetContentPane() baseSizer = wx.BoxSizer(wx.HORIZONTAL) pane.SetSizer(baseSizer) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.notebook = gui.chromeTabs.PFNotebook(pane, False) self.notebook.SetMinSize((-1, 1000)) baseSizer.Add(self.notebook, 1, wx.EXPAND) droneImg = BitmapLoader.getImage("drone_small", "gui") implantImg = BitmapLoader.getImage("implant_small", "gui") boosterImg = BitmapLoader.getImage("booster_small", "gui") projectedImg = BitmapLoader.getImage("projected_small", "gui") gangImg = BitmapLoader.getImage("fleet_fc_small", "gui") cargoImg = BitmapLoader.getImage("cargo_small", "gui") self.notebook.AddPage(DroneView(self.notebook), "Drones", tabImage=droneImg, showClose=False) self.notebook.AddPage(CargoView(self.notebook), "Cargo", tabImage=cargoImg, showClose=False) self.notebook.AddPage(ImplantView(self.notebook), "Implants", tabImage=implantImg, showClose=False) self.notebook.AddPage(BoosterView(self.notebook), "Boosters", tabImage=boosterImg, showClose=False) self.projectedPage = ProjectedView(self.notebook) self.notebook.AddPage(self.projectedPage, "Projected", tabImage=projectedImg, showClose=False) self.gangPage = GangView(self.notebook) self.notebook.AddPage(self.gangPage, "Fleet", tabImage=gangImg, showClose=False) self.notebook.SetSelection(0)
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE) self.SetTitle("pyfa - Preferences") i = wx.IconFromBitmap(BitmapLoader.getBitmap("preferences_small", "gui")) self.SetIcon(i) mainSizer = wx.BoxSizer(wx.VERTICAL) self.listbook = wx.Listbook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT) self.listview = self.listbook.GetListView() # self.listview.SetMinSize((500, -1)) # self.listview.SetSize((500, -1)) self.imageList = wx.ImageList(32, 32) self.listbook.SetImageList(self.imageList) mainSizer.Add(self.listbook, 1, wx.EXPAND | wx.TOP | wx.BOTTOM | wx.LEFT, 5) self.m_staticline2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline2, 0, wx.EXPAND, 5) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.AddSpacer((0, 0), 1, wx.EXPAND, 5) self.btnOK = wx.Button(self, wx.ID_ANY, u"OK", wx.DefaultPosition, wx.DefaultSize, 0) btnSizer.Add(self.btnOK, 0, wx.ALL, 5) mainSizer.Add(btnSizer, 0, wx.EXPAND, 5) self.SetSizer(mainSizer) self.Centre(wx.BOTH) for prefView in PreferenceView.views: page = wx.Panel(self.listbook) bmp = prefView.getImage() if bmp: imgID = self.imageList.Add(bmp) else: imgID = -1 prefView.populatePanel(page) self.listbook.AddPage(page, prefView.title, imageId=imgID) # Set the height based on a condition. Can all the panels fit in the current height? # If not, use the .GetBestVirtualSize() to ensure that all content is available. minHeight = 550 bestFit = self.GetBestVirtualSize() if minHeight > bestFit[1]: self.SetSizeWH(650, minHeight) else: self.SetSizeWH(650, bestFit[1]) self.Layout() self.btnOK.Bind(wx.EVT_BUTTON, self.OnBtnOK)
def __init__(self, parent): TogglePanel.__init__(self, parent, forceLayout=1) self.SetLabel("Additions") pane = self.GetContentPane() baseSizer = wx.BoxSizer(wx.HORIZONTAL) pane.SetSizer(baseSizer) self.notebook = PFNotebook(pane, False) self.notebook.SetMinSize((-1, 1000)) baseSizer.Add(self.notebook, 1, wx.EXPAND) droneImg = BitmapLoader.getImage("drone_small", "gui") fighterImg = BitmapLoader.getImage("fighter_small", "gui") implantImg = BitmapLoader.getImage("implant_small", "gui") boosterImg = BitmapLoader.getImage("booster_small", "gui") projectedImg = BitmapLoader.getImage("projected_small", "gui") gangImg = BitmapLoader.getImage("fleet_fc_small", "gui") cargoImg = BitmapLoader.getImage("cargo_small", "gui") notesImg = BitmapLoader.getImage("skill_small", "gui") self.drone = DroneView(self.notebook) self.notebook.AddPage(self.drone, "Drones", tabImage=droneImg, showClose=False) self.fighter = FighterView(self.notebook) self.notebook.AddPage(self.fighter, "Fighters", tabImage=fighterImg, showClose=False) self.cargo = CargoView(self.notebook) self.notebook.AddPage(self.cargo, "Cargo", tabImage=cargoImg, showClose=False) self.implant = ImplantView(self.notebook) self.notebook.AddPage(self.implant, "Implants", tabImage=implantImg, showClose=False) self.booster = BoosterView(self.notebook) self.notebook.AddPage(self.booster, "Boosters", tabImage=boosterImg, showClose=False) self.projectedPage = ProjectedView(self.notebook) self.notebook.AddPage(self.projectedPage, "Projected", tabImage=projectedImg, showClose=False) self.gangPage = CommandView(self.notebook) self.notebook.AddPage(self.gangPage, "Command", tabImage=gangImg, showClose=False) self.notes = NotesView(self.notebook) self.notebook.AddPage(self.notes, "Notes", tabImage=notesImg, showClose=False) self.notebook.SetSelection(0)
def addCharge(self, menu, charge): id = ContextMenu.nextID() name = charge.name if charge is not None else "Empty" self.chargeIds[id] = charge item = wx.MenuItem(menu, id, name) menu.Bind(wx.EVT_MENU, self.handleAmmoSwitch, item) item.charge = charge if charge is not None and charge.icon is not None: bitmap = BitmapLoader.getBitmap(charge.icon.iconFile, "icons") if bitmap is not None: item.SetBitmap(bitmap) return item
def __init__(self): """Renders the add tab button""" self.addImg = BitmapLoader.getImage("ctabadd", "gui") self.width = self.addImg.GetWidth() self.height = self.addImg.GetHeight() self.region = None self.tbmp = wx.BitmapFromImage(self.addImg) self.addBitmap = None self.position = (0, 0) self.highlighted = False self.InitRenderer()
def __init__(self, fittingView, params = None): if params == None: params = {"showIcon": True, "displayName": False} ViewColumn.__init__(self, fittingView) if params["showIcon"]: self.imageId = fittingView.imageList.GetImageIndex("column_misc", "gui") self.bitmap = BitmapLoader.getBitmap("column_misc", "gui") self.mask = wx.LIST_MASK_IMAGE else: self.imageId = -1 if params["displayName"] or self.imageId == -1: self.columnText = "Misc data" self.mask |= wx.LIST_MASK_TEXT self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def addPattern(self, rootMenu, pattern): id = wx.NewId() name = getattr(pattern, "_name", pattern.name) if pattern is not None else "No Profile" self.patternIds[id] = pattern menuItem = wx.MenuItem(rootMenu, id, name) rootMenu.Bind(wx.EVT_MENU, self.handlePatternSwitch, menuItem) # set pattern attr to menu item menuItem.pattern = pattern # determine active pattern sFit = service.Fit.getInstance() fitID = self.mainFrame.getActiveFit() f = sFit.getFit(fitID) dp = f.damagePattern if dp == pattern: bitmap = BitmapLoader.getBitmap("state_active_small", "gui") menuItem.SetBitmap(bitmap) return menuItem
def addPattern(self, rootMenu, pattern): id = ContextMenu.nextID() name = getattr(pattern, "_name", pattern.name) if pattern is not None else "No Profile" self.patternIds[id] = pattern item = wx.MenuItem(rootMenu, id, name) rootMenu.Bind(wx.EVT_MENU, self.handleResistSwitch, item) # set pattern attr to menu item item.pattern = pattern # determine active pattern sFit = service.Fit.getInstance() fitID = self.mainFrame.getActiveFit() f = sFit.getFit(fitID) tr = f.targetResists if tr == pattern: bitmap = BitmapLoader.getBitmap("state_active_small", "gui") item.SetBitmap(bitmap) return item
def __init__(self, parent): wx.Panel.__init__ (self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size(500, 24), style=wx.TAB_TRAVERSAL) self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) ) self.newBmp = BitmapLoader.getBitmap("fit_add_small","gui") bmpSize = (16,16) mainSizer = wx.BoxSizer(wx.HORIZONTAL) if 'wxMac' in wx.PlatformInfo: bgcolour = wx.Colour(0, 0, 0, 0) else: bgcolour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_BTNFACE ) self.fbNewFleet = PFGenBitmapButton( self, wx.ID_ANY, self.newBmp, wx.DefaultPosition, bmpSize, wx.BORDER_NONE ) mainSizer.Add(self.fbNewFleet, 0, wx.LEFT | wx.TOP | wx.BOTTOM | wx.ALIGN_CENTER_VERTICAL , 5) self.fbNewFleet.SetBackgroundColour( bgcolour ) self.sl1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_VERTICAL ) mainSizer.Add( self.sl1, 0, wx.EXPAND |wx.LEFT, 5 ) self.tcFilter = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) mainSizer.Add( self.tcFilter, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5 ) self.stStatus = wx.StaticText( self, wx.ID_ANY, u"", wx.DefaultPosition, wx.DefaultSize, 0 ) self.stStatus.Wrap( -1 ) mainSizer.Add( self.stStatus, 1, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5 ) self.SetSizer(mainSizer) self.Layout() self.fbNewFleet.Bind(wx.EVT_ENTER_WINDOW, self.fbNewEnterWindow) self.fbNewFleet.Bind(wx.EVT_LEAVE_WINDOW, self.fbHItemLeaveWindow) self.fbNewFleet.Bind(wx.EVT_BUTTON, self.OnNewFleetItem) self.tcFilter.Bind(wx.EVT_TEXT, self.OnFilterText) self.tcFilter.Bind(wx.EVT_ENTER_WINDOW, self.fbFilterEnterWindow) self.tcFilter.Bind(wx.EVT_LEAVE_WINDOW, self.fbHItemLeaveWindow)
def getSubMenu(self, context, selection, rootMenu, i, pitem): msw = True if "wxMSW" in wx.PlatformInfo else False if self.m[i] not in self.subMenus: # if we're trying to get submenu to something that shouldn't have one, # redirect event of the item to handlePatternSwitch and put pattern in # our patternIds mapping, then return None for no submenu id = pitem.GetId() self.patternIds[id] = self.singles[i] rootMenu.Bind(wx.EVT_MENU, self.handlePatternSwitch, pitem) if self.patternIds[id] == self.fit.damagePattern: bitmap = BitmapLoader.getBitmap("state_active_small", "gui") pitem.SetBitmap(bitmap) return False sub = wx.Menu() # Items that have a parent for pattern in self.subMenus[self.m[i]]: sub.AppendItem(self.addPattern(rootMenu if msw else sub, pattern)) return sub
def getSubMenu(self, context, selection, rootMenu, i, pitem): msw = True if "wxMSW" in wx.PlatformInfo else False self.skillIds = {} sub = wx.Menu() for skill in self.skills: skillItem = wx.MenuItem(sub, wx.NewId(), skill.item.name) grandSub = wx.Menu() skillItem.SetSubMenu(grandSub) if skill.learned: bitmap = BitmapLoader.getBitmap("lvl%s" % skill.level, "gui") if bitmap is not None: skillItem.SetBitmap(bitmap) for i in xrange(-1, 6): levelItem = self.addSkill(rootMenu if msw else grandSub, skill, i) grandSub.AppendItem(levelItem) if (not skill.learned and i == -1) or (skill.learned and skill.level == i): levelItem.Check(True) sub.AppendItem(skillItem) return sub
def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL) self.charEditor = self.Parent.Parent # first parent is Notebook, second is Character Editor self.SetBackgroundColour( wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) pmainSizer = wx.BoxSizer(wx.VERTICAL) tree = self.skillTreeListCtrl = wx.gizmos.TreeListCtrl( self, wx.ID_ANY, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT) pmainSizer.Add(tree, 1, wx.EXPAND | wx.ALL, 5) self.imageList = wx.ImageList(16, 16) tree.SetImageList(self.imageList) self.skillBookImageId = self.imageList.Add( BitmapLoader.getBitmap("skill_small", "gui")) tree.AddColumn("Skill") tree.AddColumn("Level") tree.SetMainColumn(0) self.root = tree.AddRoot("Skills") tree.SetItemText(self.root, "Levels", 1) tree.SetColumnWidth(0, 500) self.populateSkillTree() tree.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.expandLookup) tree.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.scheduleMenu) # bind the Character selection event self.charEditor.entityEditor.Bind(wx.EVT_CHOICE, self.populateSkillTree) self.charEditor.Bind(GE.CHAR_LIST_UPDATED, self.populateSkillTree) srcContext = "skillItem" itemContext = "Skill" context = (srcContext, itemContext) self.statsMenu = ContextMenu.getMenu(None, context) self.levelChangeMenu = ContextMenu.getMenu(None, context) or wx.Menu() self.levelChangeMenu.AppendSeparator() self.levelIds = {} idUnlearned = wx.NewId() self.levelIds[idUnlearned] = "Not learned" self.levelChangeMenu.Append(idUnlearned, "Unlearn") for level in xrange(6): id = wx.NewId() self.levelIds[id] = level self.levelChangeMenu.Append(id, "Level %d" % level) self.levelChangeMenu.AppendSeparator() self.revertID = wx.NewId() self.levelChangeMenu.Append(self.revertID, "Revert") self.saveID = wx.NewId() self.levelChangeMenu.Append(self.saveID, "Save") self.levelChangeMenu.Bind(wx.EVT_MENU, self.changeLevel) self.SetSizer(pmainSizer) self.Layout()
def __init__(self, parent): wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"pyfa: Character Editor", pos=wx.DefaultPosition, size=wx.Size(640, 600), style=wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER) i = wx.IconFromBitmap(BitmapLoader.getBitmap("character_small", "gui")) self.SetIcon(i) self.mainFrame = parent #self.disableWin = wx.WindowDisabler(self) sFit = service.Fit.getInstance() self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)) mainSizer = wx.BoxSizer(wx.VERTICAL) self.entityEditor = CharacterEntityEditor(self) mainSizer.Add(self.entityEditor, 0, wx.ALL | wx.EXPAND, 2) # Default drop down to current fit's character self.entityEditor.setActiveEntity(sFit.character) self.viewsNBContainer = wx.Notebook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0) self.sview = SkillTreeView(self.viewsNBContainer) self.iview = ImplantEditorView(self.viewsNBContainer) self.aview = APIView(self.viewsNBContainer) self.viewsNBContainer.AddPage(self.sview, "Skills") self.viewsNBContainer.AddPage(self.iview, "Implants") self.viewsNBContainer.AddPage(self.aview, "API") mainSizer.Add(self.viewsNBContainer, 1, wx.EXPAND | wx.ALL, 5) bSizerButtons = wx.BoxSizer(wx.HORIZONTAL) self.btnSaveChar = wx.Button(self, wx.ID_ANY, "Save") self.btnSaveAs = wx.Button(self, wx.ID_ANY, "Save As...") self.btnRevert = wx.Button(self, wx.ID_ANY, "Revert") self.btnOK = wx.Button(self, wx.ID_OK) bSizerButtons.Add(self.btnSaveChar, 0, wx.ALL, 5) bSizerButtons.Add(self.btnSaveAs, 0, wx.ALL, 5) bSizerButtons.Add(self.btnRevert, 0, wx.ALL, 5) bSizerButtons.AddStretchSpacer() bSizerButtons.Add(self.btnOK, 0, wx.ALL, 5) self.btnSaveChar.Bind(wx.EVT_BUTTON, self.saveChar) self.btnSaveAs.Bind(wx.EVT_BUTTON, self.saveCharAs) self.btnRevert.Bind(wx.EVT_BUTTON, self.revertChar) self.btnOK.Bind(wx.EVT_BUTTON, self.editingFinished) mainSizer.Add(bSizerButtons, 0, wx.EXPAND, 5) self.btnRestrict() self.SetSizer(mainSizer) self.Layout() self.Centre(wx.BOTH) self.Bind(wx.EVT_CLOSE, self.closeEvent) self.Bind(GE.CHAR_LIST_UPDATED, self.refreshCharacterList) self.entityEditor.Bind(wx.EVT_CHOICE, self.charChanged)
def buildModuleView(self, root): # We first build a usable dictionary of items. The key is either a fit # if the afflictions stem from a projected fit, or self.stuff if they # are local afflictions (everything else, even gang boosts at this time) # The value of this is yet another dictionary in the following format: # # "Module Name": [ # class of affliction, # set of afflictors (such as 2 of the same module), # info on affliction (attribute name, modifier, and modification amount), # item that will be used to determine icon (required due to GH issue #335) # whether this affliction is actually used (unlearned skills are not used) # ] attributes = self.stuff.itemModifiedAttributes if self.item == self.stuff.item else self.stuff.chargeModifiedAttributes container = {} for attrName in attributes.iterAfflictions(): # if value is 0 or there has been no change from original to modified, return if attributes[attrName] == (attributes.getOriginal(attrName) or 0): continue for fit, afflictors in attributes.getAfflictions(attrName).iteritems(): for afflictor, modifier, amount, used in afflictors: if not used or getattr(afflictor, 'item', None) is None: continue if fit.ID != self.activeFit: # affliction fit does not match our fit if fit not in container: container[fit] = {} items = container[fit] else: # local afflictions if self.stuff not in container: container[self.stuff] = {} items = container[self.stuff] if afflictor == self.stuff and getattr(afflictor, 'charge', None): # we are showing a charges modifications, see #335 item = afflictor.charge else: item = afflictor.item # items hold our module: info mappings if item.name not in items: items[item.name] = [type(afflictor), set(), [], item, getattr(afflictor, "projected", False)] info = items[item.name] info[1].add(afflictor) # If info[1] > 1, there are two separate modules working. # Check to make sure we only include the modifier once # See GH issue 154 if len(info[1]) > 1 and (attrName, modifier, amount) in info[2]: continue info[2].append((attrName, modifier, amount)) # Make sure projected fits are on top rootOrder = container.keys() rootOrder.sort(key=lambda x: self.ORDER.index(type(x))) # Now, we take our created dictionary and start adding stuff to our tree for thing in rootOrder: # This block simply directs which parent we are adding to (root or projected fit) if thing == self.stuff: parent = root else: # projected fit icon = self.imageList.Add(BitmapLoader.getBitmap("ship_small", "gui")) child = self.affectedBy.AppendItem(root, "{} ({})".format(thing.name, thing.ship.item.name), icon) parent = child items = container[thing] order = items.keys() order.sort(key=lambda x: (self.ORDER.index(items[x][0]), x)) for itemName in order: info = items[itemName] afflictorType, afflictors, attrData, item, projected = info counter = len(afflictors) if afflictorType == Ship: itemIcon = self.imageList.Add(BitmapLoader.getBitmap("ship_small", "gui")) elif item.icon: bitmap = BitmapLoader.getBitmap(item.icon.iconFile, "icons") itemIcon = self.imageList.Add(bitmap) if bitmap else -1 else: itemIcon = -1 displayStr = itemName if counter > 1: displayStr += " x {}".format(counter) if projected: displayStr += " (projected)" # this is the Module node, the attribute will be attached to this child = self.affectedBy.AppendItem(parent, displayStr, itemIcon) self.affectedBy.SetPyData(child, afflictors.pop()) if counter > 0: attributes = [] for attrName, attrModifier, attrAmount in attrData: attrInfo = self.stuff.item.attributes.get(attrName) displayName = attrInfo.displayName if attrInfo else "" if attrInfo: if attrInfo.icon is not None: iconFile = attrInfo.icon.iconFile icon = BitmapLoader.getBitmap(iconFile, "icons") if icon is None: icon = BitmapLoader.getBitmap("transparent16x16", "gui") attrIcon = self.imageList.Add(icon) else: attrIcon = self.imageList.Add(BitmapLoader.getBitmap("7_15", "icons")) else: attrIcon = self.imageList.Add(BitmapLoader.getBitmap("7_15", "icons")) if attrModifier == "s*": attrModifier = "*" penalized = "(penalized)" else: penalized = "" attributes.append((attrName, (displayName if displayName != "" else attrName), attrModifier, attrAmount, penalized, attrIcon)) attrSorted = sorted(attributes, key = lambda attribName: attribName[0]) for attr in attrSorted: attrName, displayName, attrModifier, attrAmount, penalized, attrIcon = attr if self.showRealNames: display = "%s %s %.2f %s" % (attrName, attrModifier, attrAmount, penalized) saved = "%s %s %.2f %s" % ((displayName if displayName != "" else attrName), attrModifier, attrAmount, penalized) else: display = "%s %s %.2f %s" % ((displayName if displayName != "" else attrName), attrModifier, attrAmount, penalized) saved = "%s %s %.2f %s" % (attrName, attrModifier, attrAmount, penalized) treeitem = self.affectedBy.AppendItem(child, display, attrIcon) self.affectedBy.SetPyData(treeitem, saved) self.treeItems.append(treeitem)
def PopulateList(self): self.paramList.InsertColumn(0, "Attribute") self.paramList.InsertColumn(1, "Value") self.paramList.SetColumnWidth(1, 150) self.paramList.setResizeColumn(1) self.imageList = wx.ImageList(16, 16) self.paramList.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL) names = list(self.attrValues.iterkeys()) names.sort() idNameMap = {} idCount = 0 for name in names: info = self.attrInfo.get(name) att = self.attrValues[name] val = getattr(att, "value", None) value = val if val is not None else att if info and info.displayName and self.toggleView == 1: attrName = info.displayName else: attrName = name if info: if info.icon is not None: iconFile = info.icon.iconFile icon = BitmapLoader.getBitmap(iconFile, "icons") if icon is None: icon = BitmapLoader.getBitmap("transparent16x16", "gui") attrIcon = self.imageList.Add(icon) else: attrIcon = self.imageList.Add( BitmapLoader.getBitmap("07_15", "icons")) else: attrIcon = self.imageList.Add( BitmapLoader.getBitmap("07_15", "icons")) index = self.paramList.InsertImageStringItem( sys.maxint, attrName, attrIcon) idNameMap[idCount] = attrName self.paramList.SetItemData(index, idCount) idCount += 1 if self.toggleView != 1: valueUnit = str(value) elif info and info.unit: valueUnit = self.TranslateValueUnit(value, info.unit.displayName, info.unit.name) else: valueUnit = formatAmount(value, 3, 0, 0) self.paramList.SetStringItem(index, 1, valueUnit) self.paramList.SortItems( lambda id1, id2: cmp(idNameMap[id1], idNameMap[id2])) self.paramList.RefreshRows() self.totalAttrsLabel.SetLabel("%d attributes. " % idCount) self.Layout()
def getImage(self): return BitmapLoader.getBitmap("settings_database", "gui")
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Damage Pattern Editor", size=wx.Size(400, 240)) self.block = False self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) mainSizer = wx.BoxSizer(wx.VERTICAL) self.entityEditor = DmgPatternEntityEditor(self) mainSizer.Add(self.entityEditor, 0, wx.ALL | wx.EXPAND, 2) self.sl = wx.StaticLine(self) mainSizer.Add(self.sl, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) contentSizer = wx.BoxSizer(wx.VERTICAL) self.embitmap = BitmapLoader.getBitmap("em_big", "gui") self.thermbitmap = BitmapLoader.getBitmap("thermal_big", "gui") self.kinbitmap = BitmapLoader.getBitmap("kinetic_big", "gui") self.expbitmap = BitmapLoader.getBitmap("explosive_big", "gui") dmgeditSizer = wx.FlexGridSizer(2, 6, 0, 2) dmgeditSizer.AddGrowableCol(0) dmgeditSizer.AddGrowableCol(5) dmgeditSizer.SetFlexibleDirection(wx.BOTH) dmgeditSizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) width = -1 defSize = wx.Size(width, -1) for i, type_ in enumerate(self.DAMAGE_TYPES): bmp = wx.StaticBitmap( self, wx.ID_ANY, BitmapLoader.getBitmap("%s_big" % type_, "gui")) if i % 2: style = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT border = 20 else: style = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT border = 5 # set text edit setattr(self, "%sEdit" % type_, IntCtrl(self, wx.ID_ANY, 0, wx.DefaultPosition, defSize)) setattr(self, "%sPerc" % type_, wx.StaticText(self, wx.ID_ANY, u"0%")) editObj = getattr(self, "%sEdit" % type_) dmgeditSizer.Add(bmp, 0, style, border) dmgeditSizer.Add(editObj, 0, wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL, 5) dmgeditSizer.Add(getattr(self, "%sPerc" % type_), 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 5) editObj.Bind(wx.EVT_TEXT, self.ValuesUpdated) editObj.SetLimited(True) editObj.SetMin(0) editObj.SetMax(2000000) contentSizer.Add(dmgeditSizer, 1, wx.EXPAND | wx.ALL, 5) self.slfooter = wx.StaticLine(self) contentSizer.Add(self.slfooter, 0, wx.EXPAND | wx.TOP, 5) footerSizer = wx.BoxSizer(wx.HORIZONTAL) perSizer = wx.BoxSizer(wx.VERTICAL) self.stNotice = wx.StaticText(self, wx.ID_ANY, u"") self.stNotice.Wrap(-1) perSizer.Add(self.stNotice, 0, wx.BOTTOM | wx.TOP | wx.LEFT, 5) footerSizer.Add(perSizer, 1, wx.ALIGN_CENTER_VERTICAL, 5) self.totSizer = wx.BoxSizer(wx.VERTICAL) contentSizer.Add(footerSizer, 0, wx.EXPAND, 5) mainSizer.Add(contentSizer, 1, wx.EXPAND, 0) if "wxGTK" in wx.PlatformInfo: self.closeBtn = wx.Button(self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.closeBtn, 0, wx.ALL | wx.ALIGN_RIGHT, 5) self.closeBtn.Bind(wx.EVT_BUTTON, self.closeEvent) self.SetSizer(mainSizer) importExport = (("Import", wx.ART_FILE_OPEN, "from"), ("Export", wx.ART_FILE_SAVE_AS, "to")) for name, art, direction in importExport: bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) btn = wx.BitmapButton(self, wx.ID_ANY, bitmap) btn.SetMinSize(btn.GetSize()) btn.SetMaxSize(btn.GetSize()) btn.Layout() setattr(self, name, btn) btn.Enable(True) btn.SetToolTipString("%s patterns %s clipboard" % (name, direction)) footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT) btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower()))) self.Layout() bsize = self.GetBestSize() self.SetSize((-1, bsize.height)) self.CenterOnParent() self.Bind(wx.EVT_CHOICE, self.patternChanged) self.patternChanged()
def getImage(self): return BitmapLoader.getBitmap("prefs_settings", "gui")
def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Target Resists Editor", size=wx.Size(350, 240)) self.block = False self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) mainSizer = wx.BoxSizer(wx.VERTICAL) self.entityEditor = TargetResistsEntityEditor(self) mainSizer.Add(self.entityEditor, 0, wx.ALL | wx.EXPAND, 2) self.sl = wx.StaticLine(self) mainSizer.Add(self.sl, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) contentSizer = wx.BoxSizer(wx.VERTICAL) resistEditSizer = wx.FlexGridSizer(2, 6, 0, 2) resistEditSizer.AddGrowableCol(0) resistEditSizer.AddGrowableCol(5) resistEditSizer.SetFlexibleDirection(wx.BOTH) resistEditSizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) width = -1 defSize = wx.Size(50, -1) for i, type in enumerate(self.DAMAGE_TYPES): if i % 2: style = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.LEFT border = 25 else: style = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT border = 5 bmp = wx.StaticBitmap( self, wx.ID_ANY, BitmapLoader.getBitmap("%s_big" % type, "gui")) resistEditSizer.Add(bmp, 0, style, border) # set text edit setattr( self, "%sEdit" % type, wx.TextCtrl(self, wx.ID_ANY, "", wx.DefaultPosition, defSize)) editObj = getattr(self, "%sEdit" % type) resistEditSizer.Add(editObj, 0, wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL, 5) resistEditSizer.Add( wx.StaticText(self, wx.ID_ANY, u"%", wx.DefaultPosition, wx.DefaultSize, 0), 0, wx.BOTTOM | wx.TOP | wx.ALIGN_CENTER_VERTICAL, 5) editObj.Bind(wx.EVT_TEXT, self.ValuesUpdated) # Color we use to reset invalid value color self.colorReset = wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT) contentSizer.Add(resistEditSizer, 1, wx.EXPAND | wx.ALL, 5) self.slfooter = wx.StaticLine(self) contentSizer.Add(self.slfooter, 0, wx.EXPAND | wx.TOP, 5) footerSizer = wx.BoxSizer(wx.HORIZONTAL) perSizer = wx.BoxSizer(wx.VERTICAL) self.stNotice = wx.StaticText(self, wx.ID_ANY, u"") self.stNotice.Wrap(-1) perSizer.Add(self.stNotice, 0, wx.BOTTOM | wx.TOP | wx.LEFT, 5) footerSizer.Add(perSizer, 1, wx.ALIGN_CENTER_VERTICAL, 5) self.totSizer = wx.BoxSizer(wx.VERTICAL) contentSizer.Add(footerSizer, 0, wx.EXPAND, 5) mainSizer.Add(contentSizer, 1, wx.EXPAND, 0) if "wxGTK" in wx.PlatformInfo: self.closeBtn = wx.Button(self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.closeBtn, 0, wx.ALL | wx.ALIGN_RIGHT, 5) self.closeBtn.Bind(wx.EVT_BUTTON, self.closeEvent) self.SetSizer(mainSizer) importExport = (("Import", wx.ART_FILE_OPEN, "from"), ("Export", wx.ART_FILE_SAVE_AS, "to")) for name, art, direction in importExport: bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) btn = wx.BitmapButton(self, wx.ID_ANY, bitmap) btn.SetMinSize(btn.GetSize()) btn.SetMaxSize(btn.GetSize()) btn.Layout() setattr(self, name, btn) btn.Enable(True) btn.SetToolTipString("%s patterns %s clipboard" % (name, direction)) footerSizer.Add(btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT) btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Patterns".format(name.lower()))) if not self.entityEditor.checkEntitiesExist(): self.Destroy() return self.Layout() bsize = self.GetBestSize() self.SetSize((-1, bsize.height)) self.CenterOnParent() self.Bind(wx.EVT_CHOICE, self.patternChanged) self.patternChanged() self.ShowModal()
def __init__(self, parent, style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE | wx.FRAME_FLOAT_ON_PARENT): global graphFrame_enabled global mplImported global mpl_version self.legendFix = False if not graphFrame_enabled: pyfalog.warning( "Matplotlib is not enabled. Skipping initialization.") return try: cache_dir = mpl._get_cachedir() except: cache_dir = os.path.expanduser(os.path.join("~", ".matplotlib")) cache_file = os.path.join(cache_dir, 'fontList.cache') if os.access(cache_dir, os.W_OK | os.X_OK) and os.path.isfile(cache_file): # remove matplotlib font cache, see #234 os.remove(cache_file) if not mplImported: mpl.use('wxagg') graphFrame_enabled = True if int(mpl.__version__[0]) < 1: print("pyfa: Found matplotlib version ", mpl.__version__, " - activating OVER9000 workarounds") print("pyfa: Recommended minimum matplotlib version is 1.0.0") self.legendFix = True mplImported = True wx.Frame.__init__(self, parent, title=u"pyfa: Graph Generator", style=style, size=(520, 390)) i = wx.IconFromBitmap(BitmapLoader.getBitmap("graphs_small", "gui")) self.SetIcon(i) self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.CreateStatusBar() self.mainSizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.mainSizer) sFit = Fit.getInstance() fit = sFit.getFit(self.mainFrame.getActiveFit()) self.fits = [fit] if fit is not None else [] self.fitList = FitList(self) self.fitList.SetMinSize((270, -1)) self.fitList.fitList.update(self.fits) self.graphSelection = wx.Choice(self, wx.ID_ANY, style=0) self.mainSizer.Add(self.graphSelection, 0, wx.EXPAND) self.figure = Figure(figsize=(4, 3)) rgbtuple = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE).Get() clr = [c / 255. for c in rgbtuple] self.figure.set_facecolor(clr) self.figure.set_edgecolor(clr) self.canvas = Canvas(self, -1, self.figure) self.canvas.SetBackgroundColour(wx.Colour(*rgbtuple)) self.subplot = self.figure.add_subplot(111) self.subplot.grid(True) self.mainSizer.Add(self.canvas, 1, wx.EXPAND) self.mainSizer.Add( wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.EXPAND) self.gridPanel = wx.Panel(self) self.mainSizer.Add(self.gridPanel, 0, wx.EXPAND) dummyBox = wx.BoxSizer(wx.VERTICAL) self.gridPanel.SetSizer(dummyBox) self.gridSizer = wx.FlexGridSizer(0, 4) self.gridSizer.AddGrowableCol(1) dummyBox.Add(self.gridSizer, 0, wx.EXPAND) for view in Graph.views: view = view() self.graphSelection.Append(view.name, view) self.graphSelection.SetSelection(0) self.fields = {} self.select(0) self.sl1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) self.mainSizer.Add(self.sl1, 0, wx.EXPAND) self.mainSizer.Add(self.fitList, 0, wx.EXPAND) self.fitList.fitList.Bind(wx.EVT_LEFT_DCLICK, self.removeItem) self.mainFrame.Bind(GE.FIT_CHANGED, self.draw) self.Bind(wx.EVT_CLOSE, self.close) self.Fit() self.SetMinSize(self.GetSize())
def __init__(self, title): self.title = title wx.Frame.__init__(self, None, wx.ID_ANY, self.title) MainFrame.__instance = self #Load stored settings (width/height/maximized..) self.LoadMainFrameAttribs() #Fix for msw (have the frame background color match panel color if 'wxMSW' in wx.PlatformInfo: self.SetBackgroundColour( wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)) #Load and set the icon for pyfa main window i = wx.IconFromBitmap(BitmapLoader.getBitmap("pyfa", "gui")) self.SetIcon(i) #Create the layout and windows mainSizer = wx.BoxSizer(wx.HORIZONTAL) self.browser_fitting_split = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE) self.fitting_additions_split = wx.SplitterWindow( self.browser_fitting_split, style=wx.SP_LIVE_UPDATE) mainSizer.Add(self.browser_fitting_split, 1, wx.EXPAND | wx.LEFT, 2) self.fitMultiSwitch = MultiSwitch(self.fitting_additions_split) self.additionsPane = AdditionsPane(self.fitting_additions_split) self.notebookBrowsers = gui.chromeTabs.PFNotebook( self.browser_fitting_split, False) marketImg = BitmapLoader.getImage("market_small", "gui") shipBrowserImg = BitmapLoader.getImage("ship_small", "gui") self.marketBrowser = MarketBrowser(self.notebookBrowsers) self.notebookBrowsers.AddPage(self.marketBrowser, "Market", tabImage=marketImg, showClose=False) self.marketBrowser.splitter.SetSashPosition(self.marketHeight) self.shipBrowser = ShipBrowser(self.notebookBrowsers) self.notebookBrowsers.AddPage(self.shipBrowser, "Ships", tabImage=shipBrowserImg, showClose=False) #======================================================================= # DISABLED FOR RC2 RELEASE #self.fleetBrowser = FleetBrowser(self.notebookBrowsers) #self.notebookBrowsers.AddPage(self.fleetBrowser, "Fleets", showClose = False) #======================================================================= self.notebookBrowsers.SetSelection(1) self.browser_fitting_split.SplitVertically( self.notebookBrowsers, self.fitting_additions_split) self.browser_fitting_split.SetMinimumPaneSize(204) self.browser_fitting_split.SetSashPosition(self.browserWidth) self.fitting_additions_split.SplitHorizontally(self.fitMultiSwitch, self.additionsPane, -200) self.fitting_additions_split.SetMinimumPaneSize(200) self.fitting_additions_split.SetSashPosition(self.fittingHeight) self.fitting_additions_split.SetSashGravity(1.0) cstatsSizer = wx.BoxSizer(wx.VERTICAL) self.charSelection = CharacterSelection(self) cstatsSizer.Add(self.charSelection, 0, wx.EXPAND) self.statsPane = StatsPane(self) cstatsSizer.Add(self.statsPane, 0, wx.EXPAND) mainSizer.Add(cstatsSizer, 0, wx.EXPAND) self.SetSizer(mainSizer) #Add menu self.addPageId = wx.NewId() self.closePageId = wx.NewId() self.widgetInspectMenuID = wx.NewId() self.SetMenuBar(MainMenuBar()) self.registerMenu() #Internal vars to keep track of other windows (graphing/stats) self.graphFrame = None self.statsWnds = [] self.activeStatsWnd = None self.Bind(wx.EVT_CLOSE, self.OnClose) #Show ourselves self.Show() self.LoadPreviousOpenFits() #Check for updates self.sUpdate = service.Update.getInstance() self.sUpdate.CheckUpdate(self.ShowUpdateBox) if not 'wxMac' in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): self.Bind(GE.EVT_SSO_LOGIN, self.onSSOLogin) self.Bind(GE.EVT_SSO_LOGOUT, self.onSSOLogout) self.titleTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.updateTitle, self.titleTimer)
def populatePanel(self, contentPanel, headerPanel): contentSizer = contentPanel.GetSizer() parent = self.panel = contentPanel self.headerPanel = headerPanel panel = "full" sizerCapacitor = wx.GridSizer(1, 2) contentSizer.Add(sizerCapacitor, 0, wx.EXPAND, 0) # Capacitor capacity and time baseBox = wx.BoxSizer(wx.HORIZONTAL) sizerCapacitor.Add(baseBox, 0, wx.ALIGN_LEFT) bitmap = BitmapLoader.getStaticBitmap("capacitorInfo_big", parent, "gui") tooltip = wx.ToolTip("Capacitor stability") bitmap.SetToolTip(tooltip) baseBox.Add(bitmap, 0, wx.ALIGN_CENTER) box = wx.BoxSizer(wx.VERTICAL) baseBox.Add(box, 0, wx.ALIGN_LEFT) hbox = wx.BoxSizer(wx.HORIZONTAL) box.Add(hbox, 0, wx.ALIGN_LEFT) hbox.Add(wx.StaticText(parent, wx.ID_ANY, "Total: "), 0, wx.ALIGN_LEFT | wx.LEFT, 3) lbl = wx.StaticText(parent, wx.ID_ANY, "0.0") setattr(self, "label%sCapacitorCapacity" % panel.capitalize(), lbl) hbox.Add(lbl, 0, wx.ALIGN_LEFT) hbox.Add(wx.StaticText(parent, wx.ID_ANY, " GJ"), 0, wx.ALIGN_LEFT) hbox = wx.BoxSizer(wx.HORIZONTAL) box.Add(hbox, 0, wx.ALIGN_LEFT) lbl = wx.StaticText(parent, wx.ID_ANY, "Lasts ") hbox.Add(lbl, 0, wx.ALIGN_LEFT | wx.LEFT, 3) setattr(self, "label%sCapacitorState" % panel.capitalize(), lbl) lbl = wx.StaticText(parent, wx.ID_ANY, "0s") setattr(self, "label%sCapacitorTime" % panel.capitalize(), lbl) hbox.Add(lbl, 0, wx.ALIGN_LEFT) # Capacitor balance baseBox = wx.BoxSizer(wx.HORIZONTAL) sizerCapacitor.Add(baseBox, 0, wx.ALIGN_CENTER_HORIZONTAL) tooltip = wx.ToolTip("Capacitor throughput") bitmap = BitmapLoader.getStaticBitmap("capacitorRecharge_big", parent, "gui") bitmap.SetToolTip(tooltip) baseBox.Add(bitmap, 0, wx.ALIGN_CENTER) # Recharge chargeSizer = wx.FlexGridSizer(2, 3) baseBox.Add(chargeSizer, 0, wx.ALIGN_CENTER) chargeSizer.Add(wx.StaticText(parent, wx.ID_ANY, "+ "), 0, wx.ALIGN_CENTER) lbl = wx.StaticText(parent, wx.ID_ANY, "0.0") setattr(self, "label%sCapacitorRecharge" % panel.capitalize(), lbl) chargeSizer.Add(lbl, 0, wx.ALIGN_CENTER) chargeSizer.Add(wx.StaticText(parent, wx.ID_ANY, " GJ/s"), 0, wx.ALIGN_CENTER) # Discharge chargeSizer.Add(wx.StaticText(parent, wx.ID_ANY, "- "), 0, wx.ALIGN_CENTER) lbl = wx.StaticText(parent, wx.ID_ANY, "0.0") setattr(self, "label%sCapacitorDischarge" % panel.capitalize(), lbl) chargeSizer.Add(lbl, 0, wx.ALIGN_CENTER) chargeSizer.Add(wx.StaticText(parent, wx.ID_ANY, " GJ/s"), 0, wx.ALIGN_CENTER)
def getImage(self): return BitmapLoader.getBitmap("settings_stats", "gui")
def __init__(self): self.characterEditorId = wx.NewId() self.damagePatternEditorId = wx.NewId() self.targetResistsEditorId = wx.NewId() self.implantSetEditorId = wx.NewId() self.graphFrameId = wx.NewId() self.backupFitsId = wx.NewId() self.exportSkillsNeededId = wx.NewId() self.importCharacterId = wx.NewId() self.exportHtmlId = wx.NewId() self.wikiId = wx.NewId() self.forumId = wx.NewId() self.saveCharId = wx.NewId() self.saveCharAsId = wx.NewId() self.revertCharId = wx.NewId() self.eveFittingsId = wx.NewId() self.exportToEveId = wx.NewId() self.ssoLoginId = wx.NewId() self.attrEditorId = wx.NewId() self.toggleOverridesId = wx.NewId() self.importDatabaseDefaultsId = wx.NewId() if 'wxMac' in wx.PlatformInfo and wx.VERSION >= (3,0): wx.ID_COPY = wx.NewId() wx.ID_PASTE = wx.NewId() self.mainFrame = gui.mainFrame.MainFrame.getInstance() wx.MenuBar.__init__(self) # File menu fileMenu = wx.Menu() self.Append(fileMenu, "&File") fileMenu.Append(self.mainFrame.addPageId, "&New Tab\tCTRL+T", "Open a new fitting tab") fileMenu.Append(self.mainFrame.closePageId, "&Close Tab\tCTRL+W", "Close the current fit") fileMenu.AppendSeparator() fileMenu.Append(self.backupFitsId, "&Backup All Fittings", "Backup all fittings to a XML file") fileMenu.Append(wx.ID_OPEN, "&Import Fittings\tCTRL+O", "Import fittings into pyfa") fileMenu.Append(wx.ID_SAVEAS, "&Export Fitting\tCTRL+S", "Export fitting to another format") fileMenu.AppendSeparator() fileMenu.Append(self.exportHtmlId, "Export HTML", "Export fits to HTML file (set in Preferences)") fileMenu.Append(self.exportSkillsNeededId, "Export &Skills Needed", "Export skills needed for this fitting") fileMenu.Append(self.importCharacterId, "Import C&haracter File", "Import characters into pyfa from file") fileMenu.AppendSeparator() fileMenu.Append(wx.ID_EXIT) # Edit menu editMenu = wx.Menu() self.Append(editMenu, "&Edit") #editMenu.Append(wx.ID_UNDO) #editMenu.Append(wx.ID_REDO) editMenu.Append(wx.ID_COPY, "To Clipboard\tCTRL+C", "Export a fit to the clipboard") editMenu.Append(wx.ID_PASTE, "From Clipboard\tCTRL+V", "Import a fit from the clipboard") editMenu.AppendSeparator() editMenu.Append(self.saveCharId, "Save Character") editMenu.Append(self.saveCharAsId, "Save Character As...") editMenu.Append(self.revertCharId, "Revert Character") # Character menu windowMenu = wx.Menu() self.Append(windowMenu, "&Window") charEditItem = wx.MenuItem(windowMenu, self.characterEditorId, "&Character Editor\tCTRL+E") charEditItem.SetBitmap(BitmapLoader.getBitmap("character_small", "gui")) windowMenu.AppendItem(charEditItem) damagePatternEditItem = wx.MenuItem(windowMenu, self.damagePatternEditorId, "Damage Pattern Editor\tCTRL+D") damagePatternEditItem.SetBitmap(BitmapLoader.getBitmap("damagePattern_small", "gui")) windowMenu.AppendItem(damagePatternEditItem) targetResistsEditItem = wx.MenuItem(windowMenu, self.targetResistsEditorId, "Target Resists Editor\tCTRL+R") targetResistsEditItem.SetBitmap(BitmapLoader.getBitmap("explosive_small", "gui")) windowMenu.AppendItem(targetResistsEditItem) implantSetEditItem = wx.MenuItem(windowMenu, self.implantSetEditorId, "Implant Set Editor\tCTRL+I") implantSetEditItem.SetBitmap(BitmapLoader.getBitmap("hardwire_small", "gui")) windowMenu.AppendItem(implantSetEditItem) graphFrameItem = wx.MenuItem(windowMenu, self.graphFrameId, "Graphs\tCTRL+G") graphFrameItem.SetBitmap(BitmapLoader.getBitmap("graphs_small", "gui")) windowMenu.AppendItem(graphFrameItem) preferencesShortCut = "CTRL+," if 'wxMac' in wx.PlatformInfo else "CTRL+P" preferencesItem = wx.MenuItem(windowMenu, wx.ID_PREFERENCES, "Preferences\t"+preferencesShortCut) preferencesItem.SetBitmap(BitmapLoader.getBitmap("preferences_small", "gui")) windowMenu.AppendItem(preferencesItem) if not 'wxMac' in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3,0)): self.sCrest = service.Crest.getInstance() # CREST Menu crestMenu = wx.Menu() self.Append(crestMenu, "&CREST") if self.sCrest.settings.get('mode') != CrestModes.IMPLICIT: crestMenu.Append(self.ssoLoginId, "Manage Characters") else: crestMenu.Append(self.ssoLoginId, "Login to EVE") crestMenu.Append(self.eveFittingsId, "Browse EVE Fittings") crestMenu.Append(self.exportToEveId, "Export To EVE") if self.sCrest.settings.get('mode') == CrestModes.IMPLICIT or len(self.sCrest.getCrestCharacters()) == 0: self.Enable(self.eveFittingsId, False) self.Enable(self.exportToEveId, False) if not gui.mainFrame.disableOverrideEditor: windowMenu.AppendSeparator() attrItem = wx.MenuItem(windowMenu, self.attrEditorId, "Attribute Overrides\tCTRL+B") attrItem.SetBitmap(BitmapLoader.getBitmap("fit_rename_small", "gui")) windowMenu.AppendItem(attrItem) windowMenu.Append(self.toggleOverridesId, "Turn Overrides On") # Help menu helpMenu = wx.Menu() self.Append(helpMenu, "&Help") helpMenu.Append(self.wikiId, "Wiki", "Go to wiki on GitHub") helpMenu.Append(self.forumId, "Forums", "Go to EVE Online Forum thread") helpMenu.AppendSeparator() helpMenu.Append(self.importDatabaseDefaultsId, "Import D&atabase Defaults", "Imports missing database defaults") helpMenu.AppendSeparator() helpMenu.Append(wx.ID_ABOUT) if config.debug: helpMenu.Append( self.mainFrame.widgetInspectMenuID, "Open Widgets Inspect tool", "Open Widgets Inspect tool") self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged)
def getControlPanel(self, parent, onFieldChanged): self.fields.clear() panel = wx.Panel(parent) sizer = wx.GridBagSizer(vgap=3, hgap=3) panel.SetSizer(sizer) # attacker vector self.fields["attackerVector"] = vector = VectorPicker( panel, style=wx.NO_BORDER, size=60, offset=90, label="Atk", labelpos=2) vector.Bind(VectorPicker.EVT_VECTOR_CHANGED, onFieldChanged) sizer.Add(vector, pos=(0, 1), span=(3, 1), flag=wx.SHAPED | wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) # target vector self.fields["targetVector"] = vector = VectorPicker(panel, style=wx.NO_BORDER, size=60, offset=-90, label="Tgt", labelpos=3) vector.Bind(VectorPicker.EVT_VECTOR_CHANGED, onFieldChanged) sizer.Add(vector, pos=(0, 2), span=(3, 1), flag=wx.SHAPED | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) """ # behavior icon = wx.StaticBitmap(panel, bitmap=BitmapLoader.getBitmap("22_13", "icons")) sizer.Add(icon, pos=(1,7), flag=wx.ALIGN_CENTER) label = wx.StaticText(panel, label="Behavior: ") sizer.Add(label, pos=(1,8), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) self.fields["behavior"] = choice = wx.Choice(panel) choice.Append("Target Vector", "vector") choice.Append("Target Profile AI", "ai") choice.SetSelection(0) choice.Bind(wx.EVT_CHOICE, onFieldChanged) sizer.Add(choice, pos=(1,9), flag=wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) """ # resists icon = wx.StaticBitmap(panel, bitmap=BitmapLoader.getBitmap("22_19", "icons")) sizer.Add(icon, pos=(1, 3), flag=wx.ALIGN_CENTER) label = wx.StaticText(panel, label="Resistances: ") sizer.Add(label, pos=(1, 4), flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) self.fields["resists"] = choice = wx.Choice(panel) choice.Append("Weighted Average", "ehp") choice.Append("Shield", "shield") choice.Append("Armor", "armor") choice.Append("Hull", "hull") choice.Append("None", "") choice.SetSelection(0) choice.Bind(wx.EVT_CHOICE, onFieldChanged) sizer.Add(choice, pos=(1, 5), flag=wx.EXPAND | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL) # spacers sizer.Add(wx.StaticText(panel, label=""), pos=(1, 0), flag=wx.EXPAND) sizer.Add(wx.StaticText(panel, label=""), pos=(1, 6), flag=wx.EXPAND) sizer.AddGrowableRow(0, proportion=1) sizer.AddGrowableRow(2, proportion=1) sizer.AddGrowableCol(0, proportion=1) sizer.AddGrowableCol(6, proportion=1) return panel
def populatePanel(self, contentPanel, headerPanel): contentSizer = contentPanel.GetSizer() parent = self.panel = contentPanel self.headerPanel = headerPanel panel = "full" sizerMiningYield = wx.FlexGridSizer(1, 4) sizerMiningYield.AddGrowableCol(1) contentSizer.Add(sizerMiningYield, 0, wx.EXPAND, 0) counter = 0 for miningType, image in (("miner", "mining"), ("drone", "drones")): baseBox = wx.BoxSizer(wx.HORIZONTAL) sizerMiningYield.Add( baseBox, 1, wx.ALIGN_LEFT if counter == 0 else wx.ALIGN_CENTER_HORIZONTAL) baseBox.Add( BitmapLoader.getStaticBitmap("%s_big" % image, parent, "gui"), 0, wx.ALIGN_CENTER) box = wx.BoxSizer(wx.VERTICAL) baseBox.Add(box, 0, wx.ALIGN_CENTER) box.Add(wx.StaticText(parent, wx.ID_ANY, miningType.capitalize()), 0, wx.ALIGN_LEFT) hbox = wx.BoxSizer(wx.HORIZONTAL) box.Add(hbox, 1, wx.ALIGN_CENTER) lbl = wx.StaticText(parent, wx.ID_ANY, u"0.0 m\u00B3/s") setattr( self, "label%sminingyield%s" % (panel.capitalize(), miningType.capitalize()), lbl) hbox.Add(lbl, 0, wx.ALIGN_CENTER) self._cachedValues.append(0) counter += 1 targetSizer = sizerMiningYield baseBox = wx.BoxSizer(wx.HORIZONTAL) targetSizer.Add(baseBox, 0, wx.ALIGN_LEFT) baseBox.Add( BitmapLoader.getStaticBitmap("cargoBay_big", parent, "gui"), 0, wx.ALIGN_CENTER) box = wx.BoxSizer(wx.VERTICAL) baseBox.Add(box, 0, wx.EXPAND) box.Add(wx.StaticText(parent, wx.ID_ANY, "Total"), 0, wx.ALIGN_LEFT) hbox = wx.BoxSizer(wx.HORIZONTAL) box.Add(hbox, 1, wx.EXPAND) lbl = wx.StaticText(parent, wx.ID_ANY, u"0.0 m\u00B3/s") setattr(self, "label%sminingyieldTotal" % panel.capitalize(), lbl) hbox.Add(lbl, 0, wx.ALIGN_LEFT) self._cachedValues.append(0) image = BitmapLoader.getBitmap("turret_small", "gui") firepower = wx.BitmapButton(contentPanel, -1, image) firepower.SetToolTip(wx.ToolTip("Click to toggle to Firepower View")) firepower.Bind(wx.EVT_BUTTON, self.switchToFirepowerView) sizerMiningYield.Add(firepower, 0, wx.ALIGN_LEFT) self._cachedValues.append(0)
def getImage(self): return BitmapLoader.getBitmap("prefs_update", "gui")
def __init__(self, parent, fleetID, fleetName, fleetCount, id=wx.ID_ANY, pos=wx.DefaultPosition, size=(0, 40), style=0): SFItem.SFBrowserItem.__init__(self, parent, size=size) self.fleetBrowser = self.Parent self.fleetID = fleetID self.fleetName = fleetName self.fleetCount = fleetCount self.padding = 4 self.fontBig = wx.FontFromPixelSize((0, 15), wx.SWISS, wx.NORMAL, wx.BOLD, False) self.fontNormal = wx.FontFromPixelSize((0, 14), wx.SWISS, wx.NORMAL, wx.NORMAL, False) self.fontSmall = wx.FontFromPixelSize((0, 12), wx.SWISS, wx.NORMAL, wx.NORMAL, False) self.copyBmp = BitmapLoader.getBitmap("fit_add_small", "gui") self.renameBmp = BitmapLoader.getBitmap("fit_rename_small", "gui") self.deleteBmp = BitmapLoader.getBitmap("fit_delete_small", "gui") self.acceptBmp = BitmapLoader.getBitmap("faccept_small", "gui") self.fleetBmp = BitmapLoader.getBitmap("fleet_item_big", "gui") fleetImg = self.fleetBmp.ConvertToImage() fleetImg = fleetImg.Blur(2) if not fleetImg.HasAlpha(): fleetImg.InitAlpha() fleetImg = fleetImg.AdjustChannels(1, 1, 1, 0.5) self.fleetEffBmp = wx.BitmapFromImage(fleetImg) self.toolbar.AddButton(self.copyBmp, "Copy", self.CopyFleetCB) self.renameBtn = self.toolbar.AddButton(self.renameBmp, "Rename", self.RenameFleetCB) self.toolbar.AddButton(self.deleteBmp, "Delete", self.DeleteFleetCB) self.editWidth = 150 self.tcFleetName = wx.TextCtrl(self, wx.ID_ANY, "%s" % self.fleetName, wx.DefaultPosition, (self.editWidth, -1), wx.TE_PROCESS_ENTER) if self.fleetBrowser.fleetIDMustEditName != self.fleetID: self.tcFleetName.Show(False) else: self.tcFleetName.SetFocus() self.tcFleetName.SelectAll() self.fleetBrowser.fleetIDMustEditName = -1 self.renameBtn.SetBitmap(self.acceptBmp) self.selected = True self.tcFleetName.Bind(wx.EVT_KILL_FOCUS, self.OnEditLostFocus) self.tcFleetName.Bind(wx.EVT_TEXT_ENTER, self.RenameFleet) self.tcFleetName.Bind(wx.EVT_KEY_DOWN, self.EditCheckEsc) self.animCount = 0
def getImage(self): return BitmapLoader.getBitmap("prefs_html", "gui")
def __init__( self, parent , forceLayout = -1): wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.TAB_TRAVERSAL ) self._toggle = 1 self.parent = parent self.forceLayout = forceLayout self.bkColour = self.GetBackgroundColour() # Create the main sizer of this panel self.mainSizer = wx.BoxSizer( wx.VERTICAL ) self.SetSizer( self.mainSizer ) parentSize = parent.GetMinSize() # Create the header panel self.headerPanel = wx.Panel(self) self.mainSizer.Add(self.headerPanel,0,wx.EXPAND | wx.TOP|wx.BOTTOM|wx.RIGHT, 1) # Load expanded/collapsed bitmaps from the icons folder self.bmpExpanded = BitmapLoader.getBitmap("down-arrow2","gui") self.bmpCollapsed = BitmapLoader.getBitmap("up-arrow2","gui") # Make the bitmaps have the same color as window text sysTextColour = wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) img = self.bmpExpanded.ConvertToImage() img.Replace(0, 0, 0, sysTextColour[0], sysTextColour[1], sysTextColour[2]) self.bmpExpanded = wx.BitmapFromImage(img) img = self.bmpCollapsed.ConvertToImage() img.Replace(0, 0, 0, sysTextColour[0], sysTextColour[1], sysTextColour[2]) self.bmpCollapsed = wx.BitmapFromImage(img) self.headerBmp = wx.StaticBitmap(self.headerPanel ) self.headerBmp.SetBitmap( self.bmpExpanded) # Create the header sizer and add static bitmap and static text controls to it headerSizer = wx.BoxSizer( wx.HORIZONTAL ) self.headerPanel.SetSizer( headerSizer) hbmpSizer = wx.BoxSizer( wx.HORIZONTAL ) hlblSizer = wx.BoxSizer( wx.HORIZONTAL ) self.hcntSizer = wx.BoxSizer( wx.HORIZONTAL) hbmpSizer.Add( self.headerBmp, 0,0, 5 ) self.headerLabel = wx.StaticText( self.headerPanel, wx.ID_ANY, u"PYFA", wx.DefaultPosition, wx.DefaultSize, 0 ) hlblSizer.Add( self.headerLabel, 0, wx.EXPAND , 5 ) headerSizer.Add( hbmpSizer, 0, wx.RIGHT, 5 ) headerSizer.Add( hlblSizer, 0, wx.RIGHT, 5 ) headerSizer.Add( self.hcntSizer, 0, wx.RIGHT, 5) # Set the static text font weight to BOLD headerFont=parent.GetFont() headerFont.SetWeight(wx.BOLD) self.headerLabel.SetFont(headerFont) # Create the content panel and its main sizer self.contentSizer = wx.BoxSizer( wx.VERTICAL ) self.contentPanel = wx.Panel(self) self.contentPanel.SetSizer(self.contentSizer) self.mainSizer.Add( self.contentPanel, 0, wx.EXPAND | wx.RIGHT | wx.LEFT , 5) self.Layout() # Connect Events self.headerLabel.Bind( wx.EVT_LEFT_UP, self.toggleContent ) self.headerBmp.Bind( wx.EVT_LEFT_UP, self.toggleContent ) self.headerPanel.Bind( wx.EVT_LEFT_UP, self.toggleContent )
def buildAttributeView(self, root): # We first build a usable dictionary of items. The key is either a fit # if the afflictions stem from a projected fit, or self.stuff if they # are local afflictions (everything else, even gang boosts at this time) # The value of this is yet another dictionary in the following format: # # "attribute name": { # "Module Name": [ # class of affliction, # affliction item (required due to GH issue #335) # modifier type # amount of modification # whether this affliction was projected # ] # } attributes = self.stuff.itemModifiedAttributes if self.item == self.stuff.item else self.stuff.chargeModifiedAttributes container = {} for attrName in attributes.iterAfflictions(): # if value is 0 or there has been no change from original to modified, return if attributes[attrName] == (attributes.getOriginal(attrName) or 0): continue for fit, afflictors in attributes.getAfflictions(attrName).iteritems(): for afflictor, modifier, amount, used in afflictors: if not used or afflictor.item is None: continue if fit.ID != self.activeFit: # affliction fit does not match our fit if fit not in container: container[fit] = {} items = container[fit] else: # local afflictions if self.stuff not in container: container[self.stuff] = {} items = container[self.stuff] # items hold our module: info mappings if attrName not in items: items[attrName] = [] if afflictor == self.stuff and getattr(afflictor, 'charge', None): # we are showing a charges modifications, see #335 item = afflictor.charge else: item = afflictor.item items[attrName].append((type(afflictor), afflictor, item, modifier, amount, getattr(afflictor, "projected", False))) # Make sure projected fits are on top rootOrder = container.keys() rootOrder.sort(key=lambda x: self.ORDER.index(type(x))) # Now, we take our created dictionary and start adding stuff to our tree for thing in rootOrder: # This block simply directs which parent we are adding to (root or projected fit) if thing == self.stuff: parent = root else: # projected fit icon = self.imageList.Add(BitmapLoader.getBitmap("ship_small", "gui")) child = self.affectedBy.AppendItem(root, "{} ({})".format(thing.name, thing.ship.item.name), icon) parent = child attributes = container[thing] attrOrder = sorted(attributes.keys(), key=self.sortAttrDisplayName) for attrName in attrOrder: attrInfo = self.stuff.item.attributes.get(attrName) displayName = attrInfo.displayName if attrInfo and attrInfo.displayName != "" else attrName if attrInfo: if attrInfo.icon is not None: iconFile = attrInfo.icon.iconFile icon = BitmapLoader.getBitmap(iconFile, "icons") if icon is None: icon = BitmapLoader.getBitmap("transparent16x16", "gui") attrIcon = self.imageList.Add(icon) else: attrIcon = self.imageList.Add(BitmapLoader.getBitmap("7_15", "icons")) else: attrIcon = self.imageList.Add(BitmapLoader.getBitmap("7_15", "icons")) if self.showRealNames: display = attrName saved = displayName else: display = displayName saved = attrName # this is the attribute node child = self.affectedBy.AppendItem(parent, display, attrIcon) self.affectedBy.SetPyData(child, saved) self.treeItems.append(child) items = attributes[attrName] items.sort(key=lambda x: self.ORDER.index(x[0])) for itemInfo in items: afflictorType, afflictor, item, attrModifier, attrAmount, projected = itemInfo if afflictorType == Ship: itemIcon = self.imageList.Add(BitmapLoader.getBitmap("ship_small", "gui")) elif item.icon: bitmap = BitmapLoader.getBitmap(item.icon.iconFile, "icons") itemIcon = self.imageList.Add(bitmap) if bitmap else -1 else: itemIcon = -1 displayStr = item.name if projected: displayStr += " (projected)" if attrModifier == "s*": attrModifier = "*" penalized = "(penalized)" else: penalized = "" # this is the Module node, the attribute will be attached to this display = "%s %s %.2f %s" % (displayStr, attrModifier, attrAmount, penalized) treeItem = self.affectedBy.AppendItem(child, display, itemIcon) self.affectedBy.SetPyData(treeItem, afflictor)
def __init__(self, parent): wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.TAB_TRAVERSAL) self.charEditor = self.Parent.Parent # first parent is Notebook, second is Character Editor self.SetBackgroundColour( wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) pmainSizer = wx.BoxSizer(wx.VERTICAL) hSizer = wx.BoxSizer(wx.HORIZONTAL) self.clonesChoice = wx.Choice(self, wx.ID_ANY, style=0) i = self.clonesChoice.Append("Omega Clone", None) self.clonesChoice.SetSelection(i) hSizer.Add(self.clonesChoice, 5, wx.ALL | wx.EXPAND, 5) self.searchInput = PlaceholderTextCtrl(self, wx.ID_ANY, placeholder="Search...") hSizer.Add(self.searchInput, 1, wx.ALL | wx.EXPAND, 5) self.searchInput.Bind(wx.EVT_TEXT, self.delaySearch) sChar = Character.getInstance() self.alphaClones = sChar.getAlphaCloneList() char = self.charEditor.entityEditor.getActiveEntity() for clone in self.alphaClones: i = self.clonesChoice.Append(clone.alphaCloneName, clone.ID) if clone.ID == char.alphaCloneID: self.clonesChoice.SetSelection(i) self.clonesChoice.Bind(wx.EVT_CHOICE, self.cloneChanged) self.clonesChoice.SetToolTip( wx.ToolTip( "Setting an Alpha clone does not replace the character's skills, but rather caps them to Alpha levels." )) pmainSizer.Add(hSizer, 0, wx.EXPAND | wx.ALL, 5) # Set up timer for skill search self.searchTimer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.populateSkillTreeSkillSearch, self.searchTimer) tree = self.skillTreeListCtrl = wx.gizmos.TreeListCtrl( self, wx.ID_ANY, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT) pmainSizer.Add(tree, 1, wx.EXPAND | wx.ALL, 5) self.imageList = wx.ImageList(16, 16) tree.SetImageList(self.imageList) self.skillBookImageId = self.imageList.Add( BitmapLoader.getBitmap("skill_small", "gui")) tree.AddColumn("Skill") tree.AddColumn("Level") tree.SetMainColumn(0) self.root = tree.AddRoot("Skills") tree.SetItemText(self.root, "Levels", 1) tree.SetColumnWidth(0, 500) self.btnSecStatus = wx.Button( self, wx.ID_ANY, "Sec Status: {0:.2f}".format(char.secStatus or 0.0)) self.btnSecStatus.Bind(wx.EVT_BUTTON, self.onSecStatus) self.populateSkillTree() tree.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.expandLookup) tree.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.scheduleMenu) bSizerButtons = wx.BoxSizer(wx.HORIZONTAL) bSizerButtons.Add(self.btnSecStatus, 0, wx.ALL, 5) bSizerButtons.AddSpacer((0, 0), 1, wx.EXPAND, 5) importExport = (("Import", wx.ART_FILE_OPEN, "from"), ("Export", wx.ART_FILE_SAVE_AS, "to")) for name, art, direction in importExport: bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON) btn = wx.BitmapButton(self, wx.ID_ANY, bitmap) btn.SetMinSize(btn.GetSize()) btn.SetMaxSize(btn.GetSize()) btn.Layout() setattr(self, "{}Btn".format(name.lower()), btn) btn.Enable(True) btn.SetToolTipString("%s skills %s clipboard" % (name, direction)) bSizerButtons.Add( btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT | wx.ALL, 5) btn.Bind(wx.EVT_BUTTON, getattr(self, "{}Skills".format(name.lower()))) pmainSizer.Add(bSizerButtons, 0, wx.EXPAND, 5) # bind the Character selection event self.charEditor.entityEditor.Bind(wx.EVT_CHOICE, self.charChanged) self.charEditor.Bind(GE.CHAR_LIST_UPDATED, self.populateSkillTree) srcContext = "skillItem" itemContext = "Skill" context = (srcContext, itemContext) self.statsMenu = ContextMenu.getMenu(None, context) self.levelChangeMenu = ContextMenu.getMenu(None, context) or wx.Menu() self.levelChangeMenu.AppendSeparator() self.levelIds = {} idUnlearned = wx.NewId() self.levelIds[idUnlearned] = "Not learned" self.levelChangeMenu.Append(idUnlearned, "Unlearn") for level in xrange(6): id = wx.NewId() self.levelIds[id] = level self.levelChangeMenu.Append(id, "Level %d" % level) self.levelChangeMenu.AppendSeparator() self.revertID = wx.NewId() self.levelChangeMenu.Append(self.revertID, "Revert") self.saveID = wx.NewId() self.levelChangeMenu.Append(self.saveID, "Save") self.levelChangeMenu.Bind(wx.EVT_MENU, self.changeLevel) self.SetSizer(pmainSizer) self.Layout()
def __init__(self, victim, fullContext=None, pos=wx.DefaultPosition, size=wx.DefaultSize, maximized=False): wx.Dialog.__init__(self, gui.mainFrame.MainFrame.getInstance(), wx.ID_ANY, title="Item stats", pos=pos, size=size, style=wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU) empty = getattr(victim, "isEmpty", False) if empty: self.Hide() self.Destroy() return srcContext = fullContext[0] try: itmContext = fullContext[1] except IndexError: itmContext = None item = getattr(victim, "item", None) if srcContext.lower() not in ( "projectedcharge", "fittingcharge") else getattr(victim, "charge", None) if item is None: sMkt = service.Market.getInstance() item = sMkt.getItem(victim.ID) victim = None self.context = itmContext if item.icon is not None: before, sep, after = item.icon.iconFile.rpartition("_") iconFile = "%s%s%s" % (before, sep, "0%s" % after if len(after) < 2 else after) itemImg = BitmapLoader.getBitmap(iconFile, "icons") if itemImg is not None: self.SetIcon(wx.IconFromBitmap(itemImg)) self.SetTitle( "%s: %s%s" % ("%s Stats" % itmContext if itmContext is not None else "Stats", item.name, " (%d)" % item.ID if config.debug else "")) self.SetMinSize((300, 200)) if "wxGTK" in wx.PlatformInfo: # GTK has huge tab widgets, give it a bit more room self.SetSize((530, 300)) else: self.SetSize((500, 300)) #self.SetMaxSize((500, -1)) self.mainSizer = wx.BoxSizer(wx.VERTICAL) self.container = ItemStatsContainer(self, victim, item, itmContext) self.mainSizer.Add(self.container, 1, wx.EXPAND) if "wxGTK" in wx.PlatformInfo: self.closeBtn = wx.Button(self, wx.ID_ANY, u"Close", wx.DefaultPosition, wx.DefaultSize, 0) self.mainSizer.Add(self.closeBtn, 0, wx.ALL | wx.ALIGN_RIGHT, 5) self.closeBtn.Bind(wx.EVT_BUTTON, self.closeEvent) self.SetSizer(self.mainSizer) self.parentWnd = gui.mainFrame.MainFrame.getInstance() dlgsize = self.GetSize() psize = self.parentWnd.GetSize() ppos = self.parentWnd.GetPosition() ItemStatsDialog.counter += 1 self.dlgOrder = ItemStatsDialog.counter counter = ItemStatsDialog.counter dlgStep = 30 if counter * dlgStep > ppos.x + psize.width - dlgsize.x or counter * dlgStep > ppos.y + psize.height - dlgsize.y: ItemStatsDialog.counter = 1 dlgx = ppos.x + counter * dlgStep dlgy = ppos.y + counter * dlgStep if pos == wx.DefaultPosition: self.SetPosition((dlgx, dlgy)) else: self.SetPosition(pos) if maximized: self.Maximize(True) else: if size != wx.DefaultSize: self.SetSize(size) self.parentWnd.RegisterStatsWindow(self) self.Show() self.Bind(wx.EVT_CLOSE, self.closeEvent) self.Bind(wx.EVT_ACTIVATE, self.OnActivate)