📄 compslct.tcl
字号:
set tornadoSelected [isTornadoSelected [lindex $torObj 0]]
set torIndex [lindex $torObj 0]
set torArch [lindex $torObj 1]
if {$setupVals(drvIndex) != -1 && $tornadoSelected && \
[expr $currProdIndex == $torIndex || \
$savedProdIndex == $torIndex] } {
foreach drvObj $setupVals(drvIndex) {
set index [lindex $drvObj 0]
set arch [lindex $drvObj 1]
set drvObjSelected [productInfoGet instFlag $index]
if {!$drvObjSelected && $torArch == $arch} {
messageBox [strTableGet 5010_DRIVERS_INFO] \
-informationicon
productInfoSet instFlag $index 1
productGuiSizeUpdate 1
productInfoSet stateCommit $index
productInfoSet childStateCommit $index
set guiIndex [guiMapCtrlIndexGet $index]
controlItemPropertySet \
$ctrlVals(mainWindow).optionList \
-index $guiIndex -checkstate 1
set drvObjRestored 1
break
}
}
}
if {$drvObjRestored} {
break
}
}
}
}
}
#############################################################################
#
# guiMapCtrlIndexGet - return the GUI index of the selected product index
#
# This procedure will return the GUI index of the selected product index
#
# SYNOPSIS
# .tS
# guiMapCtrlIndexGet <prodIndex>
# .tE
#
# PARAMETERS:
# .IP prodIndex
# product index
#
# RETURNS: GUI mapped index of the product index
#
# ERRORS: N/A
#
proc guiMapCtrlIndexGet {prodIndex} {
global objGuiMap ctrlVals
set retVal $objGuiMap(prod2gui,$prodIndex)
return $retVal
}
#############################################################################
#
# productGuiChkLstCreate - create the check list of products in compSelect page
#
# This procedure will create the check list of products in compSelect page
#
# SYNOPSIS
# .tS
# productGuiChkLstCreate
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc productGuiChkLstCreate {} {
global objGuiMap
global ctrlVals
global setupVals
global productObj
# populate the list of check button.
set i 0
set chkList ""
set totalSize 0
catch {
unset objGuiMap
}
foreach prodIndex [cdInfoGet productIndexList] {
# test automation
if { $ctrlVals(useInputScript) } {
set desc [productInfoGet desc $prodIndex]
if {[lsearch $setupVals(compList) "$desc"] < 0} {
productInfoSet instFlag $prodIndex 0
}
foreach part [productInfoGet partIndexList $prodIndex] {
set descp "[partInfoGet desc $part]"
if [regexp WTX $descp] {
partInfoSet instFlag $part 1
}
}
}
set objGuiMap(gui2prod,$i) $prodIndex
set objGuiMap(prod2gui,$prodIndex) $i
set size [productInfoGet size $prodIndex]
set formatMbSize [format "%7s MB" [byteToMbyte $size]]
set desc " [productInfoGet desc $prodIndex]\t$formatMbSize "
lappend chkList [list $desc [productInfoGet instFlag $prodIndex]]
incr i
}
controlValuesSet $ctrlVals(mainWindow).optionList $chkList
controlSelectionSet $ctrlVals(mainWindow).optionList -noevent 0
currSelProdIndexSet 0
# use the tri-state checkbox
for {set ix 0} {$ix < $i} {incr ix} {
set prodIndex $objGuiMap(gui2prod,$ix)
set nCompSel 0
set totComps 0
foreach partIndex $productObj($prodIndex,partIndexList) {
if {"[partInfoGet instFlag $partIndex]" == "1"} {
incr nCompSel
}
incr totComps
}
if {[productInfoGet instFlag $prodIndex]} {
if {$totComps != $nCompSel} {
controlItemPropertySet $ctrlVals(mainWindow).optionList \
-index $objGuiMap(prod2gui,$prodIndex) -checkstate 2
}
}
}
# uncheck the products not meant for this host type
set hostType [windHostTypeGet]
for {set ix 0} {$ix < $i} {incr ix} {
set prodIndex $objGuiMap(gui2prod,$ix)
set desc [productInfoGet desc $prodIndex]
set prodHostType [prodHostTypeGet $desc]
if {$hostType != $prodHostType && $prodHostType != "unknown"} {
productInfoSet instFlag $prodIndex 0
controlItemPropertySet $ctrlVals(mainWindow).optionList \
-index $ix -checkstate 0
}
}
# test automation
if { $ctrlVals(useInputScript) } {
autoSetupLog "\tInstalled product(s):"
# retrieve product name from the product list
foreach i $chkList {
autoSetupLog "\t $i"
}
}
}
#############################################################################
#
# productGuiChkLstUpdate - update the check list of products in the compSelect
# page
#
# This procedure will update the check list of products in the compSelect page
#
# SYNOPSIS
# .tS
# productGuiChkLstUpdate <index>
# .tE
#
# PARAMETERS:
# .IP index
# product index
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc productGuiChkLstUpdate {index} {
global objGuiMap
global ctrlVals
global productObj
set prodIndex [currSelProdIndexGet]
set size [productInfoGet size $prodIndex]
set formatMbSize [format "%7s MB" [byteToMbyte $size]]
# add in indication of components/product selected
# remove this section if a UITcl tristate button list is created
set nCompSel 0
set totComps 0
foreach partIndex $productObj($prodIndex,partIndexList) {
if {"[partInfoGet instFlag $partIndex]" == "1"} {
incr nCompSel
}
incr totComps
}
set desc " [productInfoGet desc $prodIndex]\t$formatMbSize "
set chkButt [list [list "$desc" [productInfoGet instFlag $prodIndex]]]
controlValuesSet $ctrlVals(mainWindow).optionList -insert $index $chkButt
controlValuesSet $ctrlVals(mainWindow).optionList -delete [expr $index + 1]
controlSelectionSet $ctrlVals(mainWindow).optionList -noevent $index
if {$totComps != $nCompSel} {
if {[productInfoGet instFlag $prodIndex]} {
set index $objGuiMap(prod2gui,$prodIndex)
controlItemPropertySet $ctrlVals(mainWindow).optionList \
-index $index -checkstate 2
}
}
}
#############################################################################
#
# productguisizeupdate - update the size of products in the compSelect page
#
# This procedure will update the size of products in the compSelect page
#
# SYNOPSIS
# .tS
# productGuiSizeUpdate [state]
# .tE
#
# PARAMETERS:
# .IP state
# init -- first time the sizes of products are updated
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc productGuiSizeUpdate {{state "init"}} {
global ctrlVals
global setupVals
uiEventProcess
set setupVals(availDiskSpace) "Unknown"
if {[isUnix]} {
set free [fspace [destDirGet]]
if [regexp {^[0-9]+$} $free] {
set setupVals(availDiskSpace) \
[format "%3.1f" [expr $free / 1024.0]]
}
} else {
if {![catch {setupDiskSpaceGet [destDirGet]} diskSpace] &&
$diskSpace >= 0} {
set setupVals(availDiskSpace) [kbyteToMbyte $diskSpace]
}
}
set setupVals(reqDiskSpace) [cdInfoGet size]
# add size of SETUP directory to total required space only if SETUP
# directory is not present in destination directory
if [file exists [file join [destDirGet] SETUP RESOURCE TCL INSTW32.TCL]] {
set totalSize [byteToMbyte $setupVals(reqDiskSpace)]
} else {
set totalSize [expr [setupSizeGet] + \
[byteToMbyte $setupVals(reqDiskSpace)]]
}
detailShow
controlValuesSet $ctrlVals(mainWindow).reqSpace \
[format "%7s MB" $totalSize]
controlValuesSet $ctrlVals(mainWindow).availSpace \
[format "%7s MB" $setupVals(availDiskSpace)]
}
#############################################################################
#
# checkProductDependency - check to see if dependencies are OK
#
# This is a callback procedure for the partList Dialog. It will check to
# see if any dependencies are violated. If so warn the user and correct
# them. The only one is the driver/objects dependency on Tornado parts.
#
# SYNOPSIS
# .tS
# checkProductDependency
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc checkProductDependency {} {
global ctrlVals
global setupVals
set prodIndex [currSelProdIndexGet]
if {"$prodIndex" != ""} {
# check to see if the current product is the Tornado product
# determine if customer is trying to uncheck a driverObject/Header prod
set drvObjRestored 0
if {[info exists setupVals(tornadoIndex)]} {
foreach torObj $setupVals(tornadoIndex) {
set tornadoSelected [isTornadoSelected [lindex $torObj 0]]
set torIndex [lindex $torObj 0]
set torArch [lindex $torObj 1]
if {$setupVals(drvIndex) != -1 && $tornadoSelected && \
[expr [currSelProdIndexGet] == $torIndex]} {
foreach drvObj $setupVals(drvIndex) {
set index [lindex $drvObj 0]
set arch [lindex $drvObj 1]
set drvObjSelected [productInfoGet instFlag $index]
if {!$drvObjSelected && $torArch == $arch} {
messageBox [strTableGet 5010_DRIVERS_INFO] \
-informationicon
productInfoSet instFlag $index 1
productGuiSizeUpdate 1
productInfoSet stateCommit $index
productInfoSet childStateCommit $index
set guiIndex [guiMapCtrlIndexGet $index]
controlItemPropertySet \
$ctrlVals(mainWindow).optionList \
-index $guiIndex -checkstate 1
set drvObjRestored 1
break
}
}
}
if {$drvObjRestored} {
break
}
}
}
}
}
#############################################################################
#
# isTornadoSelected - checks to see if the tornado product is selected
#
# This procedure checks to see if the tornado product is selected by the
# customer. If the parts "Tornado Integrated Simulator" and|or
# "Tornado Object" are selected, then 1 is returned, else 0 is returned.
#
# SYNOPSIS
# .tS
# isTornadoSelected <prodIndex>
# .tE
#
# PARAMETERS: prodIndex - the product index of the Tornado product
#
# RETURNS: 1 if either the simulator or tornado objects are selected
# 0 otherwise
#
# ERRORS: N/A
#
proc isTornadoSelected {prodIndex} {
set retVal 0
# first check to see if the tornado product has been selected
if {[productInfoGet instFlag $prodIndex]} {
foreach part [productInfoGet partIndexList $prodIndex] {
set desc [partInfoGet desc $part]
# check if the simulator part is selected
if {[string first "Tornado Integrated Simulator" $desc] != -1} {
if {[partInfoGet instFlag $part] == 1} {
return 1
}
}
# check if the full simulator is selected
if {[string first "Tornado Simulator:" $desc] != -1} {
if {[partInfoGet instFlag $part] == 1} {
return 1
}
}
# check if the Tornado part is selected
if {[string first "Tornado Object" $desc] != -1} {
if {[partInfoGet instFlag $part] == 1} {
return 1
}
}
}
}
return $retVal
}
#############################################################################
#
# kbyteToMbyte - converts kilo bytes to mega bytes
#
# SYNOPSIS
# kbyteToMbyte <size>
#
# PARAMETERS:
# <kbyte> : number in kilo bytes
#
# RETURNS: number in mega bytes
#
# ERRORS: N/A
#
proc kbyteToMbyte {size} {
return [format "%3.1f" [expr $size / 1024.0]]
}
##############################################################################
#
# byteToMbyte - converts bytes to Mbytes
#
# SYNOPSIS
# byteToMbyte <size>
#
# PARAMETERS:
# <byte> : number in bytes
#
# RETURNS: number in mega bytes
#
# ERRORS: N/A
#
proc byteToMbyte {size} {
return [format "%3.1f" [expr $size / 1048576.0]]
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -