From: Ian Jackson Date: Sun, 21 Jun 2009 18:22:25 +0000 (+0100) Subject: Privacy control UI X-Git-Tag: 1.9.2~103 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=commitdiff_plain;h=f8488ba218ce448dc5c02c8d83e85b6c551332eb Privacy control UI --- diff --git a/pctb/README.privacy b/pctb/README.privacy index 70cd93a..a59a2ad 100644 --- a/pctb/README.privacy +++ b/pctb/README.privacy @@ -76,9 +76,9 @@ User interface for privacy The dictionary submission feature, and whether to quote your pirate identity, is exposed in and controllable from the dictionary update GUI, for maximum visibility. The settings in the GUI are not recorded -anywhere from one run to the next; instead the initial settings in the -GUI come from the --dict-* privacy options. See the table of options -in the README for details. +anywhere from one run to the next. If you want to consistently +increase your privacy setting, use the --dict-* privacy options. +See the table of options in the README for details. Having said all that, please do not upload data to the PCTB server without also participating in dictionary sharing. If you don't update diff --git a/pctb/convert.c b/pctb/convert.c index 2685e87..70b4769 100644 --- a/pctb/convert.c +++ b/pctb/convert.c @@ -262,9 +262,10 @@ int main(int argc, char **argv) { badusage("need --ocean option when replaying images" " (consider supplying --pirate too)"); sysassert(! setenv("YPPSC_OCEAN",ocean,1) ); - if (pirate && (o_flags & ff_dict_pirate)) - sysassert(! setenv("YPPSC_PIRATE",pirate,1) ); } + if (pirate && (o_flags & ff_dict_pirate)) + sysassert(! setenv("YPPSC_PIRATE",pirate,1) ); + if (o_mode & mf_screenshot) { open_screenshot_file("w"); if (o_flags & ff_singlepage) take_one_screenshot(); @@ -288,6 +289,7 @@ int main(int argc, char **argv) { default: abort(); } } + progress_log("Finished."); return 0; } 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 diff --git a/pctb/structure.c b/pctb/structure.c index 97cbb07..35cf0d9 100644 --- a/pctb/structure.c +++ b/pctb/structure.c @@ -470,7 +470,7 @@ void analyse(FILE *tsv_output) { if (!rd) rd= ocr_init(text_h); - progress("OCRing page %d...",page); + progress("Scanning page %d...",page); for (tryrect= +cim->h; tryrect >= -cim->h; tryrect--) { find_commodity(tryrect, &thisr); @@ -494,6 +494,7 @@ void analyse(FILE *tsv_output) { sysassert(!fflush(tsv_output)); } } + progress("Commodity table scan complete."); } //static Rect islandnamer; diff --git a/pctb/x.gdb b/pctb/x.gdb index 86aca3d..c6d2387 100644 --- a/pctb/x.gdb +++ b/pctb/x.gdb @@ -1,5 +1,5 @@ file ypp-commodities set confirm off -set args --same --raw-tsv >raw.tsv -break ocr_init +set args -Dcallout --ocean midnight --pirate aristarchus --same --raw-tsv >raw.tsv +break convert.c:260 run