chiark / gitweb /
Privacy control UI
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 21 Jun 2009 18:22:25 +0000 (19:22 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sun, 21 Jun 2009 18:22:25 +0000 (19:22 +0100)
pctb/README.privacy
pctb/convert.c
pctb/dictionary-manager
pctb/structure.c
pctb/x.gdb

index 70cd93aca907ff26513fb779e66e8fd217002089..a59a2ada9910883119100ca0fc5581575241fd90 100644 (file)
@@ -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
 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
 
 Having said all that, please do not upload data to the PCTB server
 without also participating in dictionary sharing.  If you don't update
index 2685e879c8d43c5ed409303945080c7e0fe48eb4..70b4769fe41d74b3539d99be65abb337fc7e2658 100644 (file)
@@ -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) );
       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();
   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();
     }
   }
     default: abort();
     }
   }
+  progress_log("Finished.");
   return 0;
 }
 
   return 0;
 }
 
index 49156adc1786115c5f432e6f54c46e47d8eddd58..c2ea2b59f5b371fe99d72de6afa30b27123c468b 100755 (executable)
@@ -85,8 +85,13 @@ proc init_widgets {} {
     global csrh gotsh ctxh
 
     if {[winfo exists .d]} return
     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
 
     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
     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
     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 {} {
 }
 
 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
        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
            incr x
        }
        incr y
@@ -349,7 +355,8 @@ proc required/pixmap {} {
     place forget .d.mi.csr_1
 
     pack forget .d.csr .d.got
     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 {
 
     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 {
     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 ==========
 }
 
 #========== 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 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 {
     } else {
-       bind_key Tab {}
+       bind_key BackSpace {}
     }
     bind_key Return {
        if {$cur_0 != $cur_1} {
     }
     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)}}
        {{<- ->}   {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}}
     }
 }
        {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 {}
     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_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] \
     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}}
     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}}
     }
 }
        {Q         {quit and abandon OCR run}}
     }
 }
@@ -1066,5 +1122,4 @@ if {$debug} {
 }
 set argv [lrange $argv $ai end]
 
 }
 set argv [lrange $argv $ai end]
 
-debug [exec printenv]
 main/$mainkind
 main/$mainkind
index 97cbb0739473e0e2fcdc5fb5609a973dd438c1c8..35cf0d9507da3335dbe47df403e9992808bc8e85 100644 (file)
@@ -470,7 +470,7 @@ void analyse(FILE *tsv_output) {
     if (!rd)
       rd= ocr_init(text_h);
 
     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);
 
     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));
     }
   }
       sysassert(!fflush(tsv_output));
     }
   }
+  progress("Commodity table scan complete.");
 }
 
 //static Rect islandnamer;
 }
 
 //static Rect islandnamer;
index 86aca3dd9a68bcfb1effc37f1dc7d5ab5ec419eb..c6d2387b18f1795ee0911cec77dc07c6bc650922 100644 (file)
@@ -1,5 +1,5 @@
 file ypp-commodities
 set confirm off
 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
 run