chiark / gitweb /
WIP commod-update-receiver testing - seems to work
[ypp-sc-tools.db-live.git] / pctb / dictionary-manager
index ad05c6b1760b343571a1bb3b052b57f17c2b8f82..5501765992e14e21953238e4fce7724a4801bc32 100755 (executable)
@@ -94,6 +94,13 @@ proc bgerror {m} {
     exit 16
 }
 
+proc execpnm_createphoto {photoname args} {
+    set tmpfile ./_dictimage.tmp
+    eval exec $args > $tmpfile
+    image create photo $photoname -file $tmpfile
+    file delete $tmpfile
+}
+
 #---------- display core ----------
 
 set mul 6
@@ -250,7 +257,7 @@ proc write_database {} {
 proc select_database {dbname_spec} {
     global dbname
     set dbname $dbname_spec
-    read_database "./#local-$dbname#.txt"
+    read_database "./_local-$dbname.txt"
 }
 
 proc do_database_update {im def} {
@@ -422,8 +429,7 @@ proc required/pixmap {} {
        if {![string length $ppml]} break
        append ppm $ppml "\n"
     }
-    set data [exec pnmscale 2 << $ppm]
-    image create photo image/main -data $data
+    execpnm_createphoto image/main  pnmscale 2 << $ppm
 
     set alloptions [exec ./database-info-fetch $unk_what]
 
@@ -700,11 +706,9 @@ proc char_read_pgm {f} {
        append o $ointerl
     }
 
-    debug "DATA1 $o"
-    set tmpfile ./#dictimage#.tmp
-    exec pnmscale 1 << $o >$tmpfile
-    image create photo image/main -file $tmpfile
-    file delete $tmpfile
+#    debug "DATA1 $o"
+
+    execpnm_createphoto image/main  pnmscale 1 << $o
 }
 
 #---------- character set editor display ----------
@@ -1064,9 +1068,14 @@ proc remote-serv/take {yesno file dict} {
     manyset [dict2_reqkind_rows $dict] reqkind rows
     
     if {$yesno} {
-       read_database $dictdir/master-$dict.txt
+       set fnbase $dictdir/master-$dict.txt
+       read_database $fnbase
        set database($key) $val
        write_database
+
+       exec gzip --rsyncable -7 < $fnbase > $fnbase.gz.new
+       exec mv -f -- $fnbase.gz.new $fnbase.gz
+
        set desc approve
     } else {
        set desc reject
@@ -1203,9 +1212,7 @@ proc approve_showentry {ix file specdata} {
        set image [exec pgmtoppm {#008-white} << $image | pnmnoraw]
        append image "\n"
     }
-    set image [exec pnmscale 2 << $image]
-
-    image create photo approve/$ix -data $image
+    execpnm_createphoto approve/$ix  pnmscale 3 << $image
     label $wb-image -image approve/$ix -bd 2 -relief flat -bg black
 
     manyset [dict2_reqkind_rows $dict] reqkind