X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=dialog.py;h=e21c0f6e9286adcf8a353625b84d297016986971;hp=630b60f2371f3fb8a765a50a02f895482a985ee1;hb=a215187924e98a385f5d481bbb2e9f4b8804aba3;hpb=5fe741965178c0b1728560ee8787a26ce903f142 diff --git a/dialog.py b/dialog.py index 630b60f..e21c0f6 100755 --- a/dialog.py +++ b/dialog.py @@ -84,7 +84,10 @@ class FileOptionDialog(wx.Dialog): if locale.getpreferredencoding().lower() == 'mac-roman' : enc = self.le.index('macroman') else : - enc = self.le.index(locale.getpreferredencoding().lower()) + try : + enc = self.le.index(sys.getdefaultencoding().lower()) + except ValueError: + enc = self.le.index('utf-8') self.list_encodages.SetSelection(enc) grid_sizer.Add(self.list_encodages, 1, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5) elif sheet : @@ -152,7 +155,6 @@ class ClusterNbDialog(wx.Dialog): LIST_CLASSE_OK.append(str(i)) else : LIST_CLASSE_OK.append(str(LIST_CLASSE)) - print str(LIST_CLASSE_OK) self.list_box_1 = wx.ListBox(self, -1, choices=LIST_CLASSE_OK, style=wx.LB_SINGLE | wx.LB_HSCROLL) self.list_box_1.SetHelpText("Here's some help text for field #1") box.Add(self.list_box_1, 1, wx.ALIGN_CENTRE | wx.ALL, 5) @@ -1149,7 +1151,9 @@ class StatDialog(wx.Dialog): def OnKeys(self, evt): dial = AlcOptFrame(self, self.parent.parent) dial.CenterOnParent() - val = dial.ShowModal() + dial.ShowModal() + dial.Destroy() + print 'zerazer' class LexDialog( wx.Dialog ): @@ -1686,7 +1690,6 @@ class SearchDial ( wx.Dialog ): self.search.Clear() def UnSelectList(liste) : - print liste if liste.GetFirstSelected() != -1 : last = liste.GetFirstSelected() liste.Select(liste.GetFirstSelected(), False) @@ -1696,12 +1699,13 @@ def UnSelectList(liste) : class OptLexi(wx.Dialog): - def __init__(self, *args, **kwds): + def __init__(self, parent, force_chi = False): # begin wxGlade: MyDialog.__init__ - kwds["style"] = wx.DEFAULT_DIALOG_STYLE - wx.Dialog.__init__(self, *args, **kwds) + #kwds["style"] = wx.DEFAULT_DIALOG_STYLE + wx.Dialog.__init__(self, parent, style = wx.DEFAULT_DIALOG_STYLE) self.listet = None self.variables = None + self.force_chi = force_chi #self.labellem = wx.StaticText(self, -1, u"Lemmatisation : ") #self.checklem = wx.CheckBox(self, -1) self.label_var = wx.StaticText(self, -1, u"Sélection par :") @@ -1710,10 +1714,15 @@ class OptLexi(wx.Dialog): self.list_box_1 = wx.ListBox(self, -1, choices=[], size = wx.Size( 150,200 ), style=wx.LB_EXTENDED | wx.LB_HSCROLL) self.button_2 = wx.Button(self, wx.ID_CANCEL, "") self.button_1 = wx.Button(self, wx.ID_OK, "") + if not self.force_chi : + indices = [u'loi hypergéométique', u'chi2'] + else : + indices = [u'chi2'] self.label_indice = wx.StaticText(self, -1, u"indice") - self.choice_indice = wx.Choice(self, -1, (100,50), choices = [u'loi hypergéométique', u'chi2']) - self.label = wx.StaticText(self, -1, u"effectif minimum") - self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000) + self.choice_indice = wx.Choice(self, -1, (100,50), choices = indices) + if not self.force_chi : + self.label = wx.StaticText(self, -1, u"effectif minimum") + self.spin = wx.SpinCtrl(self, -1, min = 1, max = 10000) self.Bind(wx.EVT_CHOICE, self.onselect, self.choice) self.__set_properties() self.__do_layout() @@ -1722,7 +1731,8 @@ class OptLexi(wx.Dialog): def __set_properties(self): # begin wxGlade: MyDialog.__set_properties self.SetTitle("Choix des variables") - self.spin.SetValue(10) + if not self.force_chi : + self.spin.SetValue(10) self.choice.SetSelection(0) #self.SetMinSize(wx.Size(300, 400)) # end wxGlade @@ -1742,8 +1752,9 @@ class OptLexi(wx.Dialog): sizer_3.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3) sizer_2.Add(self.label_indice, 0, wx.ALIGN_CENTER_VERTICAL, 3) sizer_2.Add(self.choice_indice, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3) - sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3) - sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3) + if not self.force_chi : + sizer_2.Add(self.label, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 3) + sizer_2.Add(self.spin, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 3) sizer_1.Add(sizer_2, 0, wx.ALIGN_CENTER_HORIZONTAL, 3) sizer_1.Add(sizer_3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_RIGHT, 3) self.SetSizer(sizer_1) @@ -2188,12 +2199,12 @@ class CorpusPref ( wx.Dialog ): def __init__( self, parent, parametres ): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Préférences", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE ) self.parent = parent - langues_n = [u'français', u'english', u'german (expérimentale)', u'italian (expérimentale)', u'swedish (exp.)', u'portuguese (exp.)', 'greek', 'other...'] + langues_n = [u'français', u'english', u'german (expérimentale)', u'italian', u'swedish (expérimentale)', u'portuguese (expérimentale)', u'greek (expériementale)', u'autre...'] self.langues = [u'french', u'english', u'german', 'italian', 'swedish', u'portuguese', 'greek', 'other'] self.encodages = [enc[0].lower() for enc in encodages] ucimark = [u'****', u'0000'] - ucemethod = [u'charactères', u'occurrences', u'paragraphe'] + ucemethod = [u'charactères', u'occurrences', u'paragraphes'] self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) @@ -2396,7 +2407,10 @@ class CorpusPref ( wx.Dialog ): if locale.getpreferredencoding().lower() == 'mac-roman' : enc = self.encodages.index('macroman') else : - enc = self.encodages.index(locale.getpreferredencoding().lower()) + try : + enc = self.encodages.index(locale.getpreferredencoding().lower()) + except ValueError : + enc = self.encodages.index('utf-8') self.encodage_choices.SetSelection(enc) self.lang_choices.SetSelection(0) self.repout_choices.SetValue(parametres['pathout']) @@ -2587,7 +2601,6 @@ class ExtractDialog ( wx.Dialog ): else : parametres['onefile'] = False parametres['encodeout'] = locale.getpreferredencoding() - print parametres return parametres def __del__( self ):