📄 tknl.tcl
字号:
.hintline.status configure -text "Get Newton notes for Xrolodex file"}bind .top.xrolo <Leave> { .hintline.status configure -text ""} button .top.plan -text "Plan" -image $plan_img \ -width 20 -height 20 -command {Run $plan}bind .top.plan <Motion> { .hintline.status configure -text "Get Newton dates for Plan file"}bind .top.plan <Leave> { .hintline.status configure -text ""}button .top.print -text "Print" -image $print_img \ -width 20 -height 20 -command {Run $pr}bind .top.print <Motion> { .hintline.status configure -text "Get Newton outbox entrys for printing"}bind .top.print <Leave> { .hintline.status configure -text ""}button .top.fax -text "Fax" -image $fax_img \ -width 20 -height 20 -command {Run $fax}bind .top.fax <Motion> { .hintline.status configure -text "Get Newton outbox entrys for faxing"}bind .top.fax <Leave> { .hintline.status configure -text ""}button .top.kjots -text "Kjots" -image $kjots_img \ -width 20 -height 20 -command {Run $kjots}bind .top.kjots <Motion> { .hintline.status configure -text "Get Newton notes for Kjots file"}button .top.xfadr -text "XfAddr" -image $xfadr_img \ -width 20 -height 20 -command {Run $xfadr}bind .top.xfadr <Motion> { .hintline.status configure -text "Get Newton card entrys for Xfmail addressbook"}bind .top.xfadr <Leave> { .hintline.status configure -text ""}button .top.send -text "Send file" -image $send_img \ -width 20 -height 20 -command {Runf $send}bind .top.send <Motion> { .hintline.status configure -text "Send file to Newton"}bind .top.send <Leave> { .hintline.status configure -text ""}button .top.getpnam -text "Get Packackage Names" -image $getpnam_img \ -width 20 -height 20 -command {Run $getpnam}bind .top.getpnam <Motion> { .hintline.status configure -text "Get Newton package names"}bind .top.getpnam <Leave> { .hintline.status configure -text ""}button .top.mail -text "Mail" -image $mail_img \ -width 20 -height 20 -command {Run $mail}bind .top.mail <Motion> { .hintline.status configure -text "Get Newton outbox entrys for email"}bind .top.mail <Leave> { .hintline.status configure -text ""}button .top.inst -text "Install" -image $inst_img \ -width 20 -height 20 -command {Runf $inst}bind .top.inst <Motion> { .hintline.status configure -text "Install Newton package"}bind .top.inst <Leave> { .hintline.status configure -text ""}button .top.lpkg -text "Lpkg" -image $lpkg_img \ -width 20 -height 20 -command {Runf $lpkg}bind .top.lpkg <Motion> { .hintline.status configure -text "Install Newton package (using lpkg)"}bind .top.lpkg <Leave> { .hintline.status configure -text ""}button .top.help -text "Help" -image $help_img \ -width 20 -height 20 -command {Run $onlinehelp}bind .top.help <Motion> { .hintline.status configure -text "Get help for Newtonlink"}bind .top.help <Leave> { .hintline.status configure -text ""}button .top.quit -text "Quit" -image $quit_img \ -width 20 -height 20 -command exitbind .top.quit <Motion> { .hintline.status configure -text "Quit Newtonlink"}bind .top.quit <Leave> { .hintline.status configure -text ""}pack \ .top.update \ .top.adr \ .top.nsadr \ .top.xfadr \ .top.webadr \ .top.ksendfax \ .top.xrolo \ .top.kjots \ .top.plan \ .top.fax \ .top.print \ .top.nsmail \ .top.mail \ .top.inst \ .top.lpkg \ .top.getpnam \ .top.send \ .top.help \ .top.quit \ -side left################################################### ## Create a text widget to log the output ## ###################################################frame .tset log [text .t.log -width 80 -height 20 \ -borderwidth 2 -relief flat -bg black -fg white -setgrid true\ -yscrollcommand {.t.scroll set}]scrollbar .t.scroll -command {.t.log yview}pack .t.scroll -side right -fill ypack .t.log -side left -fill both -expand truepack .t -side top -fill both -expand true################################################### ## Create the hint status line ## ###################################################frame .hintlinelabel .hintline.status -relief sunken -text ""pack .hintline.status -fill x -pady 1mpack .hintline -side top -fill x################################################### ## Run the program and arrange to read its input ## ###################################################proc Run {cmd} { global input log . config -cursor watch disableButtons if [catch {open "|newtonlink $cmd |& cat"} input] { $log insert end $input\n } else { fileevent $input readable Log $log insert end "Newtonlink $cmd\n" }}################################################### ## Run the program, but ask for a file first and ## arrange to read its input ## ###################################################proc Runf {cmd} { global input log set types { {{All Files} * } {{Package Files} {.pkg} } {{Text Files} {.txt} } {{HTML files} {.html} } {{Sloup Files} {.slp} } {{Newt Files} {.nwt} } {{Bitmap Files} {.bit} } {{Sound File} {.snd} } } set file [tk_getOpenFile -filetypes $types -title "Choose a File..."] if {$file == {}} { tk_messageBox -type ok -message "You did not select a file." -icon info return } . config -cursor watch disableButtons if [catch {open "|newtonlink $cmd $file |& cat"} input] { $log insert end $input\n } else { fileevent $input readable Log $log insert end "Newtonlink $cmd\n" }}################################################### ## Read and log output from the program ## ###################################################proc Log {} { global input log if [eof $input] { Stop } else {# gets $input line set line [read $input 1 ] $log insert end $line $log see end }}################################################### ## Stop the program and fix up the button ## ###################################################proc Stop {} { global input but catch {close $input} . configure -cursor arrow enableButtons}################################################### ## enableButtons ## ###################################################proc enableButtons {} { .top.update configure -state normal .top.fax configure -state normal .top.print configure -state normal .top.plan configure -state normal .top.xrolo configure -state normal .top.adr configure -state normal .top.nsmail configure -state normal .top.nsadr configure -state normal .top.webadr configure -state normal .top.ksendfax configure -state normal .top.kjots configure -state normal .top.xfadr configure -state normal .top.mail configure -state normal .top.inst configure -state normal .top.lpkg configure -state normal .top.getpnam configure -state normal .top.send configure -state normal .top.help configure -state normal .top.quit configure -state normal .menubar.filem configure -state normal .menubar.update configure -state normal .menubar.cards configure -state normal .menubar.notes configure -state normal .menubar.dates configure -state normal .menubar.outbox configure -state normal .menubar.mail configure -state normal .menubar.install configure -state normal .menubar.misc configure -state normal}################################################### ## disableButtons ## ###################################################proc disableButtons {} { .top.update configure -state disabled .top.fax configure -state disabled .top.print configure -state disabled .top.plan configure -state disabled .top.xrolo configure -state disabled .top.adr configure -state disabled .top.nsmail configure -state disabled .top.nsadr configure -state disabled .top.webadr configure -state disabled .top.ksendfax configure -state disabled .top.kjots configure -state disabled .top.xfadr configure -state disabled .top.mail configure -state disabled .top.inst configure -state disabled .top.lpkg configure -state disabled .top.getpnam configure -state disabled .top.send configure -state disabled .top.help configure -state disabled .top.quit configure -state disabled .menubar.filem configure -state disabled .menubar.update configure -state disabled .menubar.cards configure -state disabled .menubar.notes configure -state disabled .menubar.dates configure -state disabled .menubar.outbox configure -state disabled .menubar.mail configure -state disabled .menubar.install configure -state disabled .menubar.misc configure -state disabled}################################################### ## Select Preferences Box ## ###################################################proc SelectPreferences {} { toplevel .selectPreferences wm title .selectPreferences "Select Newtonlink preferences" label .selectPreferences.ab-label -text "Addressbook File :" entry .selectPreferences.ab-entry -width 20 -relief sunken -bd 2 -textvariable AddressbookFile pack .selectPreferences.ab-label .selectPreferences.ab-entry -side left set AddressbookFile home button .selectPreferences.ok -text OK -command exit pack .selectPreferences.ok -side bottom}################################################### ## Get Packages and list ## ###################################################proc getpackage {} { #Run {-getpnam} toplevel .getpackage wm title .getpackage "Newtonlink - Get package" label .getpackage.label -text "Select Newton package to upload" pack .getpackage.label -side top -fill x listbox .getpackage.packages -relief sunken -borderwidth 2 -yscrollcommand ".getpackage.scroll set" pack .getpackage.packages -side left -fill both -expand 1 scrollbar .getpackage.scroll -command ".getpackage.packages yview" pack .getpackage.scroll -side right -fill y set Datei [open /home/e1l52/.newtonlink/newtonlink.packagenames] while {[gets $Datei Zeile] >= 0} { .getpackage.packages insert end [lrange $Zeile 0 end] } close $Datei bind .getpackage.packages <Double-Button-1> { .getpackage.packages configure -background [selection get] } #button .getpackage.ok -text OK -command exit #pack .getpackage.ok -side bottom}################################################### ## Box -- produce info on tknl ## ###################################################proc aboutBox {} { global PREFIX #Reinhold Schoeb, Frank Scholz, Andrew Maier, Gerald Hofer" set top [toplevel .about] wm title $top "About Newtonlink" $top configure -background white set ok [button .about.ok -text "Ok" -command {destroy .about}] set pict_img [image create photo -file $PREFIX/icons/about.gif] set pict [label .about.pict -width 500 -height 400 -image $pict_img] pack .about.pict .about.ok -side top}################################################### ## Box -- currently not implemented ## ###################################################proc notImplementedBox {} { set notImplemented [toplevel .notImplemented] wm title $notImplemented "Not implemented" message .notImplemented.message -width 8c -justify center -text "Sorry, option currently not implemented" set ok [button .notImplemented.ok -text "Ok" -command {destroy .notImplemented}] pack .notImplemented.message .notImplemented.ok -side top}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -