no display name and no $DISPLAY environment variable
    while executing
"load /enadisk/commun/linux/local/ActiveTcl-8.6.11/lib/libtk8.6.so Tk"
    ("package ifneeded Tk 8.6.11" script)
    invoked from within
"package require Tk"
    (in namespace eval "::request" script line 1582)
    invoked from within
"namespace eval ::request $script"
    ("::try" body line 12)

OUTPUT BUFFER:

#!/usr/local/ActiveTcl/bin/wish # RReportGenerator.tcl ###################### # Version 1.0 # Yannick KRAUSE # LBGI, IGBMC, Illkirch France # 06-07/2006 # Creation d'1 rapport pdf d'analyse stat R ############################################# # 01/08/2007 -- Version 1.3.0 # Luc Moulinier # - Adapted for multi-platform usage # - Change design to conform LBGI standards # - Add WWW scenario library retrieval # - Change configuration steps ; now support all defauts output # - minor bugs fixing ############################################# # 2/11/2007 -- Version 1.3.1 # Luc Moulinier & Wolfgang Raffelsberger # - improved error-messages # - allow reading libraries form [home] ############################################# # 7/5/2008 -- Version 1.3.2 # Wolfgang Raffelsberger # - adopt to internationalization of R-2.7.x : remove tests for R messages in English # - recompile under Tcl 8.5.2 ############################################# # 29/7/2008 -- Version 1.3.3 (beta) # Wolfgang Raffelsberger # - add parameter for customizing memory limit in R under Win # - add parameter for preferred paper size # - add parameter for export comma type ? ############################################# ############################################# # Outils luc proc PlusLongEltDe l { set max -1 foreach e $l { set v [string length $e] if {$v > $max} {set max $v} } return $max } proc LesDefauts {args} { global RRGDir global RRGData global Def if {[llength $args] != 0} { foreach {Type Valeur} $args {} set Def($Type) $Valeur return } set Def(DATA_IN) "" set Def(DATA_IN2) "" set Def(ANALYSE_IN) "" set Def(DIR_OUT) [pwd] set Def(DATA_OUT) "" set Def(REPORT_OUT) "" set Def(TYPE_OUT) "pdf" set Def(SCN_DIR) [file join $RRGDir scenario] set Def(DATA_DIR) [file join $RRGDir indata] set Def(TAG_DATA_IN) "" set Def(TAG_DATA_IN2) "" set Def(TAG_DATA_OUT) "" set Def(TAG_DIR_OUT) "" set Def(TAG_PAP_FORM) "" set Def(KEEP_TEX) 0 set Def(KEEP_DATA_OUT) 0 ## new 17jul08 : set Def(R_MEMORYLIMIT) 0 set Def(PDF_PAP_FORM) "A4" set Def(CONFIG_FILE) [file join $RRGData RRG_config] set Def(HELP_FILE) [file join $RRGDir doc "RRG_help.txt"] set Def(SWEAVELIB) [file join $RRGDir lib "Sweave.sty"] set Def(BG_TEXT) "white" set Def(FG_TEXT) "black" set Def(BG_ENTRY) "white" set Def(FG_ENTRY) "black" set Def(BG_CANCEL) "#d0694b" set Def(BG_LIBRARY) "#acd8e5" set Def(BackAppliOri) "#d9d9d9" set Def(FtpHost) "ftp-igbmc.u-strasbg.fr" set Def(FtpUser) anonymous set Def(FtpPass) anonymous set Def(LibDir) "/pub/wraff/RReportGenerator/scenarios/" return } proc TotalWSize {win} { set top [winfo toplevel $win] wm geometry $top +10+10 update idletasks # Recuperation geometrie (avec decoration) # Scan de la geometrie pour extraire les champs set g [wm geometry $top] scan $g "%dx%d%d%d" w h x y set w [winfo width $top] set h [winfo height $top] # Position absolue de la fenetre set tx [winfo rootx $top] set ty [winfo rooty $top] # Epaisseur de la bordure set borderw [expr {$tx-$x}] # Hauteur de la barre de titre set titleh [expr {$ty-$y}] # On peut alors, en supposant que la bordure est la # meme a gauche, a droite et en bas, et que la barre # de titre est en haut, "deviner" les dimensions totales # du toplevel set totalwidth [expr {$w + 2*$borderw}] set totalheight [expr {$h + $titleh + $borderw}] update return [list $totalwidth $totalheight] } proc FenetreAuCentre {f} { foreach {w h} [TotalWSize $f] {} set x [expr {[winfo screenwidth $f]/2 - $w/2}] set y [expr {[winfo screenheight $f]/2 - $h/2}] wm geom [winfo toplevel $f] +$x-$y return } proc CouleurOri e { global tcl_platform global Def set col [$e cget -bg] switch $tcl_platform(platform) { "windows" {set rep [regexp {^System} $col]} "unix" {set rep [expr {$col eq $Def(BackAppliOri)}]} } return $rep } proc MesCouleurs {f} { set abg "#ffffffffd0d0" set Ll [winfo children $f] foreach e $Ll { if {[winfo children $e] != {} } {MesCouleurs $e} set type [string toupper [winfo class $e]] switch $type { "BUTTON" { if {! [CouleurOri $e]} {continue} } "NOTEBOOK" { if {! [CouleurOri $e]} {continue} } "TEXT" {continue} "LABEL" { if {! [CouleurOri $e]} {continue} } "ENTRY" { if {! [CouleurOri $e]} {continue} } "CANVAS" { if {! [CouleurOri $e]} {continue} } "COMBOBOX" { if {! [CouleurOri $e]} {continue} } "RADIOBUTTON" { $e configure -activebackground $abg } "CHECKBUTTON" { $e configure -activebackground $abg } "SCALE" { if {! [CouleurOri $e]} {continue} } } $e configure -background $abg } $f configure -background $abg return } proc ContenuDuFic {{Fic ""}} { if { $Fic == "" } {return ""} set f [open $Fic r] set Texte [read -nonewline $f] close $f return $Texte } proc LesLignesDuFic {{Fic ""}} { return [split [ContenuDuFic $Fic] "\n"] } # execution de R puis (pdf)latex avec les parametres # transmis par l'interface graphique proc EffaceLeLog {} { global LogW $LogW configure -state normal $LogW delete 1.0 end $LogW configure -state disabled return } proc AjouteAuLog {s {sep "00"}} { global LogW foreach {sepD sepF} [split $sep ""] {} set Sep "[string repeat "_" 40]\n" $LogW configure -state normal if {$sepD} {$LogW insert end $Sep} $LogW insert end $s if {$sepF} {$LogW insert end $Sep} $LogW configure -state disabled $LogW see end update idletasks return } proc exec_R {nomFicDonnees_in nomFicDonnees_in2 nomFicAnalyse \ nomDirResultat nomFicDonnees_out nomRapportResultat \ typeFicResultat garderTex garderData paperForm} { global Def set fFinal [file join $Def(DIR_OUT) $Def(REPORT_OUT)] if {[file exists $fFinal] || [file exists "$fFinal.pdf"]} { set choix [tk_dialog .chx "Beware !!" "Beware !! The file\n$fFinal\n already exists ! \nDo you want to overwrite it ?" "" 0 " Yes " " No "] if {$choix} { return } else { file delete -force $fFinal } } set Maison [pwd] set fAnalyse [file tail $nomFicAnalyse] set fIn1 [file tail $nomFicDonnees_in] set fIn2 [file tail $nomFicDonnees_in2] # elimine l'extension .pdf au cas ou l'utilisateur l'ait indiquee set nomRapportResultat [file rootname $nomRapportResultat] AjouteAuLog "Analysis of $fAnalyse on : $fIn1 $fIn2\n\n" 10 cd $Def(TMP_DIR) set nomFicRtmp tmp.R set nomFicAnalyseTmp $nomRapportResultat.Rnw file copy -force $nomFicAnalyse $nomFicAnalyseTmp # substitution des Tags d'entrees/sorties du code Rnw remplacerDansFic $nomFicAnalyseTmp $Def(TAG_DATA_IN) $nomFicDonnees_in remplacerDansFic $nomFicAnalyseTmp $Def(TAG_DIR_OUT) $nomDirResultat if {$nomFicDonnees_in2 ne ""} { remplacerDansFic $nomFicAnalyseTmp $Def(TAG_DATA_IN2) $nomFicDonnees_in2 } if {$nomFicDonnees_out ne ""} { remplacerDansFic $nomFicAnalyseTmp $Def(TAG_DATA_OUT) $nomFicDonnees_out } else { remplacerDansFic $nomFicAnalyseTmp $Def(TAG_DATA_OUT) "data_out_tmp.dat" } if {$paperForm ne ""} { remplacerDansFic $nomFicAnalyseTmp $Def(TAG_PAP_FORM) $paperForm } # add new for formating 23jul08 # synthaxe de 'remplacerDansFic' : nimFic avant apres set latexLetter_1 "\documentclass{article}" set latexLetter_2 "\documentclass\[" set latexA4_1 "\documentclass\[a4paper\]{article}" set latexA4_2 "\documentclass\[a4paper" set latexA4_3 "\documentclass\[a4paper," set latexA4_4 "\usepackage{a4wide}" set latexSup "\usepackage{Sweave}" ##need to check for additional parameters (point size, etc) if {$Def(PDF_PAP_FORM) == "A4"} { # check if (any) A4 statement is there .. if {[trouveDansFic $nomFicAnalyseTmp $latexA4_2] == 0 & [trouveDansFic $nomFicAnalyseTmp $latexLetter_1] == 1} { # A4 statement NOT found; simple replacement remplacerDansFic $nomFicAnalyseTmp $latexLetter_1 $latexA4_1 # in any case, need to add $latexA4_3 remplacerDansFic $nomFicAnalyseTmp $latexSup ${latexSup \n latexA4_4} } elseif {[trouveDansFic $nomFicAnalyseTmp $latexLetter_2] == 1} { # add'l parameters -> partial replacement remplacerDansFic $nomFicAnalyseTmp $latexLetter_2 $latexA4_3 # in any case, need to add $latexA4_3 remplacerDansFic $nomFicAnalyseTmp $latexSup [ concat $latexSup \n $latexA4_4] } } elseif {$Def(PDF_PAP_FORM) == "letter"} { # must be letter size if {[trouveDansFic $nomFicAnalyseTmp $latexA4_3] == 1} { # A4 statement+param found; remove it : remplacerDansFic $nomFicAnalyseTmp $latexA4_3 $latexLetter_2 # remove a4wide : remplacerDansFic $nomFicAnalyseTmp $latexA4_4 "" } elseif {[trouveDansFic $nomFicAnalyseTmp $latexA4_1] == 1} { # A4 statement wo param found; remove it : remplacerDansFic $nomFicAnalyseTmp $latexA4_1 $latexLetter_1 # remove a4wide : remplacerDansFic $nomFicAnalyseTmp $latexA4_4 "" } } ## end wr added # pour affichage a l'utilisateur des Fichiers crees set FicsCrees {} # creation du Fic de commandes .R pour le lancement de Sweave set FicRtmp [open $nomFicRtmp w] puts $FicRtmp "setwd(\"$Def(TMP_DIR)\")" puts $FicRtmp "Sweave(\"$nomRapportResultat.Rnw\")" close $FicRtmp # lancement de R --> creation du Fic .tex AjouteAuLog "\nExecution of R program : creating the .tex file ...\n" 11 ## changed wr (5 oct 07) : catch {exec [RExe] --vanilla -q < $nomFicRtmp} msg1 #catch {eval exec [RExe] --vanilla -q < $nomFicRtmp} msg1 ## (wr 2Nov07): still problem to find path of supl packages ... AjouteAuLog "\n$msg1" AjouteAuLog "\n" # lancement de latex --> creation du Fic .pdf (ou .dvi) # si le Fic .tex a ete genere [not any more : ET si le Fic .tex est complet (R nous renvoie le prompt a la fin) ] # CHANGED: old version (1.3.1) tested also if [regexp {You can now run LaTeX} $msg1] , but from R-2.7.x these messages may be in any language !! if {[file exists $nomRapportResultat.tex] } { # copie de la librairie Sweave.sty fournie par R # dans le Dir de l'executable (si celle-ci est absente) file copy -force $Def(SWEAVELIB) Sweave.sty if {$typeFicResultat eq "dvi"} { AjouteAuLog "\nExecution of LaTeX program : creating the .dvi file ...\n" 11 set garderTex 1 catch {eval exec [LatexExe] $nomRapportResultat.tex -output-directory $Def(TMP_DIR)} msg2 if {[file exists $nomRapportResultat.dvi]} { file rename -force $nomRapportResultat.dvi $nomDirResultat lappend FicsCrees [file join $nomDirResultat $nomRapportResultat.dvi] } else { afficherErreur "Error while executing Latex command !\n Please check for missing libraries (or libraries not installed in the original path of R), syntax errors in the scenario code $nomFicAnalyse and for the \\usepackage{Sweave} declaration." } } else { # Fic de sortie par défaut : pdf AjouteAuLog "\n" AjouteAuLog "Execution of pdfLaTeX program : creating the .pdf file ...\n" 11 catch {eval exec [PdflatexExe] $nomRapportResultat.tex -output-directory $Def(TMP_DIR)} msg2 if {[file exists $nomRapportResultat.pdf]} { file rename -force $nomRapportResultat.pdf $nomDirResultat lappend FicsCrees [file join $nomDirResultat $nomRapportResultat.pdf] } else { afficherErreur "Error while executing pdflatex command !\n Please check for missing libraries (or libraries not installed in the original path of R), syntax errors in the scenario code $nomFicAnalyse and for the \\usepackage{Sweave} declaration." } } AjouteAuLog "\n$msg2\n" if {$garderTex} { file rename -force $nomRapportResultat.tex $nomDirResultat lappend FicsCrees [file join $nomDirResultat $nomRapportResultat.tex] foreach ext {eps txt tif jpg png} { foreach f [glob -nocomplain "$nomRapportResultat-*.$ext"] { file rename -force $f $nomDirResultat set nomTmp [file tail $f] lappend FicsCrees [file join $nomDirResultat $nomTmp] } } } if {$nomFicDonnees_out ne ""} { if {[file exists $nomFicDonnees_out]} { file rename -force $nomFicDonnees_out $nomDirResultat lappend FicsCrees [file join $nomDirResultat $nomFicDonnees_out] } else { tk_dialog .dialog "Warning" "You choose to write a Supplemental Data Output File but the current Analysis Scenario \ ($nomFicAnalyse) does not generate such a file." warning 0 "OK" } } if {$FicsCrees != {}} { AjouteAuLog "\nExecution finished with $fAnalyse on $fIn1 $fIn2.\n" 01 AjouteAuLog "The following files have been created :\n\n" AjouteAuLog [join $FicsCrees "\n"] AjouteAuLog "\n" } else { AjouteAuLog "\n\n EXECUTION FAILED : NO FILE CREATED !\n" } } else { afficherErreur "Error while executing R (Sweave) : the .tex hasn't been created ! \n\ The possible causes of this error are : \n\ * The configuration might not be correct (click Help->Configuration) \n\ * R may request libraries not installed or not found in search path. All libraries should be in the library path of the original R installation. \n\ (Windows-Vista users : Install new packages by launching R as right click 'as administrator')\n\ * R or LaTeX syntax errors in the code of the Analyse Scenario file (.Rnw)\n\ * Insufficient memory on processor \n\. \n\ Check also the Session Window for additional information on the current error." } # suppression des fichiers temporaires foreach f [glob -nocomplain *] { file delete -force $f } if {[file dirname $Def(ANALYSE_IN)] eq $Def(TMP_DIR)} { set Def(ANALYSE_IN) "" } update cd $Maison return } # recupere infos du Fic entre les tags %@RRG_INFO et %@RRG_INFO_END proc recupererInfos {FicOuListe} { if {[llength $FicOuListe] == 1} { set Ll [LesLignesDuFic $FicOuListe] } else { set Ll $FicOuListe } set Linfos {} set Li [lsearch -regexp -all $Ll "%@RRG_INFO"] foreach {d f} $Li { incr d incr f -1 set Linfos [concat $Linfos [lrange $Ll $d $f]] } foreach e $Linfos { regsub "%" $e "" e lappend new $e } return [join $new "\n"] } # cherche le chemin complet du Fic en parametre # (recherche recursive) proc chercherRep {DirRacine FicAtrouver} { global ListeRep # on sait deja que le Fic est dans un Dir "bin" if {[file tail $DirRacine] == "bin"} { if {[glob -directory $DirRacine -nocomplain $FicAtrouver] != ""} { return $DirRacine } } set ListeRep "" set contenu [glob -directory $DirRacine -nocomplain *] # discrimination répertoire / Fic foreach element $contenu { if {[file isdirectory $element]} { lappend ListeRep $element } } # pour les répertoires, on les parcourt foreach rep $ListeRep { set path [chercherRep [file join $DirRacine $rep] $FicAtrouver] if {$path != ""} { return $path } } } proc FindTcl {fic {dir "."}} { set r [glob -directory $dir -nocomplain -- $fic] if {$r ne ""} { return "$r" } set Ld [glob -directory $dir -type d -nocomplain -- *] foreach dir $Ld { set r [FindTcl $fic $dir] if {$r ne ""} {return "$r"} } return "" } # recherche d'un Fic, affichage d'une erreur si non trouve proc automaticSearch {FicAtrouver} { global tcl_platform global env set chm {} switch $FicAtrouver { "R" { switch $tcl_platform(platform) { "windows" { set chm [FindTcl Rterm.exe $env(ProgramFiles)] if {[llength $chm] >= 1} { set chm [file dirname [lindex $chm 0]] set chm [file join $chm ..] set chm [file attributes [file normalize $chm] -shortname] } } "unix" { set chm [exec which R] if {$chm ne ""} { set chm [file normalize [file join [file dirname $chm] ..]] } } "macintosh" { # Je sais pas } } } "latex" { switch $tcl_platform(platform) { "windows" { set chm [FindTcl latex.exe $env(ProgramFiles)] if {[llength $chm] >= 1} { set chm [file dirname [lindex $chm 0]] set chm [file join $chm ..] set chm [file attributes [file normalize $chm] -shortname] } } "unix" { set chm [exec which latex] if {$chm ne ""} { set chm [file normalize [file join [file dirname $chm] ..]] } } "macintosh" { # Je sais pas } } } } return $chm } # remplace la chaine de caracteres "avant" par la chaine de caracteres "apres" dans le Fic texte "nomFic" proc remplacerDansFic {nomFic avant apres} { set Fic [open $nomFic "r+"] set data [read $Fic] regsub -all $avant $data $apres data close $Fic set Fic [open $nomFic "w"] puts -nonewline $Fic $data close $Fic return } # wr added 21jul08 : trouve la chaine de caracteres "aTrouver" dans le Fic texte "nomFic" donne resultat estPresent proc trouveDansFic {nomFic aTrouver} { set Fic [open $nomFic "r+"] set data [read $Fic] close $Fic if {[regexp $aTrouver $data] > 0} {return 1} else {return 0} } # ouverture d'un panel permettant la selection d'un Fic proc choisirFic {filtres Dir typeFic} { set nomFic [tk_getOpenFile \ -initialdir $Dir \ -title "Choose $typeFic" \ -filetypes $filtres] return $nomFic } # ouverture d'un panel permettant la selection d'un dossier proc choisirDir {initialRep} { set nomRep [tk_chooseDirectory \ -initialdir $initialRep \ -title "Choose a directory" \ -mustexist true] if {$nomRep eq ""} {set nomRep $initialRep} return $nomRep } # sauvegarde de la configuration proc sauverConfig {} { global Def set error 1 set FicConfig [open "$Def(CONFIG_FILE)" w] puts $FicConfig [array get Def] close $FicConfig tk_dialog .dialog "Configuration file update" "The configuration file ($Def(CONFIG_FILE)) has been updated..." warning 0 "OK" return $error } # chargement de la configuration proc chargerConfig {} { global Def ## 17jul08 : need to add (Win spec) memory.limit ? set Ll [ContenuDuFic $Def(CONFIG_FILE)] array set TDef $Ll # modif 17 jul08 : add R_MEMORYLIMIT ? PDF_PAP_FORM ? # remove values set main main GUI set Avirer [list ANALYSE_IN DATA_IN DATA_IN2 TMP_DIR REPORT_OUT DATA_OUT TYPE_OUT KEEP_TEX ] foreach e $Avirer { array unset TDef $e } LesDefauts array set Def [array get TDef] update return } # verification de l'existence du Dir proc DefinitTmpDir {} { global env global RRGData set Msg "" set ok 0 if {[info exists env(TMP)] && $env(TMP) ne ""} { set rt $env(TMP) set ftmp [file join $rt [pid]_RRG_tmp] catch {file mkdir $ftmp} Msg if {$Msg eq ""} {set ok 1} } if {! $ok && [info exists env(TEMP)] && $env(TEMP) ne ""} { set rt $env(TEMP) set ftmp [file join $rt [pid]_RRG_tmp] catch {file mkdir $ftmp} Msg if {$Msg eq ""} {set ok 1} } if {! $ok} { set rt $RRGData set ftmp [file join $rt [pid]_RRG_tmp] catch {file mkdir $ftmp} Msg if {$Msg eq ""} {set ok 1} {set ok 0} } LesDefauts TMP_DIR $ftmp return } # lancement de R (commande executee par le bouton "generate report") proc generate_cmd {} { global Def if {$Def(DATA_IN) ne "" && [file exists $Def(ANALYSE_IN)] && [file exists $Def(DIR_OUT)]} { if {$Def(REPORT_OUT) eq ""} {set Def(REPORT_OUT) "new_report"} # add $Def(PDF_PAP_FORM) ? exec_R $Def(DATA_IN) $Def(DATA_IN2) $Def(ANALYSE_IN) $Def(DIR_OUT) $Def(DATA_OUT) $Def(REPORT_OUT) $Def(TYPE_OUT) $Def(KEEP_TEX) $Def(KEEP_DATA_OUT) $Def(PDF_PAP_FORM)) AjouteAuLog "\n" 10 } else { afficherErreur "You should enter at least \n--> the Analyse Scenario file (.Rnw or .Snw),\ \n--> the data input file,\n--> and a valid output folder\n before generating !" } return } # affichage des infos sur le logiciel (menu About) proc afficherAbout {} { set Def(ABOUT_INFOS) "RReportGenerator Version 1.3.3 - July 2008\n by Wolfgang Raffelsberger, Yannick Krause and Luc Moulinier\n Laboratoire de BioInformatique et Génomique Intégratives (LBGI) headed by O. Poch , IGBMC, Illkirch-Strasbourg, France\n Please cite using this program as : Raffelsberger et al, Bioinformatics 2008 24(2):276-278. RReportGenerator : Automatic reports from routine statistical analysis using R.\n For questions please look at the user-manual on http://www-bio3d-igbmc.u-strasbg.fr/~wraff or refer to wolfgang.raffelsberger@igbmc.fr " tk_dialog .dialog "About ..." $Def(ABOUT_INFOS) questhead 0 "OK" return } # affichage d'une boite de dialogue contenant un message d'erreur proc afficherErreur {msg_err} { tk_dialog .dialog "Error" "$msg_err" warning 0 "OK" return } # affichage des infos du scenario proc afficherInfos {nomFic} { global tcl_platform if {$nomFic ne ""} { if {$tcl_platform(platform) eq "windows"} { set nomFic [file attributes [file normalize $nomFic] -shortname] } set infos [recupererInfos $nomFic] if {$infos ne ""} { AffichageInfosScenario $infos } else { afficherErreur "No Analysis Scenario information available !" } } else { afficherErreur "Please choose an Analysis Scenario (browse...)." } return } # Affichage infos scenario proc AffichageInfosScenario {infos} { if {[winfo exists .affinfsc]} {destroy .affinfsc} toplevel .affinfsc wm title .affinfsc "Analysis Scenario informations" set w .affinfsc frame $w.f pack $w.f -side top -expand 1 -fill both label $w.f.l -text "Analysis Scenario Informations :" -justify left text $w.f.t -bg white -width 90 \ -yscrollcommand "$w.f.y set" scrollbar $w.f.y -command "$w.f.t yview" -width 8 button $w.f.b -text " close " -bg green -command "destroy [winfo toplevel $w]" grid $w.f.l -row 0 -column 0 -sticky w -pady 10 -padx 10 grid $w.f.t -row 1 -column 0 -sticky ns -padx {10 1} grid $w.f.y -row 1 -column 1 -sticky ns -padx {1 10} grid $w.f.b -row 2 -column 0 -sticky w -padx 10 -pady 20 $w.f.t insert end $infos $w.f.t configure -state disabled MesCouleurs $w FenetreAuCentre $w return } # affichage du Fic d'aide proc afficherHelp {} { global Def if {! [file exists $Def(HELP_FILE)]} { afficherErreur "Can't find the help file ($Def(HELP_FILE)) ! " return } if {[winfo exists .helpPanel]} {return} toplevel .helpPanel wm title .helpPanel "Help Guide" set w .helpPanel scrollbar .helpPanel.scroll -command ".helpPanel.text yview" text .helpPanel.text -yscrollcommand ".helpPanel.scroll set" \ -bg white \ -width 60 -height 40 \ -font TextFont pack .helpPanel.scroll -side right -fill y pack .helpPanel.text -side left -expand yes -fill both .helpPanel.text insert end [ContenuDuFic $Def(HELP_FILE)] .helpPanel.text configure -state disabled focus -force .helpPanel MesCouleurs $w FenetreAuCentre $w return } # check memory limit for vaulabel numeric value 29jul08 proc checkMemLim {aTester} { global tcl_platform set DoSave 1 if {$tcl_platform(platform) eq "windows"} { if {$aTester == ""} { ## allow empty space set DoSave 1 } elseif {[scan $aTester {%[0-9]}] == "" | [scan $aTester {%[0-9]}] == "{}" } { # incorrect (non-numeric) entry !! -> STOP afficherErreur "Error: please leave empty or enter memory limit as numeric value (without comma)" set DoSave 0 } else { ## remove any text behind values (& convert to numeric) set aTester [format %o [scan $aTester {%[0-9]}]] set DoSave 1 } } return $DoSave } #proc checkMemLim {} { # global Def # global tcl_platform # # #array set Def $q # if {$tcl_platform(platform) eq "windows"} { # ## check memory limit for valid entry here : 29jul08 # if {$Def(R_MEMORYLIMIT) == ""} { # set DoSave 1 # } elseif {[scan $Def(R_MEMORYLIMIT) {%[0-9]}] == "" | [scan $Def(R_MEMORYLIMIT) {%[0-9]}] == "{}" } { # # incorrect (non-numeric) entry !! -> STOP # afficherErreur "Error: please leave empty or enter memory limit as numeric value (without comma)" # set DoSave 0 # } else { # ## remove any text behind values (& convery to numeric) # set Def(R_MEMORYLIMIT) [format %o [scan $Def(R_MEMORYLIMIT) {%[0-9]}]] # set DoSave 1 # } # } # return $DoSave #} # affichage du panneau de configuration proc FinConfig {w q} { if {[llength $q] > 1} { global Def global tcl_platform set DoSave 1 array set Def $q if {$tcl_platform(platform) eq "windows"} { set Li [array names Def "*_DIR"] lappend Li "R_HOME" "LATEX_HOME" lappend Li "DIR_OUT" foreach i $Li { set Def($i) [file attributes $Def($i) -shortname] } ## check memory limit for valid entry here : 29jul08 if {$Def(R_MEMORYLIMIT) == ""} { set DoSave 1 } elseif {[scan $Def(R_MEMORYLIMIT) {%[0-9]}] == "" | [scan $Def(R_MEMORYLIMIT) {%[0-9]}] == "{}" } { # incorrect (non-numeric) entry !! -> STOP afficherErreur "Error: please leave empty or enter memory limit as numeric value (without comma)" set Def(R_MEMORYLIMIT) "" set DoSave 0 } elseif {[scan $Def(R_MEMORYLIMIT) {%[0]}] != "{}" } { ## remove any text behind values with heading 0s (& convery to numeric) set Def(R_MEMORYLIMIT) [format %o [scan $Def(R_MEMORYLIMIT) {%[0-9]}]] set DoSave 1 } else { ## remove any text behind values (& convery to numeric) set Def(R_MEMORYLIMIT) [format %d [scan $Def(R_MEMORYLIMIT) {%[0-9]}]] set DoSave 1 } } if {! [file exists $Def(TMP_DIR)]} {file mkdir $Def(TMP_DIR)} if {$DoSave == 1} sauverConfig } destroy [winfo toplevel $w] return } proc config_gui {} { global TDef Def global tcl_platform if {[winfo exists .configPanel]} {return} array set TDef [array get Def] toplevel .configPanel wm title .configPanel "Environnement configuration" wm resizable .configPanel 0 0 wm protocol .configPanel continue focus -force .configPanel set wp ".configPanel" grid columnconfig $wp 0 -weight 1 label $wp.ltop -text "Current Configuration" -justify left grid $wp.ltop -row 0 -column 0 -sticky w -pady 20 -padx 10 set winShiftLi 0 if {$tcl_platform(platform)=="windows"} { set winShiftLi 2} ### label $wp.lout_dir -text "Default Output files folder :" entry $wp.eout_dir -bg white \ -width 50 -textvar TDef(DIR_OUT) button $wp.bout_dir -text "Browse ..." -bg white \ -command { set TDef(DIR_OUT) [choisirDir $TDef(DIR_OUT)] focus .configPanel raise .configPanel } grid $wp.lout_dir -row 1 -column 0 -sticky w -padx 10 -pady {5 0} grid $wp.eout_dir -row 2 -column 0 -sticky we -padx {10 1} -pady {5 0} grid $wp.bout_dir -row 2 -column 1 -padx {1 10} -pady {0 5} ### label $wp.lData_dir -text "Default (Input) Data files folder :" entry $wp.eData_dir -bg white \ -width 50 -textvar TDef(DATA_DIR) button $wp.bData_dir -text "Browse ..." -bg white \ -command { set TDef(DATA_DIR) [choisirDir $TDef(DATA_DIR)] focus .configPanel raise .configPanel } grid $wp.lData_dir -row 3 -column 0 -sticky w -padx 10 -pady {5 0} grid $wp.eData_dir -row 4 -column 0 -sticky we -padx {10 1} -pady {5 0} grid $wp.bData_dir -row 4 -column 1 -padx {1 10} -pady {0 5} ### label $wp.lScn_dir -text "Default Analysis Scenario folder :" entry $wp.eScn_dir -bg white \ -width 50 -textvar TDef(SCN_DIR) button $wp.bScn_dir -text "Browse ..." -bg white \ -command { set TDef(SCN_DIR) [choisirDir $TDef(SCN_DIR)] focus .configPanel raise .configPanel } grid $wp.lScn_dir -row 5 -column 0 -sticky w -padx 10 -pady {5 0} grid $wp.eScn_dir -row 6 -column 0 -sticky we -padx {10 1} -pady {5 0} grid $wp.bScn_dir -row 6 -column 1 -padx {1 10} -pady {0 5} ### label $wp.lR_home -text "R installation path :" -justify left entry $wp.eR_home -width 50 \ -textvar TDef(R_HOME) -bg $Def(BG_ENTRY) button $wp.bR_home -text "Browse ..." -bg white\ -command { set TDef(R_HOME) [choisirDir $TDef(R_HOME)] focus .configPanel raise .configPanel } grid $wp.lR_home -row 7 -column 0 -sticky w -padx 10 -pady {5 0} grid $wp.eR_home -row 8 -column 0 -sticky we -padx {10 1} -pady {0 5} grid $wp.bR_home -row 8 -column 1 -padx {1 10} -pady {0 5} ### 17jul08 : need to add (conditional) memory.limit (R_MEMORYLIMIT) if {$tcl_platform(platform)=="windows"} { label $wp.lR_memLim -text "(Windows only:) Optional custom memory limt for R (in Mb):" -justify left entry $wp.eR_memLim -width 50 -textvar TDef(R_MEMORYLIMIT) -bg white # test for valid entry R_MEMORYLIMIT at save ? grid $wp.lR_memLim -row [expr {$winShiftLi + 7}] -column 0 -sticky w -padx 10 -pady {5 0} grid $wp.eR_memLim -row [expr {$winShiftLi + 8}] -column 0 -sticky we -padx {10 1} -pady {0 5} } ### label $wp.lLatex_home -text "LaTeX installation path :" -justify left entry $wp.eLatex_home \ -width 50 -bg white \ -textvar TDef(LATEX_HOME) button $wp.bLatex_home -text "Browse ..." -bg white \ -command { set TDef(LATEX_HOME) [choisirDir $TDef(LATEX_HOME)] focus .configPanel raise .configPanel } grid $wp.lLatex_home -row [expr {$winShiftLi + 9}] -column 0 -sticky w -padx 10 -pady {5 0} grid $wp.eLatex_home -row [expr {$winShiftLi + 10}] -column 0 -sticky we -padx {10 1} -pady {0 5} grid $wp.bLatex_home -row [expr {$winShiftLi + 10}] -column 1 -padx {1 10} -pady {0 5} ### label $wp.lTmp_dir -text "Temporary files folder :" -justify left entry $wp.eTmp_dir -width 50 -textvar TDef(TMP_DIR) \ -bg white grid $wp.lTmp_dir -row [expr {$winShiftLi + 11}] -column 0 -sticky w -padx 10 -pady {5 0} grid $wp.eTmp_dir -row [expr {$winShiftLi + 12}] -column 0 -sticky we -padx 10 -pady {0 5} ## new 17jul08 : add radiobuttons for prefered paper size ## label $wl1.fOutputReport.lOutputReport -font ItmFont -text "Report File Name :" -fg $Def(FG_ENTRY) -anchor w -justify left ## entry $wl1.fOutputReport.eOutputReport -width 50 -textvar Def(REPORT_OUT) -bg $Def(BG_ENTRY) ## radiobutton $wl1.fOutputReport.rbOutputReport_pdf -text ".pdf" -value "pdf" -relief flat -variable Def(TYPE_OUT) ## radiobutton $wl1.fOutputReport.rbOutputReport_dvi -text ".dvi (+ .eps)" -value "dvi" -relief flat -variable Def(TYPE_OUT) ## grid $wl1.fOutputReport.rbOutputReport_pdf -row 1 -column 1 ## grid $wl1.fOutputReport.rbOutputReport_dvi -row 1 -column 2 ## add add'l field/label since orig/main won't show !?! label $wp.xx -text "Prefered paper format for pdf reports:" -justify left grid $wp.xx -row [expr {$winShiftLi + 13}] -column 0 -sticky w -padx 10 -pady {5 0} label $wp.lpap -text " paper format:" -justify left #entry $wp.epap -width 50 -textvar TDef(PDF_PAP_FORM) -bg $TDef(BG_ENTRY) ## label won't show ?!?! radiobutton $wp.lpap.pap_A4 -text "A4 format " -value "A4" -relief flat -variable TDef(PDF_PAP_FORM) radiobutton $wp.lpap.pap_letter -text "letter format " -value "letter" -relief flat -variable TDef(PDF_PAP_FORM) radiobutton $wp.lpap.pap_other -text "other " -value "other" -relief flat -variable TDef(PDF_PAP_FORM) grid $wp.lpap -row [expr {$winShiftLi + 14}] -column 0 -sticky w -padx 10 -pady {5 0} grid $wp.lpap.pap_A4 -row [expr {$winShiftLi + 15}] -column 0 grid $wp.lpap.pap_letter -row [expr {$winShiftLi + 15}] -column 1 grid $wp.lpap.pap_other -row [expr {$winShiftLi + 15}] -column 2 # 17jul08 push button further down frame $wp.fButtons grid $wp.fButtons -row [expr {$winShiftLi + 16}] -column 0 -columnspan 2 -sticky we -padx 30 -pady {10 20} grid columnconfig $wp.fButtons {0 1} -weight 1 button $wp.fButtons.bSaveConfig \ -text " Save " -bg green \ -command "FinConfig $wp \[array get TDef\]" button $wp.fButtons.bCancelConfig -text "Cancel" \ -bg $TDef(BG_CANCEL) \ -command "FinConfig $wp dismiss" grid $wp.fButtons.bCancelConfig -row 0 -column 0 -sticky w grid $wp.fButtons.bSaveConfig -row 0 -column 1 -sticky e MesCouleurs $wp FenetreAuCentre $wp raise $wp focus $wp tkwait window $wp return } #proc showChoices {yPos parent varname args} { # set f [frame $parent.choices -borderwidth 5 ] # set b $yPos # foreach item $args { # ratiobutton $f.$b -variable $varname -text $item -value $item # pack $f.$b -side left # incr b # } # pack $f -side top #} # creation des menus proc creerMenus_gui {w} { frame $w.fm -relief raised grid $w.fm -row 0 -column 0 -padx 5 -sticky we # menu File set mfi $w.fm.file.m menubutton $w.fm.file -text "File" -underline 0 -menu $mfi menu $mfi -tearoff 0 $mfi add command -label "Quit" -command {AdieuRRG} # menu Help set mhe $w.fm.help.m menubutton $w.fm.help -text "Help" -underline 0 -menu $mhe menu $mhe -tearoff 0 $mhe add command -label "Configuration" -command "config_gui" $mhe add command -label "Help Guide" -command "afficherHelp" $mhe add command -label "About ..." -command "afficherAbout" pack $w.fm.file $w.fm.help -side left return } proc DemandeFtp {{quoi ""}} { global Def package require ftp set host $Def(FtpHost) set user $Def(FtpUser) set pass $Def(FtpPass) set dir $Def(LibDir) set handle [::ftp::Open $host $user $pass -mode passive] ::ftp::Cd $handle $dir if {$quoi eq ""} { set res [::ftp::NList $handle] } else { set out [::ftp::Get $handle $quoi -variable res] set res [split $res "\n"] } ::ftp::Close $handle return $res } proc DemandeEtSauveScnWWW f { global Def set Ll [DemandeFtp $f] set fout [file join $Def(TMP_DIR) $f] set foo [open $fout w] puts $foo [join $Ll "\n"] close $foo return $fout } proc FinRecupFtp {w {quoi ""} {finf ""}} { global Def if {$quoi ne "dismiss" && $quoi ne ""} { set f [lindex [set Def(ListeScnWWW)] $quoi] set file [DemandeEtSauveScnWWW $f] if {$finf ne ""} { afficherInfos $file return } else { set Def(ANALYSE_IN) $file } } else { set Def(ANALYSE_IN) "" } update destroy [winfo toplevel $w] return } proc RecupereScenario {} { global Def set Lscn [DemandeFtp] if {! [llength $Lscn]} {return} LesDefauts ListeScnWWW $Lscn set w ".lib" if {[winfo exists $w]} {destroy $w} toplevel $w wm title $w "WWW Scenario Library" wm protocol $w WM_DELETE_WINDOW "FinRecupFtp $w dismiss" label $w.l -text "WWW Scenario Library :" -justify left grid $w.l -row 0 -column 0 -sticky w -pady {10 20} -padx 10 frame $w.f grid $w.f -row 1 -column 0 grid columnconfig $w.f 0 -weight 1 set wdt [expr {[PlusLongEltDe $Lscn]+3}] listbox $w.f.l -selectmode single \ -width $wdt -yscrollcommand "$w.f.s set" scrollbar $w.f.s -command "$w.f.l yview" -width 8 grid $w.f.l -row 1 -column 0 -sticky w -padx {10 1} grid $w.f.s -row 1 -column 1 -sticky ns -padx {1 10} frame $w.b grid $w.b -row 2 -column 0 -sticky we -pady 20 -padx 5 button $w.b.ok -text " OK " -bg green \ -command "FinRecupFtp $w \[$w.f.l curselection\]" button $w.b.if -text "Infos" -bg cyan \ -command "FinRecupFtp $w \[$w.f.l curselection\] infos" button $w.b.di -text "Dismiss" -bg $Def(BG_CANCEL) \ -command [list FinRecupFtp $w dismiss] grid $w.b.di -row 0 -column 0 -sticky w -padx 5 grid $w.b.if -row 0 -column 1 -sticky w -padx 5 grid $w.b.ok -row 0 -column 2 -sticky e -padx 5 eval $w.f.l insert end $Lscn MesCouleurs $w FenetreAuCentre $w update idletasks tkwait window $w return } # creation du panneau de gauche de l'interface graphique proc creerFrameLeft_gui w { global Def set wl1 "$w.fLeft1" labelframe $wl1 -text "Main items" -fg red -font LfrFont grid $wl1 -row 1 -column 0 -padx {5 10} -pady {10 5} set wl2 "$w.fLeft2" labelframe $wl2 -text "Optional items" -fg blue -font LftFont grid $wl2 -row 2 -column 0 -padx {5 10} -pady {5 10} frame $wl1.fAnalyseFile frame $wl1.fDataFile_in frame $wl1.fOutputDir frame $wl1.fOutputReport frame $wl2.fDataFile_in2 frame $wl2.fDataFile_out grid columnconfig $wl1.fAnalyseFile 0 -weight 1 grid $wl1.fAnalyseFile -row 0 -column 0 -ipady 5 -sticky we -padx 5 grid columnconfig $wl1.fDataFile_in 0 -weight 1 grid $wl1.fDataFile_in -row 1 -column 0 -ipady 5 -sticky we -padx 5 grid columnconfig $wl1.fOutputDir 0 -weight 1 grid $wl1.fOutputDir -row 2 -column 0 -ipady 5 -sticky we -padx 5 grid columnconfig $wl1.fOutputReport 0 -weight 1 grid $wl1.fOutputReport -row 3 -column 0 -ipady 5 -sticky we -padx 5 -pady {0 5} grid columnconfig $wl2.fDataFile_in2 0 -weight 1 grid $wl2.fDataFile_in2 -row 0 -column 0 -ipady 5 -sticky we -padx 5 grid columnconfig $wl2.fDataFile_out 0 -weight 1 grid $wl2.fDataFile_out -row 1 -column 0 -ipady 5 -sticky we -padx 5 -pady {0 5} label $wl1.fAnalyseFile.lAnalyseFile -font ItmFont \ -text "Analysis Scenario File :" -justify left \ -fg $Def(FG_ENTRY) -anchor w entry $wl1.fAnalyseFile.eAnalyseFile \ -width 50 -bg $Def(BG_ENTRY) \ -textvar Def(ANALYSE_IN) button $wl1.fAnalyseFile.bAnalyseFile -text "Browse ..." \ -bg white \ -command \ {set Def(ANALYSE_IN) [choisirFic {{{Rnw and Snw Files} {*.Rnw *.Snw *.rnw *.snw}} {{All Files} {*.*}}} $Def(SCN_DIR) "an Analysis Scenario File"]} button $wl1.fAnalyseFile.bInfos \ -text "Infos" -bg Grey \ -command {afficherInfos $Def(ANALYSE_IN)} button $wl1.fAnalyseFile.bLib \ -text "Library" -bg $Def(BG_LIBRARY) \ -command {RecupereScenario} grid $wl1.fAnalyseFile.lAnalyseFile -row 0 -column 0 -sticky we grid $wl1.fAnalyseFile.bLib -row 0 -column 1 -sticky we grid $wl1.fAnalyseFile.eAnalyseFile -row 1 -column 0 -sticky we grid $wl1.fAnalyseFile.bAnalyseFile -row 1 -column 1 -sticky we grid $wl1.fAnalyseFile.bInfos -row 2 -column 0 -sticky w label $wl1.fDataFile_in.lDataFile_in -font ItmFont \ -text "Data Input File :" \ -fg $Def(FG_ENTRY) -anchor w -justify left entry $wl1.fDataFile_in.eDataFile_in \ -width 50 -textvar Def(DATA_IN) -bg $Def(BG_ENTRY) button $wl1.fDataFile_in.bDataFile_in \ -text "Browse ..." \ -bg white \ -command { set Def(DATA_IN) [choisirFic {{{Data Files} {*.*} TEXT}} $Def(DATA_DIR) "an Input File"]} grid $wl1.fDataFile_in.lDataFile_in -row 0 -column 0 -sticky we grid $wl1.fDataFile_in.eDataFile_in -row 1 -column 0 -sticky we grid $wl1.fDataFile_in.bDataFile_in -row 1 -column 1 -sticky we label $wl1.fOutputDir.lOutputDir -font ItmFont \ -text "Output Folder" \ -fg $Def(FG_ENTRY) -anchor w -justify left entry $wl1.fOutputDir.eOutputDir \ -width 50 -textvar Def(DIR_OUT) -bg $Def(BG_ENTRY) button $wl1.fOutputDir.bOutputDir \ -text "Browse ..." \ -bg white \ -command { set Def(DIR_OUT) [choisirDir $Def(DIR_OUT)] update } grid $wl1.fOutputDir.lOutputDir -row 0 -column 0 -sticky nw grid $wl1.fOutputDir.eOutputDir -row 1 -column 0 -sticky we grid $wl1.fOutputDir.bOutputDir -row 1 -column 1 -sticky we label $wl1.fOutputReport.lOutputReport -font ItmFont \ -text "Report File Name :" -fg $Def(FG_ENTRY) \ -anchor w -justify left entry $wl1.fOutputReport.eOutputReport \ -width 50 -textvar Def(REPORT_OUT) -bg $Def(BG_ENTRY) radiobutton $wl1.fOutputReport.rbOutputReport_pdf \ -text ".pdf" -value "pdf" -relief flat \ -variable Def(TYPE_OUT) radiobutton $wl1.fOutputReport.rbOutputReport_dvi \ -text ".dvi (+ .eps)" -value "dvi" -relief flat \ -variable Def(TYPE_OUT) grid $wl1.fOutputReport.lOutputReport -row 0 -column 0 -sticky we grid $wl1.fOutputReport.eOutputReport -row 1 -column 0 -sticky we grid $wl1.fOutputReport.rbOutputReport_pdf -row 1 -column 1 grid $wl1.fOutputReport.rbOutputReport_dvi -row 1 -column 2 label $wl2.fDataFile_in2.lDataFile_in2 -font ItmFont \ -text "Supplemental Data Input File :" \ -fg $Def(FG_ENTRY) -anchor w -justify left entry $wl2.fDataFile_in2.eDataFile_in2 -width 50 \ -textvar Def(DATA_IN2) -bg $Def(BG_ENTRY) button $wl2.fDataFile_in2.bDataFile_in2 \ -text "Browse ..." \ -bg white \ -command { set Def(DATA_IN2) [choisirFic {{{Data Files} {*.*} TEXT}} $Def(DATA_DIR) "a Supplemental Data Input File"]} grid $wl2.fDataFile_in2.lDataFile_in2 -row 0 -column 0 -sticky nw grid $wl2.fDataFile_in2.eDataFile_in2 -row 1 -column 0 -sticky we grid $wl2.fDataFile_in2.bDataFile_in2 -row 1 -column 1 -sticky we label $wl2.fDataFile_out.lDataFile_out -font ItmFont \ -text "Supplemental Data Output File :" \ -fg $Def(FG_ENTRY) -anchor w -justify left entry $wl2.fDataFile_out.eDataFile_out \ -width 53 -textvar Def(DATA_OUT) -bg $Def(BG_ENTRY) checkbutton $wl2.fDataFile_out.cbTexFile \ -text "Keep the .tex file" \ -variable Def(KEEP_TEX) grid $wl2.fDataFile_out.lDataFile_out -row 0 -column 0 -sticky we grid $wl2.fDataFile_out.eDataFile_out -row 1 -column 0 -sticky we grid $wl2.fDataFile_out.cbTexFile -row 1 -column 1 -sticky we return } # creation du panneau de droite de l'interface graphique proc creerFrameRight_gui {w} { global Def global LogW set wr "$w.fRight" frame $wr grid $wr -row 1 -column 1 -rowspan 2 -sticky ns -pady {10 10} grid rowconfig $wr 0 -weight 1 grid columnconfig $wr 0 -weight 1 frame $wr.fCenter frame $wr.fBottom grid rowconfig $wr.fCenter 1 -weight 1 grid $wr.fCenter -row 0 -column 0 -sticky ns -padx {5 10} grid $wr.fBottom -row 1 -column 0 -sticky we set LogW $wr.fCenter.tSessionWindow label $wr.fCenter.lSessionWindow -text "Session Window :" \ -font ItmFont -anchor w -justify left scrollbar $wr.fCenter.sSessionWindow -width 8 \ -command "$wr.fCenter.tSessionWindow yview" text $wr.fCenter.tSessionWindow \ -yscrollcommand "$wr.fCenter.sSessionWindow set" \ -bg $Def(BG_TEXT) -fg $Def(FG_TEXT) \ -width 50 -font TextFont \ -state disabled grid $wr.fCenter.lSessionWindow -row 0 -column 0 -sticky w grid $wr.fCenter.tSessionWindow -row 1 -column 0 -sticky news grid $wr.fCenter.sSessionWindow -row 1 -column 1 -sticky ns return } # affichage boutons proc creerBoutons_gui {w} { set wb "$w.fb" grid columnconfig $w {0 1} -weight 1 frame $wb grid $wb -row 3 -column 0 -columnspan 2 -sticky we -pady {10 20} -padx 10 grid columnconfig $wb {0 1} -weight 1 button $wb.bReset -text " Reset " -height 3\ -bg yellow \ -command {initialiserFormulaire} button $wb.bGenerate -text "Generate Report" -height 3 \ -bg green \ -command {generate_cmd} grid $wb.bReset -row 0 -column 0 -sticky w grid $wb.bGenerate -row 0 -column 1 -sticky e return } proc initialiserFormulaire {} { chargerConfig EffaceLeLog update idletasks return } # affichage de l'interface graphique du programme proc RReportGenerator_gui {} { wm protocol . WM_DELETE_WINDOW AdieuRRG wm title . "RReportGenerator : statistical analysis with automatic reports" font create LfrFont -family "Helvetica" -size 12 -weight bold font create ItmFont -family "Helvetica" -size 10 -weight normal font create TextFont -family "Helvetica" -size 10 -weight normal set w ".wRRG" frame $w creerMenus_gui $w creerFrameLeft_gui $w creerFrameRight_gui $w creerBoutons_gui $w pack $w -expand yes -side top -anchor nw -fill both grid rowconfig $w {0 1 2 3} -weight 0 -minsize 0 grid columnconfig $w {0 1} -weight 1 MesCouleurs $w FenetreAuCentre $w focus -force $w raise $w bind $w {AdieuRRG} update idletasks return } proc RExe {} { global Def global tcl_platform switch $tcl_platform(platform) { "windows" { ## 17jul08: ADD HERE : ## test if Win memory size specified in Config, if yes then add ## --max-mem-size=2047Mb (or equiv) to yield (final): Rterm.exe --max-mem-size=2047Mb --vanilla if {$Def(R_MEMORYLIMIT) > 1} { ## use custom memory limit ## problem : need to paste $Def(R_MEMORYLIMIT) to "Mb" WITHOUT SPACE INBETWEEN set rexe [concat [file join $Def(R_HOME) bin Rterm.exe] "--max-mem-size=" $Def(R_MEMORYLIMIT) "Mb"] set rexe [regsub " Mb" $rexe "Mb" ] } else { set rexe [file join $Def(R_HOME) bin Rterm.exe] } } "unix" { set rexe [file join $Def(R_HOME) bin R] } "macintosh" { set rexe [file join $Def(R_HOME) bin R] } } return $rexe } proc LatexExe {} { global Def global tcl_platform switch $tcl_platform(platform) { "windows" { set rexe [file join $Def(LATEX_HOME) bin latex.exe] } "unix" { set rexe [file join $Def(LATEX_HOME) bin latex] } "macintosh" { set rexe [file join $Def(LATEX_HOME) latex] } } return $rexe } proc PdflatexExe {} { global Def global tcl_platform switch $tcl_platform(platform) { "windows" { set rexe [file join $Def(LATEX_HOME) bin pdflatex.exe] } "unix" { set rexe [file join $Def(LATEX_HOME) bin pdflatex] } "macintosh" { set rexe [file join $Def(LATEX_HOME) pdflatex] } } return $rexe } proc AdieuRRG {} { global Def if {[file exists $Def(TMP_DIR)]} { file delete -force $Def(TMP_DIR) } exit 0 } ############################################################### ########## PROGRAMME PRINCIPAL ################################ ############################################################### proc main {} { global Def global RRGDir global RRGData global env tcl_platform global auto_path set RRGDir [file normalize [file join [file dirname [info nameofexecutable]] ..]] switch $tcl_platform(platform) { "windows" { set RRGData [file join $env(APPDATA) .RRG] if {! [file exists $RRGData]} {file mkdir $RRGData} set RRGData [file attributes $RRGData -shortname] set RRGDir [file attributes $RRGDir -shortname] } "unix" { set RRGData [file join $env(HOME) .RRG] } "macintosh" { } } lappend auto_path [file join $RRGDir lib] LesDefauts # verification de l'existence du Fic de configuration if {! [file exists $RRGData]} {file mkdir $RRGData} if {! [file exists $Def(CONFIG_FILE)]} { LesDefauts R_HOME [automaticSearch R] LesDefauts LATEX_HOME [automaticSearch latex] #need ?# LesDefauts R_MEMORYLIMIT (1024) if {$Def(R_HOME) eq "" || $Def(LATEX_HOME) eq ""} { config_gui } sauverConfig } else { # chargement du Fic de configuration chargerConfig } DefinitTmpDir # lancement de l'interface utilisateur RReportGenerator_gui return } package require Tk main ########## FIN PROGRAMME ###########################################>