Source: linuxcnc
Severity: normal
Tags: patch

Dear Maintainer,

I'm planning to upgrade the blt package to 3.0 shortly after the release
of trixie, this will affect linuxcnc, specifically scripts
hal-histogram, latency-histogram and latency-plot, which use blt to
display plots.

As far as I can see, it's fairly easy to port the scripts to blt 3.0,
I'm attaching a patch which does that. It loses compatibility with
blt 2, so if you want to send the changes upstream, you'd have to
augment the patch (guard the changes by something like
[if {[package vsatisfies [package provides BLT] 3]} {...}]).

You can do additional testing with the blt packages available in
experimental.

Cheers!
-- 
Sergei Golovan
--- a/scripts/hal-histogram
+++ b/scripts/hal-histogram
@@ -223,11 +223,12 @@
     exit 1
   }
   signal trap SIGINT finish ;# uses Tclx
-  if [catch {package require BLT} msg] {
+  if [catch {package require BLT 3} msg] {
     puts $msg
     puts "To install: sudo apt-get install blt"
     exit 1
   }
+  package require blt_picture_png
 
   # augment ::auto_path for special case:
   # 1) RIP build (no install)
@@ -876,8 +877,8 @@
 
 #------------------------------------------------------------------
 proc bltCaptureWindow { win } {
-  set image [image create photo]
-  blt::winop snap $win $image
+  set image [image create picture]
+  $image snap $win
   return $image
 } ;# bltCaptureWindow
 
@@ -891,7 +892,7 @@
       -defaultextension .png]
   if {[llength $filename]} {
     set ::HH(dir,screenshot) [file dirname $filename]
-    $image write -format png $filename
+    $image export png -file $filename
   }
   image delete $image
 } ;# windowToFile
--- a/scripts/latency-histogram
+++ b/scripts/latency-histogram
@@ -273,11 +273,12 @@
     wm protocol . WM_DELETE_WINDOW finish
     wm withdraw .
 
-    if [catch {package require BLT} msg] {
+    if [catch {package require BLT 3} msg] {
       puts $msg
       puts "To install: sudo apt-get install blt"
       exit 1
     }
+    package require blt_picture_png
     blt::bitmap define nbmap {
      {8 8}
      {0xc7,0x8f,0x1f,0x3e,0x7c, 0xf8,0xf1,0xe3}
@@ -817,8 +818,8 @@
 
 #------------------------------------------------------------------
 proc bltCaptureWindow { win } {
-  set image [image create photo]
-  blt::winop snap $win $image
+  set image [image create picture]
+  $image snap $win
   return $image
 } ;# bltCaptureWindow
 
@@ -832,7 +833,7 @@
       -defaultextension .png]
   if {[llength $filename]} {
     set ::LH(dir,screenshot) [file dirname $filename]
-    $image write -format png $filename
+    $image export png -file $filename
   }
   image delete $image
 } ;# windowToFile
--- a/scripts/latency-plot
+++ b/scripts/latency-plot
@@ -37,7 +37,7 @@
    puts $msg
 } ;# popup
 
-if [catch {package require BLT} msg] {
+if [catch {package require BLT 3} msg] {
   if {[string first "version conflict" $msg] == 0} {
     set msg "BLT version conflict!\n\n$msg"
   } elseif {[string first "can't find package" $msg] == 0} {
@@ -328,22 +328,22 @@
 
   pack $::sc(stripchart) -expand yes -fill both
 
-  $::sc(stripchart) grid configure \
-      -hide $::sc(grid,hide) \
-     -color $::sc(grid,color)
-
   $::sc(stripchart) legend configure \
        -anchor n \
-     -position leftmargin
+     -position left
 
   # note: hide x axis label until autoranging completed
   $::sc(stripchart) axis configure x \
+     -grid [expr {!$::sc(grid,hide)}] \
+     -gridcolor $::sc(grid,color) \
      -autorange $::sc(xpoints) \
        -shiftby $::sc(shiftby) \
        -command xfmt \
           -hide 1
 
   $::sc(stripchart) axis configure y \
+     -grid [expr {!$::sc(grid,hide)}] \
+     -gridcolor $::sc(grid,color) \
      -autorange 0
 
   foreach {v name} $::sc(v,name,pairs) {
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to