X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;ds=sidebyside;f=pctb%2Fdictionary-manager;h=c2ea2b59f5b371fe99d72de6afa30b27123c468b;hb=f8488ba218ce448dc5c02c8d83e85b6c551332eb;hp=49156adc1786115c5f432e6f54c46e47d8eddd58;hpb=0487d41d9c7796c6efebb8235c9aa39fe580ccf9;p=ypp-sc-tools.web-live.git diff --git a/pctb/dictionary-manager b/pctb/dictionary-manager index 49156ad..c2ea2b5 100755 --- a/pctb/dictionary-manager +++ b/pctb/dictionary-manager @@ -85,8 +85,13 @@ proc init_widgets {} { global csrh gotsh ctxh if {[winfo exists .d]} return + + frame .privacy -bd 2 -relief groove + pack .privacy -side top -padx 2 -pady 2 -fill x + + upload_init_widgets - frame .d + frame .d -bd 2 -relief groove -pady 2 -padx 2 image create bitmap image/main label .d.mi -image image/main -borderwidth 0 @@ -112,14 +117,15 @@ static unsigned char csr_bits[] = { frame .d.mi.csr_1 -bg white -width 1 frame .d.pe frame .d.pe.grid + button .d.pe.ok -text OK pack .d.pe.grid .d.pe.ok -side left pack .d.mi .d.ctx -side top - pack .d + pack .d -fill x -padx 2 -pady 2 - frame .help - pack .help + frame .help -bd 2 -relief groove + pack .help -pady 2 -padx 2 } proc resize_widgets_core {} { @@ -143,7 +149,7 @@ proc helptext {t} { set x 0; foreach c $l { set w .help.at${x}x${y} label $w -text $c - grid $w -row $y -column $x -padx 5 + grid $w -row $y -column $x -padx 5 -sticky w incr x } incr y @@ -349,7 +355,8 @@ proc required/pixmap {} { place forget .d.mi.csr_1 pack forget .d.csr .d.got - pack .d.pe -side top -before .d.mi -pady 10 + pack .d.pe -side top -before .d.mi -pady 2 + #-pady 2 -fill x eval destroy [winfo children .d.pe.grid] set col 0; foreach {colname coldesc rows} $alloptions { @@ -368,8 +375,58 @@ proc required/pixmap {} { pixmap_maybe_ok helptext { - {{Indicate the correct parse of this image, and click OK.}} + {{Indicate the meaning of this image, and click OK.}} + } +} + +#========== UPLOADS TO DICTIONARY SERVER ========== + +proc upload_init_widgets {} { + global privacy_setting + + set privacy_setting [upload_status] + + label .privacy.warn -text " Privacy " + if {$privacy_setting} { + .privacy.warn configure -background yellow -foreground black } + label .privacy.overall -text " Upload new dictionary entry:" + label .privacy.reference -text " See README.privacy." + + pack .privacy.warn .privacy.overall -side left + + foreach {setting string} { + 0 {No} + 1 {Yes, anonymously} + 2 {Yes, quoting my pirate name.} + } { + radiobutton .privacy.o$setting -text $string \ + -value $setting -variable privacy_setting + pack .privacy.o$setting -side left + if {$setting > $privacy_setting} { + .privacy.o$setting configure -state disabled + } + } + pack .privacy.reference -side left + + if {!$privacy_setting} { + foreach w [winfo children .privacy] { + $w configure -state disabled + } + } +} + +proc upload_status {} { + # returns 0, 1, 2 for none, anon, with pirate name + global env + + if {![info exists env(YPPSC_PCTB_DICT_SUBMIT)]} { debug a; return 0 } + if {![string compare 0 $env(YPPSC_PCTB_DICT_SUBMIT)]} { debug b; return 0 } + + if {![info exists env(YPPSC_PIRATE)]} { return 1 } + if {![string length $env(YPPSC_PIRATE)]} { return 1 } + + return 2 } #========== CHARACTER SET ========== @@ -531,9 +588,9 @@ proc recursor//01 {z1} { bind_key space { othercursor } bind_leftright_q cur_$z1 0 [expr {$cols-1}] if {[llength $glyphsdone]} { - bind_key Tab { set cur_mode already; recursor } + bind_key BackSpace { set cur_mode already; recursor } } else { - bind_key Tab {} + bind_key BackSpace {} } bind_key Return { if {$cur_0 != $cur_1} { @@ -546,7 +603,7 @@ proc recursor//01 {z1} { {{<- ->} {move cursor, adjusting area to define}} {Space {switch to moving other cursor}} {Return {confirm location, enter letter(s)}} - {Tab {switch to correcting earlier ocr}} + {Backspace {switch to correcting earlier ocr}} {Q {quit and abandon OCR run}} } } @@ -588,9 +645,8 @@ proc recursor/already {} { set rmax [lindex $glyphsdone [expr {$cur_already*4}]] place .d.csr.csr -x [expr {$rmax*$mul-3}] bind_key Return {} - bind_key space {} bind_leftright_q cur_already 0 [expr {[llength $glyphsdone]/4-1}] - bind_key Tab { bind_key Delete {}; set cur_mode 1; recursor } + bind_key space { bind_key Delete {}; set cur_mode 1; recursor } bind_key Delete { RETURN_RESULT DELETE [lrange $glyphsdone \ [expr $cur_already*4] \ @@ -599,7 +655,7 @@ proc recursor/already {} { helptext { {{<- ->} {move cursor, selecting glyph to correct}} {Del {clear this glyph from the recognition database}} - {Tab {switch to selecting area to define as new glyph}} + {Space {switch to selecting area to define as new glyph}} {Q {quit and abandon OCR run}} } } @@ -1066,5 +1122,4 @@ if {$debug} { } set argv [lrange $argv $ai end] -debug [exec printenv] main/$mainkind