summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texlive/tlmgrgui/gui-remove.pl
blob: 9a2c881108054556b2367d89e2dae2a888b6bcce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# guinb2.pl
# $Id$
# 
# Copyright 2009 Tomasz Luczak, Norbert Preining
#
# GUI for tlmgr
#

our $b2 = $top->Button(-text => "Removing packages",
              -command => sub { 
                                foreach my $f (keys %screens) {
                                  $screens{$f}->packForget
                                    unless ($screens{$f} eq $back_f2);
                                }
                                $back_f2->pack;
                              });

$b2->pack(-side => 'left');

our $back_f2 = $back->Frame;
$screens{"remove"} = $back_f2;

#######################     row 1

# frame .back.f2.f1 -relief  ridge -borderwidth 2
our $back_f2_f1 = $back_f2->Frame(-relief => "ridge", -borderwidth => 2);
# label .back.f2.f1.l -text "Removing packages" \
#     -foreground blue -font {helvetica 10 bold}
$back_f2_f1_l = $back_f2_f1->Label(-text => "Removing packages",
    -foreground => "blue", -font => "helvetica 10 bold");
# label .back.f2.f1.l1 -text "Use Ctrl or Shift or drag to select more"
our $back_f2_f1_l1 = $back_f2_f1->Label(-text => "Use Ctrl or Shift or drag to select more");

# grid .back.f2.f1 -row 1 -column 1 -columnspan 3 -padx 2m -pady 2m -sticky nwe
$back_f2_f1->grid(-row => 1, -column => 1, -columnspan => 3, 
                   -padx => "2m", -pady => "2m", -sticky => "nwe");
# pack .back.f2.f1.l .back.f2.f1.l1 -side top
$back_f2_f1_l->pack(-side => "top");
$back_f2_f1_l1->pack(-side => "top"); 

#######################     row 2 col 1
# list of packages
# labelframe .back.f2.f21 -text "Select packages for removal"
our $back_f2_f21 = $back_f2->Labelframe(-text => "Select packages for removal");
$back_f2_f21->grid(-row => 2, -column => 1, -sticky => "nswe",
                   -rowspan => 2, -padx => "2m", -pady => "1m");
# search field
# frame .back.f2.f21.f
our $back_f2_f21_f = $back_f2_f21->Frame();
# pack .back.f2.f21.f -pady 1m
$back_f2_f21_f->pack(-pady => "1m");
# label .back.f2.f21.f.l -text "Search"
our $back_f2_f21_f_l = $back_f2_f21_f->Label(-text => "Search");
# entry .back.f2.f21.f.e -validate key -validatecommand {
#     set searchListRm [.back.f2.f21.lb get 0 end]
#     set listPositionRm [lsearch $searchListRm " %P*"]
#     if {$listPositionRm ne -1} then {
# 	.back.f2.f21.lb yview $listPositionRm
# 	.back.f2.f21.lb selection set $listPositionRm
#     }
#     return 1
# }
our $back_f2_f21_f_e = $back_f2_f21_f->Entry(
    -validate => "key", 
    -validatecommand => sub { validate_search_input($back_f2_f21_lb, $back_f2_f23_t, $_[0], @alllocalpackages); } );
# button .back.f2.f21.f.b -text "Next" -command {}
our $back_f2_f21_f_b = $back_f2_f21_f->Button(-text => "Next", 
           -command => sub { find_next_search_match($back_f2_f21_lb, $back_f2_f21_f_e, $back_f2_f23_t, @alllocalpackages); });
# pack  .back.f2.f21.f.l .back.f2.f21.f.e .back.f2.f21.f.b -anchor w -side left -padx 1m -pady 1m
$back_f2_f21_f_l->pack(-anchor => "w", -side => "left", 
                       -padx => "1m", -pady => "1m");
$back_f2_f21_f_e->pack(-anchor => "w", -side => "left", 
                       -padx => "1m", -pady => "1m");
$back_f2_f21_f_b->pack(-anchor => "w", -side => "left", 
                       -padx => "1m", -pady => "1m");

# listbox .back.f2.f21.lb -width 40 -height 24 \
#     -selectmode extended \
#     -yscrollcommand ".back.f2.f21.scry set"  \
#     -xscrollcommand ".back.f2.f21.scrx set"
our $back_f2_f21_scry;
our $back_f2_f21_scrx;
our $back_f2_f21_lb = $back_f2_f21->Listbox(-width => 30, -height => 24,
    -listvariable => \@alllocalpackages,
    -selectmode => "extended",
    -yscrollcommand => sub { $back_f2_f21_scry->set(@_); },
    -xscrollcommand => sub { $back_f2_f21_scrx->set(@_); });
$back_f2_f21_lb->bind('<<ListboxSelect>>',
  sub { update_info_window ($back_f2_f21_lb, $back_f2_f23_t, @alllocalpackages); });
# scrollbar .back.f2.f21.scrx -command ".back.f2.f21.lb xview" -orient horizontal 
$back_f2_f21_scrx = $back_f2_f21->Scrollbar(
   -command => sub { $back_f2_f21_lb->xview(@_); }, -orient => "horizontal"); 
# scrollbar .back.f2.f21.scry -command ".back.f2.f21.lb yview" -orient vertical
$back_f2_f21_scry = $back_f2_f21->Scrollbar(
   -command => sub { $back_f2_f21_lb->yview(@_); }, -orient => "vertical"); 
# pack .back.f2.f21.scrx -side bottom -fill x
# pack .back.f2.f21.scry -side right -fill y
# pack .back.f2.f21.lb -fill y  -expand 1
$back_f2_f21_scrx->pack(-side => "bottom", -fill => "x");
$back_f2_f21_scry->pack(-side => "right", -fill => "y");
$back_f2_f21_lb->pack(-fill => "y", -expand => 1);


#######################     row 2 col 3
# text: info
# labelframe .back.f2.f23 -text "Info on the selected item"
our $back_f2_f23 = $back_f2->Labelframe(-text => "Info on the selected item");
$back_f2_f23->grid(-row => 2, -column => 2, -sticky => "nswe",
                   -padx => "2m", -pady => "1m",
                   -ipadx => "2m", -ipady => "2m");
# set f323 .back.f2.f23
# text $f323.t -width 65 -wrap word \
#     -yscrollcommand "$f323.scry set"  
our $back_f2_f23_scry;
our $back_f2_f23_t = $back_f2_f23->Text(-width => 45, -wrap => "word",
     -yscrollcommand => sub { $back_f2_f23_scry->set(@_); } );
# $f323.t insert end "\nAttention: to display package information, the CD drive with the TeX Live CD should be selected in the \"Add packages\" tab.\n\nFirst fill in the list using the \"Search\" button, then select an item and click the \"Remove\" button to remove the package."
$back_f2_f23_t->insert("end", "\nAttention: to display package information, the CD drive with the TeX Live CD should be selected in the \"Add packages\" tab.\n\nFirst fill in the list using the \"Search\" button, then select an item and click the \"Remove\" button to remove the package.");
# scrollbar $f323.scry -command "$f323.t yview" -orient vertical
$back_f2_f23_scry = $back_f2_f23->Scrollbar( 
  -command => sub { $back_f2_f23_t->yview(@_); }, -orient => "vertical");
# pack $f323.scry -side right -fill y
$back_f2_f23_scry->pack(-side => "right", -fill => "y");
# pack $f323.t -expand 1 -fill both
$back_f2_f23_t->pack(-expand => 1, -fill => "both");

######################
# buttons
# labelframe .back.f2.f22 -text "Buttons"
our $back_f2_buttons = $back_f2->Labelframe(); ### -text => "Buttons");
$back_f2_buttons->grid(-row => 3, -column => 2, -sticky => "nswe", 
                       -padx => "2m", -pady => "2m");

our $back_f2_buttons_b1 = $back_f2_buttons->Button(-text => "Remove", 
  -command => sub { my @l = $back_f2_f21_lb->curselection;
                    my @pl;
                    foreach my $i (@l) {
                      my $foo = $alllocalpackages[$i];
                      $foo =~ s/^\s*(\(i\) )?//;
                      push @pl, $foo;
                    }
                    remove_selected_packages(@pl); });
$back_f2_buttons_b1->pack(-side => "top", -anchor => "center", -padx => "2m", -pady => "2m", -expand => 1, -fill => "both");


# EOF
### Local Variables:
### perl-indent-level: 2
### tab-width: 2
### indent-tabs-mode: nil
### End:
# vim:set tabstop=2 expandtab: #