Changeset 455a6d5 in tol


Ignore:
Timestamp:
Jan 11, 2012, 10:17:10 AM (15 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
35458ba
Parents:
0db54a1
Message:

refs #1191, se implementa UpdateAll y UpgradeAll

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

Location:
tolbase/lib/toltk
Files:
2 edited

Legend:

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

    r0db54a1 r455a6d5  
    221221    Real TolPackage::Client::RemoteInstall( "%r", "%p", 1 )
    222222  } ]
    223   set result [ toltcl::eval $tolexpr ]
     223  if { [ catch  { toltcl::eval $tolexpr } result ] } {
     224    set result 0
     225  }
    224226  if { [ string is boolean $result ] && $result } {
    225227    DeleteBackup $pkg
    226228  } else {
    227     RestoreBackup $pkg
     229    RestoreBackup $pkg 1
    228230  }
    229231  return $result
  • tolbase/lib/toltk/tolpkg_gui.tcl

    r0db54a1 r455a6d5  
    681681  set nodesInfo($treeParents($p),type) pkg
    682682  set nodesInfo($treeParents($p),status) $nodeStatus
     683  lappend nodesInfo($nodeStatus) $treeParents($p)
    683684}
    684685
    … …  
    762763    set nodesInfo($nid,type) pkgver
    763764    set nodesInfo($nid,status) $nodeStatus
     765    lappend nodesInfo($nodeStatus) $nid
    764766    foreach {{} d} $pkg(_.autodoc.dependencies) {
    765767      set _nid [ $T insert [ list [ list back_to_ou_16 $d ] ] \
    … …  
    788790      -postcommand [ list ::TolPkgGUI::PostContextMenu $t $t.cmenu ]
    789791  $t configure -contextmenu $t.cmenu
     792}
     793
     794proc ::TolPkgGUI::EntryState { listName } {
     795  upvar $listName v
     796
     797  if { [ info exists v ] && [ llength $v ] } {
     798    return "normal"
     799  } else {
     800    return "disabled"
     801  }
    790802}
    791803
    … …  
    904916  }
    905917  $w add command -label [ mc "Update all" ] \
    906       -command "::TolPkgGUI::UpdatePackageVersion"
     918      -command "::TolPkgGUI::UpdatePackageVersion" \
     919      -state [ EntryState nodesInfo(update) ]
    907920  # upgrade list
    908921  if { [ llength $listUPG ] == 1 } {
    … …  
    915928  }
    916929  $w add command -label [ mc "Upgrade all" ] \
    917       -command "::TolPkgGUI::UpgradePackages"
     930      -command "::TolPkgGUI::UpgradePackages" \
     931      -state [ EntryState nodesInfo(upgrade) ]
     932
    918933  # export options
    919934  $w add separator
    … …  
    13001315proc ::TolPkgGUI::UpgradePackages { { pkgs {} } } {
    13011316  variable installData
     1317  variable nodesInfo
     1318  variable tree
    13021319
    13031320  if { ![ CheckConnectionConfig ] } {
    … …  
    13121329  } else {
    13131330    # upgrade all, look for the list
    1314     Unimplemented "Upgrade all packages"
    1315     return
     1331    if { [ info exists nodesInfo(upgrade) ] } {
     1332      foreach nid $nodesInfo(upgrade) {
     1333        set p [ $tree item text $nid 0 ]
     1334        lappend upgradeList $p
     1335        set installData($p) $nid
     1336      }
     1337    } else {
     1338      return
     1339    }
    13161340  }
    13171341  DlgProcess $upgradeList -title [ mc "Upgrade packages" ] \
    … …  
    13231347proc ::TolPkgGUI::UpdatePackageVersion { { pkgs {} } } {
    13241348  variable installData
     1349  variable nodesInfo
     1350  variable tree
    13251351
    13261352  puts "UpdatePackageVersion: $pkgs"
    … …  
    13301356 
    13311357  array unset installData
     1358  set updateList {}
    13321359  if { [ llength $pkgs ] } {
    13331360    foreach p $pkgs {
    … …  
    13361363    }
    13371364  } else {
    1338     # upgrade all, look for the list
    1339     Unimplemented "Update all packages"
    1340     return
     1365    # update all, look for the list
     1366    if { [ info exists nodesInfo(update) ] } {
     1367      foreach nid $nodesInfo(update) {
     1368        set p [ $tree item text $nid 0 ]
     1369        lappend updateList $p
     1370        set installData($p) $nid
     1371      }
     1372    } else {
     1373      return
     1374    }
    13411375  }
    13421376  DlgProcess $updateList -title [ mc "Update packages" ] \
Note: See TracChangeset for help on using the changeset viewer.