From 35d5c49745a795770f434b4830595253f1d8d24d Mon Sep 17 00:00:00 2001 From: blitzmann Date: Mon, 15 Sep 2014 16:11:30 -0400 Subject: [PATCH] Allow us to select target resist after creating / renaming it --- gui/resistsEditor.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gui/resistsEditor.py b/gui/resistsEditor.py index 01d874725..1092e77a2 100644 --- a/gui/resistsEditor.py +++ b/gui/resistsEditor.py @@ -325,7 +325,7 @@ class ResistsEditorDlg (wx.Dialog): # rename regardless of new or rename sTR.renamePattern(p, newName) - self.updateChoices() + self.updateChoices(newName) self.headerSizer.Replace(self.namePicker, self.ccResists) self.ccResists.Show() self.namePicker.Hide() @@ -361,7 +361,7 @@ class ResistsEditorDlg (wx.Dialog): def __del__( self ): pass - def updateChoices(self): + def updateChoices(self, select=None): "Gathers list of patterns and updates choice selections" sTR = service.TargetResists.getInstance() self.choices = sTR.getTargetResistsList() @@ -370,9 +370,15 @@ class ResistsEditorDlg (wx.Dialog): self.choices.sort(key=lambda p: p.name) self.ccResists.Clear() - for choice in map(lambda p: p.name, self.choices): + for i, choice in enumerate(map(lambda p: p.name, self.choices)): self.ccResists.Append(choice) - self.ccResists.SetSelection(0) + + if select is not None and choice == select: + self.ccResists.SetSelection(i) + + if select is None: + self.ccResists.SetSelection(0) + self.patternChanged() def importPatterns(self, event):