Changeset 724 for trunk/gui/scripts/tool.tcl
- Timestamp:
- May 10, 2007, 7:53:32 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/tool.tcl
r680 r724 24 24 } { # defined below } 25 25 26 public method get {{option ""}}27 26 public method installdir {} { return $_installdir } 28 27 … … 37 36 private common jobnum 0 ;# counter for unique job number 38 37 39 # resources file tells us the application name 40 public common _appname "" 41 public proc setAppName {name} { set _appname $name } 38 # get global resources for this tool session 39 public proc resources {{option ""}} 40 41 public common _resources 42 public proc setAppName {name} { set _resources(-appname) $name } 43 public proc setHubName {name} { set _resources(-hubname) $name } 44 public proc setHubURL {name} { set _resources(-huburl) $name } 45 public proc setSession {name} { set _resources(-session) $name } 42 46 } 43 47 … … 45 49 proc tool_init_resources {} { 46 50 Rappture::resources::register \ 47 application_name Rappture::Tool::setAppName 51 application_name Rappture::Tool::setAppName \ 52 application_id Rappture::Tool::setAppId \ 53 hub_name Rappture::Tool::setHubName \ 54 hub_url Rappture::Tool::setHubURL \ 55 session_token Rappture::Tool::setSession 48 56 } 49 57 … … 66 74 67 75 # ---------------------------------------------------------------------- 68 # USAGE: get?-option?76 # USAGE: resources ?-option? 69 77 # 70 78 # Clients use this to query information about the tool. 71 79 # ---------------------------------------------------------------------- 72 itcl::body Rappture::Tool::get {{option ""}} { 73 set values(-name) $_appname 80 itcl::body Rappture::Tool::resources {{option ""}} { 74 81 if {$option == ""} { 75 return [array get values]76 } 77 if {![info exists values]} {78 error "bad option \"$option\": should be [join [array names values] {, }]"79 } 80 return $ values($option)82 return [array get _resources] 83 } 84 if {![info exists _resources($option)]} { 85 error "bad option \"$option\": should be [join [array names _resources] {, }]" 86 } 87 return $_resources($option) 81 88 } 82 89 … … 114 121 # tool name from the resources config file. 115 122 # 116 if {"" != $_ appname&& "" == [$_xmlobj get tool.name]} {117 $_xmlobj put tool.name $_ appname123 if {"" != $_resources(-appname) && "" == [$_xmlobj get tool.name]} { 124 $_xmlobj put tool.name $_resources(-appname) 118 125 } 119 126
Note: See TracChangeset
for help on using the changeset viewer.