X-Git-Url: http://www.iramuteq.org/git?a=blobdiff_plain;f=iramuteq.py;h=042ee0ef41a7f542c23ce994eb94b0538e6965e1;hb=refs%2Fheads%2F3.0;hp=fad74eaffe8c88218150d385499cbce44662bd33;hpb=978a043350587e050b2eae263bcadbff716854d9;p=iramuteq diff --git a/iramuteq.py b/iramuteq.py index fad74ea..042ee0e 100755 --- a/iramuteq.py +++ b/iramuteq.py @@ -56,6 +56,7 @@ from tabfrequence import Frequences, FreqMultiple from tableau import Tableau from tabrsimple import InputText from tabsimi import DoSimi +from tabcatego import Categorisation from tabsplitvar import SplitMatrixFromVar from tabverges import Prototypical from textaslexico import Lexico @@ -93,6 +94,7 @@ ID_CHECKCORPUS = wx.Window.NewControlId() ID_Tabcontent = wx.Window.NewControlId() ID_AFCM = wx.Window.NewControlId() ID_SIMI = wx.Window.NewControlId() +ID_CATE = wx.Window.NewControlId() ID_CloseTab = wx.Window.NewControlId() ID_SaveTab = wx.Window.NewControlId() ID_CreateText = wx.Window.NewControlId() @@ -217,7 +219,8 @@ images_analyses = { 'preferences' : 'preferences.png', 'exportmetatable' : 'exportmetatable.png', 'importdmi' : 'twitter.png', - 'labbe' : 'spec.png' + 'labbe' : 'spec.png', + 'categorisation' : 'spec.png', } @@ -235,7 +238,10 @@ class IraFrame(wx.Frame): wx.CLIP_CHILDREN): log.info('Starting Iramuteq... ' ) log.info('version : %s' % ConfigGlob.get('DEFAULT', 'version')) + print(size) wx.Frame.__init__(self, parent, id, title, pos, size, style) + #Font + self.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) # configuration self.AppliPath = AppliPath self.images_path = os.path.join(AppliPath,'images') @@ -351,6 +357,7 @@ class IraFrame(wx.Frame): [ID_SIMI, _("Similarities Analysis"), 'simimatrix'], [ID_proto, _("Prototypical Analysis"), 'proto'], [ID_Splitfromvar, _("Split from variable"), 'subcorpusmeta'], + [ID_CATE, _("ElCaTeGoRiZatoR"), 'categorisation'], ] for analyse in matanalyses : if not isinstance(analyse, dict) : @@ -426,7 +433,7 @@ class IraFrame(wx.Frame): # min size for the frame itself isn't completely done. # see the end up FrameManager::Update() for the test # code. For now, just hard code a frame minimum size - self.SetMinSize(wx.Size(400, 400)) + self.SetMinSize(wx.Size(800, 600)) #-------------------------------------------------------------------- # barre d'outils : le menu de petits icones en haut de la fenetre @@ -488,10 +495,10 @@ class IraFrame(wx.Frame): #------------------------------------------------------------------------------------------------ # fichier d'historique de Iramuteq #------------------------------------------------------------------------------------------------ - #if not os.path.exists(os.path.join(UserConfigPath, 'history.db')) : - # with open(os.path.join(UserConfigPath, 'history.db'), 'w') as f : - # f.write('') - self.history = History(os.path.join(UserConfigPath, 'historyIramuteq')) + if not os.path.exists(os.path.join(UserConfigPath, 'history.db')) : + with open(os.path.join(UserConfigPath, 'history.db'), 'w') as f : + f.write('{}') + self.history = History(os.path.join(UserConfigPath, 'history.db')) # l'extension ".db" est ajoutée automatiquement par le module #------------------------------------------------------------------------------------------------ @@ -504,7 +511,7 @@ class IraFrame(wx.Frame): Name("lefttree"). Caption(_("Historic")). Left(). - MinSize(wx.Size(200,500)). + MinSize(wx.Size(300,400)). Layer(1). Position(1). CloseButton(False). @@ -578,7 +585,7 @@ class IraFrame(wx.Frame): self._mgr.GetPane("lefttree").Show() self._mgr.GetPane("classif_tb").Hide() # utilisé nulle part ailleurs que sur cette ligne ??? # "commit" all changes made to FrameManager - self._mgr.Update() + #self._mgr.Update() # Attache les événements aux éléments d'interface self.Bind(wx.EVT_MENU, self.OnAcceuil, id=ID_ACCEUIL) @@ -602,6 +609,7 @@ class IraFrame(wx.Frame): self.Bind(wx.EVT_MENU, self.OnAFCM, id=ID_AFCM) self.Bind(wx.EVT_MENU, self.OnProto, id=ID_proto) self.Bind(wx.EVT_MENU, self.OnSplitVar, id = ID_Splitfromvar) + self.Bind(wx.EVT_MENU, self.OnCategorisation, id = ID_CATE) #self.Bind(wx.EVT_MENU, self.OnRCode, id=ID_RCODE) #??? #self.Bind(wx.EVT_MENU, self.OnSplitVar, id=ID_SPLITVAR) #??? #self.Bind(wx.EVT_MENU, self.OnCheckcorpus, id = ID_CHECKCORPUS) #??? @@ -637,7 +645,7 @@ class IraFrame(wx.Frame): self._mgr.SetAGWFlags(self._mgr.GetAGWFlags() ^ (aui.AUI_MGR_RECTANGLE_HINT | aui.AUI_MGR_ALLOW_FLOATING)) self._mgr.GetArtProvider().SetMetric(aui.AUI_DOCKART_GRADIENT_TYPE, aui.AUI_GRADIENT_HORIZONTAL) self.GetDockArt().SetColor(aui.AUI_DOCKART_ACTIVE_CAPTION_GRADIENT_COLOUR, "#00FFF9") - self.DoUpdate() + #self.DoUpdate() self._icon = wx.Icon(os.path.join(ImagePath, "iraicone.ico"), wx.BITMAP_TYPE_ICO) self.SetIcon(self._icon) @@ -700,10 +708,14 @@ class IraFrame(wx.Frame): BestRPath = False if not CheckRPath(self.PathPath) : if sys.platform == 'win32': - if os.path.exists(self.AppliPath + '\\R\\R') : + if os.path.exists(self.AppliPath + '\\R\\R\\x64\\R.exe') : BestRPath = self.AppliPath + '\\R\\R\\bin\\x64\\R.exe' + elif os.path.exists(self.AppliPath + '\\R\\R\\i386\\R.exe') : + BestRPath = self.AppliPath + '\\R\\R\\bin\\i386\\R.exe' else : BestRPath = FindRPAthWin32() + elif os.path.exists(self.AppliPath + '/R/R') : + BestRPath = self.AppliPath + '/R/R' else: BestRPath = FindRPathNix() if BestRPath: @@ -740,10 +752,11 @@ class IraFrame(wx.Frame): # vu comme elle est écrite, impossible de gérer # l'affichage/masquage des toolbars en fonction du contexte def ShowMenu(self, menu, Show=True): - print("showmenu") if menu == 'text' : menu_pos = 4 if Show : + if self._mgr.GetPane('tb_text').IsShown() : + return self._mgr.GetPane('tb_text').Show() self._mgr.GetPane('tb_mat').Hide() self.mb.EnableTop(menu_pos, Show) @@ -753,6 +766,8 @@ class IraFrame(wx.Frame): elif menu == 'matrix' : menu_pos = 3 if Show : + if self._mgr.GetPane('tb_mat').IsShown(): + return self._mgr.GetPane('tb_mat').Show() self._mgr.GetPane('tb_text').Hide() self.mb.EnableTop(menu_pos, Show) @@ -767,6 +782,7 @@ class IraFrame(wx.Frame): #self.mb.EnableTop(menu_pos, Show) self.mb.Refresh() self._mgr.Update() + self.Refresh() #-------------------------------------------------------------------- # fin de __init__ du wx.Frame @@ -914,22 +930,13 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis.""" # action ou évènement ? def OnPageChanged(self, event) : - print("OnPageChange") new = event.GetSelection() nobject = event.GetEventObject() parent = nobject.GetParent() if isinstance(parent, IraFrame) : npage = self.nb.GetPage(new) if 'parametres' in dir(npage) : - #self.tree.GiveFocus(uuid=npage.parametres['uuid']) - if npage.parametres.get('matrix', False) : - #self.ShowMenu('text', False) - self.ShowMenu('matrix', True) - elif npage.parametres.get('corpus', False) : - self.ShowMenu('text') - #self.ShowMenu('matrix', False) - wx.CallAfter(self.nb.SendSizeEvent) - self.Refresh() + self.tree.GiveFocus(uuid=npage.parametres['uuid']) # action ou évènement ? def OnCloseTab(self, evt): @@ -966,6 +973,7 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis.""" # action ou évènement ? def ShowAPane(self, panel): + print('ShowAPane') for pane in self._mgr.GetAllPanes() : if not pane.IsToolbar() and pane.name != 'lefttree': pane.Hide() @@ -1022,6 +1030,10 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis.""" def OnSimiTab(self, event, matrix = None): self.analyse_matrix(DoSimi, matrix = matrix, analyse_type = 'simimatrix', dlgnb = 5) + def OnCategorisation(self, event, matrix = None) : + self.analyse_matrix(Categorisation, matrix = matrix, analyse_type = 'categorisation', dlgnb = 1) + + def OnCHDReinert(self, event, matrix = None): #if matrix is None : # matrix = self.tree.getmatrix()