From 415f126356e19c960e9b359c6d76095c89b5a85c Mon Sep 17 00:00:00 2001 From: cncfanatics Date: Thu, 21 Oct 2010 10:39:25 +0200 Subject: [PATCH] Add a row != -1 check to the click handler --- gui/fittingView.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/gui/fittingView.py b/gui/fittingView.py index 23004c40a..a53a96416 100644 --- a/gui/fittingView.py +++ b/gui/fittingView.py @@ -70,13 +70,14 @@ class FittingView(d.Display): self.Bind(wx.EVT_RIGHT_DOWN, self.click) def startDrag(self, event): - data = wx.PyTextDataObject() row = event.GetIndex() - data.SetText(str(self.GetItemData(row))) + if row != -1: + data = wx.PyTextDataObject() + data.SetText(str(self.GetItemData(row))) - dropSource = wx.DropSource(self) - dropSource.SetData(data) - res = dropSource.DoDragDrop() + dropSource = wx.DropSource(self) + dropSource.SetData(data) + res = dropSource.DoDragDrop() def getSelectedMods(self): @@ -226,18 +227,18 @@ class FittingView(d.Display): def click(self, event): event.Skip() row, _ = self.HitTest(event.Position) - sel = [] - curr = self.GetFirstSelected() - while curr != -1: - sel.append(curr) - curr = self.GetNextSelected(curr) - - if curr not in sel: - mods = [self.mods[self.GetItemData(row)]] - else: - mods = self.getSelectedMods() - if row != -1: + sel = [] + curr = self.GetFirstSelected() + while curr != -1: + sel.append(curr) + curr = self.GetNextSelected(curr) + + if curr not in sel: + mods = [self.mods[self.GetItemData(row)]] + else: + mods = self.getSelectedMods() + col = self.getColumn(event.Position) if col == self.getColIndex(ModuleState): sFit = service.Fit.getInstance()