Changeset 5f12935 in tol for tolbase/lib/toltk


Ignore:
Timestamp:
Feb 2, 2012, 8:39:53 PM (15 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
b83a49e
Parents:
fa8b47d
Message:

refs #1408

  • se implementa la opción -project path_to_project.ini
  • -project "" implica que no se carga _iniproject.tol ni project.ini
  • -project <path>/project.ini implica que se carga <path>/project.ini y <path>/_iniproject.tol, no se carga _iniproject.tol que suele estar en TOLHOME.
  • se recuerda que existe la opción -np que implica que no se carga _iniproject.tol, esta opcion es compartida con tol.exe y tolsh.exe

refs #1409

  • se require la versión 3.1 de toltcl.

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@4059 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tolbase/lib/toltk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tolbase/lib/toltk/init_toltk.tcl

    rfa8b47d r5f12935  
    7777    load $::env(USE_TOLTCL)
    7878  } else {
    79     package require Toltcl 2.0.2
     79    package require Toltcl 3.1
    8080  }
    8181  package require rmtps_client
    … …  
    134134
    135135#/////////////////////////////////////////////////////////////////////////////
    136   proc loadInfoProjects { dir } {
     136  proc loadInfoProjects { prjini } {
    137137#
    138138# PURPOSE: Loads in a list the name and paths of each project to load
    … …  
    145145  global toltk_script_path
    146146 
     147  set values {}
    147148  # File exists ?
    148149  set ok 0
    149   set dirPrjIni "[file normalize $dir]/../../../"
    150   set fileProject [file join $dirPrjIni "project.ini"]
    151   if {[file exists $fileProject]} {
    152     set ok [ file writable $fileProject ]
     150  if { [ file isfile $prjini ] } {
     151    if { [ file readable $prjini ] } {
     152      set ok 1
     153      set fileProject [ file normalize $prjini ]
     154      # se intentara leer el iniproject.tol desde este sitio
     155      lappend values Project,path,root [ file dir $fileProject ]
     156    } else {
     157      tk_messageBox -default ok -icon error \
     158          -message [ mc "The project does not exist, file not found or not readable: %s" $prj ] \
     159          -parent . -title "Error" -type ok
     160      return ""
     161    }
    153162  } else {
    154     set fileProject [file join $dir "project.ini"]
     163    # comportamiento anterior, pudiera limpiarse
     164    lappend values Project,path,root ""
     165    set pathInitTol ""
     166    set dir $prjini
     167    set dirPrjIni "[file normalize $dir]/../../../"
     168    set fileProject [file join $dirPrjIni "project.ini"]
    155169    if {[file exists $fileProject]} {
    156       set ok [ file writable $fileProject ] 
     170      set ok [ file writable $fileProject ]
     171    } else {
     172      set fileProject [file join $dir "project.ini"]
     173      if {[file exists $fileProject]} {
     174        set ok [ file writable $fileProject ] 
     175      }
    157176    }
    158177  }
    … …  
    161180    set id [iniparse:openfile $fileProject]
    162181    catch { ::iniFile::Create $fileProject }
    163     set values {}
    164182    foreach prj $iniparse($id,sections) {
    165183      if { $prj eq "Project" } {
    … …  
    211229    }
    212230    iniparse:closefile $id
    213     return $values
    214   }
    215   return ""
     231  }
     232  return $values
    216233}
    217234
    … …  
    280297}
    281298
     299# Load project
     300namespace import project::*
     301set project::data(iniproject) 1
     302set state ""
     303set project::data(-project) $toltk_script_path
     304foreach option $argv {
     305  if { $state eq "" } {
     306    switch -- $option {
     307      -b {
     308        set project::data(oculto) 1
     309      }
     310      -np {
     311        set project::data(iniproject) 0
     312      }
     313      -project {
     314        set state "project"
     315      }
     316      default {
     317        puts "unknown option $option"
     318      }
     319    }
     320  } else {
     321    switch $state {
     322      project {
     323        set project::data(-project) [ file normalize $option ]
     324      }
     325      default {
     326        puts "unknown state $state"
     327      }
     328    }
     329    set state ""
     330  }
     331}
     332
    282333# Get info about project
    283 set infoProjects [loadInfoProjects $toltk_script_path]
     334set infoProjects [ loadInfoProjects $project::data(-project) ]
     335project::project $infoProjects
    284336
    285337# load iniFile
    … …  
    295347
    296348Tolcon_Trace "toltk_script_path=$toltk_script_path"
    297 # Load project
    298 namespace import project::*
    299 set project::data(iniproject) 1
    300 foreach option $argv {
    301   if { [string equal $option "-b"] } {
    302     set project::data(oculto) 1
    303   } elseif { $option eq "-np" } {
    304     set project::data(iniproject) 0
    305   }
    306 }
    307 project::project $infoProjects
    308 
    309349
    310350Tolcon_Trace "begin"
  • tolbase/lib/toltk/project.tcl

    rfa8b47d r5f12935  
    165165  }
    166166#   update
    167   tol::initlibrary $data(iniproject)
     167  if { $projects(Project,path,root) ne "" } {
     168    set initol 0
     169    set iniproject [ file join $projects(Project,path,root) "_iniproject.tol" ]
     170  } else {
     171    set initol $data(iniproject)
     172    set iniproject ""
     173  }
     174  tol::initlibrary $initol
     175  if { $iniproject ne "" } {
     176    # incluyo _iniproject.tol relativo a -project
     177    tol::include $iniproject
     178  }
    168179  foreach prj $projects(Project,names) {
    169180    set prjname $projects(${prj},name)
Note: See TracChangeset for help on using the changeset viewer.