def writetable(self, pathout, tgens, totocc):
etoiles = totocc.keys()
+ etoiles.sort()
with open(pathout, 'w') as f :
line = '\t'.join([u'tgens'] + etoiles) + '\n'
f.write(line.encode(self.encoding))
if val.startswith(u'X.') :
val = val.replace(u'X.', u'*')
self.etoiles.append(val)
-
self.menu = menu
#def start(self) :
self.selected = {}
i=0
- for name in [u'formes'] + self.first :
+ for name in [u'formes'] + self.etoiles :
self.InsertColumn(i,name,wx.LIST_FORMAT_LEFT)
i+=1
else :
ListEt = variables[var[dial.list_box_1.GetSelections()[0]]]
self.listet = ListEt
+ self.listet.sort()
self.parametres['mineff'] = dial.spin.GetValue()
if dial.choice_indice.GetSelection() == 0 :
self.parametres['indice'] = 'hypergeo'
def doanalyse(self):
self.tgen = TGen(path = self.parametres['tgenpath'], encoding = self.ira.syscoding)
self.tgen.read(self.tgen.path)
+ self.parametres['etoiles'].sort()
tgenocc, totocc = self.corpus.make_tgen_table(self.tgen, self.parametres['etoiles'])
self.parametres['tgeneff'] = os.path.join(self.parametres['pathout'], 'tgeneff.csv')
self.tgen.writetable(self.parametres['tgeneff'], tgenocc, totocc)
def OnTgenCompute(self, evt):
corpus = self.page.corpus
tgenpath = os.path.join(self.page.parametres['pathout'], 'tgen.csv')
- self.page.parametres['tgenpath'] = tgenpath
- tgen = TGen(path = tgenpath, encoding = self.parent.syscoding)
- self.page.parametres['etoiles'] = self.page.etoiles
- TgenSpec(self.parent, corpus, self.page.parametres)
- TgenLayout(self.page)
+ if not os.path.exists(tgenpath) :
+ message = wx.MessageDialog(self.parent, _(u"No TGen yet !"), style = wx.ICON_EXCLAMATION | wx.OK)
+ message.ShowModal()
+ message.Destroy()
+ else :
+ self.page.parametres['tgenpath'] = tgenpath
+ tgen = TGen(path = tgenpath, encoding = self.parent.syscoding)
+ self.page.parametres['etoiles'] = self.page.etoiles
+ TgenSpec(self.parent, corpus, self.page.parametres)
+ TgenLayout(self.page)
def OnExportClasses(self, event):
corpus = self.page.corpus
self._OnAdd(e)
else:
self._OnRemove(e)
-
-
-
-
-if __name__ == '__main__':
- print 'ezerzerzer'
- test = wx.App(0)
- frame = wx.Frame(None, -1)
- d = wx.Dialog(frame, style = wx.RESIZE_BORDER|wx.DEFAULT_DIALOG_STYLE)
-
- d.sizer = wx.BoxSizer(wx.VERTICAL)
- d.sizer.Add(wx.StaticText(d, -1, label = 'Example of the ItemsPicker'),
- 0, wx.ALL, 10)
- ip = ItemsPicker(d, -1, ['pop', 'cool', 'lame'],
- 'Stuff:', 'Selected stuff:',IP_SORT_SELECTED|IP_SORT_CHOICES|IP_REMOVE_FROM_CHOICES)
- ip.add_button_label = u'left -> right'
- ip.remove_button_label = u'right -> left'
- d.sizer.Add(ip, 1, wx.EXPAND, 1)
- d.SetSizer(d.sizer)
- test.SetTopWindow(frame)
- def callback(e):
- print 'selected items', e.GetItems()
- d.Bind(EVT_IP_SELECTION_CHANGED, callback)
- d.ShowModal()
- d.Destroy()
- frame.Close()
\ No newline at end of file