indices_simi = [u'cooccurrence' ,'pourcentage de cooccurrence',u'Russel',u'Jaccard', 'Kulczynski1', 'Kulczynski2', 'Mountford', 'Fager', 'simple matching', 'Hamman', 'Faith', 'Tanimoto', 'Dice', 'Phi', 'Stiles', 'Michael', 'Mozley', 'Yule', 'Yule2', 'Ochiai', 'Simpson', 'Braun-Blanquet','Chi-squared', 'Phi-squared', 'Tschuprow', 'Cramer', 'Pearson', 'binomial']
+
+def open_folder(folder):
+ if sys.platform == "win32":
+ os.startfile(folder)
+ else:
+ opener ="open" if sys.platform == "darwin" else "xdg-open"
+ call([opener, folder])
+
def normpath_win32(path) :
if not sys.platform == 'win32' :
return path
while '\\\\' in path :
path = path.replace('\\\\', '\\')
- if sys.platform == 'win32' and path.startswith('\\') and not path.startswith('\\\\') :
+ if path.startswith('\\') and not path.startswith('\\\\') :
path = '\\' + path
return path
def __getitem__(self, key):
return self.tgen[key]
- def read(self, path):
+ def read(self, path = None):
+ if path is None :
+ path = self.path
with codecs.open(path, 'r', self.encoding) as f :
tgen = f.read()
tgen = [line.split('\t') for line in tgen.splitlines()]
def rmtab(self, analyse) :
del self.opened[analyse['uuid']]
+
+ def update(self, analyse) :
+ if 'matrix_name' in analyse :
+ self.matrixanalyse[analyse['uuid']].update(analyse)
+ elif 'corpus_name' in analyse :
+ self.corpus[analyse['uuid']].update(analyse)
+ elif 'corpus' in analyse :
+ self.analyses[analyse['uuid']].update(analyse)
+ else :
+ toupdate = [an for an in self.matrixanalyse[analyse['matrix']]['analyses'] if an['uuid'] == analyse['uuid']]
+ toupdate[0].update(analyse)
+ self.write()
+ self.read()
def clean(self) :
corpustodel = [corpus for corpus in self.history if not os.path.exists(corpus['ira'])]
class BugDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: MyDialog.__init__
- kwds["style"] = wx.DEFAULT_DIALOG_STYLE
+ kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.STAY_ON_TOP
kwds["size"] = wx.Size(500, 200)
wx.Dialog.__init__(self, *args, **kwds)
self.SetTitle(kwds['title'])
return [i, int(line[0]), int(line[1]), float(line[2]), float(line[3]), line[6], line[4], line[5]]
def ReadProfileAsDico(File, Alceste=False, encoding = sys.getdefaultencoding()):
- #print 'lecture des profils : ReadProfileAsDico'
- #if Alceste :
- # print 'lecture du dictionnaire de type'
- # dictlem = {}
- # for line in parent.corpus.lem_type_list :
- # dictlem[line[0]] = line[1]
dictlem = {}
print 'lecture des profiles'
- #encoding = sys.getdefaultencoding()
FileReader = codecs.open(File, 'r', encoding)
Filecontent = FileReader.readlines()
FileReader.close()
return '\n\n'.join(proflist)
def formatExceptionInfo(maxTBlevel=5):
- cla, exc, trbk = sys.exc_info()
- try :
- excName = cla.__name__
- except :
- excName = 'None'
- try:
- excArgs = exc.args[0]
- except :
- excArgs = "<no args>"
- excTb = traceback.format_tb(trbk, maxTBlevel)
- return (excName, excArgs, excTb)
+ cla, exc, trbk = sys.exc_info()
+ try :
+ excName = cla.__name__
+ except :
+ excName = 'None'
+ try:
+ excArgs = exc.args[0]
+ except :
+ excArgs = "<no args>"
+ excTb = traceback.format_tb(trbk, maxTBlevel)
+ return (excName, excArgs, excTb)
#fonction des etudiants de l'iut
def progressbar(self, maxi) :
- if 'parent' in dir(self) :
- parent = self.parent
- else :
- parent = self
+ ira = wx.GetApp().GetTopWindow()
+ parent = ira
try :
- print '###horrible hack progressbar'
maxi = int(maxi)
except :
maxi = 1
- return wx.ProgressDialog("Traitements",
+ prog = wx.ProgressDialog("Traitements",
"Veuillez patienter...",
maximum=maxi,
parent=parent,
style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_ELAPSED_TIME | wx.PD_CAN_ABORT
)
-
+ prog.SetSize((400,150))
+ prog.SetIcon(ira._icon)
+ return prog
def treat_var_mod(variables) :
var_mod = {}