📄 node.tk
字号:
set x2 [lindex $coords 2] set w [expr $x2 - $x1] set aScale [nodeMatchItemTag $nodeframe $item scale] if {![info exists max($j)]} { set max($j) 0 } else { if {!$aScale && $x1 > $max($j)} { set max($j) $x1 } } if { ![info exists maxw($j)] || $w > $maxw($j) } { set maxw($j) $w } incr j set item [nodeLineGet $nodeframe $i $j] } incr i if { [string compare $endl "end"] != 0 && $i > $endl} { break } set j 0 set item [nodeLineGet $nodeframe $i $j] } set glen [array size max] for {set g 0} {$g < $glen} {incr g} { set newval [expr $max($g) + $maxw($g)] set k [expr $g + 1] if {[info exists max($k)] && $newval > $max($k)} { set max($k) $newval } nodeGroupXCPut $nodeframe $g $max($g) }}proc nodeAdjustDisplay {nodeframe splitl} { global canvas if {[string compare $nodeframe ""] == 0} { return } set viewtype [nodeViewTypeGet $nodeframe] switch -exact -- $viewtype { MIRROR { set text_width $canvas(bigTextFontWidth) set text_height $canvas(bigTextFontHeight) } default { set text_width $canvas(smallTextFontWidth) set text_height $canvas(smallTextFontHeight) } } if {$splitl < 0} { nodeFindXCs $nodeframe 0 end } else { nodeFindXCs $nodeframe 0 [expr $splitl - 1] } set canv [nodeCanvasGet $nodeframe] set maxw 0 set maxs 0 set totheight $text_height set i 0 set j 0 set xgsave 0 set item [nodeLineGet $nodeframe $i $j] while {[string compare $item ""] != 0} { set maxh 0 set hasScale 0 while {[string compare $item ""] != 0} { set xg [nodeGroupXCGet $nodeframe $j] if {$j == 0} { set xgsave $xg } set x1 [lindex [$canv bbox $item] 0] set xoffset [expr $xg - $x1] $canv move $item $xoffset 0 set coords [$canv bbox $item] set x1 [lindex $coords 0] set x2 [lindex $coords 2] set y1 [lindex $coords 1] set y2 [lindex $coords 3] set h [expr ($y2 - $y1) + 1] if {$h > $maxh} { set maxh $h } incr j set item [nodeLineGet $nodeframe $i $j] } if {$x2 > $maxw} { set maxw $x2 } if {$hasScale && $x2 > $maxs} { set maxs $x2 } incr totheight $maxh incr i if {$i == $splitl} { nodeFindXCs $nodeframe $splitl end nodeGroupXCPut $nodeframe 0 $xgsave } set j 0 set item [nodeLineGet $nodeframe $i $j] } incr maxw if {$maxw != [nodeScrollRegionWidthGet $nodeframe]} { nodeScrollRegionWidthPut $nodeframe $maxw set xscroll [nodeXscrollGet $nodeframe] if {[string compare $viewtype ICON] != 0} { if {$maxw > [nodeCanvasWidthGet $nodeframe]} { catch {pack $xscroll -side bottom -fill x -padx 0 \ -pady 0 -ipadx 0 -ipady 0} } } else { catch {pack forget $xscroll} } } set scrollheight [nodeScrollRegionHeightGet $nodeframe] if {$totheight != [nodeScrollRegionHeightGet $nodeframe]} { nodeScrollRegionHeightPut $nodeframe $totheight set yscroll [nodeYscrollGet $nodeframe] if {[string compare $viewtype ICON] != 0} { if {$totheight > [nodeCanvasHeightGet $nodeframe]} { catch {pack $yscroll -side right -fill y -padx 0 \ -pady 0 -ipadx 0 -ipady 0 -anchor nw} } } else { catch {pack forget $yscroll} } } set scrollRegionWidth [nodeScrollRegionWidthGet $nodeframe] set scrollRegionHeight [nodeScrollRegionHeightGet $nodeframe] $canv configure \ -scrollregion [list 0 0 $scrollRegionWidth $scrollRegionHeight]}proc nodeDown nodeframe { global canvas if {[string compare $nodeframe ""] == 0} { return } [nodeCanvasGet $nodeframe] configure -background $canvas(nodeColorDOWN)}proc nodeUp nodeframe { global canvas if {[string compare $nodeframe ""] == 0} { return } [nodeCanvasGet $nodeframe] configure -background $canvas(nodeColorFREE)}proc nodeOffline nodeframe { global canvas if {[string compare $nodeframe ""] == 0} { return } [nodeCanvasGet $nodeframe] configure -background $canvas(nodeColorOFFL)}proc nodeReserved nodeframe { global canvas if {[string compare $nodeframe ""] == 0} { return } [nodeCanvasGet $nodeframe] configure -background $canvas(nodeColorRSVD)}proc nodeNoInfo nodeframe { global canvas if {[string compare $nodeframe ""] == 0} { return } [nodeCanvasGet $nodeframe] configure -background $canvas(nodeColorNOINFO)}proc nodeInUse nodeframe { global canvas if {[string compare $nodeframe ""] == 0} { return } set nodename [nodeNameGet $nodeframe] set sysframe [clusterSystemFrameGet [nodeClusterFrameGet $nodeframe]] set color "" set nodestat [systemNodeStatusGet $sysframe $nodename] set nodeinfo [systemNodeInfoGet $sysframe $nodename] set k [expr [llength $nodeinfo] - 1] while {$k >= 0} { set info [lindex $nodeinfo $k] set type [lindex $info end] if {[string compare $type NODEJOB] == 0} { set userinfo [lindex $info 0] set jobs "" foreach u $userinfo { set uname [lindex $u 0] set jids [lindex $u 1] foreach j [split $jids ","] { set jstr [lindex [split $j "."] 0] lappend jobs "$jstr.$uname" } } set jobslen [llength $jobs] if { [string compare $nodestat INUSE-EXCLUSIVE] == 0 \ && $jobslen <= 1} { set color [assignNodeColorInUse $jobs] } else { set color [assignNodeColorInUse TIMESHARED \ $canvas(nodeColorINUSEshared)] } break } incr k -1 } if {[string compare $color ""] != 0} { [nodeCanvasGet $nodeframe] configure -background $color }}proc nodeUpdateStat {sysframe nodeid status2 {defstat NOINFO}} { if {[string compare $sysframe ""] == 0} { return } set status [statNodesStateMap $status2] set nodeframe [systemNodeFrameGet $sysframe $nodeid FULL] set nodestat [systemNodeStatusGet $sysframe $nodeid] set oldstatus $nodestat if {[string compare $status ""] == 0} { set status [statNodesStateMap $defstat] } systemNodeStatusPut $sysframe $nodeid $status set clusterf [nodeClusterFrameGet $nodeframe] if {[string compare $clusterf ""] != 0} { clusterStatsUpdate $clusterf $status + clusterStatsUpdate $clusterf $oldstatus - }}proc nodeColorIt {nodeframe nodeid} { if {[string compare $nodeframe ""] == 0} { return } set cframe [nodeClusterFrameGet $nodeframe] set sysframe [clusterSystemFrameGet $cframe] set status [systemNodeStatusGet $sysframe $nodeid] switch -exact -- $status { OFFLINE { nodeOffline $nodeframe } DOWN { nodeDown $nodeframe } FREE { nodeUp $nodeframe } INUSE-SHARED - INUSE-EXCLUSIVE { nodeInUse $nodeframe } RESERVED { nodeReserved $nodeframe } default { nodeNoInfo $nodeframe } } set viewtype [nodeViewTypeGet $nodeframe] if {[string compare $viewtype ICON] == 0} { nodeReCoverCanvas $nodeframe }}proc nodeDisplayInfo {nodeframe queryInfo {create 0}} { if {[string compare $nodeframe ""] == 0} { return } set nodename [nodeNameGet $nodeframe] nodeColorIt $nodeframe $nodename set llen [llength $queryInfo] set jobline -1 for {set i 0} {$i < $llen} {incr i} { set queryinfo [lindex $queryInfo $i] set expr [lindex $queryinfo 0] set hdr [lindex $queryinfo 1] set typ [lindex $queryinfo 2] set res [evaluateExpr $expr] if {[string compare $typ TEXT] == 0} { if {$create} { nodeAddLineText $nodeframe $i [list $hdr $res] } else { nodeModLineText $nodeframe $i [list $hdr $res] } } elseif {[string compare $typ SCALE] == 0} { if {$create} { nodeAddLineScale $nodeframe $i [list $hdr $res] } else { nodeModLineScale $nodeframe $i [list $hdr $res] } } elseif {[string compare $typ NODEJOB] == 0} { set jobline $i if {[string compare \ [nodeLineGet $nodeframe $i 0] ""] == 0} { nodeAddLineText $nodeframe $i $hdr } else { nodeModLineText $nodeframe $i $hdr } set k [expr $i+1] foreach e $expr { set user [lindex $e 0] set ljobs [lrange $e 1 end] set arglist [list " " " " $user " " $ljobs] if {[string compare \ [nodeLineGet $nodeframe $k 0] ""] == 0} { nodeAddLineText $nodeframe $k $arglist } else { nodeModLineText $nodeframe $k $arglist } incr k } } } if {![info exists k]} { set k $i }# Remove extra lines that are not found in queryInfo nodeRemLines $nodeframe $k nodeAdjustDisplay $nodeframe $jobline set viewtype [nodeViewTypeGet $nodeframe] if {[string compare $viewtype ICON] == 0} { nodeCoverCanvas $nodeframe } else { nodeUnCoverCanvas $nodeframe } update idletasks}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -