source: trunk/gui/scripts/textresult.tcl @ 11

Last change on this file since 11 was 11, checked in by mmc, 16 years ago

Major reorganization of the entire package. The config.xml file
is now irrelevant. All the action is in the tool.xml file. The
main program now organizes all input into 1) side-by-side pages,
2) input/result (wizard-style) pages, or 3) a series of wizard-
style pages. The <input> can have <phase> parts representing
the various pages.

Added a new ContourResult? widget based on Swaroop's vtk plotting
code.

Also, added easymesh and showmesh to the "tools" directory.
We need these for Eric Polizzi's code.

File size: 4.2 KB
Line 
1# ----------------------------------------------------------------------
2#  COMPONENT: TextResult - Log output for ResultSet
3#
4#  This widget is used to show text output in a ResultSet.  The log
5#  output from a tool, for example, is rendered as a TextResult.
6# ======================================================================
7#  AUTHOR:  Michael McLennan, Purdue University
8#  Copyright (c) 2004-2005
9#  Purdue Research Foundation, West Lafayette, IN
10# ======================================================================
11package require Itk
12package require BLT
13
14option add *TextResult.width 4i widgetDefault
15option add *TextResult.height 4i widgetDefault
16option add *TextResult.font \
17    -*-courier-medium-r-normal-*-*-120-* widgetDefault
18
19itcl::class Rappture::TextResult {
20    inherit itk::Widget
21
22    constructor {args} { # defined below }
23
24    public method add {dataobj {settings ""}}
25    public method delete {args}
26    public method scale {args}
27}
28                                                                               
29itk::usual TextResult {
30    keep -background -foreground -cursor -font
31}
32
33# ----------------------------------------------------------------------
34# CONSTRUCTOR
35# ----------------------------------------------------------------------
36itcl::body Rappture::TextResult::constructor {args} {
37    option add hull.width hull.height
38    pack propagate $itk_component(hull) no
39
40    itk_component add scroller {
41        Rappture::Scroller $itk_interior.scroller \
42            -xscrollmode auto -yscrollmode auto
43    }
44    pack $itk_component(scroller) -expand yes -fill both
45
46    itk_component add text {
47        text $itk_component(scroller).text -width 1 -height 1 -wrap none
48    }
49    $itk_component(scroller) contents $itk_component(text)
50    $itk_component(text) configure -state disabled
51
52    eval itk_initialize $args
53}
54
55# ----------------------------------------------------------------------
56# USAGE: add <dataobj> ?<settings>?
57#
58# Clients use this to add a data object to the plot.  If the optional
59# <settings> are specified, then the are applied to the data.  Allowed
60# settings are -color and -width/-raise (ignored).
61# ----------------------------------------------------------------------
62itcl::body Rappture::TextResult::add {dataobj {settings ""}} {
63    array set params {
64        -color ""
65        -width ""
66        -raise ""
67    }
68    foreach {opt val} $settings {
69        if {![info exists params($opt)]} {
70            error "bad setting \"$opt\": should be [join [lsort [array names params]] {, }]"
71        }
72        set params($opt) $val
73    }
74
75    $itk_component(text) configure -state normal
76    $itk_component(text) delete 1.0 end
77
78    if {"" != $dataobj} {
79        set txt [$dataobj get]
80        if {"" != $params(-color)} {
81#
82# ignore color for now -- may use it some day
83#
84#            $itk_component(text) insert end $txt special
85#            $itk_component(text) tag configure special \
86#                -foreground $params(-color)
87            $itk_component(text) insert end $txt
88        } else {
89            $itk_component(text) insert end $txt
90        }
91    }
92
93    $itk_component(text) configure -state disabled
94}
95
96# ----------------------------------------------------------------------
97# USAGE: delete ?<curve1> <curve2> ...?
98#
99# Clients use this to delete a curve from the plot.  If no curves
100# are specified, then all curves are deleted.
101# ----------------------------------------------------------------------
102itcl::body Rappture::TextResult::delete {args} {
103    $itk_component(text) configure -state normal
104    $itk_component(text) delete 1.0 end
105    $itk_component(text) configure -state disabled
106}
107
108# ----------------------------------------------------------------------
109# USAGE: scale ?<curve1> <curve2> ...?
110#
111# Sets the default limits for the overall plot according to the
112# limits of the data for all of the given <curve> objects.  This
113# accounts for all curves--even those not showing on the screen.
114# Because of this, the limits are appropriate for all curves as
115# the user scans through data in the ResultSet viewer.
116# ----------------------------------------------------------------------
117itcl::body Rappture::TextResult::scale {args} {
118    # nothing to do for text
119}
Note: See TracBrowser for help on using the repository browser.