X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;f=dialog.py;h=bfd17e23dbe7d01bc853b2249f8a3f1de99885ae;hb=ffec6ef119df2ab7e1b391b79ba6e8b59031325d;hp=317ca0a43f48a2d2aae7b9c20cb3208313f72efb;hpb=d43935c26ab026954e7c7bca5af6f5216f232dd8;p=iramuteq
diff --git a/dialog.py b/dialog.py
index 317ca0a..bfd17e2 100755
--- a/dialog.py
+++ b/dialog.py
@@ -15,6 +15,7 @@ from PrintRScript import barplot
import tempfile
import sys
from KeyFrame import AlcOptFrame
+import wx.lib.hyperlink as hl
#---------------------------------------------------------------------------
provider = wx.SimpleHelpProvider()
wx.HelpProvider_Set(provider)
@@ -375,7 +376,7 @@ releases at startup""").decode('utf8')
self.m_staticText46.Wrap( -1 )
fgSizer1.Add( self.m_staticText46, 0, wx.ALL, 5 )
- self.listlangues = [ u"french", u"english", u"spanish", u"portuguese", u"italian" ]
+ self.listlangues = [ u"english",u"french", u"italian", u"portuguese", u"spanish"]
self.langues = wx.Choice( self, wx.ID_ANY, (200, -1), choices = self.listlangues)
#self.langues.SetSelection( 0 )
fgSizer1.Add( self.langues, 0, wx.ALIGN_RIGHT|wx.ALL, 5 )
@@ -1880,38 +1881,38 @@ class PrefDendro ( wx.Dialog ):
self.m_staticline41 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
fgSizer1.Add( self.m_staticline41, 0, wx.EXPAND |wx.ALL, 5 )
+ if self.param['typedendro'] == 'classique' :
+ self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Color or black and white").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText5.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
- self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Color or black and white").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
- self.m_staticText5.Wrap( -1 )
- fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
-
- m_radioBox1Choices = [ _(u"color").decode('utf8'), _(u"black and white").decode('utf8') ]
- self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
- self.m_radioBox1.SetSelection( 0 )
- fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
+ m_radioBox1Choices = [ _(u"color").decode('utf8'), _(u"black and white").decode('utf8') ]
+ self.m_radioBox1 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox1Choices, 1, wx.RA_SPECIFY_COLS )
+ self.m_radioBox1.SetSelection( 0 )
+ fgSizer1.Add( self.m_radioBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
- self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
- fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
+ self.m_staticline5 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
+ fgSizer1.Add( self.m_staticline5, 0, wx.EXPAND |wx.ALL, 5 )
- self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
- fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
+ self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
+ fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
- bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
+ bSizer4 = wx.BoxSizer( wx.HORIZONTAL )
- self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Add cluster size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
- self.m_staticText6.Wrap( -1 )
- bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+ self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, _(u"Add cluster size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText6.Wrap( -1 )
+ bSizer4.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
- self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
- self.m_checkBox1.SetValue(True)
- bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+ self.m_checkBox1 = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_checkBox1.SetValue(True)
+ bSizer4.Add( self.m_checkBox1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
- fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
+ fgSizer1.Add( bSizer4, 1, wx.EXPAND, 5 )
- m_radioBox2Choices = [ _(u"circular diagram").decode('utf8'), _(u"bar").decode('utf8') ]
- self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
- self.m_radioBox2.SetSelection( 0 )
- fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
+ m_radioBox2Choices = [ _(u"circular diagram").decode('utf8'), _(u"bar").decode('utf8') ]
+ self.m_radioBox2 = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, m_radioBox2Choices, 1, wx.RA_SPECIFY_COLS )
+ self.m_radioBox2.SetSelection( 0 )
+ fgSizer1.Add( self.m_radioBox2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT|wx.ALL, 5 )
self.m_staticline7 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
fgSizer1.Add( self.m_staticline7, 0, wx.EXPAND |wx.ALL, 5 )
@@ -1941,10 +1942,11 @@ class PrefDendro ( wx.Dialog ):
self.m_spinCtrl2.SetValue(self.param['width'])
self.m_spinCtrl1.SetValue(self.param['height'])
self.m_choice1.SetSelection(self.param['type_dendro'])
- self.m_radioBox1.SetSelection(self.param['color_nb'])
- self.m_checkBox1.SetValue(self.param['taille_classe'])
- self.m_radioBox2.SetSelection(self.param['type_tclasse'])
self.choice_format.SetSelection(self.param['svg'])
+ if self.param['typedendro'] == 'classique' :
+ self.m_radioBox1.SetSelection(self.param['color_nb'])
+ self.m_checkBox1.SetValue(self.param['taille_classe'])
+ self.m_radioBox2.SetSelection(self.param['type_tclasse'])
def __del__( self ):
pass
@@ -2623,24 +2625,25 @@ class message(wx.Frame):
self.uceids = uceids
self.ira = wx.GetApp().GetTopWindow()
self.SetIcon(self.ira._icon)
- self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+ #self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
self.items = items
self.html = ""
#self.HtmlPage=wx.html.HtmlWindow(self, -1)
- self.HtmlPage = ConcordList(self, items)
+ self.panel = wx.Panel(self, wx.ID_ANY)
+ self.HtmlPage = ConcordList(self.panel, items)
#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_1 = wx.Button(self.panel, wx.ID_CANCEL)
self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1)
if self.save :
- self.button_2 = wx.Button(self, wx.ID_SAVE)
+ self.button_2 = wx.Button(self.panel, wx.ID_SAVE)
self.Bind(wx.EVT_BUTTON, self.OnSavePage, self.button_2)
if self.uceids is not None :
- self.butsub = wx.Button(self, -1, _(u"Build sub corpus").decode('utf8'))
+ self.butsub = wx.Button(self.panel, -1, _(u"Build sub corpus").decode('utf8'))
self.Bind(wx.EVT_BUTTON, self.OnSub, self.butsub)
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
self.__do_layout()
@@ -2650,15 +2653,16 @@ class message(wx.Frame):
sizer_2.Add(self.HtmlPage, 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
#m_sdbSizer1 = wx.StdDialogButtonSizer()
m_sdbSizer1 = wx.BoxSizer(wx.HORIZONTAL)
- m_sdbSizer1.Add( self.button_1 , 0, wx.RIGHT | wx.EXPAND)
+ m_sdbSizer1.Add( self.button_1 , 0, wx.ALIGN_RIGHT | wx.EXPAND)
if self.save :
- m_sdbSizer1.Add( self.button_2 , 0, wx.RIGHT | wx.EXPAND)
+ m_sdbSizer1.Add( self.button_2 , 0, wx.ALIGN_RIGHT | wx.EXPAND)
if self.uceids is not None :
- m_sdbSizer1.Add( self.butsub , 0, wx.RIGHT | wx.EXPAND)
+ m_sdbSizer1.Add( self.butsub , 0, wx.ALIGN_RIGHT | wx.EXPAND)
#m_sdbSizer1.Realize()
- sizer_2.Add(m_sdbSizer1, 0, wx.RIGHT | wx.EXPAND, 5)
- self.SetSizer(sizer_2)
- self.Layout()
+ #self.panel.SetSizer( m_sdbSizer1 )
+ sizer_2.Add( m_sdbSizer1, 0, wx.ALIGN_RIGHT, 5)
+ self.panel.SetSizer(sizer_2)
+ self.panel.Layout()
sizer_2.Fit( self )
def OnSavePage(self, evt) :
@@ -3205,46 +3209,77 @@ class BarGraphDialog ( wx.Dialog ):
self.heightsp.Enable(True)
event.Skip()
-class MessageImage(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.CLOSE_BOX|wx.DEFAULT_FRAME_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.TAB_TRAVERSAL )
+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.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
self.parametres = parametres
self.imageFile = self.parametres['tmpgraph']
if parametres['svg'] == 'TRUE' :
self.imagename = u"image.svg"
else :
self.imagename = u"image.png"
- 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.OnCloseMe, self.button_1)
- self.Bind(wx.EVT_BUTTON, self.OnSaveImage, self.button_2)
- self.do_layout()
-
- def do_layout(self):
- self.sizer_1 = wx.BoxSizer(wx.VERTICAL)
- self.sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
- self.sizer_1.Add(self.HtmlPage, 2, wx.EXPAND, 0)
-
- self.m_sdbSizer1 = wx.StdDialogButtonSizer()
- self.m_sdbSizer1.AddButton( self.button_2 )
- self.m_sdbSizer1.AddButton( self.button_1 )
- self.m_sdbSizer1.Realize()
- self.sizer_1.Add(self.m_sdbSizer1, 0, wx.EXPAND, 5)
- self.SetSizer(self.sizer_1)
+
+ 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 )
+
+ panel = wx.Panel(self, -1)
+ m_sdbSizer1 = wx.StdDialogButtonSizer()
+ self.m_sdbSizer1Save = wx.Button( panel, wx.ID_SAVE )
+ m_sdbSizer1.AddButton( self.m_sdbSizer1Save )
+ self.m_sdbSizer1Cancel = wx.Button( panel, wx.ID_CANCEL )
+ m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
+ m_sdbSizer1.Realize();
+
+ panel.SetSizer( m_sdbSizer1 )
+
+ bSizer1.Add( panel, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
self.Layout()
- self.sizer_1.Fit( self )
-
+
+ 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()
+ self.Destroy()
def OnSaveImage(self, event) :
dlg = wx.FileDialog(
@@ -3292,12 +3327,6 @@ class BarFrame :
with open(tmpscript,'w') as f :
f.write(txt)
exec_rcode(ira.RPath, tmpscript, wait = True)
- win = MessageImage(ira, parametres, _(u"Graphic").decode('utf8'), size=(700, 500))
- if svg == 'FALSE' :
- txt = "" % tmpgraph
- else :
- txt = """Copiez ce lien dans votre navigateur :
- %s""" % (tmpgraph, tmpgraph)
- win.HtmlPage.SetPage(txt)
+ win = ImageViewer(ira, parametres, _(u"Graphic").decode('utf8'), size=(700, 500))
win.Show(True)
dial.Destroy()
\ No newline at end of file