X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=ProfList.py;h=909789776a7d8fc5633b390c8da92c98749739f6;hp=0e3fab796028cc7f4dabaee7f70cca887d103415;hb=25061ca972d5be7a8ef3aa42276accc3761a3364;hpb=655d1e1ab00740c37712f476dc89dff7965c2161 diff --git a/ProfList.py b/ProfList.py index 0e3fab7..9097897 100644 --- a/ProfList.py +++ b/ProfList.py @@ -20,7 +20,7 @@ import wx.lib.mixins.listctrl as listmix from tabsimi import DoSimi from listlex import ListForSpec from chemins import ConstructPathOut, ffr -from dialog import PrefExport, PrefUCECarac, SearchDial +from dialog import PrefExport, PrefUCECarac, SearchDial, message from tableau import Tableau from search_tools import SearchFrame import webbrowser @@ -663,14 +663,19 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col tableout = [vchistable[fchistable.index(word)] for word in words] tmpgraph = tempfile.mktemp(dir=self.Source.parent.TEMPDIR) nbcl = len(title) + nbwords = len(words) txt = barplot(tableout, words, title, self.Source.parent.RscriptsPath['Rgraph'], tmpgraph) tmpscript = tempfile.mktemp(dir=self.Source.parent.TEMPDIR) file = open(tmpscript,'w') file.write(txt) file.close() - exec_rcode(self.Source.parent.RPath, tmpscript, wait = True) - win = MessageImage(self, u"Graphique", size=(700, 500)) + w = 100 + (20 * nbwords) + (100 * nbcl) + h = 100 + (nbwords * 15) + if w > 1100 : w = 1100 + if h > 800 : h = 800 + if h < 450 : h = 450 + win = MessageImage(self, u"Graphique", size=(w, h)) win.addsaveimage(tmpgraph) txt = "" % tmpgraph win.HtmlPage.SetPage(txt) @@ -1588,93 +1593,55 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col # def OnCloseWindow(self, event): # self.Destroy() # -class message(wx.Dialog): - def __init__(self, parent, title, size): - wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE ) - - self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) - - #kwds["style"] = wx.DEFAULT_FRAME_STYLE - #wx.Frame.__init__(self, *args, **kwds) - self.html = "" - self.HtmlPage=wx.html.HtmlWindow(self, -1) - self.HtmlPage.SetMinSize( size ) - if "gtk2" in wx.PlatformInfo: - self.HtmlPage.SetStandardFonts() - self.HtmlPage.SetFonts('Courier','Courier') - - self.button_1 = wx.Button(self, wx.ID_CANCEL) - self.button_2 = wx.Button(self, wx.ID_SAVE) - - self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2) - self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1) - self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) - self.__do_layout() - - def __do_layout(self): - #sizer_1 = wx.BoxSizer(wx.VERTICAL) - sizer_2 = wx.BoxSizer(wx.VERTICAL) - sizer_2.Add(self.HtmlPage, 0, wx.EXPAND|wx.ADJUST_MINSIZE, 0) - m_sdbSizer1 = wx.StdDialogButtonSizer() - m_sdbSizer1.AddButton( self.button_1 ) - m_sdbSizer1.AddButton( self.button_2 ) - m_sdbSizer1.Realize() - #sizer_2.Add(self.button_1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) - #sizer_2.Add(self.button_2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSIZE, 0) - #sizer_1.Add(sizer_2, 1, wx.EXPAND, 0) - sizer_2.Add(m_sdbSizer1, 1, wx.EXPAND, 5) - #self.SetAutoLayout(True) - self.SetSizer(sizer_2) - self.Layout() - sizer_2.Fit( self ) - - def OnSavePage(self, evt) : - dlg = wx.FileDialog( - self, message="Enregistrer sous...", defaultDir=os.getcwd(), - defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT - ) - dlg.SetFilterIndex(2) - dlg.CenterOnParent() - if dlg.ShowModal() == wx.ID_OK: - path = dlg.GetPath() - with open(path, 'w') as f : - f.write(self.html) - - def OnCloseMe(self, event): - self.Close(True) - - def OnCloseWindow(self, event): - self.Destroy() +#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.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) +# +# self.html = "" +# self.HtmlPage=wx.html.HtmlWindow(self, -1) +# self.HtmlPage.SetMinSize( size ) +# if "gtk2" in wx.PlatformInfo: +# self.HtmlPage.SetStandardFonts() +# self.HtmlPage.SetFonts('Courier','Courier') # -#def getSmallUpArrowData(): -# return \ -#'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\ -#\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\ -#\x00\x00C\xb0\x89\ -#\xd3.\x10\xd1m\xc3\xe5*\xbc.\x80i\xc2\x17.\x8c\xa3y\x81\x01\x00\xa1\x0e\x04e\ -#?\x84B\xef\x00\x00\x00\x00IEND\xaeB`\x82" +# def OnSavePage(self, evt) : +# dlg = wx.FileDialog( +# self, message="Enregistrer sous...", defaultDir=os.getcwd(), +# defaultFile="concordancier.html", wildcard="html|*.html", style=wx.SAVE | wx.OVERWRITE_PROMPT +# ) +# dlg.SetFilterIndex(2) +# dlg.CenterOnParent() +# if dlg.ShowModal() == wx.ID_OK: +# path = dlg.GetPath() +# with open(path, 'w') as f : +# f.write(self.html) # -#def getSmallDnArrowBitmap(): -# return wx.BitmapFromImage(getSmallDnArrowImage()) +# def OnCloseMe(self, event): +# self.Close(True) # -#def getSmallDnArrowImage(): -# stream = cStringIO.StringIO(getSmallDnArrowData()) -# return wx.ImageFromStream(stream) +# def OnCloseWindow(self, event): +# self.Destroy()