summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2018-01-16 20:36:22 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2018-01-16 20:36:22 +0000
commit9400805c5dcd35ebc3b3d859f5abd716efef3522 (patch)
tree0186c77980095f84265f77922b6fd3e7a0f03180 /Master/texmf-dist/scripts
parent32c7220a14f732eb69a73a326a9747170685bc86 (diff)
Tlshell: added generate... actions
git-svn-id: svn://tug.org/texlive/trunk@46330 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-xMaster/texmf-dist/scripts/tlshell/tlshell.tcl56
1 files changed, 47 insertions, 9 deletions
diff --git a/Master/texmf-dist/scripts/tlshell/tlshell.tcl b/Master/texmf-dist/scripts/tlshell/tlshell.tcl
index 0751d3b2d0e..dbc3ea73ed3 100755
--- a/Master/texmf-dist/scripts/tlshell/tlshell.tcl
+++ b/Master/texmf-dist/scripts/tlshell/tlshell.tcl
@@ -163,8 +163,11 @@ proc place_dlg {wnd {p ""}} {
wm state $wnd normal
raise $wnd $p
tkwait visibility $wnd
- focus $wnd
- grab set $wnd
+ if {$::tcl_platform(platform) ne "windows"} {
+ # dont understand why these give trouble in windows
+ focus $wnd
+ grab set $wnd
+ }
} ; # place_dlg
proc long_message {str type {p "."}} {
@@ -518,7 +521,7 @@ proc log_widget_cb {mode {l ""}} {
.tllg.log.tx configure -state normal
.tllg.log.tx insert end "$l\n"
if {$::tcl_platform(os) ne "Darwin"} {
- .tllg.err.tx configure -state disabled
+ .tllg.log.tx configure -state disabled
}
} elseif {$mode eq "init"} {
show_logs
@@ -1761,6 +1764,38 @@ proc set_paper {p} {
run_cmd "paper paper $p" log_widget_cb
}
+##### running external commands #####
+
+# For capturing an external command, we need a separate output channel,
+# but we reuse ::out_log.
+# stderr is bundled with stdout so ::err_log should stay empty.
+proc read_capt {} {
+ set l "" ; # will contain the line to be read
+ if {([catch {chan gets $::capt l} len] || [chan eof $::capt])} {
+ catch {chan close $::capt}
+ log_widget_cb "finish"
+ set ::done_waiting 1
+ } elseif {$len >= 0} {
+ lappend ::out_log $l
+ log_widget_cb "line" $l
+ }
+}; # read_capt
+
+proc run_external {cmd mess} {
+ set ::out_log {}
+ set ::err_log {}
+ lappend ::out_log $mess
+ unset -nocomplain ::done_waiting
+ # dont understand why, on windows, start_tlmgr does not trigger
+ # a console window but this proc does
+ if [catch {open "|$cmd 2>&1" "r"} ::capt] {
+ tk_messageBox -message "Failure to launch $cmd"
+ }
+ chan configure $::capt -buffering line -blocking 0
+ chan event $::capt readable read_capt
+ log_widget_cb "init"
+}
+
##### main window #####
proc make_widgets {} {
@@ -1802,6 +1837,7 @@ proc make_widgets {} {
-command {get_packages_info_remote; collect_filtered}
.mn.file add command -command {destroy .} -label "Exit" -underline 1
+ # inx: keeping count where needed, i.e. when an entry needs to be referenced
.mn add cascade -label "Packages" -menu .mn.pkg
menu .mn.pkg
set inx 0
@@ -1825,9 +1861,14 @@ proc make_widgets {} {
-command restore_backups_dialog
}
- #.mn add cascade -label "Actions" -menu .mn.act -underline 0
- #menu .mn.act
- #set inx 0
+ .mn add cascade -label "Actions" -menu .mn.act -underline 0
+ menu .mn.act
+ .mn.act add command -label "Regenerate filename database" -command \
+ {run_external "mktexlsr" "Regenerating filename database..."}
+ .mn.act add command -label "Regenerate formats" -command \
+ {run_external "fmtutil-sys --all" "Rebuilding formats..."}
+ .mn.act add command -label "Regenerate fontmaps" -command \
+ {run_external "updmap-sys" "Rebuilding fontmap files..."}
.mn add cascade -label "Options" -menu .mn.opt -underline 0
menu .mn.opt
@@ -1846,9 +1887,6 @@ proc make_widgets {} {
.mn.opt add command -label "Platforms..." -command platform_select
}
- #.mn add cascade -label "Actions" -menu .mn.act -underline 0
- #menu .mn.act
-
.mn add cascade -label "Help" -menu .mn.help -underline 0
menu .mn.help
.mn.help add command -command {tk_messageBox -message "Helpless"} \