+class ProtoDial ( wx.Dialog ):
+
+ def __init__( self, parent, headers ):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
+
+ self.SetSizeHintsSz( wx.Size( -1,-1 ), wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ 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"Variables").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
+
+ self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Ranks").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText2.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
+
+ variablesChoices = headers
+ self.variables = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, variablesChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
+ self.variables.SetMinSize( wx.Size( 350,-1 ) )
+
+ fgSizer1.Add( self.variables, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
+
+ rangsChoices = headers
+ self.rangs = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, rangsChoices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
+ self.rangs.SetMinSize( wx.Size( 350,-1 ) )
+
+ fgSizer1.Add( self.rangs, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 )
+
+
+ bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL, 5 )
+
+ fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
+ fgSizer3.SetFlexibleDirection( wx.BOTH )
+ fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"Limit frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText3.Wrap( -1 )
+ fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
+
+ choix_freqChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8') ]
+ self.choix_freq = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_freqChoices, 0 )
+ self.choix_freq.SetSelection( 0 )
+ bSizer2.Add( self.choix_freq, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.freqlim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
+ self.freqlim.Enable( False )
+ self.freqlim.SetMinSize( wx.Size( 100,-1 ) )
+
+ bSizer2.Add( self.freqlim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ fgSizer3.Add( bSizer2, 1, wx.EXPAND, 5 )
+
+ self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Limit rank").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText4.Wrap( -1 )
+ fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ bSizer21 = wx.BoxSizer( wx.HORIZONTAL )
+
+ choix_rangChoices = [ _(u"automatic (mean)").decode('utf8'), _(u"manual").decode('utf8')]
+ self.choix_rang = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choix_rangChoices, 0 )
+ self.choix_rang.SetSelection( 0 )
+ bSizer21.Add( self.choix_rang, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.ranglim = wx.TextCtrl( self, wx.ID_ANY, u"0", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
+ self.ranglim.Enable( False )
+ self.ranglim.SetMinSize( wx.Size( 100,-1 ) )
+
+ bSizer21.Add( self.ranglim, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ fgSizer3.Add( bSizer21, 1, wx.EXPAND, 5 )
+
+ self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Minimum frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText5.Wrap( -1 )
+ fgSizer3.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.m_textCtrl4 = wx.TextCtrl( self, wx.ID_ANY, u"2", wx.DefaultPosition, wx.DefaultSize, wx.TE_CENTRE )
+ fgSizer3.Add( self.m_textCtrl4, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
+
+ self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Type de représentation", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText6.Wrap( -1 )
+ fgSizer3.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ m_choice3Choices = [ u"Classical - List", u"Classical - Cloud", u"Plan" ]
+ self.typegraph = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choice3Choices, 0 )
+ self.typegraph.SetSelection( 0 )
+ fgSizer3.Add( self.typegraph, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
+
+ bSizer1.Add( fgSizer3, 0, wx.ALIGN_CENTER_HORIZONTAL, 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();
+
+ bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ # Connect Events
+ self.choix_freq.Bind( wx.EVT_CHOICE, self.UpdateText )
+ self.choix_rang.Bind( wx.EVT_CHOICE, self.UpdateText )
+ self.Bind(wx.EVT_LISTBOX, self.selchange, self.variables)
+ self.Bind(wx.EVT_LISTBOX, self.selchange, self.rangs)
+
+ self.m_sdbSizer1OK.Enable(False)
+
+ def __del__( self ):
+ pass
+
+ def selchange(self, evt):
+ if (len(self.variables.GetSelections()) == 0) or (len(self.rangs.GetSelections()) == 0) or (len(self.variables.GetSelections()) != len(self.rangs.GetSelections())) :
+ self.m_sdbSizer1OK.Enable(False)
+ else :
+ self.m_sdbSizer1OK.Enable(True)
+
+
+ # Virtual event handlers, overide them in your derived class
+ def UpdateText( self, event ):
+ event.Skip()
+
+class SimpleDialog ( wx.Dialog ):
+
+ def __init__( self, parent ):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = wx.EmptyString, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
+
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ self.m_panel1 = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
+ bSizer2 = wx.BoxSizer( wx.VERTICAL )
+
+ self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Export finished. Open in a web browser :").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ bSizer2.Add( self.m_staticText1, 0, wx.ALL, 5 )
+
+ self.link = wx.HyperlinkCtrl( self.m_panel1, wx.ID_ANY, u"wxFB Website", u"http://www.wxformbuilder.org", wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE )
+ bSizer2.Add( self.link, 0, wx.ALL, 5 )
+
+
+ self.m_panel1.SetSizer( bSizer2 )
+ self.m_panel1.Layout()
+ bSizer2.Fit( self.m_panel1 )
+ bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
+
+ m_sdbSizer1 = wx.StdDialogButtonSizer()
+ self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
+ m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
+ m_sdbSizer1.Realize();
+
+ bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ def __del__( self ):
+ pass
+
+
+class SubTextFromMetaDial ( wx.Dialog ):
+
+ def __init__( self, parent, parametres ):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Subcorpus").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
+
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ 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"Name").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.subcorpusname = wx.TextCtrl( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
+ fgSizer1.Add( self.subcorpusname, 0, wx.ALL, 5 )
+
+ self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"Select one or more metadata").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText2.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ m_listBox1Choices = parametres['meta']
+ self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), m_listBox1Choices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
+ self.m_listBox1.SetMinSize( wx.Size( -1,200 ) )
+ self.m_listBox1.SetMaxSize( wx.Size( -1,500 ) )
+
+ fgSizer1.Add( self.m_listBox1, 0, wx.ALL|wx.EXPAND, 5 )
+
+
+ bSizer1.Add( fgSizer1, 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();
+
+ bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+ self.Bind(wx.EVT_LISTBOX, self.onchoose, self.m_listBox1)
+ if not parametres.get('isempty', False) :
+ self.m_sdbSizer1OK.Enable(False)
+
+ def __del__( self ):
+ pass
+
+ def onchoose(self, evt):
+ if len(self.m_listBox1.GetSelections()) > 0 :
+ self.m_sdbSizer1OK.Enable(True)
+ else :
+ self.m_sdbSizer1OK.Enable(False)
+
+class BarGraphDialog ( wx.Dialog ):
+
+ def __init__( self, parent, width, height ):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Preferences").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
+
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
+
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, _(u"Size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ bSizer2.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ sizeradioChoices = [ _(u"automatic").decode('utf8'), _(u"manual").decode('utf8') ]
+ self.sizeradio = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, sizeradioChoices, 1, wx.RA_SPECIFY_COLS )
+ self.sizeradio.SetSelection( 0 )
+ bSizer2.Add( self.sizeradio, 0, wx.ALIGN_TOP|wx.ALL, 5 )
+
+ fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
+ fgSizer1.SetFlexibleDirection( wx.BOTH )
+ fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText2.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.widthsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 0, 1000000, 600 )
+ fgSizer1.Add( self.widthsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText3.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.heightsp = wx.SpinCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 10000000, 400 )
+ fgSizer1.Add( self.heightsp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ bSizer2.Add( fgSizer1, 1, wx.EXPAND, 5 )
+
+
+ bSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
+
+ bSizer3 = wx.BoxSizer( wx.HORIZONTAL )
+
+ self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"Image format").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText4.Wrap( -1 )
+ bSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ formatChoices = [ u"png", u"svg" ]
+ self.format = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, formatChoices, 0 )
+ self.format.SetSelection( 0 )
+ bSizer3.Add( self.format, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ bSizer1.Add( bSizer3, 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();
+
+ bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ # Connect Events
+ self.sizeradio.Bind( wx.EVT_RADIOBOX, self.OnSizeRadio )
+
+ self.widthsp.SetValue(width)
+ self.heightsp.SetValue(height)
+ self.widthsp.Enable(False)
+ self.heightsp.Enable(False)
+ self.m_sdbSizer1OK.SetFocus()
+
+ def __del__( self ):
+ pass
+
+
+ # Virtual event handlers, overide them in your derived class
+ def OnSizeRadio( self, event ):
+ if self.sizeradio.GetSelection() == 0 :
+ self.widthsp.Enable(False)
+ self.heightsp.Enable(False)
+ else :
+ self.widthsp.Enable(True)
+ self.heightsp.Enable(True)
+ event.Skip()
+
+class ImageViewer ( wx.Frame ):
+
+ def __init__( self, parent, parametres, title, size ):
+ wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_FRAME_STYLE|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX|wx.STAY_ON_TOP|wx.TAB_TRAVERSAL )
+
+ self.ira = wx.GetApp().GetTopWindow()
+ self.SetIcon(self.ira._icon)
+ self.parametres = parametres
+ self.imageFile = self.parametres['tmpgraph']
+ if parametres['svg'] == 'TRUE' :
+ self.imagename = u"image.svg"
+ else :
+ self.imagename = u"image.png"
+
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ self.m_panel1 = wx.ScrolledWindow(self, -1)# wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.HSCROLL|wx.TAB_TRAVERSAL|wx.VSCROLL )
+ self.m_panel1.SetScrollbars(1, 1, 200, 300)
+ bSizer2 = wx.BoxSizer( wx.VERTICAL )
+
+ if parametres['svg'] == 'FALSE' :
+ image = wx.Image(self.imageFile, wx.BITMAP_TYPE_PNG)
+ W = image.GetWidth()
+ H = image.GetHeight()
+ if W > 1000 :
+ W = 1000
+ if H > 800 :
+ H = 800
+ image = image.ConvertToBitmap()
+ self.m_bitmap1 = wx.StaticBitmap( self.m_panel1, wx.ID_ANY, image, wx.DefaultPosition, wx.DefaultSize, 0 )
+ bSizer2.Add( self.m_bitmap1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+ else :
+ link = hl.HyperLinkCtrl(self.m_panel1, wx.ID_ANY, u"Click on this link", URL=self.imageFile )
+ bSizer2.Add( link, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.m_panel1.SetSizer( bSizer2 )
+ self.m_panel1.Layout()
+ bSizer2.Fit( self.m_panel1 )
+ bSizer1.Add( self.m_panel1, 1, wx.EXPAND |wx.ALL, 5 )
+
+
+ m_sdbSizer1 = wx.StdDialogButtonSizer()
+ self.m_sdbSizer1Save = wx.Button( self, wx.ID_SAVE )
+ m_sdbSizer1.AddButton( self.m_sdbSizer1Save )
+ self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
+ m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
+ m_sdbSizer1.Realize();
+
+ bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+
+ self.Centre( wx.BOTH )
+
+ if parametres['svg'] == 'FALSE' :
+ self.SetSize((W + 30,H + 30))
+
+ self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.m_sdbSizer1Cancel)
+ self.Bind(wx.EVT_BUTTON, self.OnSaveImage, self.m_sdbSizer1Save)
+
+ def __del__( self ):
+ pass
+
+ def OnCloseMe(self, event):
+ self.Destroy()
+
+ def OnSaveImage(self, event) :
+ dlg = wx.FileDialog(
+ self, message=_(u"Save as...").decode('utf8'), defaultDir=os.getcwd(),
+ defaultFile= self.imagename, wildcard=self.parametres['wildcard'], style=wx.SAVE | wx.OVERWRITE_PROMPT
+ )
+ dlg.SetFilterIndex(2)
+ dlg.CenterOnParent()
+ if dlg.ShowModal() == wx.ID_OK:
+ path = dlg.GetPath()
+ copyfile(self.imageFile, path)
+
+class BarFrame :
+ def __init__(self, ira, table, colnames, rownames, tree = False):
+ if not tree :
+ width = 100 + (10*len(rownames)) + (100 * len(colnames))
+ height = len(rownames) * 15
+ if height < 400 :
+ height = 400
+ else :
+ width = 500
+ height = (35 * len(colnames)) + (15 * len(rownames))
+ dial = BarGraphDialog(ira, width, height)
+ val = dial.ShowModal()
+ if val == wx.ID_OK :
+ tmpgraph = tempfile.mktemp(dir=ira.TEMPDIR)
+ if dial.format.GetSelection() == 0 :
+ svg = 'FALSE'
+ wildcard = "png|*.png"
+ else :
+ svg = 'TRUE'
+ wildcard = "svg|*.svg"
+ parametres = {'width' : dial.widthsp.GetValue(),
+ 'height': dial.heightsp.GetValue(),
+ 'colnames' : colnames,
+ 'rownames' : rownames,
+ 'tmpgraph' : tmpgraph,
+ 'rgraph' : ira.RscriptsPath['Rgraph'],
+ 'svg' : svg,
+ 'wildcard' : wildcard}
+ if tree :
+ parametres['tree'] = tree
+ txt = barplot(table, parametres)
+ tmpscript = tempfile.mktemp(dir=ira.TEMPDIR)
+ with open(tmpscript,'w') as f :
+ f.write(txt)
+ exec_rcode(ira.RPath, tmpscript, wait = True)
+ win = ImageViewer(ira, parametres, _(u"Graphic").decode('utf8'), size=(700, 500))
+ win.Show(True)
+ dial.Destroy()
\ No newline at end of file