From f08a66924cd770dc6165a864fcd06a77610a49ac Mon Sep 17 00:00:00 2001 From: Ryan Holmes Date: Sat, 1 Apr 2017 22:04:44 -0500 Subject: [PATCH] Re-introduce Command Fit State (#1074) Reintroduce command view state Squashes `blitzmann/command-fit-state`: * Reintroduces command view state, allowing users to toggle command fits on and off. * Remove type() function call and use __class__ instead --- gui/builtinViewColumns/state.py | 12 +++++++++--- gui/commandView.py | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gui/builtinViewColumns/state.py b/gui/builtinViewColumns/state.py index aa3f79ebe..c99ae2947 100644 --- a/gui/builtinViewColumns/state.py +++ b/gui/builtinViewColumns/state.py @@ -68,11 +68,17 @@ class State(ViewColumn): "gui") elif isinstance(stuff, Fit): fitID = self.mainFrame.getActiveFit() - projectionInfo = stuff.getProjectionInfo(fitID) - if projectionInfo is None: + # Can't use isinstance here due to being prevented from importing CommandView. + # So we do the next best thing and compare Name of class. + if self.fittingView.__class__.__name__ == "CommandView": + info = stuff.getCommandInfo(fitID) + else: + info = stuff.getProjectionInfo(fitID) + + if info is None: return -1 - if projectionInfo.active: + if info.active: return generic_active return generic_inactive elif isinstance(stuff, Implant) and stuff.character: diff --git a/gui/commandView.py b/gui/commandView.py index d295c7939..6ba38859b 100644 --- a/gui/commandView.py +++ b/gui/commandView.py @@ -57,7 +57,7 @@ class CommandViewDrop(wx.PyDropTarget): class CommandView(d.Display): - DEFAULT_COLS = ["Base Name"] + DEFAULT_COLS = ["State", "Base Name"] def __init__(self, parent): d.Display.__init__(self, parent, style=wx.LC_SINGLE_SEL | wx.BORDER_NONE)