Changeset 3209 for branches


Ignore:
Timestamp:
Dec 17, 2012 8:57:04 AM (12 years ago)
Author:
gah
Message:

Added debug window for vtkvis commands

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Rappture 1.2/gui/scripts/vtkheightmapviewer.tcl

    r3204 r3209  
    8585    private method BuildAxisTab {}
    8686    private method BuildCameraTab {}
    87     private method BuildViewTab {}
    8887    private method BuildColormap { name colors }
     88    private method BuildContourTab {}
    8989    private method BuildCutplaneTab {}
    9090    private method BuildDownloadPopup { widget command }
    91     private method BuildContourTab {}
     91    private method BuildViewTab {}
     92    private method ChangeColormap { dataobj comp color }
     93    private method ColorsToColormap { color }
     94    private method Combo { option }
    9295    private method ConvertToVtkData { dataobj comp }
    9396    private method DrawLegend { title }
    94     private method Combo { option }
    9597    private method EnterLegend { x y }
     98    private method EventuallyContour { numContours }
    9699    private method EventuallyResize { w h }
    97     private method EventuallyContour { numContours }
    98100    private method EventuallyRotate { q }
    99101    private method EventuallySetCutplane { axis args }
     
    106108    private method RequestLegend {}
    107109    private method SetColormap { dataobj comp }
    108     private method ChangeColormap { dataobj comp color }
    109     private method ColorsToColormap { color }
    110110    private method SetLegendTip { x y }
    111111    private method SetObjectStyle { dataobj comp }
    112112    private method Slice {option args}
     113
     114    private method DebugConsole {}
     115    private method BuildConsole {}
     116    private method TraceComm { channel {data {}} }
     117    private method SendDebugCommand {}
    113118
    114119    private variable _arcball ""
     
    238243
    239244    array set _settings [subst {
     245        debug-console           0
    240246        axis-labels             1
    241247        axis-visible            1
     
    20112017        -font "Arial 9"
    20122018
     2019    checkbutton $inner.debug \
     2020        -text "Debug " \
     2021        -variable [itcl::scope _settings(debug-console)] \
     2022        -command [itcl::code $this DebugConsole] \
     2023        -font "Arial 9"
     2024
    20132025    blt::table $inner \
    20142026        0,0 $inner.view      -anchor w -pady 2 \
     
    20182030        5,0 $inner.contour   -anchor w -pady 2 \
    20192031        6,0 $inner.heightmap -anchor w -pady 2 \
     2032        8,0 $inner.debug     -anchor w -pady 2 \
    20202033
    20212034    blt::table configure $inner r* c* -resize none
    2022     blt::table configure $inner r8 c1 -resize expand
    2023     blt::table configure $inner r4 -height 0.25i
     2035    blt::table configure $inner r9 c1 -resize expand
     2036    blt::table configure $inner r4 r7 -height 0.25i
    20242037}
    20252038
     
    27752788    }
    27762789}
     2790
     2791# ----------------------------------------------------------------------
     2792# USAGE: show_comm <channel> <data>
     2793#
     2794# Invoked automatically whenever there is communication between
     2795# the rendering widget and the server.  Eavesdrops on the communication
     2796# and posts the commands in a text viewer.
     2797# ----------------------------------------------------------------------
     2798itcl::body Rappture::VtkHeightmapViewer::TraceComm {channel {data ""}} {
     2799    $itk_component(trace) configure -state normal
     2800    switch -- $channel {
     2801        closed {
     2802            $itk_component(trace) insert end "--CLOSED--\n" error
     2803        }
     2804        <<line {
     2805            $itk_component(trace) insert end $data incoming "\n" incoming
     2806        }
     2807        >>line {
     2808            $itk_component(trace) insert end $data outgoing "\n" outgoing
     2809        }
     2810        error {
     2811            $itk_component(trace) insert end $data error "\n" error
     2812        }
     2813        default {
     2814            $itk_component(trace) insert end "$data\n"
     2815        }
     2816    }
     2817    $itk_component(trace) configure -state disabled
     2818    $itk_component(trace) see end
     2819}
     2820
     2821# ----------------------------------------------------------------------
     2822# USAGE: send_command
     2823#
     2824# Invoked automatically whenever the user enters a command and
     2825# presses <Return>.  Sends the command along to the rendering
     2826# widget.
     2827# ----------------------------------------------------------------------
     2828itcl::body Rappture::VtkHeightmapViewer::SendDebugCommand {} {
     2829    set cmd [$itk_component(command) get]
     2830    SendBytes "$cmd\n"
     2831    $itk_component(command) delete 0 end
     2832}
     2833
     2834itcl::body Rappture::VtkHeightmapViewer::BuildConsole {} {
     2835    toplevel .vtkconsole
     2836   
     2837    set f .vtkconsole
     2838    frame $f.send
     2839    pack $f.send -side bottom -fill x
     2840    label $f.send.l -text "Send:"
     2841    pack $f.send.l -side left
     2842    itk_component add command {
     2843        entry $f.send.e -background white
     2844    } {
     2845        ignore -background
     2846    }
     2847    pack $f.send.e -side left -expand yes -fill x
     2848    bind $f.send.e <KeyPress-Return> [itcl::code $this SendDebugCommand]
     2849   
     2850    scrollbar $f.sb -orient vertical -command "$f.comm yview"
     2851    pack $f.sb -side right -fill y
     2852    itk_component add trace {
     2853        text $f.comm -wrap char -yscrollcommand "$f.sb set" -background white
     2854    } {
     2855        ignore -background
     2856    }
     2857    pack $f.comm -expand yes -fill both
     2858
     2859    $itk_component(trace) tag configure error -foreground red \
     2860        -font -*-courier-medium-o-normal-*-*-120-*
     2861    $itk_component(trace) tag configure incoming -foreground blue
     2862}
     2863
     2864itcl::body Rappture::VtkHeightmapViewer::DebugConsole {} {
     2865    if { ![winfo exists .vtkconsole] } {
     2866        BuildConsole
     2867    }
     2868    if { $_settings(debug-console) } {
     2869        $this configure -sendcommand [itcl::code $this TraceComm]
     2870        $this configure -receivecommand [itcl::code $this TraceComm]
     2871        wm deiconify .vtkconsole
     2872    } else {
     2873        $this configure -sendcommand ""
     2874        $this configure -receivecommand ""
     2875        wm withdraw .vtkconsole
     2876    }
     2877}
     2878
     2879
     2880
     2881
     2882
     2883
     2884
     2885
     2886
     2887
     2888
     2889
     2890
     2891
     2892
     2893
     2894
     2895
Note: See TracChangeset for help on using the changeset viewer.