Copy functionality from fit list to target list

This commit is contained in:
DarkPhoenix
2019-06-29 11:21:54 +03:00
parent 62b7b44120
commit fc7613451e
2 changed files with 16 additions and 18 deletions

View File

@@ -26,7 +26,7 @@ import gui.globalEvents as GE
from service.fit import Fit
class FitList(gui.display.Display):
class BaseList(gui.display.Display):
DEFAULT_COLS = (
'Base Icon',
@@ -40,11 +40,6 @@ class FitList(gui.display.Display):
fitToolTip = wx.ToolTip('Drag a fit into this list to graph it')
self.SetToolTip(fitToolTip)
fit = Fit.getInstance().getFit(self.graphFrame.mainFrame.getActiveFit())
if fit is not None:
self.fits.append(fit)
self.update(self.fits)
self.contextMenu = wx.Menu()
removeItem = wx.MenuItem(self.contextMenu, 1, 'Remove Fit')
self.contextMenu.Append(removeItem)
@@ -55,7 +50,6 @@ class FitList(gui.display.Display):
self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)
self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
def kbEvent(self, event):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
@@ -125,15 +119,18 @@ class FitList(gui.display.Display):
self.graphFrame.draw()
class TargetList(gui.display.Display):
DEFAULT_COLS = (
'Base Icon',
'Base Name')
class FitList(BaseList):
def __init__(self, graphFrame, parent):
super().__init__(parent)
self.graphFrame = graphFrame
self.targetFits = []
fitToolTip = wx.ToolTip('Drag a fit into this list to graph it')
self.SetToolTip(fitToolTip)
super().__init__(graphFrame, parent)
fit = Fit.getInstance().getFit(self.graphFrame.mainFrame.getActiveFit())
if fit is not None:
self.fits.append(fit)
self.update(self.fits)
class TargetList(BaseList):
def __init__(self, graphFrame, parent):
super().__init__(graphFrame, parent)
self.update(self.fits)

View File

@@ -298,10 +298,11 @@ class GraphControlPanel(wx.Panel):
@property
def targets(self):
return self.targetList.targetFits
return self.targetList.fits
def unbindExternalEvents(self):
self.fitList.unbindExternalEvents()
self.targetList.unbindExternalEvents()
def formatLabel(self, axisDef):
if axisDef.unit is None: