X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=dialog.py;h=d9185387530a9b046bef8efb1d9670eca1642d73;hp=da4eed747c7c8672db6d4517ca3db43c7ed65680;hb=12b4b71c8c8feb6154abc04dfa9bb93a521ef789;hpb=25061ca972d5be7a8ef3aa42276accc3761a3364 diff --git a/dialog.py b/dialog.py index da4eed7..d918538 100755 --- a/dialog.py +++ b/dialog.py @@ -576,6 +576,8 @@ class PrefGraph(wx.Dialog): else : choix=[u'2D' ,u'3D'] self.choicetype = wx.Choice(self, -1, (100,50), choices=choix) + self.label_format = wx.StaticText(self, -1, u"Format de l'image") + self.choix_format = wx.Choice(self, -1, (100,50), choices = ['png', 'svg']) self.label_1 = wx.StaticText(self, -1, u'Largeur') self.spin1 = wx.SpinCtrl(self, -1, '',size = (100,30), min=100, max=5000) self.label_2 = wx.StaticText(self, -1, u'Hauteur') @@ -602,7 +604,7 @@ par le chi2 de liaison aux classes""" self.label_6 = wx.StaticText(self, -1, u'Eliminer les recouvrements') self.check3 = wx.CheckBox(self, -1) txt = u"""Taille du texte proportionnel -à la masse de la forme""" +à l'effectif de la forme""" self.label_7 = wx.StaticText(self, -1, txt) self.check4 = wx.CheckBox(self, -1) self.label_min = wx.StaticText(self, -1, 'min') @@ -660,6 +662,7 @@ au chi2 d'association de la forme""" self.film.Enable(False) self.spin_f3.Enable(False) self.slider_sphere.Enable(False) + self.choix_format.SetSelection(self.paramgraph['svg']) self.choice1.SetSelection(self.paramgraph['what']) self.choice2.SetSelection(self.paramgraph['qui']) self.spin_chi.SetValue(self.paramgraph['select_nb']) @@ -721,6 +724,11 @@ au chi2 d'association de la forme""" fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) + fsizer.Add(self.label_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5) + fsizer.Add(self.choix_format, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5) + fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) + fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) + fsizer.Add(self.label_what, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5) fsizer.Add(self.choice1, 0, wx.ALL | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 5) fsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) @@ -896,7 +904,7 @@ au chi2 d'association de la forme""" self.slider_sphere.Enable(False) def OnPass(self,evt) : - if evt.GetString() != u'actives' : + if evt.GetString() == u'classes' : self.check4.SetValue(False) self.check4.Enable(False) self.OnNorm(wx.EVT_CHECKBOX) @@ -2329,7 +2337,7 @@ class CorpusPref ( wx.Dialog ): fgSizer4.Add( self.check_charact, 0, wx.ALL, 5 ) self.txt_charact = wx.TextCtrl( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) - self.txt_charact.SetMinSize( wx.Size( 200,-1 ) ) + self.txt_charact.SetMinSize( wx.Size( 400,-1 ) ) fgSizer4.Add( self.txt_charact, 0, wx.ALL|wx.EXPAND, 5 ) @@ -2449,7 +2457,7 @@ class CorpusPref ( wx.Dialog ): class message(wx.Dialog): def __init__(self, parent, title, size, save = True): wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE ) - self.save = save + self.save = save self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) self.html = "" @@ -2498,3 +2506,145 @@ class message(wx.Dialog): def OnCloseWindow(self, event): self.Destroy() + +class ExtractDialog ( wx.Dialog ): + + def __init__( self, parent, option ): + wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE ) + + self.option = option + + self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) + + fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 ) + fgSizer1.SetFlexibleDirection( wx.BOTH ) + fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) + + self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Corpus", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText1.Wrap( -1 ) + fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 ) + + self.corpusfile = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.txt", wx.DefaultPosition, wx.Size( -1,-1 ), wx.FLP_DEFAULT_STYLE|wx.FLP_FILE_MUST_EXIST|wx.FLP_OPEN ) + self.corpusfile.SetMinSize( wx.Size( 500,-1 ) ) + + fgSizer1.Add( self.corpusfile, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 ) + + self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Encodage", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText2.Wrap( -1 ) + fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + encodageChoices = [' - '.join(encodage) for encodage in encodages] + self.encodage = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, encodageChoices, 0 ) + self.encodage.SetSelection( 0 ) + self.encodage.SetMinSize( wx.Size( 200,-1 ) ) + + fgSizer1.Add( self.encodage, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 ) + + if option == 'splitvar' : + self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Variable (avec * mais sans le _ )", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText3.Wrap( -1 ) + fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.txtvar = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) + self.txtvar.SetMinSize( wx.Size( 200,-1 ) ) + + fgSizer1.Add( self.txtvar, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 ) + + if option == 'mods' : + self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, u"Modalités (une par ligne, avec * )", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText4.Wrap( -1 ) + fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE ) + self.txtmods.SetMinSize( wx.Size( 200,150 ) ) + + fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 ) + + self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Format de l'extraction", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText5.Wrap( -1 ) + fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + extractformatChoices = [ u"Un seul fichier", u"Un fichier par modalité" ] + self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS ) + self.extractformat.SetSelection( 0 ) + fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) + + + fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 ) + + m_sdbSizer1 = wx.StdDialogButtonSizer() + self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK ) + m_sdbSizer1.AddButton( self.m_sdbSizer1OK ) + self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL ) + m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel ) + m_sdbSizer1.Realize(); + + fgSizer1.Add( m_sdbSizer1, 1, wx.EXPAND, 5 ) + + + self.SetSizer( fgSizer1 ) + self.Layout() + fgSizer1.Fit( self ) + + self.Centre( wx.BOTH ) + + def make_param(self) : + parametres = {} + le = [enc[0].lower() for enc in encodages] + parametres['filein'] = self.corpusfile.GetPath() + encodage = le[self.encodage.GetSelection()] + parametres['encodein'] = encodage + if self.option == 'splitvar' : + parametres['var'] = self.txtvar.GetValue() + if self.option == 'mods' : + parametres['mods'] = self.txtmods.GetValue().splitlines() + if self.extractformat.GetSelection() == 0 : + parametres['onefile'] = True + else : + parametres['onefile'] = False + parametres['encodeout'] = locale.getpreferredencoding() + print parametres + return parametres + + def __del__( self ): + pass + +class FreqDialog(wx.Dialog): + def __init__(self, parent, ID, listcol, title, size) : + wx.Dialog.__init__(self, parent, ID, title, size=size, pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK ) + pre = wx.PreDialog() + pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP) + pre.Create(parent, ID, title, wx.DefaultPosition, size, wx.DEFAULT_DIALOG_STYLE | wx.CANCEL | wx.OK) + self.PostCreate(pre) + self.parent = parent + sizer = wx.BoxSizer(wx.VERTICAL) + #self.content = parent.content + self.header = listcol + #LABELLIST = [] + #for i in self.header: + # forme = i + # if len(forme) > 60 : + # LABELLIST.append(i[0:60]) + # else: + # LABELLIST.append(i) + self.list_box_1 = wx.ListBox(self, -1, choices=self.header, style=wx.LB_EXTENDED | wx.LB_HSCROLL) + sizer.Add(self.list_box_1, 0, 5) + + btnsizer = wx.BoxSizer(wx.HORIZONTAL) + + btn = wx.Button(self, wx.ID_CANCEL) + btn.SetHelpText("Annuler") + btnsizer.Add(btn) + + btn = wx.Button(self, wx.ID_OK) + btn.SetHelpText("Valider") + btn.SetDefault() + btnsizer.Add(btn) + + sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL, 5) + self.SetSizer(sizer) + sizer.Fit(self) + self.SetTitle(u"Sélection") + + # end wxGlade +