📄 pref.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.################################################################################# pref: defines the layout and functions of the user preferences# dialog box.proc pref {callerDialogBox focusBox} { global prefDialogBox activeWindow dialog sysinfo set sysinfo(PREFLCK) 1 busy_cursor## Bring up the standard Dialog box ## set dialog(prefDialogBox) ".pref" set dbox [popupDialogBox $dialog(prefDialogBox) "User Preferences Dialog"] set activeWindow($dialog(prefDialogBox)) 1 set dbox_top [lindex $dbox 0] set dbox_bottom [lindex $dbox 1]## TOP PART ## box $dbox_top.box1 -title "Sites Preference" \ -entrylabels \ [list [list "Site Name" "" ""] [list "View" MENU_ENTRY "ICON" "FULL"]] \ -lboxlabels [list "Sites" "View"] -lboxwidths [list 19 4] \ -lboxheights [list 10 10] \ -remCmd "siteDelete \[boxGetCurselect $dbox_top.box1 0\]" \ -addCmd "siteAdd \[cleanstr \[box $dbox_top.box1 entryval 0\]\] $dbox_top.box1" \ -grabBox $dialog(prefDialogBox) -noUpdateButton 1 box $dbox_top.box2 -title "" \ -entrylabels [list "Server_Host" "DisplayLabel"] \ -lboxlabels [list "Servers" "DisplayLabel"] -lboxwidths [list 15 10] \ -lboxheights [list 10 10] -orient x -key 0 \ -addCmd "serversPut $dbox_top.box2 \[boxGetCurselect $dbox_top.box1 0\]" \ -remCmd "serverDelete \[boxGetCurselect $dbox_top.box1 0\],\[boxGetCurselect $dbox_top.box2 0\]" \ -grabBox $dialog(prefDialogBox) set lbox1 [box $dbox_top.box1 lbox 0] set_listbox_cmd [box $dbox_top.box1 lbox 0] \ "serversGet $dbox_top.box2 \[boxGetCurselect $dbox_top.box1 0\]" set updButton [box $dbox_top.box2 updateButton] $updButton configure -text "nodes.." -command \ "prefServer \[boxGetCurselect $dbox_top.box1 0\] \[boxGetCurselect $dbox_top.box2 0\] $dialog(prefDialogBox) \[box $dbox_top.box2 entry 0\]"## BOTTOM PART ## set cmdButtons \ [buildCmdButtons $dbox_bottom {{{ok1 "done\nredisplay view"} {ok2 "done\ndon't redisplay view"} {help help}}} x 2m 21 3] set cmdFrame [lindex $cmdButtons 0] set cmdOk1 [lindex $cmdButtons 1] set cmdOk2 [lindex $cmdButtons 2] set cmdHelp [lindex $cmdButtons 3] $cmdOk1 configure -command "sitesPut $dbox_top.box1; prefComplete1 $dialog(prefDialogBox)" $cmdOk2 configure -command "sitesPut $dbox_top.box1; prefComplete2 $dialog(prefDialogBox)" $cmdHelp configure -command {xpbs_help pref $dialog(prefDialogBox)} pack $dbox_top.box1 $dbox_top.box2 -side top -anchor nw -fill both -expand 1 tkwait visibility $dialog(prefDialogBox) sitesGet $dbox_top.box1 remove_busy_cursor catch {tkwait window $dialog(prefDialogBox)} boxesUnset set activeWindow($dialog(prefDialogBox)) 0 catch {grab $callerDialogBox} catch {focus $focusBox} set sysinfo(PREFLCK) 0}proc prefComplete1 {callerDialogBox} { global sysinfo destroy $callerDialogBox catch {$sysinfo(sysMenuButton) invoke $sysinfo(systemName)}}proc prefComplete2 {callerDialogBox} { global sysinfo destroy $callerDialogBox}proc siteNamesGet {} { global sysview set sites "" foreach s [array names sysview] { if {[lsearch -exact $sites $s] == -1} { lappend sites $s } } return $sites}proc siteNamesPrint {} { puts "Site Names:==================" foreach s [siteNamesGet] { puts $s }}proc siteAdd {siteName boxframe} { global sysview set sysview($siteName) [box $boxframe entryval 1]}proc siteDelete {{siteName ""}} { global sysinfo sysview if { [string compare $siteName ""] == 0 } { return } catch {unset sysview($siteName)} catch {$sysinfo(sysMenuButton) delete $siteName} if {[string compare $sysinfo(systemName) $siteName] == 0} { systemDelete $sysinfo(systemFrame) set sysinfo(systemName) "" set sysinfo(systemFrame) "" }}proc serverDelete {serverid} { global sysnodes catch {unset sysnodes($serverid)}}# queryTableGet: get the query string for nodename of given 'type'.proc queryTableGet {sitename nodename type} { global queryTable if { ![info exists queryTable($sitename,$nodename)] } { return "" } foreach q $queryTable($sitename,$nodename) { set query [lindex $q 0] set t [lindex $q 2] if {[string compare $t $type] == 0} { return $query } } return ""}proc queryTableDelete {nodeid} { global queryTable catch {unset queryTable($nodeid)}}proc queryTableSave {sitename boxframe} { global queryTable set host [box $boxframe title] set nrows [box $boxframe nrows] set qexprBox [box $boxframe lbox 0] set labelBox [box $boxframe lbox 1] set typeBox [box $boxframe lbox 2] catch {unset queryTable($sitename,$host)} for {set i 0} {$i < $nrows} {incr i} { set line "" lappend line [queryExprCreate "[$qexprBox get $i]"] lappend line [$labelBox get $i] lappend line [$typeBox get $i] lappend queryTable($sitename,$host) $line }}proc queryTableLoad {sitename boxframe} { global queryTable set host [box $boxframe title] if {![info exists queryTable($sitename,$host)]} { return } set qexprBox [box $boxframe lbox 0] set labelBox [box $boxframe lbox 1] set typeBox [box $boxframe lbox 2] $qexprBox delete 0 end $labelBox delete 0 end $typeBox delete 0 end foreach line $queryTable($sitename,$host) { set qexpr [lindex $line 0] set label [lindex $line 1] set type [lindex $line 2] $qexprBox insert end $qexpr $labelBox insert end $label $typeBox insert end $type box $boxframe -nrows +1 } boxSelect $boxframe 0}proc queryTablePrint {sitename} { global queryTable foreach h [array names queryTable] { set h_list [split $h ","] set sname [lindex $h_list 0] if {[string compare $sname $sitename] == 0} { puts "queryTable($h):=================================" puts "=============== $queryTable($h)" } }}proc sitesGet {boxframe} { global sysview set box [box $boxframe entry 0] $box delete 0 end foreach s [siteNamesGet] { box $boxframe -entryval 0 $s box $boxframe -entryval 1 $sysview($s) boxAdd $boxframe }}proc sitesPut {boxframe} { global sysinfo canvas sysview set nrows [box $boxframe nrows] set siteBox [box $boxframe lbox 0] for {set i 0} {$i < $nrows} {incr i} { set sitename [$siteBox get $i] if [catch {$sysinfo(sysMenuButton) index $sitename}] { $sysinfo(sysMenuButton) add radio -label $sitename \ -variable sysinfo(systemName) \ -value $sitename \ -command "displayView $sysinfo(main_frame) $sitename" } }}proc serverNamesGet {siteName} { global sysnodes set servers "" foreach s [array names sysnodes] { set s_list [split $s ","] set sname [lindex $s_list 0] set hname [lindex $s_list 1] if {[string compare $sname $siteName] == 0} { lappend servers $hname } } return $servers}proc statNodes {server_name sysframe} { set nlist "" catch {pbsconnect $server_name} fd InfoBox_sendmsg "statNodes: pbsconnect($server_name): $fd" end if { $fd >= 0 } { catch {pbsstatnode} ninfo InfoBox_sendmsg "statNodes: pbsstatnode($server_name): " end foreach n $ninfo { set nname [lindex $n 0] set attribl [lindex $n 1] foreach na $attribl { set attn [lindex $na 0] set attv [lindex $na 1] switch -exact -- $attn { state { nodeUpdateStat $sysframe $nname $attv } properties { set props "" lappend props $attv set line [list "$props" "Properties: " \ TEXT] systemNodeInfo2Append $sysframe $nname \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -