📄 node.tk
字号:
# OpenPBS (Portable Batch System) v2.3 Software License# # Copyright (c) 1999-2000 Veridian Information Solutions, Inc.# All rights reserved.# # ---------------------------------------------------------------------------# For a license to use or redistribute the OpenPBS software under conditions# other than those described below, or to purchase support for this software,# please contact Veridian Systems, PBS Products Department ("Licensor") at:# # www.OpenPBS.org +1 650 967-4675 sales@OpenPBS.org# 877 902-4PBS (US toll-free)# ---------------------------------------------------------------------------# # This license covers use of the OpenPBS v2.3 software (the "Software") at# your site or location, and, for certain users, redistribution of the# Software to other sites and locations. Use and redistribution of# OpenPBS v2.3 in source and binary forms, with or without modification,# are permitted provided that all of the following conditions are met.# After December 31, 2001, only conditions 3-6 must be met:# # 1. Commercial and/or non-commercial use of the Software is permitted# provided a current software registration is on file at www.OpenPBS.org.# If use of this software contributes to a publication, product, or# service, proper attribution must be given; see www.OpenPBS.org/credit.html# # 2. Redistribution in any form is only permitted for non-commercial,# non-profit purposes. There can be no charge for the Software or any# software incorporating the Software. Further, there can be no# expectation of revenue generated as a consequence of redistributing# the Software.# # 3. Any Redistribution of source code must retain the above copyright notice# and the acknowledgment contained in paragraph 6, this list of conditions# and the disclaimer contained in paragraph 7.# # 4. Any Redistribution in binary form must reproduce the above copyright# notice and the acknowledgment contained in paragraph 6, this list of# conditions and the disclaimer contained in paragraph 7 in the# documentation and/or other materials provided with the distribution.# # 5. Redistributions in any form must be accompanied by information on how to# obtain complete source code for the OpenPBS software and any# modifications and/or additions to the OpenPBS software. The source code# must either be included in the distribution or be available for no more# than the cost of distribution plus a nominal fee, and all modifications# and additions to the Software must be freely redistributable by any party# (including Licensor) without restriction.# # 6. All advertising materials mentioning features or use of the Software must# display the following acknowledgment:# # "This product includes software developed by NASA Ames Research Center,# Lawrence Livermore National Laboratory, and Veridian Information# Solutions, Inc.# Visit www.OpenPBS.org for OpenPBS software support,# products, and information."# # 7. DISCLAIMER OF WARRANTY# # THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT# ARE EXPRESSLY DISCLAIMED.# # IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE# U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT,# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.# # This license will be governed by the laws of the Commonwealth of Virginia,# without reference to its choice of law rules.proc nodeCreate { nodeframe nodename nodelabel clusterframe {nodeType NOMOM_SNODE} {viewType "FULL"} } { global canvas sysinfo if {[string compare $nodeframe ""] == 0 || \ [string compare $nodename ""] == 0} { return } set sysframe "" if {[string compare $clusterframe ""] != 0} { set sysframe [clusterSystemFrameGet $clusterframe] systemNodeFramePut $sysframe $nodename $nodeframe $viewType } nodeNamePut $nodeframe $nodename nodeViewTypePut $nodeframe $viewType nodeTypePut $nodeframe $nodeType nodeClusterFramePut $nodeframe $clusterframe switch -exact -- $viewType { MIRROR { set label_font $canvas(bigLabelFont) set label_font_width $canvas(bigLabelFontWidth) set label_font_height $canvas(bigLabelFontHeight) set text_width $canvas(bigTextFontWidth) set text_height $canvas(bigTextFontHeight) set maxWidth $canvas(mirrorMaxWidth) set maxHeight $canvas(mirrorMaxHeight) } FULL { set label_font $canvas(smallLabelFont) set label_font_width $canvas(smallLabelFontWidth) set label_font_height $canvas(smallLabelFontHeight) set text_width $canvas(smallTextFontWidth) set text_height $canvas(smallTextFontHeight) set maxWidth $canvas(nodeMaxWidth) set maxHeight $canvas(nodeMaxHeight) } ICON { set label_font $canvas(smallLabelFont) set label_font_width $canvas(smallLabelFontWidth) set label_font_height $canvas(smallLabelFontHeight) set text_width $canvas(smallTextFontWidth) set text_height $canvas(smallTextFontHeight) set maxWidth $canvas(iconMaxWidth) set maxHeight $canvas(iconMaxHeight) } default { return } } set basicWidth $maxWidth set basicHeight $maxHeight frame $nodeframe -class Small frame $nodeframe.cf -borderwidth 0 frame $nodeframe.cf.c -class SmallCanvas frame $nodeframe.cf.y -borderwidth 0 frame $nodeframe.cf.x -borderwidth 0 frame $nodeframe.lf -class SmallLabel -borderwidth 0 -relief flat set nodelabel2 $nodelabel if { [string compare $viewType "ICON"] == 0 } { set nodelabel2 [lindex [split $nodelabel .] 0] label $nodeframe.lf.label -text $nodelabel2 -justify left \ -font $label_font -anchor nw } else { label $nodeframe.lf.label -text $nodelabel2 -justify center \ -font $label_font -anchor c } set labelWidth [expr 2*$canvas(smallBd) + 2*$canvas(smallLabelBd) + \ $label_font_width*[string length $nodelabel2]] set labelHeight [expr $canvas(smallBd) + 2*$canvas(smallLabelBd) + \ + $label_font_height] canvas $nodeframe.cf.c.canvas -width $basicWidth -height $basicHeight \ -xscrollcommand [list $nodeframe.cf.x.xscroll set] \ -yscrollcommand [list $nodeframe.cf.y.yscroll set] \ -confine 1 nodeCanvasPut $nodeframe $nodeframe.cf.c.canvas set sysinfo(nodeframe,$nodeframe.cf.c.canvas) $nodeframe bind_canvas $nodeframe.cf.c.canvas set nodestat [systemNodeStatusGet $sysframe $nodename] if { [string compare $nodeType MOM] == 0 || \ [string compare $nodeType MOM_SNODE] == 0} { if {[string compare $viewType MIRROR] != 0 } { nodeUpdateStat $sysframe $nodename $nodestat NOINFO } else { nodeNoInfo $nodeframe } } else { if {[string compare $viewType MIRROR] != 0} { nodeUpdateStat $sysframe $nodename $nodestat FREE } else { nodeUp $nodeframe } } set canvasFrameWidth [expr $canvas(smallBd) + \ 2*$canvas(smallCanvasBd)] set canvasFrameHeight [expr 2*$canvas(smallCanvasBd)] scrollbar $nodeframe.cf.x.xscroll -orient horizontal \ -relief $canvas(smallScrollRelief) \ -borderwidth $canvas(smallScrollBd) \ -background $canvas(smallScrollBg) \ -width $text_height \ -command [list $nodeframe.cf.c.canvas xview] set scrollHeight [expr $canvas(smallBd) + \ 2*[lindex [$nodeframe.cf.x.xscroll configure -borderwidth] end] \ + [lindex [$nodeframe.cf.x.xscroll configure -width] end]] $nodeframe.cf.x configure -height $scrollHeight scrollbar $nodeframe.cf.y.yscroll -orient vertical \ -relief $canvas(smallScrollRelief) \ -borderwidth $canvas(smallScrollBd) \ -background $canvas(smallScrollBg) \ -width $text_height \ -command [list $nodeframe.cf.c.canvas yview] set scrollWidth [expr $canvas(smallBd) + \ 2*[lindex [$nodeframe.cf.y.yscroll configure -borderwidth] end] \ + [lindex [$nodeframe.cf.y.yscroll configure -width] end]] $nodeframe.cf.y configure -width $scrollWidth nodeLabelPut $nodeframe $nodeframe.lf.label nodeLabelFramePut $nodeframe $nodeframe.lf nodeCanvasFramePut $nodeframe $nodeframe.cf.c nodeMainFramePut $nodeframe $nodeframe.cf nodeXscrollPut $nodeframe $nodeframe.cf.x.xscroll nodeXscrollFramePut $nodeframe $nodeframe.cf.x nodeYscrollPut $nodeframe $nodeframe.cf.y.yscroll nodeYscrollFramePut $nodeframe $nodeframe.cf.y nodeXposPut $nodeframe 0 nodeYposPut $nodeframe 0 nodeScrollRegionWidthPut $nodeframe 0 nodeScrollRegionHeightPut $nodeframe 0 nodeOffsetWidthPut $nodeframe 0 nodeNextPut $nodeframe "" nodeRefreshPut $nodeframe 0 pack $nodeframe.lf.label -fill both -expand true -padx 0 -pady 0 -ipadx 0 -ipady 0 -anchor nw pack $nodeframe.cf.c.canvas -fill both -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $nodeframe.cf.y -side right -fill y -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $nodeframe.cf.x -side bottom -fill x -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $nodeframe.cf.c -expand true -fill both -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $nodeframe.lf $nodeframe.cf -side top -fill both -expand true -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $nodeframe -expand true -fill both -padx 0 -pady 0 -ipadx 0 -ipady 0 set width [expr $canvasFrameWidth + $basicWidth + $scrollWidth] if {$labelWidth > $width} { set width $labelWidth } nodeCanvasWidthPut $nodeframe $basicWidth nodeDisplayWidthPut $nodeframe $width if {$width > $maxWidth} { set canvWidth [expr $maxWidth - \ $canvasFrameWidth - $scrollWidth] if {$canvWidth > 0} { nodeCanvasWidthPut $nodeframe $canvWidth nodeDisplayWidthPut $nodeframe $maxWidth $nodeframe.cf.c.canvas configure -width $canvWidth set width $maxWidth } } set height [expr $labelHeight + $canvasFrameHeight + $basicHeight + \ $scrollHeight] nodeCanvasHeightPut $nodeframe $basicHeight nodeDisplayHeightPut $nodeframe $height if {$height > $maxHeight} { set canvHeight [expr $maxHeight - \ $labelHeight - $canvasFrameHeight - $scrollHeight] if {$canvHeight > 0} { nodeCanvasHeightPut $nodeframe $canvHeight nodeDisplayHeightPut $nodeframe $maxHeight $nodeframe.cf.c.canvas configure -height $canvHeight set height $maxHeight } } if {[string compare $viewType ICON] == 0} { nodeCoverCanvas $nodeframe } else { nodeUnCoverCanvas $nodeframe } return [list $width $height]}proc nodeAddWidth {nodeframe incr} { global canvas if {[string compare $nodeframe ""] == 0 || \ ![regexp {[0-9]+} $incr]} { return } set vtype [nodeViewTypeGet $nodeframe] switch -exact -- $vtype { MIRROR { set maxWidth $canvas(mirrorMaxWidth) } FULL { set maxWidth $canvas(nodeMaxWidth) } ICON { set maxWidth $canvas(iconMaxWidth) } default { return } } set newDispWidth [expr [nodeDisplayWidthGet $nodeframe] + $incr] if {$newDispWidth < $maxWidth } { nodeCanvasWidthPut $nodeframe \ [expr [nodeCanvasWidthGet $nodeframe] + $incr] nodeDisplayWidthPut $nodeframe $newDispWidth clusterAddWidth [nodeClusterFrameGet $nodeframe] $incr }}proc nodeRepack {nodeframe} { global canvas if {[string compare $nodeframe ""] == 0} { return } set vtype [nodeViewTypeGet $nodeframe] switch -exact -- $vtype { MIRROR { set maxWidth $canvas(mirrorMaxWidth) } FULL { set maxWidth $canvas(nodeMaxWidth) } ICON { set maxWidth $canvas(iconMaxWidth) } default { return } } set label [nodeLabelGet $nodeframe] set labelFrame [nodeLabelFrameGet $nodeframe] set c [nodeCanvasGet $nodeframe] set canvasFrame [nodeCanvasFrameGet $nodeframe] set mainFrame [nodeMainFrameGet $nodeframe] set xscroll [nodeXscrollGet $nodeframe] set xscrollf [nodeXscrollFrameGet $nodeframe] set yscroll [nodeYscrollGet $nodeframe] set yscrollf [nodeYscrollFrameGet $nodeframe] set clusterf [nodeClusterFrameGet $nodeframe] set clusterc [clusterCanvasGet $clusterf] if {[string compare $clusterc ""] != 0} { catch {pack forget $labelFrame $mainFrame $canvasFrame $xscrollf} $clusterc delete $nodeframe } set canvWidth [nodeCanvasWidthGet $nodeframe] set scrollRegionWidth [nodeScrollRegionWidthGet $nodeframe] set scrollRegionHeight [nodeScrollRegionHeightGet $nodeframe] set canvWidth [nodeCanvasWidthGet $nodeframe] set canvHeight [nodeCanvasHeightGet $nodeframe] if {$scrollRegionWidth > $canvWidth} { catch {pack $xscroll -side bottom -fill x -padx 0 -pady 0 -ipadx 0 -ipady 0} } else { catch {pack forget $xscroll} } if {$scrollRegionHeight > $canvHeight} { catch {pack $yscroll -side right -fill y -padx 0 -pady 0 -ipadx 0 -ipady 0 -anchor nw} } else { catch {pack forget $yscroll} } if {[string compare $clusterc ""] == 0} { return } pack $label -fill both -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $c -fill both -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $yscrollf -side right -fill y -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $xscrollf -side bottom -fill x -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $canvasFrame -fill both -expand true -padx 0 -pady 0 -ipadx 0 -ipady 0 pack $labelFrame $mainFrame -side top -fill both -expand true -padx 0 -pady 0 -ipadx 0 -ipady 0 $c configure -width $canvWidth -height $canvHeight \ -scrollregion [list 0 0 $scrollRegionWidth $scrollRegionHeight] $clusterc create window \ [nodeXposGet $nodeframe] \ [nodeYposGet $nodeframe] \ -window $nodeframe -anchor nw \ -tags $nodeframe \ -width [nodeDisplayWidthGet $nodeframe] \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -