- Timestamp:
- Feb 9, 2012, 4:09:14 PM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 4c5e200
- Parents:
- fa037e6
- Location:
- tolbase/lib/toltk
- Files:
-
- 2 edited
-
tolpkg.tcl (modified) (1 diff)
-
tolpkg_gui.tcl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tolbase/lib/toltk/tolpkg.tcl
rfa037e6 r567b369 222 222 } 223 223 224 proc ::TolPkg::RemovePackage { pkg } { 225 set tolexpr [ string map [ list %p ${pkg} ] { 226 Real TolPackage::Client::LocalClean( "%p" ) 227 } ] 228 return [ toltcl::eval $tolexpr ] 229 } 230 224 231 proc ::TolPkg::RemoteInstall { pkg repo } { 225 232 puts "::TolPkg::RemoteInstall $pkg $repo" -
tolbase/lib/toltk/tolpkg_gui.tcl
rfa037e6 r567b369 550 550 } 551 551 552 proc ::TolPkgGUI::lsearchi { i l it } { 553 set _i 0 554 foreach _it $l { 555 if { $it eq [ lindex $_it $i ] } { 556 return $_i 557 } 558 } 559 return -1 560 } 561 552 562 proc ::TolPkgGUI::ReadPackSyncInfo { } { 553 563 variable packSyncInfo … … 813 823 $w add command -label [ mc "Sync with servers" ] \ 814 824 -command "::TolPkgGUI::SyncServers" 815 $w add separator816 825 # preprocess selection of packages 826 # list of new packages available 817 827 set listNEW {} 828 # list of package to remove including all installed versions 829 set listDEL {} 830 # list of individual package selected to remove 831 set listDEL0 {} 832 # list of packages selected needing update 818 833 set listUPD {} 834 # list of packages selected needing upgrade 819 835 set listUPG {} 836 # list of packages selected that can be exported 820 837 set listEXP {} 821 838 … … 823 840 foreach nid $selectionInfo(pkg) { 824 841 set pkg [ $T item text $nid 0 ] 842 if { $nodesInfo($nid,status) ne "new" } { 843 lappend listDEL [ list $pkg $nid ] 844 } 825 845 array unset pkgInfo 826 846 if { [ info exists packSyncInfo($pkg) ] } { … … 857 877 } 858 878 } 879 foreach chId [ $T item children $nid ] { 880 lappend listDEL0 [ list [ $T item text $chId 0 ] $chId ] 881 } 859 882 lappend listEXP [ list $pkgInfo(lastremote) $nodesInfo($nid,status) $nid ] 860 883 } … … 864 887 switch -exact $nodesInfo($nid,status) { 865 888 "new" { 866 if { [ lsearch $listNEW $pkg ] == -1 } { 889 puts "OJO: he encontrado un estado new en un pkgver $pkg" 890 if { [ lsearchi 0 $listNEW $pkg ] == -1 } { 867 891 lappend listNEW [ list $pkg $nid ] 868 892 } 869 893 } 870 894 "update" { 871 lappend listUPD [ list $pkg $nid ] 895 if { [ lsearchi 0 $listUPD $pkg ] == -1 } { 896 lappend listUPD [ list $pkg $nid ] 897 } 872 898 } 873 899 "ok" { … … 877 903 } 878 904 } 879 if { [ lsearch $listEXP $pkg ] == -1 } { 905 if { [ lsearchi 0 $listDEL0 $pkg ] == -1 } { 906 lappend listDEL0 [ list $pkg $nid ] 907 } 908 if { [ lsearchi 0 $listEXP $pkg ] == -1 } { 880 909 lappend listEXP [ list $pkg $nodesInfo($nid,status) $nid ] 881 910 } 882 911 } 883 912 # install list 913 $w add separator 884 914 if { [ llength $listNEW ] == 1 } { 885 915 $w add command -label [ mc "Install %s" [ lindex [ lindex $listNEW 0 ] 0 ] ] \ … … 904 934 -state [ EntryState nodesInfo(update) ] 905 935 # upgrade list 936 $w add separator 906 937 if { [ llength $listUPG ] == 1 } { 907 938 $w add command \ … … 927 958 $w add command -label [ mc "Export all" ]... \ 928 959 -command [ list ::TolPkgGUI::ExportPackageVersion ] 960 # Remove options 961 $w add separator 962 if { [ llength $listDEL ] == 1 } { 963 set _tmppkg [ lindex [ lindex $listDEL 0 ] 0 ] 964 $w add command \ 965 -label [ mc "Remove all %s" $_tmppkg ]... \ 966 -command [ list ::TolPkgGUI::RemovePackageVersion $listDEL0 $_tmppkg ] 967 } elseif { [ llength $listDEL0 ] == 1 } { 968 set _tmppkg [ lindex [ lindex $listDEL0 0 ] 0 ] 969 $w add command \ 970 -label [ mc "Remove %s" $_tmppkg ]... \ 971 -command [ list ::TolPkgGUI::RemovePackageVersion $listDEL0 ] 972 } elseif { [ llength $listDEL0 ] > 1 } { 973 $w add command -label [ mc "Remove selected" ]... \ 974 -command [ list ::TolPkgGUI::RemovePackageVersion $listDEL0 ] 975 } 976 $w add command -label [ mc "Remove all" ]... \ 977 -command [ list ::TolPkgGUI::RemovePackageVersion ] 978 929 979 # SyncInfo import/export 930 980 $w add separator … … 1386 1436 } 1387 1437 1438 proc ::TolPkgGUI::RemovePackageVersion { { pkgs {} } { matchPkg {} } } { 1439 variable installData 1440 variable tree 1441 1442 set removeList {} 1443 if { [ llength $pkgs ] } { 1444 foreach p $pkgs { 1445 set _p [ lindex $p 0 ] 1446 if { $matchPkg eq "" || [ regexp "^${matchPkg}\\.(\\d+)\\.(\\d+)\$" \ 1447 $_p ] } { 1448 lappend removeList $_p 1449 } 1450 } 1451 } else { 1452 Unimplemented "Remove all not implemented yet" 1453 } 1454 if { ![ llength $removeList ] } { 1455 return 1456 } 1457 array unset installData 1458 DlgProcess $removeList -title [ mc "Remove packages" ] \ 1459 -label [ mc "You are about to remove"]: \ 1460 -beforestart ::TolPkgGUI::Removing \ 1461 -cmditem "RemoveThisPackage" -refreshtree 1 1462 } 1463 1388 1464 proc ::TolPkgGUI::ImportSyncInfo { } { 1389 1465 Unimplemented "Import Sync Info" … … 1432 1508 foreach _p $pkgs { 1433 1509 foreach { p s } $_p break 1434 if { $s eq "upgrade" || $s eq "new" } {1510 if { $s eq "upgupd" || $s eq "upgrade" || $s eq "new" } { 1435 1511 lappend remote $p 1436 1512 } else { … … 1467 1543 proc ::TolPkgGUI::Upgrading { } { 1468 1544 DlgProcessSetLabel [ mc "Upgrading" ]... 1545 } 1546 1547 proc ::TolPkgGUI::Removing { } { 1548 DlgProcessSetLabel [ mc "Removing" ]... 1469 1549 } 1470 1550 … … 1543 1623 set result [ TolPkg::RemoteInstall $p $repo ] 1544 1624 puts "TolPkg::RemoteInstall $p: $result" 1625 return $result 1626 } 1627 1628 proc ::TolPkgGUI::RemoveThisPackage { p } { 1629 set result [ TolPkg::RemovePackage $p ] 1630 puts "TolPkg::RemovePackage $p: $result" 1631 return $result 1545 1632 } 1546 1633
Note: See TracChangeset
for help on using the changeset viewer.
