Changeset 5177


Ignore:
Timestamp:
Apr 1, 2015 9:32:24 PM (5 years ago)
Author:
ldelgass
Message:

merging some fixes from the trunk

Location:
branches/1.3
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/gui/scripts/flowvisviewer.tcl

    r5115 r5177  
    22502250    }
    22512251
    2252     $inner.colormap choices insert end \
    2253         "BCGYR"              "BCGYR"            \
    2254         "BGYOR"              "BGYOR"            \
    2255         "blue"               "blue"             \
    2256         "blue-to-brown"      "blue-to-brown"    \
    2257         "blue-to-orange"     "blue-to-orange"   \
    2258         "blue-to-grey"       "blue-to-grey"     \
    2259         "green-to-magenta"   "green-to-magenta" \
    2260         "greyscale"          "greyscale"        \
    2261         "nanohub"            "nanohub"          \
    2262         "rainbow"            "rainbow"          \
    2263         "spectral"           "spectral"         \
    2264         "ROYGB"              "ROYGB"            \
    2265         "RYGCB"              "RYGCB"            \
    2266         "brown-to-blue"      "brown-to-blue"    \
    2267         "grey-to-blue"       "grey-to-blue"     \
    2268         "orange-to-blue"     "orange-to-blue"   \
    2269         "none"               "none"
    2270 
     2252    $inner.colormap choices insert end [GetColormapList -includeNone]
    22712253    $itk_component(colormap) value "BCGYR"
    22722254    bind $inner.colormap <<Value>> \
  • branches/1.3/gui/scripts/nanovisviewer.tcl

    r5115 r5177  
    17711771    }
    17721772
    1773     $inner.colormap choices insert end \
    1774         "BCGYR"              "BCGYR"            \
    1775         "BGYOR"              "BGYOR"            \
    1776         "blue"               "blue"             \
    1777         "blue-to-brown"      "blue-to-brown"    \
    1778         "blue-to-orange"     "blue-to-orange"   \
    1779         "blue-to-grey"       "blue-to-grey"     \
    1780         "green-to-magenta"   "green-to-magenta" \
    1781         "greyscale"          "greyscale"        \
    1782         "nanohub"            "nanohub"          \
    1783         "rainbow"            "rainbow"          \
    1784         "spectral"           "spectral"         \
    1785         "ROYGB"              "ROYGB"            \
    1786         "RYGCB"              "RYGCB"            \
    1787         "brown-to-blue"      "brown-to-blue"    \
    1788         "grey-to-blue"       "grey-to-blue"     \
    1789         "orange-to-blue"     "orange-to-blue"   \
    1790         "none"               "none"
    1791 
     1773    $inner.colormap choices insert end [GetColormapList -includeNone]
    17921774    $itk_component(colormap) value "BCGYR"
    17931775    bind $inner.colormap <<Value>> \
  • branches/1.3/gui/scripts/transferfunctioneditor.tcl

    r4504 r5177  
    146146
    147147itcl::body Rappture::TransferFunctionEditor::destructor {} {
    148     $_canvas delete $_name
     148    if { [winfo exists $_canvas] } {
     149        $_canvas delete $_name
     150    }
    149151}
    150152
  • branches/1.3/gui/scripts/visviewer.tcl

    r5176 r5177  
    2727    set _servers(vtkvis)  "localhost:2010"
    2828
    29     protected variable _serverType "???";# Type of server.
    30     protected variable _sid ""      ;   # socket connection to server
    3129    private common _done            ;   # Used to indicate status of send.
    3230    private variable _buffer        ;   # buffer for incoming/outgoing commands
     31    private variable _blockOnWrite 0;   # Should writes to socket block?
    3332    private variable _initialized
    3433    private variable _isOpen 0
    3534    private variable _afterId -1
    3635    private variable _icon 0
    37 
     36    private variable _trace 0        ;    # Protocol tracing for console
     37    private variable _logging 0      ;    # Command logging to file
    3838    # Number of milliseconds to wait before idle timeout.  If greater than 0,
    3939    # automatically disconnect from the visualization server when idle timeout
     
    4343    #private variable _idleTimeout 0;       # No timeout
    4444
     45    protected variable _serverType "???";# Type of server.
     46    protected variable _sid ""      ;   # socket connection to server
    4547    protected variable _maxConnects 100
    4648    protected variable _outbuf       ;    # buffer for outgoing commands
    4749    protected variable _buffering 0
    48 
    49     private variable _logging 0
    50 
     50    protected variable _cmdSeq 0     ;    # Command sequence number
    5151    protected variable _dispatcher "";  # dispatcher for !events
    5252    protected variable _hosts ""    ;   # list of hosts for server
     
    6868    }
    6969    # Used internally only.
    70     private method Shuffle { servers }
     70    private method BuildConsole {}
     71    private method DebugConsole {}
     72    private method HideConsole {}
    7173    private method ReceiveHelper {}
    72     private method ServerDown {}
     74    private method SendDebugCommand {}
    7375    private method SendHelper {}
    7476    private method SendHelper.old {}
     77    private method ServerDown {}
     78    private method Shuffle { servers }
     79    private method TraceComm { channel {data {}} }
    7580    private method WaitDialog { state }
    76 
    77     protected method ToggleConsole {}
    78     private method DebugConsole {}
    79     private method BuildConsole {}
    80     private method HideConsole {}
    81     private method TraceComm { channel {data {}} }
    82     private method SendDebugCommand {}
     81    private method Waiting { option widget }
    8382
    8483    protected method CheckConnection {}
     
    8685    protected method ColorsToColormap { colors }
    8786    protected method Connect { servers }
     87    protected method DisableWaitDialog {}
    8888    protected method Disconnect {}
    8989    protected method EnableWaitDialog { timeout }
     
    9797    protected method ReceiveEcho { channel {data ""} }
    9898    protected method SendBytes { bytes }
    99     protected method SendCmd {string}
     99    protected method SendCmd { string }
     100    protected method SendData { bytes }
    100101    protected method SendEcho { channel {data ""} }
    101102    protected method StartBufferingCommands {}
     
    103104    protected method StopBufferingCommands {}
    104105    protected method StopWaiting {}
    105 
    106     private method Waiting { option widget }
     106    protected method ToggleConsole {}
    107107
    108108    private proc CheckNameList { namelist }  {
     
    203203        }
    204204    }
     205    if { [info exists env(VISTRACE)] } {
     206        set _trace 1
     207    }
    205208    eval itk_initialize $args
    206209}
     
    284287        if { [gets $_sid data] <= 0 } {
    285288            set _sid ""
    286             puts stderr "reading from server"
     289            puts stderr "ERORR reading from server data=($data)"
    287290            RemoveServerFromList $_serverType $server
    288291            continue
     
    320323    set _buffer(in) ""
    321324    set _outbuf ""
     325    set _cmdSeq 0
    322326}
    323327
     
    400404    puts -nonewline $_sid $_buffer(out)
    401405    flush $_sid
     406    set _buffer(out) ""
    402407    set _done($this) 1;                 # Success
    403408}
     
    453458    # before sending anything.
    454459    set _done($this) 1
     460    if {$_trace && $_buffer(out) != ""} {
     461        puts stderr "ERROR: re-entered SendBytes: buffer=([string range $_buffer(out) 0 70]...)"
     462        puts stderr "New cmd $_cmdSeq: [string range $bytes 0 70]..."
     463    }
    455464    set _buffer(out) $bytes
    456 
    457465    # There's problem when the user is interacting with the GUI at the
    458466    # same time we're trying to write to the server.  Don't want to
     
    460468    # by putting a busy window over plot so that inadvertent things like
    461469    # mouse movements aren't received.
    462 
    463     blt::busy hold $itk_component(main)
    464     fileevent $_sid writable [itcl::code $this SendHelper]
    465     tkwait variable ::Rappture::VisViewer::_done($this)
    466     blt::busy release $itk_component(main)
    467 
     470    if {$_blockOnWrite} {
     471        # Let's try this approach: allow a write to block so we don't
     472        # re-enter SendBytes
     473        SendHelper
     474    } else {
     475        # This can cause us to re-enter SendBytes during the tkwait, which
     476        # is not safe because the _buffer will be clobbered
     477        if { [info exists itk_component(main)] } {
     478            blt::busy hold $itk_component(main) -cursor ""
     479        }
     480        fileevent $_sid writable [itcl::code $this SendHelper]
     481        tkwait variable ::Rappture::VisViewer::_done($this)
     482        if { [info exists itk_component(main)] } {
     483            blt::busy release $itk_component(main)
     484        }
     485    }
    468486    set _buffer(out) ""
    469487    if { [IsConnected] } {
     
    503521}
    504522
     523itcl::body Rappture::VisViewer::DisableWaitDialog {} {
     524    set _waitTimeout 0
     525}
     526
    505527#
    506528# ReceiveBytes --
     
    553575    if { [string compare -length 3 $line "nv>"] == 0 } {
    554576        ReceiveEcho <<line $line
     577        if ($_trace) {
     578            puts stderr "<<[string range $line 0 70]"
     579        }
    555580        append _buffer(in) [string range $line 3 end]
    556581        append _buffer(in) "\n"
     
    815840# ----------------------------------------------------------------------
    816841itcl::body Rappture::VisViewer::SendDebugCommand {} {
     842    incr _cmdSeq
    817843    set cmd [$itk_component(command) get]
    818844    append cmd "\n"
     845    if {$_trace} {
     846        puts stderr "$_cmdSeq>>[string range $cmd 0 70]"
     847    }
    819848    SendBytes $cmd
    820849    $itk_component(command) delete 0 end
     
    11781207# SendCmd
    11791208#
    1180 #       Send commands off to the rendering server.  If we're currently
    1181 #       sending data objects to the server, buffer the commands to be
    1182 #       sent later.
     1209#       Send command off to the rendering server.  If we're currently
     1210#       buffering, the command is queued to be sent later.
    11831211#
    11841212itcl::body Rappture::VisViewer::SendCmd {string} {
     1213    incr _cmdSeq
     1214    if {$_trace} {
     1215        puts stderr "$_cmdSeq>>[string range $string 0 70]"
     1216    }
    11851217    if { $_buffering } {
    11861218        append _outbuf $string "\n"
     
    11891221    }
    11901222}
     1223
     1224#
     1225# SendData
     1226#
     1227#       Send data off to the rendering server.  If we're currently
     1228#       buffering, the data is queued to be sent later.
     1229#
     1230itcl::body Rappture::VisViewer::SendData {bytes} {
     1231    if {$_trace} {
     1232        puts stderr "$_cmdSeq>>data payload"
     1233    }
     1234    if { $_buffering } {
     1235        append _outbuf $bytes
     1236    } else {
     1237        SendBytes $bytes
     1238    }
     1239}
  • branches/1.3/gui/scripts/vtkglyphviewer.tcl

    r5110 r5177  
    15651565    if { $_currentColormap != ""  } {
    15661566        set cmap $_currentColormap
    1567         SendCmd "legend $cmap $_colorMode $_curFldName {} $w $h 0"
     1567        if { ![info exists _colormaps($cmap)] } {
     1568            BuildColormap $cmap
     1569            set _colormaps($cmap) 1
     1570        }
     1571        #SendCmd "legend $cmap $_colorMode $_curFldName {} $w $h 0"
     1572        SendCmd "legend2 $cmap $w $h"
    15681573    }
    15691574}
  • branches/1.3/gui/scripts/vtkheightmapviewer.tcl

    r5110 r5177  
    139139    private variable _changed
    140140    private variable _initialStyle "";  # First found style in dataobjects.
    141     private variable _reset 1;          # Indicates if camera needs to be reset
    142                                         # to starting position.
    143     private variable _beforeConnect 1;  # Indicates if camera needs to be reset
    144                                         # to starting position.
     141    private variable _reset 1;          # Indicates if the connection to the
     142                                        # render server was reset
     143    private variable _beforeConnect 1;  # Indicates if we are in the constructor
     144                                        # before the server connection is made
    145145
    146146    private variable _first ""     ;    # This is the topmost dataset.
     
    10191019        }
    10201020    }
    1021     if { $_first != ""  } {
     1021    if { $_first != "" } {
    10221022        $itk_component(field) choices delete 0 end
    10231023        $itk_component(fieldmenu) delete 0 end
     
    10551055
    10561056        foreach axis { x y z } {
    1057             if { $axis == "z" } {
    1058                 set label [$_first hints label]
    1059             } else {
    1060                 set label [$_first hints ${axis}label]
     1057            set label ""
     1058            if { $_first != "" } {
     1059                if { $axis == "z" } {
     1060                    set label [$_first hints label]
     1061                } else {
     1062                    set label [$_first hints ${axis}label]
     1063                }
    10611064            }
    10621065            if { $label == "" } {
     
    10751078
    10761079            set units ""
    1077             if {$axis == "z" && [$_first hints ${axis}units] == ""} {
    1078                 if {$_curFldName != ""} {
     1080            if { $_first != "" } {
     1081                if { $axis == "z" } {
     1082                    set units [$_first hints units]
     1083                } else {
     1084                    set units [$_first hints ${axis}units]
     1085                }
     1086            }
     1087            if { $units == "" && $axis == "z" } {
     1088                if { $_first != "" && [$_first hints zunits] != "" } {
     1089                    set units [$_first hints zunits]
     1090                } elseif { [info exists _fields($_curFldName)] } {
    10791091                    set units [lindex $_fields($_curFldName) 1]
    10801092                }
    1081             } else {
    1082                 set units [$_first hints ${axis}units]
    1083             }
    1084             if { $units != "" } {
    1085                 # May be a space in the axis units.
    1086                 SendCmd [list axis units $axis $units]
    1087             }
     1093            }
     1094            # May be a space in the axis units.
     1095            SendCmd [list axis units $axis $units]
    10881096        }
    10891097        #
     
    14621470                return
    14631471            }
    1464             set label [$_first hints label]
     1472            set label ""
     1473            if { $_first != "" } {
     1474                set label [$_first hints label]
     1475            }
    14651476            if { $label == "" } {
    14661477                if { [string match "component*" $_curFldName] } {
     
    14731484            SendCmd [list axis name z $label]
    14741485
    1475             if { [$_first hints zunits] == "" } {
    1476                 set units [lindex $_fields($_curFldName) 1]
    1477             } else {
    1478                 set units [$_first hints zunits]
    1479             }
    1480             if { $units != "" } {
    1481                 # May be a space in the axis units.
    1482                 SendCmd [list axis units z $units]
    1483             }
     1486            set units ""
     1487            if { $_first != "" } {
     1488                set units [$_first hints units]
     1489            }
     1490            if { $units == "" } {
     1491                if { $_first != "" && [$_first hints zunits] != "" } {
     1492                    set units [$_first hints zunits]
     1493                } elseif { [info exists _fields($_curFldName)] } {
     1494                    set units [lindex $_fields($_curFldName) 1]
     1495                }
     1496            }
     1497            # May be a space in the axis units.
     1498            SendCmd [list axis units z $units]
    14841499            # Get the new limits because the field changed.
    14851500            ResetAxes
     
    17211736    if { $_currentColormap != ""  } {
    17221737        set cmap $_currentColormap
     1738        if { ![info exists _colormaps($cmap)] } {
     1739           BuildColormap $cmap
     1740           set _colormaps($cmap) 1
     1741        }
    17231742        #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
    17241743        SendCmd "legend2 $cmap $w $h"
  • branches/1.3/gui/scripts/vtkimageviewer.tcl

    r5110 r5177  
    15581558    # Set the legend on the first image dataset.
    15591559    if { $_currentColormap != "" && $_currentColormap != "none" } {
    1560         #SendCmd "legend $_currentColormap scalar $_curFldName {} $w $h 0"
    1561         SendCmd "legend2 $_currentColormap $w $h"
     1560        set cmap $_currentColormap
     1561        if { ![info exists _colormaps($cmap)] } {
     1562            BuildColormap $cmap
     1563            set _colormaps($cmap) 1
     1564        }
     1565        #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     1566        SendCmd "legend2 $cmap $w $h"
    15621567    }
    15631568}
  • branches/1.3/gui/scripts/vtkisosurfaceviewer.tcl

    r5110 r5177  
    16901690    if { $_currentColormap != ""  } {
    16911691        set cmap $_currentColormap
    1692         SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     1692        if { ![info exists _colormaps($cmap)] } {
     1693            BuildColormap $cmap
     1694            set _colormaps($cmap) 1
     1695        }
     1696        #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     1697        SendCmd "legend2 $cmap $w $h"
    16931698    }
    16941699}
  • branches/1.3/gui/scripts/vtksurfaceviewer.tcl

    r5110 r5177  
    14761476    if { $_currentColormap != ""  } {
    14771477        set cmap $_currentColormap
    1478         SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     1478        if { ![info exists _colormaps($cmap)] } {
     1479            BuildColormap $cmap
     1480            set _colormaps($cmap) 1
     1481        }
     1482        #SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     1483        SendCmd "legend2 $cmap $w $h"
    14791484    }
    14801485}
  • branches/1.3/gui/scripts/vtkviewer.tcl

    r5110 r5177  
    17881788        foreach {dataobj comp} [split $dataset -] break
    17891789        if { [info exists _dataset2style($dataset)] } {
    1790             SendCmd "legend $_dataset2style($dataset) vmag {} {} $w $h 0"
     1790            #SendCmd "legend $_dataset2style($dataset) vmag {} {} $w $h 0"
     1791            SendCmd "legend2 $_dataset2style($dataset) $w $h"
    17911792            break;
    17921793        }
  • branches/1.3/gui/scripts/vtkvolumeviewer.tcl

    r5110 r5177  
    14651465        foreach {dataobj comp} [split $dataset -] break
    14661466        if { [info exists _dataset2style($dataset)] } {
    1467             SendCmd \
    1468                 "legend $_dataset2style($dataset) $_colorMode $_curFldName {} $w $h 0"
     1467            #SendCmd "legend $_dataset2style($dataset) $_colorMode $_curFldName {} $w $h 0"
     1468            SendCmd "legend2 $_dataset2style($dataset) $w $h"
    14691469            break;
    14701470        }
     
    16231623        Rappture::Combobox $inner.palette -width 10 -editable no
    16241624    }
    1625     $inner.palette choices insert end \
    1626         "BCGYR"              "BCGYR"            \
    1627         "BGYOR"              "BGYOR"            \
    1628         "blue"               "blue"             \
    1629         "blue-to-brown"      "blue-to-brown"    \
    1630         "blue-to-orange"     "blue-to-orange"   \
    1631         "blue-to-grey"       "blue-to-grey"     \
    1632         "green-to-magenta"   "green-to-magenta" \
    1633         "greyscale"          "greyscale"        \
    1634         "nanohub"            "nanohub"          \
    1635         "rainbow"            "rainbow"          \
    1636         "spectral"           "spectral"         \
    1637         "ROYGB"              "ROYGB"            \
    1638         "RYGCB"              "RYGCB"            \
    1639         "brown-to-blue"      "brown-to-blue"    \
    1640         "grey-to-blue"       "grey-to-blue"     \
    1641         "orange-to-blue"     "orange-to-blue"   
     1625    $inner.colormap choices insert end [GetColormapList]
    16421626
    16431627    $itk_component(palette) value "BCGYR"
Note: See TracChangeset for help on using the changeset viewer.