summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texlive/tlmgrgui/gui-install.pl
blob: b899f8a5623d1f4fad8a8a46b2cba7e51bdb245e (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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# guinb1.pl
# $Id$
#
# Copyright 2009 Tomasz Luczak, Norbert Preining
#
# GUI for tlmgr
#


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

# frame .back.f1.f1 -relief  ridge -borderwidth 2
our $back_f1_f1 = $back_f1->Frame(-relief => 'ridge', -borderwidth => 2);
# label .back.f1.f1.l -text "Adding packages" \
#     -foreground blue -font {helvetica 10 bold}
our $back_f1_f1_l = $back_f1_f1->Label(-text => 'Adding packages',
      -foreground => "blue", -font => "helvetica 10 bold");
# label .back.f1.f1.l1 -text "Use Ctrl or Shift or drag to select more"
our $back_f1_f1_l1 = $back_f1_f1->Label(-text => "Use Ctrl or Shift or drag to select more");
# grid .back.f1.f1 -row 1 -column 1 -columnspan 2 -padx 2m -pady 2m -sticky nwe
$back_f1_f1->grid(-row => 1, -column => 1, -columnspan => 2,
                -padx => "2m", -pady => "2m", -sticky => "nwe");
# pack .back.f1.f1.l .back.f1.f1.l1  -side top
$back_f1_f1_l->pack(-side => "top");
$back_f1_f1_l1->pack(-side => "top");


#######################     row 2 col 1
# listbox: packages
#labelframe .back.f1.f21 -text "Select packages to install"
our $back_f1_f21 = $back_f1->Labelframe(-text => "Select packages to install");
# grid .back.f1.f21 -row 2 -column 1 -rowspan 2 \
#    -sticky nswe -padx 2m -pady 1m
$back_f1_f21->grid(-row => 2, -column => 1, -rowspan => 3,
   -sticky => "nswe", -padx => "2m", -pady => "1m");


# search field
# frame .back.f1.f21.f
our $back_f1_f21_f = $back_f1_f21->Frame;
# pack .back.f1.f21.f -pady 1m
$back_f1_f21_f->pack(-pady => "1m");
# label .back.f1.f21.f.l -text "Search"
our $back_f1_f21_f_l = $back_f1_f21_f->Label(-text => "Search");
# entry .back.f1.f21.f.e -validate key -validatecommand {
#     set searchListAdd [.back.f1.f21.lb get 0 end]
#     set listPositionAdd [lsearch $searchListAdd " %P*"]
#     if {$listPositionAdd ne -1} then {
# 	.back.f1.f21.lb yview $listPositionAdd
# 	.back.f1.f21.lb selection set $listPositionAdd
#     }
#     return 1
# }
our $back_f1_f21_f_e = $back_f1_f21_f->Entry(
    -validate => "key", 
    -validatecommand => sub { validate_search_input($back_f1_f21_lb, $back_f1_f33_t, $_[0], @allpackages); });
# button .back.f1.f21.f.b -text "Next" -command {}
our $back_f1_f21_f_b = $back_f1_f21_f->Button(-text => "Next", 
      -command => sub { find_next_search_match($back_f1_f21_lb, $back_f1_f21_f_e, $back_f1_f33_t, @allpackages);  });
# pack .back.f1.f21.f.l .back.f1.f21.f.e .back.f1.f21.f.b \
#     -anchor w -side left -padx 1m -pady 1m
$back_f1_f21_f_l->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
$back_f1_f21_f_e->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");
$back_f1_f21_f_b->pack(-anchor => "w", -side => "left", -padx => "1m", -pady => "1m");

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

########################    row 2 col 3
## CD-ROM
# labelframe .back.f1.f23 -text "CD/DVD"
our $back_f1_f23 = $back_f1->Labelframe(-text => "Installation Source");
# grid .back.f1.f23 -row 2 -column 3 -sticky nswe -padx 2m -pady 1m
$back_f1_f23->grid(-row => 2, -column => 2, -sticky => "nswe", 
                   -padx => "2m", -pady => "1m");

## CD-ROM
# button .back.f1.f23.b  -text "CD/DVD" -command {}
our $back_f1_f23_b = $back_f1_f23->Button(-text => "Change", 
	-command => sub { menu_edit_location(); });
# label  .back.f1.f23.l -width 30 -textvariable dircd -relief sunken -anchor w
our $back_f1_f23_l = $back_f1_f23->Label(-width => 30, -textvariable => \$location, -relief => "sunken", -anchor => "w");
# pack .back.f1.f23.b -side left -padx 2m -pady 2m
$back_f1_f23_b->pack(-side => "left", -padx => "2m", -pady => "2m");
# pack .back.f1.f23.l -side left -padx 2m -pady 2m -expand 1 -fill x
$back_f1_f23_l->pack(-side => "left", -padx => "2m", -pady => "2m", 
                     -expand => 1, -fill => "x");


#######################     row 3 col 3
## text: info
# labelframe .back.f1.f33 -text "Info on the selected item"
our $back_f1_f33 = $back_f1->Labelframe(-text => "Info on the selected item");
# grid .back.f1.f33 -row 3 -column 3 -sticky nswe -padx 2m -pady 1m
$back_f1_f33->grid(-row => 3, -column => 2, -sticky => "nswe", 
                   -padx => "2m", -pady => "1m");



# text .back.f1.f33.t -width 65 -wrap word \
#    -yscrollcommand ".back.f1.f33.scry set" 
our $back_f1_f33_scry;
our $back_f1_f33_t = $back_f1_f33->Text(-width => 45, -wrap => "word",
    -yscrollcommand => sub { $back_f1_f33_scry->set(@_); });
# .back.f1.f33.t insert end "\nAttention. Please check if a CD drive with the TeX Live CD\n is properly selected.\n\nFirst fill in the list using the \"Search\" button, then select an item and click the \"Install\" or \"Info\" button."
#
$back_f1_f33_t->insert("end", "\nAttention. Please check if a CD drive with the TeX Live CD\n is properly selected.\n\nFirst fill in the list using the \"Search\" button, then select an item and click the \"Install\" or \"Info\" button.");

#scrollbar .back.f1.f33.scry -command ".back.f1.f33.t yview" -orient vertical
$back_f1_f33_scry = $back_f1_f33->Scrollbar(
    -command => sub { $back_f1_f33_t->yview(@_); }, -orient => "vertical");
 
# pack .back.f1.f33.scry -side right -fill y

$back_f1_f33_scry->pack(-side => "right", -fill => "y");

# pack .back.f1.f33.t  -expand 1 -fill y
$back_f1_f33_t->pack(-expand => 1, -fill => "both");

###############
our $back_f1_buttons = $back_f1->Labelframe(); ### -text => "Buttons");
$back_f1_buttons->grid(-row => 4, -column => 2, 
    -padx => "2m", -pady => "2m", -sticky => "nswe");

## Buttons
# button .back.f1.f22.b1 -text "Install" -command {}
our $back_f1_buttons_install = $back_f1_buttons->Button(-text => "Install",
  -command => sub { my @l = $back_f1_f21_lb->curselection;
                    my @pl;
                    foreach my $i (@l) {
                      my $foo = $allpackages[$i];
                      $foo =~ s/^\s*(\(i\) )?//;
                      push @pl, $foo;
                    }
                    install_selected_packages(@pl); });
$back_f1_buttons_install->pack(-expand => 1, -fill => "both",
                               -padx => "2m", -pady => "2m");

###############

sub menu_edit_location {
  my $key = shift;
  my $val = $location;
  my $sw = $mw->Toplevel(-title => "Change Location");
  $sw->Label(-text => "New location: ")->pack;
  my $entry = $sw->Entry(-text => $location, -width => 30);
  $entry->pack;
  my $f = $sw->Frame;
  $f->Button(-text => 'ok', 
    -command => sub { $location = $entry->get;
                      init_install_media($location) ; 
		      $sw->destroy })->pack(-side => 'left');
  $f->Button(-text => 'cancel', 
          -command => sub { $sw->destroy })->pack(-side => 'right');
  $f->pack(-expand => 'x');
}


1;

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