[Tkabber-dev] r769 - in trunk/tkabber: . plugins/general

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Tue Oct 24 22:57:02 MSD 2006


Author: sergei
Date: 2006-10-24 22:56:57 +0400 (Tue, 24 Oct 2006)
New Revision: 769

Modified:
   trunk/tkabber/ChangeLog
   trunk/tkabber/plugins/general/stats.tcl
   trunk/tkabber/tkabber.tcl
   trunk/tkabber/utils.tcl
Log:
	* tkabber.tcl: Stepped required jabberlib version.

	* utils.tcl: Added extra rguments to Spinbox command.

	* plugins/general/stats.tcl: Use 'Set' button relief to
	  show whether statistical parameter is requested periodically.


Modified: trunk/tkabber/ChangeLog
===================================================================
--- trunk/tkabber/ChangeLog	2006-10-22 12:35:24 UTC (rev 768)
+++ trunk/tkabber/ChangeLog	2006-10-24 18:56:57 UTC (rev 769)
@@ -1,3 +1,12 @@
+2006-10-24  Sergei Golovan  <sgolovan at nes.ru>
+
+	* tkabber.tcl: Stepped required jabberlib version.
+
+	* utils.tcl: Added extra rguments to Spinbox command.
+
+	* plugins/general/stats.tcl: Use 'Set' button relief to
+	  show whether statistical parameter is requested periodically.
+
 2006-10-22  Sergei Golovan  <sgolovan at nes.ru>
 
 	* msgs/uk.msg, msgs/uk.rc: Updated Ukrainian translation

Modified: trunk/tkabber/plugins/general/stats.tcl
===================================================================
--- trunk/tkabber/plugins/general/stats.tcl	2006-10-22 12:35:24 UTC (rev 768)
+++ trunk/tkabber/plugins/general/stats.tcl	2006-10-24 18:56:57 UTC (rev 769)
@@ -82,14 +82,18 @@
 			     $n]]
     grid $b -row $n -column 6 -sticky w
 
-    set s [SpinBox $f.spin$n -range {0 1000000000 1} \
-	       -width 4 \
-	       -textvariable \
-	       [namespace current]::data(tmpperiod,$jid,$node,$name)]
+    set s [Spinbox $f.spin$n 0 1000000000 1 \
+		   [namespace current]::data(tmpperiod,$jid,$node,$name) \
+		   -width 4]
+    trace variable [namespace current]::data(tmpperiod,$jid,$node,$name) w \
+	  [list [namespace current]::unset_timer $n $jid $node $name]
     grid $s -row $n -column 7 -sticky w
 
+    catch {unset data(period,$jid,$node,$name)}
+
     set b [button $f.bsettimer$n -text [::msgcat::mc "Set"] \
-	       -command [list [namespace current]::set_timer \
+	       -relief raised \
+	       -command [list [namespace current]::toggle_timer \
 			     $n $jid $node $name]]
     grid $b -row $n -column 8 -sticky w
 
@@ -195,21 +199,44 @@
     }
 }
 
-proc stats::set_timer {n jid node name} {
+proc stats::unset_timer {n jid node name args} {
     variable data
     variable f
 
-    set data(period,$jid,$node,$name) $data(tmpperiod,$jid,$node,$name)
+    if {[info exists data(period,$jid,$node,$name)]} {
+	unset data(period,$jid,$node,$name)
+	$f.bsettimer$n configure -relief raised
+    }
+}
 
-    timer $n $jid $node $name
+proc stats::toggle_timer {n jid node name} {
+    variable data
+    variable f
+
+    if {![info exists data(period,$jid,$node,$name)]} {
+	if {[string is integer -strict $data(tmpperiod,$jid,$node,$name)] && \
+		$data(tmpperiod,$jid,$node,$name) > 0} {
+	    set data(period,$jid,$node,$name) $data(tmpperiod,$jid,$node,$name)
+	    $f.bsettimer$n configure -relief sunken
+
+	    timer $n $jid $node $name
+	}
+    } else {
+	unset data(period,$jid,$node,$name)
+	$f.bsettimer$n configure -relief raised
+    }
 }
 
 proc stats::timer {n jid node name} {
     variable data
     variable f
 
+    if {![winfo exists $f.spin$n]} return
+
     request_value $jid $node $name
 
+    if {![info exists data(period,$jid,$node,$name)]} return
+
     set p $data(period,$jid,$node,$name)
 
     after cancel \

Modified: trunk/tkabber/tkabber.tcl
===================================================================
--- trunk/tkabber/tkabber.tcl	2006-10-22 12:35:24 UTC (rev 768)
+++ trunk/tkabber/tkabber.tcl	2006-10-24 18:56:57 UTC (rev 769)
@@ -174,7 +174,7 @@
     random seed [expr {round(1000000000*rand())}]
 }
 
-package require jabberlib 0.8.4
+package require jabberlib 0.10.0
 load_source xmppmime.tcl
 
 foreach {opt val} $argv {

Modified: trunk/tkabber/utils.tcl
===================================================================
--- trunk/tkabber/utils.tcl	2006-10-22 12:35:24 UTC (rev 768)
+++ trunk/tkabber/utils.tcl	2006-10-24 18:56:57 UTC (rev 769)
@@ -263,10 +263,14 @@
 if {[info tclversion] >= 8.4} {
     # Tk 8.4 or newer
 
-    proc Spinbox {path from to incr textvar} {
-	return [spinbox $path -from $from -to $to -increment $incr \
-		    -buttoncursor left_ptr \
-		    -textvariable $textvar]
+    proc Spinbox {path from to incr textvar args} {
+	return [eval [list spinbox $path \
+				   -from $from \
+				   -to $to \
+				   -increment $incr \
+				   -buttoncursor left_ptr \
+				   -textvariable $textvar] \
+		     $args]
     }
 
     proc textUndoable {path args} {
@@ -291,9 +295,11 @@
 } else {
     # Tk 8.3
     
-    proc Spinbox {path from to incr textvar} {
-	return [SpinBox $path -range [list $from $to $incr] \
-			-textvariable $textvar]
+    proc Spinbox {path from to incr textvar args} {
+	return [eval [list SpinBox $path \
+				   -range [list $from $to $incr] \
+				   -textvariable $textvar] \
+			   $args]
     }
 
     proc textUndoable {path args} {



More information about the Tkabber-dev mailing list