TclApps Library Source Code
Check-in [5b5ef6bf79]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:* tkchat.tcl (::tkchat::Progress): Improved progress bar handling. This hopefully fixes the occasional spinning of the progress bar when the associated action has long finished.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5b5ef6bf794fdd182ff2fd5a5d0a7cca55354985
User & Date: rmax 2009-06-02 11:41:30.000
Context
2009-07-02
21:59
Avoid posting when in lurk mode (handle the bindings too) check-in: 0b2a63e2e3 user: patthoyts tags: trunk
2009-06-02
11:41
* tkchat.tcl (::tkchat::Progress): Improved progress bar handling. This hopefully fixes the occasional spinning of the progress bar when the associated action has long finished. check-in: 5b5ef6bf79 user: rmax tags: trunk
2009-05-25
16:02
Fixed string/list confusion in the message parsing that mishandled nick changes from irc. check-in: b19a3a2f4e user: patthoyts tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to apps/tkchat/ChangeLog.






1
2
3
4
5
6
7






2009-05-25  Pat Thoyts  <[email protected]>

	* tkchat.tcl: Fixed string/list confusion in the message parsing
	that mishandled nick changes from irc.

2009-05-25  Pat Thoyts  <[email protected]>

>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
2009-06-02  Reinhard Max  <[email protected]>

	* tkchat.tcl (::tkchat::Progress): Improved progress bar handling.
	This hopefully fixes the occasional spinning of the progress bar
	when the associated action has long finished.

2009-05-25  Pat Thoyts  <[email protected]>

	* tkchat.tcl: Fixed string/list confusion in the message parsing
	that mishandled nick changes from irc.

2009-05-25  Pat Thoyts  <[email protected]>

Changes to apps/tkchat/tkchat.tcl.
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
    }
}

namespace eval ::tkchat {
    variable chatWindowTitle "The Tcler's Chat"

    variable HEADUrl {http://tcllib.cvs.sourceforge.net/*checkout*/tcllib/tclapps/apps/tkchat/tkchat.tcl?revision=HEAD}
    variable rcsid   {$Id: tkchat.tcl,v 1.470 2009/05/25 16:02:26 patthoyts Exp $}

    variable MSGS
    set MSGS(entered) [list \
	    "%user% has entered the chat!" \
	    "Out of a cloud of smoke, %user% appears!" \
	    "%user% saunters in." \
	    "%user% wanders in." \







|







275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
    }
}

namespace eval ::tkchat {
    variable chatWindowTitle "The Tcler's Chat"

    variable HEADUrl {http://tcllib.cvs.sourceforge.net/*checkout*/tcllib/tclapps/apps/tkchat/tkchat.tcl?revision=HEAD}
    variable rcsid   {$Id: tkchat.tcl,v 1.471 2009/06/02 11:41:30 rmax Exp $}

    variable MSGS
    set MSGS(entered) [list \
	    "%user% has entered the chat!" \
	    "Out of a cloud of smoke, %user% appears!" \
	    "%user% saunters in." \
	    "%user% wanders in." \
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
# -------------------------------------------------------------------------
# Translate the selection using Babelfish.
# -------------------------------------------------------------------------

proc ::tkchat::fetchurldone {cmd tok} {
    set url [set [set tok](url)]
    ::log::log info "fetchurl ($url): [::http::code $tok]"
    if {[winfo exists .status.progress]} {
        grid forget .status.progress
    }

    switch -- [::http::status $tok] {
	ok - OK - Ok {
	    if {[::http::ncode $tok] >= 500} {
		HttpServerError $tok
	    } elseif {[::http::ncode $tok] >= 400} {
		AuthenticationError $tok







<
|
<







817
818
819
820
821
822
823

824

825
826
827
828
829
830
831
# -------------------------------------------------------------------------
# Translate the selection using Babelfish.
# -------------------------------------------------------------------------

proc ::tkchat::fetchurldone {cmd tok} {
    set url [set [set tok](url)]
    ::log::log info "fetchurl ($url): [::http::code $tok]"

    Progress foo 0 0


    switch -- [::http::status $tok] {
	ok - OK - Ok {
	    if {[::http::ncode $tok] >= 500} {
		HttpServerError $tok
	    } elseif {[::http::ncode $tok] >= 400} {
		AuthenticationError $tok
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775

1776
1777
1778
1779
1780
1781

1782
1783
1784
1785
1786
1787
1788
    wm deiconify $dlg
}

proc ::tkchat::Progress {tok total current} {
    if {![winfo exists .status.progress]} { return }
    log::log debug "Progress $total $current"
    set w .status.progress
    StatusbarAddWidget .status $w 1
    if {$total == $current} {
        if {[string equal [$w cget -mode] "determinate"]} {
            $w stop
        }
        grid forget .status.progress
    }

    if {$total == 0 && [string equal [$w cget -mode] "determinate"]} {
        $w configure -mode indeterminate
        $w start
    } elseif {$total != 0} {
        $w configure -mode determinate \
            -value [expr {int(double($current)/double($total) * 100)}]

    }
}

proc ::tkchat::StatusbarAddWidget {bar slave pos} {
    if {![winfo exists $bar]} { return }
    if {![winfo ismapped $slave]} {
        set slaves [lreverse [grid slaves $bar]]







<
|
<
|
<

|
>
|
|
|
|
|
|
>







1760
1761
1762
1763
1764
1765
1766

1767

1768

1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
    wm deiconify $dlg
}

proc ::tkchat::Progress {tok total current} {
    if {![winfo exists .status.progress]} { return }
    log::log debug "Progress $total $current"
    set w .status.progress

    if {$current == $total} {

        $w stop

        grid forget .status.progress
    } else {
        StatusbarAddWidget .status $w 1
        if {$total == 0} {
            $w configure -mode indeterminate
            $w start
        } else {
            $w configure -mode determinate \
                -value [expr {int(double($current)/double($total) * 100)}]
        }
    }
}

proc ::tkchat::StatusbarAddWidget {bar slave pos} {
    if {![winfo exists $bar]} { return }
    if {![winfo ismapped $slave]} {
        set slaves [lreverse [grid slaves $bar]]