Changeset 4755 for tags/1.3.5


Ignore:
Timestamp:
Nov 19, 2014 10:26:03 AM (7 years ago)
Author:
ldelgass
Message:

Backport visviewer.tcl from 1.3 branch head for GetColormapList?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/1.3.5/gui/scripts/visviewer.tcl

    r4260 r4755  
    3636    private variable _afterId -1
    3737    private variable _icon 0
     38
    3839    # Number of milliseconds to wait before idle timeout.  If greater than 0,
    3940    # automatically disconnect from the visualization server when idle timeout
     
    4243    #private variable _idleTimeout 5000;    # 5 seconds
    4344    #private variable _idleTimeout 0;       # No timeout
     45
    4446    protected variable _maxConnects 100
    4547    protected variable _outbuf       ;    # buffer for outgoing commands
     
    8486    protected method Connect { servers }
    8587    protected method Disconnect {}
    86     protected method EnableWaitDialog { bool }
     88    protected method EnableWaitDialog { timeout }
    8789    protected method Euler2XYZ { theta phi psi }
    8890    protected method Flush {}
     91    protected method GetColormapList { args }
    8992    protected method HandleError { args }
    9093    protected method HandleOk { args }
     
    285288            continue
    286289        }
    287         puts stderr "render server is $data"
     290        puts stderr "Render server is $data"
    288291        # We're connected. Cancel any pending serverDown events and
    289292        # release the busy window over the hull.
     
    388391#
    389392#   Helper routine called from a file event to send data when the
    390 #   connection is writable (i.e. not blocked).  Sets a magic
    391 #   variable _done($this) when we're done.
     393#   connection is writable (i.e. not blocked).  Sets a magic variable
     394#   _done($this) when we're done.
    392395#
    393396itcl::body Rappture::VisViewer::SendHelper {} {
     
    404407#
    405408#   Helper routine called from a file event to send data when the
    406 #   connection is writable (i.e. not blocked).  Sends data in chunks
    407 #   of 8k (or less).  Sets magic variable _done($this) to indicate
    408 #   that we're either finished (success) or could not send bytes to
    409 #   the server (failure).
     409#   connection is writable (i.e. not blocked).  Sends data in chunks of 8k
     410#   (or less).  Sets magic variable _done($this) to indicate that we're
     411#   either finished (success) or could not send bytes to the server
     412#   (failure).
    410413#
    411414itcl::body Rappture::VisViewer::SendHelper.old {} {
     
    451454    set _done($this) 1
    452455    set _buffer(out) $bytes
     456
     457    # There's problem when the user is interacting with the GUI at the
     458    # same time we're trying to write to the server.  Don't want to
     459    # block because, the GUI will look like it's dead.  We can start
     460    # by putting a busy window over plot so that inadvertent things like
     461    # mouse movements aren't received.
     462
     463    blt::busy hold $itk_component(main)
    453464    fileevent $_sid writable [itcl::code $this SendHelper]
    454465    tkwait variable ::Rappture::VisViewer::_done($this)
     466    blt::busy release $itk_component(main)
     467
    455468    set _buffer(out) ""
    456469    if { [IsConnected] } {
     
    504517# ReceiveHelper --
    505518#
    506 #   Helper routine called from a file event when the connection is
    507 #   readable (i.e. a command response has been sent by the rendering
    508 #   server.  Reads the incoming command and executes it in a safe
    509 #   interpreter to handle the action.
     519#   Helper routine called from a file event when the connection is readable
     520#   (i.e. a command response has been sent by the rendering server.  Reads
     521#   the incoming command and executes it in a safe interpreter to handle the
     522#   action.
    510523#
    511524#       Note: This routine currently only handles command responses from
     
    561574# Color2RGB --
    562575#
    563 #   Converts a color name to a list of r,g,b values needed for the
    564 #   engine.  Each r/g/b component is scaled in the # range 0-1.
     576#   Converts a color name to a list of r,g,b values needed for the engine.
     577#   Each r/g/b component is scaled in the # range 0-1.
    565578#
    566579itcl::body Rappture::VisViewer::Color2RGB {color} {
     
    596609itcl::body Rappture::VisViewer::SendEcho {channel {data ""}} {
    597610    if { $_logging }  {
    598         set f [open "/tmp/recording.log" "a"]
    599         puts $f $data
    600         close $f
     611        set f [open "/tmp/recording.log" "a"]
     612        fconfigure $f -translation binary -encoding binary
     613        puts -nonewline $f $data
     614        close $f
    601615    }
    602616    #puts stderr ">>($data)"
     
    610624#
    611625#     Echoes received data to clients interested in this widget.  If the
    612 #     -receivecommand option is set, then it is invoked in the global
    613 #     scope with the <channel> and <data> values as arguments.  Otherwise,
    614 #     this does nothing.
     626#     -receivecommand option is set, then it is invoked in the global scope
     627#     with the <channel> and <data> values as arguments.  Otherwise, this
     628#     does nothing.
    615629#
    616630itcl::body Rappture::VisViewer::ReceiveEcho {channel {data ""}} {
     
    630644        set inner [frame $itk_component(plotarea).view.splash]
    631645        $inner configure -relief raised -bd 2
    632         label $inner.text1 -text "Rendering...\nPlease wait." \
     646        label $inner.text1 -text "Working...\nPlease wait." \
    633647            -font "Arial 10"
    634648        label $inner.icon
     
    873887}
    874888
     889itcl::body Rappture::VisViewer::GetColormapList { args } {
     890    array set opts {
     891        -includeDefault 0
     892        -includeElementDefault 0
     893        -includeNone 0
     894    }
     895    if {[llength $args] > 0} {
     896        foreach opt $args {
     897            set opts($opt) 1
     898        }
     899    }
     900    set colormaps [list]
     901    if {$opts(-includeDefault)} {
     902        lappend colormaps "default" "default"
     903    }
     904    if {$opts(-includeElementDefault)} {
     905        lappend colormaps "elementDefault" "elementDefault"
     906    }
     907    lappend colormaps \
     908        "BCGYR"              "BCGYR"            \
     909        "BGYOR"              "BGYOR"            \
     910        "blue-to-brown"      "blue-to-brown"    \
     911        "blue-to-orange"     "blue-to-orange"   \
     912        "blue-to-grey"       "blue-to-grey"     \
     913        "green-to-magenta"   "green-to-magenta" \
     914        "greyscale"          "greyscale"        \
     915        "nanohub"            "nanohub"          \
     916        "rainbow"            "rainbow"          \
     917        "spectral"           "spectral"         \
     918        "ROYGB"              "ROYGB"            \
     919        "RYGCB"              "RYGCB"            \
     920        "white-to-blue"      "white-to-blue"    \
     921        "brown-to-blue"      "brown-to-blue"    \
     922        "grey-to-blue"       "grey-to-blue"     \
     923        "orange-to-blue"     "orange-to-blue"
     924    if {$opts(-includeNone)} {
     925        lappend colormaps "none" "none"
     926    }
     927    return $colormaps
     928}
    875929
    876930itcl::body Rappture::VisViewer::ColorsToColormap { colors } {
     
    900954            }
    901955        }
    902         "blue" {
     956        "white-to-blue" {
    903957            return {
    904958                0.0                     0.900 1.000 1.000
     
    11001154# StopBufferingCommands --
    11011155#
     1156#       This gets called when we want to stop buffering the commands for
     1157#       the server and actually send then to the server.  Note that there's
     1158#       a reference count on buffering.  This is so that you can can
     1159#       Start/Stop multiple times without worrying about the current state.
     1160#
    11021161itcl::body Rappture::VisViewer::StopBufferingCommands { } {
    11031162    incr _buffering -1
Note: See TracChangeset for help on using the changeset viewer.