From 3c12716d2973bdb4cda7d49cace225d3502c1a30 Mon Sep 17 00:00:00 2001 From: Pierre Ratinaud Date: Thu, 27 Nov 2014 10:42:54 +0100 Subject: [PATCH] ... --- dialog.py | 15 ++++++++++++++- guifunct.py | 39 ++++++++++++++++----------------------- textsimi.py | 2 ++ 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/dialog.py b/dialog.py index 8de76bc..ec0c6fa 100755 --- a/dialog.py +++ b/dialog.py @@ -1739,6 +1739,7 @@ class OptLexi(wx.Dialog): self.label = wx.StaticText(self, -1, _(u"Minimum frequency").decode('utf8')) self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000, initial = 10) self.Bind(wx.EVT_CHOICE, self.onselect, self.choice) + self.Bind(wx.EVT_LISTBOX, self.onchoose, self.list_box_1) self.__set_properties() self.__do_layout() # end wxGlade @@ -1750,6 +1751,7 @@ class OptLexi(wx.Dialog): self.spin.SetValue(10) self.choice.SetSelection(0) self.choice_indice.SetSelection(0) + self.button_1.Enable(False) #self.SetMinSize(wx.Size(300, 400)) # end wxGlade @@ -1789,7 +1791,18 @@ class OptLexi(wx.Dialog): else : for et in self.listet : self.list_box_1.Append(et) - + + def onchoose(self, evt): + if self.choice.GetSelection()== 0 : + if len(self.list_box_1.GetSelections()) > 0 : + self.button_1.Enable(True) + else : + self.button_1.Enable(False) + elif self.choice.GetSelection() == 1 : + if len(self.list_box_1.GetSelections()) > 1 : + self.button_1.Enable(True) + else : + self.button_1.Enable(False) class PrefDendro ( wx.Dialog ): diff --git a/guifunct.py b/guifunct.py index 6280e94..b3b0782 100644 --- a/guifunct.py +++ b/guifunct.py @@ -728,16 +728,6 @@ class PrefSimi ( wx.Dialog ): self.__set_properties() # Connect Events - # if not self.paramsimi['first'] : - # self.check_coord.Bind( wx.EVT_CHECKBOX, self.OnKeepCoords ) - # self.choice3.Bind( wx.EVT_CHOICE, self.OnChangeType ) - # self.check2.Bind( wx.EVT_CHECKBOX, self.OnCheck2 ) - # self.checki.Bind( wx.EVT_CHECKBOX, self.OnChecki ) - # self.check_vcex.Bind( wx.EVT_CHECKBOX, self.OnCheck_vcex ) - # self.checkit.Bind( wx.EVT_CHECKBOX, self.OnCheckit ) - # self.check_s_size.Bind( wx.EVT_CHECKBOX, self.OnCheck_s_size ) - - # Connect Events if not self.paramsimi['first'] : self.check_coord.Bind( wx.EVT_CHECKBOX, self.OnKeepCoords ) self.choice3.Bind( wx.EVT_CHOICE, self.OnChangeType ) @@ -923,19 +913,22 @@ class PrepSimi : self.parametres['listet'] = self.etline else: vardial.Destroy() - last = self.dial.listcol.GetFirstSelected() - lastl = [self.dial.listcol.GetFirstSelected()] - indexes = [self.dial.listcol.getColumnText(self.dial.listcol.GetFirstSelected(),0)] - while self.dial.listcol.GetNextSelected(last) != -1: - last = self.dial.listcol.GetNextSelected(last) - lastl.append(last) - indexes.append(self.dial.listcol.getColumnText(last,0)) - column = [actives.index(val) for val in indexes] - column.sort() - with open(pathout, 'w') as f : - f.write('\n'.join([`val` for val in column])) - self.make_param() - self.dial.Destroy() + self.val = False + self.dial.Destroy() + if self.val : + last = self.dial.listcol.GetFirstSelected() + lastl = [self.dial.listcol.GetFirstSelected()] + indexes = [self.dial.listcol.getColumnText(self.dial.listcol.GetFirstSelected(),0)] + while self.dial.listcol.GetNextSelected(last) != -1: + last = self.dial.listcol.GetNextSelected(last) + lastl.append(last) + indexes.append(self.dial.listcol.getColumnText(last,0)) + column = [actives.index(val) for val in indexes] + column.sort() + with open(pathout, 'w') as f : + f.write('\n'.join([`val` for val in column])) + self.make_param() + self.dial.Destroy() else : self.dial.Destroy() diff --git a/textsimi.py b/textsimi.py index 454074d..55e2f2b 100644 --- a/textsimi.py +++ b/textsimi.py @@ -38,6 +38,8 @@ class SimiTxt(AnalyseText): continu = True self.parametres = prep.parametres self.dlg = progressbar(self.ira, 4) + else : + return False else : continu = True if continu : -- 2.7.4