Changeset e4c69c1 in tol for tolbase/lib/toltk/tolpkg_gui.tcl
- Timestamp:
- Dec 22, 2011, 6:44:11 PM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- d7ed887
- Parents:
- e83ccac
- File:
-
- 1 edited
-
tolbase/lib/toltk/tolpkg_gui.tcl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tolbase/lib/toltk/tolpkg_gui.tcl
re83ccac re4c69c1 12 12 13 13 variable urlmap 14 15 array set urlmap { 16 http://packages.tol-project.org/OfficialTolArchiveNetwork/repository.php OTAN 17 http://packages.localbayes.es/BayesPrivateTolPackages/repository.php BPTP 18 } 14 19 15 20 variable packSyncInfo … … 563 568 source [ file join $::TolPkgGUI::cwd tolpkg.tcl ] 564 569 565 proc ::TolPkgGUI::FillRepositories { T } {566 variable urlmap567 568 $T configure -table yes -columns {569 { text -tags ID -label "Identifier" }570 { text -tags SHORT -label "Short Name" }571 { text -tags Name -label "Name" }572 { text -tags TYPE -label "Type" }573 { text -tags DESC -label Description }574 { text -tags DESC -label Authors }575 { text -tags URL -label Url }576 }577 foreach r [ ::TolPkg::GetKnownRepositories ] {578 set rinfo [ list ]579 set rinfo_ [ ::TolPkg::GetRepositoryInfo $r ]580 set urlmap($r) [ lindex $rinfo_ 0 ]581 foreach i $rinfo_ {582 lappend rinfo [ list $i ]583 }584 lappend rinfo [ list $r ]585 $T insert $rinfo586 }587 }588 589 proc ::TolPkgGUI::FillPackages { T } {590 variable urlmap591 592 $T configure -table yes -filter yes -columns {593 { {image text} -tags NAME -label "Name" }594 { text -tags LASTREMOTE -label "Installed" }595 { text -tags DESC -label "Description" }596 { text -tags TOLVER -label "Minimun TOL" }597 { text -tags LASTREMOTE -label "Last Available" }598 { text -tags REPO -label "Repository" }599 }600 set pkginfo [ list ]601 foreach i [ ::TolPkg::GetPackagesInfo ] {602 set available [ lindex $i 6 ]603 set installed [ lindex $i 7 ]604 if { $installed eq "" } {605 set img "package_down_16"606 } else {607 set img [ lindex {cdr_tick_16 software_update_16} \608 [ string compare $available $installed ] ]609 }610 set reg [ list \611 [ list $img [ lindex $i 1 ] ] \612 [list [ lindex $i 7 ] ] \613 [list [ lindex $i 2 ] ] \614 [list [ lindex $i 4 ] ] \615 [list [ lindex $i 6 ] ] \616 $urlmap([lindex $i 0]) ]617 $T insert $reg618 }619 }620 621 570 proc ::TolPkgGUI::CmpVersion { v1 v2 } { 622 571 foreach { v11 v12 } { {} {} } break … … 659 608 } 660 609 661 proc ::TolPkgGUI::GetPkgNode { T repo p } { 610 proc ::TolPkgGUI::GetPkgNode { T url p } { 611 variable urlmap 662 612 variable treeParents 663 613 variable nodesInfo … … 667 617 return treeParents($p) 668 618 } 669 if { ![ info exists treeParents($repo) ] } { 670 set treeParents($repo) [ $T insert [ list [ list database_1_16 $repo ] "" ] \ 671 -at end -relative root \ 672 -button auto ] 673 set nodesInfo($treeParents($repo),type) repo 674 } 619 set url [ expr { [ string range $url end-13 end ] eq "repository.php" ? 620 $url : "${url}repository.php" } ] 621 set repo $urlmap($url) 675 622 if { [ info exists packSyncInfo($p) ] } { 676 623 array set packSync $packSyncInfo($p) … … 700 647 set statusLabel "unknown" 701 648 } 702 set treeParents($p) [ $T insert [ list [ list $img $p ] [ list $statusLabel ] ]\703 -at end -relative $treeParents($repo)\704 -button auto ]705 set nodesInfo($treeParents($p),type) pkg649 set treeParents($p) [ $T insert [ list [ list $img $p ] [ list $statusLabel ] \ 650 [ list $repo ] ] -at end -relative root \ 651 -button auto ] 652 set nodesInfo($treeParents($p),type) pkg 706 653 set nodesInfo($treeParents($p),status) $nodeStatus 707 654 } … … 724 671 { {image text} -tags NAME -label "Name" } 725 672 { {text} -tags STATUS -label "Status" } 673 { {text} -tags REPO -label "Repository" } 726 674 } 727 675 … … 791 739 } 792 740 793 proc ::TolPkgGUI::CreateToolBar { page } { 794 set f [ ::TolPkgGUI::GetToolbar $page ] 795 frame $f 796 grid $f -row 0 -column 0 -sticky "snew" 797 } 798 799 proc ::TolPkgGUI::AddToolButton { page name args } { 800 set f [ ::TolPkgGUI::GetToolbar $page ] 801 set c [ llength [ grid slaves $f ] ] 802 set w [ eval button $f.b$name $args ] 803 grid columnconfigure $f $c -weight 0 -uniform buttons 804 grid $w -row 0 -column $c -sticky snew 805 incr c 806 grid columnconfigure $f $c -weight 1 807 } 808 809 proc ::TolPkgGUI::GetToolbar { PageOrWin } { 810 variable widgets 811 812 if { [ winfo exists $PageOrWin ] } { 813 set f $PageOrWin 814 } else { 815 set f [ $widgets(notebook) getframe $PageOrWin ] 816 } 817 return $f.tbar 818 } 819 820 proc ::TolPkgGUI::CreateTree { page } { 821 set T [ GetTree $page ] 822 wtree $T 823 grid $T -row 1 -column 0 -sticky "snew" 824 set f [ winfo parent $T ] 741 proc ::TolPkgGUI::CreateTreeWidget { t } { 742 variable tree $t 743 744 wtree $t 745 grid $t -row 1 -column 0 -sticky "snew" 746 set f [ winfo parent $t ] 825 747 grid rowconfigure $f 1 -weight 1 826 748 grid columnconfigure $f 0 -weight 1 827 749 } 828 750 829 proc ::TolPkgGUI:: GetTree { PageOrWin} {751 proc ::TolPkgGUI::CreateTree { t } { 830 752 variable widgets 831 832 if { [ winfo exist $PageOrWin ] } { 833 set f $PageOrWin 834 } else { 835 set f [ $widgets(notebook) getframe $page ] 836 } 837 return $f.tree 838 } 839 840 proc ::TolPkgGUI::CreateRepositoryTab { } { 841 variable widgets 842 843 $widgets(notebook) insert end repos -text [ msgcat::mc Repositories ] 844 845 CreateToolBar repos 846 847 AddToolButton repos refresh \ 848 -image database_refresh_32 -text [ msgcat::mc "Refresh" ] -compound top \ 849 -command ::TolPkgGUI::Refresh 850 AddToolButton repos addrepo \ 851 -image database_add_32 -text [ msgcat::mc "Add Repository" ] -compound top 852 853 AddToolButton repos checkrepo \ 854 -image check_connection_32 -text [ msgcat::mc "Check Selected" ] -compound top 855 856 CreateTree repos 857 858 FillRepositories [ GetTree repos ] 859 } 860 861 proc ::TolPkgGUI::CreatePackagesTab { } { 862 variable widgets 863 864 $widgets(notebook) insert end pkgs -text [ msgcat::mc Packages ] 865 866 CreateToolBar pkgs 867 868 AddToolButton pkgs update \ 869 -image product_update_32 -text [ msgcat::mc "Update" ] -compound top 870 AddToolButton pkgs upgrade \ 871 -image system_upgrade_32 -text [ msgcat::mc "Upgrade" ] -compound top 872 AddToolButton pkgs remove \ 873 -image file_remove_32 -text [ msgcat::mc "Remove" ] -compound top 874 AddToolButton pkgs installzip \ 875 -image install_zip_32 -text [ msgcat::mc "Install Zip" ] -compound top 876 877 CreateTree pkgs 878 879 FillPackages [ GetTree pkgs ] 880 } 881 882 proc ::TolPkgGUI::CreateTreeInfoTab { { t treeinfo } } { 883 variable widgets 884 885 #$widgets(notebook) insert end treeinfo -text [ msgcat::mc "Tree Info" ] 886 887 CreateToolBar $t 888 889 if { 0 } { 890 AddToolButton $t refresh \ 891 -image database_refresh_32 -text [ msgcat::mc "Refresh" ] -compound top \ 892 -command ::TolPkgGUI::Refresh 893 894 AddToolButton $t addrepo \ 895 -image database_add_32 -text [ msgcat::mc "Add Repository" ] -compound top 896 897 AddToolButton $t checkrepo \ 898 -image check_connection_32 -text [ msgcat::mc "Check Selected" ] -compound top 899 900 AddToolButton $t installzip \ 901 -image install_zip_32 -text [ msgcat::mc "Install Zip" ] -compound top 902 } 903 904 CreateTree $t 905 906 FillTreeInfo [ GetTree $t ] 907 set T [ GetTree $t ] 908 menu $T.cmenu -tearoff 0 \ 909 -postcommand [ list ::TolPkgGUI::PostContextMenu $T $T.cmenu ] 910 $T configure -contextmenu $T.cmenu 753 754 CreateTreeWidget $t 755 756 menu $t.cmenu -tearoff 0 \ 757 -postcommand [ list ::TolPkgGUI::PostContextMenu $t $t.cmenu ] 758 $t configure -contextmenu $t.cmenu 911 759 } 912 760 … … 1038 886 $w add separator 1039 887 if { [ llength $listEXP ] == 1 } { 1040 $w add command -label [ mc "Export %s" [ lindex [ lindex $listEXP 0 ] 0 ] ] \888 $w add command -label [ mc "Export %s" [ lindex [ lindex $listEXP 0 ] 0 ] ]... \ 1041 889 -command [ list ::TolPkgGUI::ExportPackageVersion [ lindex $listEXP 0 ] ] 1042 890 } elseif { [ llength $listEXP ] > 1 } { 1043 $w add command -label [ mc "Export selected" ] \891 $w add command -label [ mc "Export selected" ]... \ 1044 892 -command [ list ::TolPkgGUI::ExportPackageVersion $listEXP ] 1045 893 } 1046 $w add command -label [ mc "Export all" ] \894 $w add command -label [ mc "Export all" ]... \ 1047 895 -command [ list ::TolPkgGUI::ExportPackageVersion ] 1048 896 # SyncInfo import/export … … 1062 910 1063 911 proc ::TolPkgGUI::SyncServers { } { 912 variable tree 913 update 1064 914 ::TolPkg::UpdateRepositoryInfo 915 $tree item delete all 916 FillTreeInfo $tree 1065 917 } 1066 918 … … 1097 949 } 1098 950 1099 proc ::TolPkgGUI::Clear { } {1100 foreach t "repos pkgs" {1101 set T [ GetTree $t ]1102 $T item delete all1103 }1104 }1105 1106 proc ::TolPkgGUI::Refresh { } {1107 return1108 # this must updated to new GUI1109 ::TolPkg::UpdateRepositoryInfo1110 Clear1111 FillRepositories [ GetTree repos ]1112 FillPackages [ GetTree pkgs ]1113 }1114 1115 proc ::TolPkgGUI::Create_0 { parent } {1116 variable widgets1117 1118 set w $parent1119 1120 # create the tabwindow1121 1122 set nb [ NoteBook $w.nb ]1123 set widgets(notebook) $nb1124 1125 # repository tab1126 1127 #CreateRepositoryTab1128 1129 # package tab1130 1131 #CreatePackagesTab1132 1133 # unified tab1134 1135 CreateTreeInfoTab1136 1137 # gridding1138 1139 grid $w.nb -row 0 -column 0 -sticky snew1140 grid rowconfigure $w 0 -weight 11141 grid columnconfigure $w 0 -weight 11142 1143 #$w.nb raise 01144 }1145 1146 proc ::TolPkgGUI::Create { parent } {1147 variable widgets1148 1149 set w $parent1150 1151 1152 CreateTreeInfoTab $w1153 1154 return1155 # gridding1156 1157 grid $w.nb -row 0 -column 0 -sticky snew1158 grid rowconfigure $w 0 -weight 11159 grid columnconfigure $w 0 -weight 11160 1161 #$w.nb raise 01162 }1163 1164 951 proc ::TolPkgGUI::Show { } { 1165 952 set w .tolpkg … … 1170 957 toplevel $w 1171 958 wm state $w withdrawn 1172 ::TolPkgGUI::Create $w 959 CreateTree $w.tree 960 FillTreeInfo $w.tree 1173 961 wm state $w normal 1174 962 } … … 1176 964 1177 965 proc ::TolPkgGUI::test { } { 1178 destroy .t 1179 toplevel .t 1180 ::TolPkgGUI::Create .t 966 destroy .tolpkg 967 ::TolPkgGUI::Show 1181 968 } 1182 969
Note: See TracChangeset
for help on using the changeset viewer.
