From 33103dbee93dbe9d29cd4ee470b2c24009bc631d Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 29 Sep 2019 22:16:19 +0300 Subject: [PATCH] Add column which shows projected item range --- gui/builtinAdditionPanes/projectedView.py | 3 +- gui/builtinViewColumns/projectionRange.py | 56 +++++++++++++++++++++++ gui/viewColumn.py | 1 + 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 gui/builtinViewColumns/projectionRange.py diff --git a/gui/builtinAdditionPanes/projectedView.py b/gui/builtinAdditionPanes/projectedView.py index 0a78b182f..6cea3ea3d 100644 --- a/gui/builtinAdditionPanes/projectedView.py +++ b/gui/builtinAdditionPanes/projectedView.py @@ -74,7 +74,8 @@ class ProjectedView(d.Display): 'Ammo Icon', 'Base Icon', 'Base Name', - 'Ammo'] + 'Ammo', + 'Projection Range'] def __init__(self, parent): d.Display.__init__(self, parent, style=wx.BORDER_NONE) diff --git a/gui/builtinViewColumns/projectionRange.py b/gui/builtinViewColumns/projectionRange.py new file mode 100644 index 000000000..db7765946 --- /dev/null +++ b/gui/builtinViewColumns/projectionRange.py @@ -0,0 +1,56 @@ +# coding: utf-8 +# ============================================================================= +# Copyright (C) 2010 Diego Duclos +# +# This file is part of pyfa. +# +# pyfa is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# pyfa is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with pyfa. If not, see . +# ============================================================================= + +# noinspection PyPackageRequirements +import wx +from logbook import Logger + +import gui.mainFrame +from gui.bitmap_loader import BitmapLoader +from gui.utils.numberFormatter import formatAmount +from gui.viewColumn import ViewColumn + + +pyfalog = Logger(__name__) + + +class ProjectionRangeColumn(ViewColumn): + + name = 'Projection Range' + + def __init__(self, fittingView, params): + super().__init__(fittingView) + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + self.imageId = fittingView.imageList.GetImageIndex(1391, "icons") + self.bitmap = BitmapLoader.getBitmap(1391, "icons") + self.mask = wx.LIST_MASK_IMAGE + self.projectedView = isinstance(fittingView, gui.builtinAdditionPanes.projectedView.ProjectedView) + + def getText(self, stuff): + projRange = getattr(stuff, 'projectionRange', None) + if projRange is None: + return '' + return formatAmount(projRange, 3, 0, 3, unitName='m') + + def getToolTip(self, mod): + return 'Projection Range' + + +ProjectionRangeColumn.register() diff --git a/gui/viewColumn.py b/gui/viewColumn.py index 5fba90c35..28c39bb3d 100644 --- a/gui/viewColumn.py +++ b/gui/viewColumn.py @@ -83,6 +83,7 @@ from gui.builtinViewColumns import ( # noqa: E402, F401 maxRange, misc, price, + projectionRange, propertyDisplay, state, sideEffects,