Changeset 5127 for trunk/gui


Ignore:
Timestamp:
Mar 14, 2015, 12:00:37 AM (10 years ago)
Author:
ldelgass
Message:

Add method to send data payload to render server. We may need to modify
encoding of command strings, so this will make it clear what data is a command
string and what is binary data. Add environment variable (VISTRACE) to enable
command tracing to stderr and resort methods/member variables by access.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/visviewer.tcl

    r5126 r5127  
    2828    set _servers(vtkvis)  "localhost:2010"
    2929
    30     protected variable _serverType "???";# Type of server.
    31     protected variable _sid ""      ;   # socket connection to server
    3230    private common _done            ;   # Used to indicate status of send.
    3331    private variable _buffer        ;   # buffer for incoming/outgoing commands
     32    private variable _blockOnWrite 0;   # Should writes to socket block?
    3433    private variable _initialized
    3534    private variable _isOpen 0
    3635    private variable _afterId -1
    3736    private variable _icon 0
    38 
     37    private variable _trace 0        ;    # Protocol tracing for console
     38    private variable _logging 0      ;    # Command logging to file
    3939    # Number of milliseconds to wait before idle timeout.  If greater than 0,
    4040    # automatically disconnect from the visualization server when idle timeout
     
    4444    #private variable _idleTimeout 0;       # No timeout
    4545
     46    protected variable _serverType "???";# Type of server.
     47    protected variable _sid ""      ;   # socket connection to server
    4648    protected variable _maxConnects 100
    4749    protected variable _outbuf       ;    # buffer for outgoing commands
    4850    protected variable _buffering 0
    4951    protected variable _cmdSeq 0     ;    # Command sequence number
    50 
    51     private variable _trace 0        ;    # Protocol tracing for console
    52     private variable _logging 0      ;    # Command logging to file
    5352
    5453    protected variable _dispatcher "";  # dispatcher for !events
     
    7170    }
    7271    # Used internally only.
    73     private method Shuffle { servers }
     72    private method BuildConsole {}
     73    private method DebugConsole {}
     74    private method HideConsole {}
    7475    private method ReceiveHelper {}
    75     private method ServerDown {}
     76    private method SendDebugCommand {}
    7677    private method SendHelper {}
    7778    private method SendHelper.old {}
     79    private method ServerDown {}
     80    private method Shuffle { servers }
     81    private method TraceComm { channel {data {}} }
    7882    private method WaitDialog { state }
    79 
    80     protected method ToggleConsole {}
    81     private method DebugConsole {}
    82     private method BuildConsole {}
    83     private method HideConsole {}
    84     private method TraceComm { channel {data {}} }
    85     private method SendDebugCommand {}
     83    private method Waiting { option widget }
    8684
    8785    protected method CheckConnection {}
     
    8987    protected method ColorsToColormap { colors }
    9088    protected method Connect { servers }
     89    protected method DisableWaitDialog {}
    9190    protected method Disconnect {}
    9291    protected method EnableWaitDialog { timeout }
     
    10099    protected method ReceiveEcho { channel {data ""} }
    101100    protected method SendBytes { bytes }
    102     protected method SendCmd {string}
     101    protected method SendCmd { string }
     102    protected method SendData { bytes }
    103103    protected method SendEcho { channel {data ""} }
    104104    protected method StartBufferingCommands {}
     
    106106    protected method StopBufferingCommands {}
    107107    protected method StopWaiting {}
    108 
    109     private method Waiting { option widget }
     108    protected method ToggleConsole {}
    110109
    111110    private proc CheckNameList { namelist }  {
     
    205204            file delete /tmp/recording.log
    206205        }
     206    }
     207    if { [info exists env(VISTRACE)] } {
     208        set _trace 1
    207209    }
    208210    eval itk_initialize $args
     
    463465    }
    464466    set _buffer(out) $bytes
    465     if {0} {
     467    if {_blockOnWrite} {
    466468        # Let's try this approach: allow a write to block so we don't
    467469        # re-enter SendBytes
     
    510512itcl::body Rappture::VisViewer::EnableWaitDialog { value } {
    511513    set _waitTimeout $value
     514}
     515
     516itcl::body Rappture::VisViewer::DisableWaitDialog {} {
     517    set _waitTimeout 0
    512518}
    513519
     
    11941200# SendCmd
    11951201#
    1196 #       Send commands off to the rendering server.  If we're currently
    1197 #       sending data objects to the server, buffer the commands to be
    1198 #       sent later.
     1202#       Send command off to the rendering server.  If we're currently
     1203#       buffering, the command is queued to be sent later.
    11991204#
    12001205itcl::body Rappture::VisViewer::SendCmd {string} {
     
    12091214    }
    12101215}
     1216
     1217#
     1218# SendData
     1219#
     1220#       Send data off to the rendering server.  If we're currently
     1221#       buffering, the data is queued to be sent later.
     1222#
     1223itcl::body Rappture::VisViewer::SendData {bytes} {
     1224    if {$_trace} {
     1225        puts stderr "$_cmdSeq>>data payload"
     1226    }
     1227    if { $_buffering } {
     1228        append _outbuf $bytes
     1229    } else {
     1230        SendBytes $bytes
     1231    }
     1232}
Note: See TracChangeset for help on using the changeset viewer.