⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compslct.tcl

📁 vxworks WindML 3.0补丁包3 (CP3)
💻 TCL
📖 第 1 页 / 共 5 页
字号:
    }

    return -1
}

#############################################################################
#
# prodHostTypeGet - proc to return a host type string
#
# SYNOPSIS
# .tS
# prodHostTypeGet
# .tE
#
# PARAMETERS: description
#   Description in the format <prod name>: <host>[ x <arch>]
#   e.g. Tornado Object: WindowsNT x ppc
#   e.g  Wind Navigator: solaris 
#
# RETURNS: the hos type (a string) if it exists, else "unknown"
#
# ERRORS: N/A
#
proc prodHostTypeGet {desc} {
        
    set prodHostType "unknown"
                                                                      
    switch -regexp $desc {
        ".*[W|w]indows.*" {set prodHostType x86-win32}
        ".*x86-win32.*"   {set prodHostType x86-win32}
        ".*[S|s]olaris.*"   {set prodHostType sun4-solaris2}
        ".*sun4-solaris2.*" {set prodHostType sun4-solaris2}
        ".*simsolaris.*"  {set prodHostType sun4-solaris2}
        ".*Windows2000.*" {set prodHostType Windows2000}
        ".*WindowsNT.*"   {set prodHostType WindowsNT}
        ".*Windows95.*"   {set prodHostType Windows95}
        ".*Windows98.*"   {set prodHostType Windows98}
        ".*hp9700.*"      {set prodHostType parisc-hpux10}
        ".*simhppa.*"     {set prodHostType parisc-hpux10}
        ".*SIMHPPA.*"     {set prodHostType parisc-hpux10}
        #"^x86-linux2"    {set prodHostType x86-linux2}
        default           {set prodHostType unknown}
    }

    #dbgputs "prodHostTypeGet - prodHostType: $prodHostType"
    
    return $prodHostType
}

#############################################################################
#
# onClickProdCheckList - callback procedure invoked when product is checked
#                        on compSelect page
#
# This procedure is a callback procedure invoked when product is checked
# on compSelect page
#
# SYNOPSIS
# .tS
# onClickProdCheckList
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc onClickProdCheckList {} {
    global ctrlVals
    global setupVals

    currSelProdIndexSet [controlSelectionGet $ctrlVals(mainWindow).optionList]
    set hasSubPart [detailShow]
    set currProdIndex [currSelProdIndexGet]
    
    if {[lindex [controlEventGet $ctrlVals(mainWindow).optionList] 0] == \
        "chkchange"} {
        set newState [lindex \
                [controlItemPropertyGet $ctrlVals(mainWindow).optionList \
                -checkstate] [currSelProdIndexGet gui]]

        # determine if customer is trying to uncheck a driverObject/Header prod

        set drvIndex [drvIndexGet $currProdIndex]
        set drvArch [drvArchGet $currProdIndex]
        set drvObjRestored 0

        #dbgputs "drvArch: $drvArch"
                    
        if {[info exists setupVals(tornadoIndex)] && $drvIndex != -1} {
            foreach torObj $setupVals(tornadoIndex) {
                set tornadoSelected  [isCoreTorSelected [lindex $torObj 0]]
                
                #dbgputs "tornadoSelected: $tornadoSelected"     
                #dbgputs "torObj: $torObj"                                             
                #dbgputs "arch: [lindex $torObj 1]"
                
                if {$tornadoSelected && [lindex $torObj 1] == $drvArch} {                    
                    set savedProdIndex -1
                    messageBox [strTableGet 5010_DRIVERS_INFO] -informationicon
                    set index [guiMapCtrlIndexGet $drvIndex]
                    controlItemPropertySet $ctrlVals(mainWindow).optionList \
                        -index $index -checkstate 1
                    set drvObjRestored 1
                    break
                }
            }
        }


        # warn user about non-native installations

        set desc [productInfoGet desc $currProdIndex]
        
        set hostType [hostVerGet]
        
        set prodHostType [prodHostTypeGet $desc]

        if {![productInfoGet instFlag $currProdIndex]} {
            if {$hostType != $prodHostType && $prodHostType != "unknown"} {
                set msg "The product, $desc, is not meant for installation \
                        on this host type of $hostType.\nContinuing with the \
                        installation may lead to an incomplete installation \
                        due to missing host tools."

                if { $ctrlVals(useInputScript) } {
                    autoSetupLog "$msg"
                    autoSetupLog "Please re-select the component\(s\)."
                    autoSetupLog "Application Exit\n"
                    set setupVals(cancel) 1                
                    applicationExit
                    return 0
                } else {
                    dialog ok_with_title "WARNING: Product Installation" $msg
                }
            }
        }

        # commit the user's selection

        if {!$drvObjRestored} {
            set savedProdIndex $currProdIndex
            productInfoSet instFlag $currProdIndex $newState
            if {$newState && $hasSubPart} {
                productGuiChkLstUpdate [currSelProdIndexGet gui]
            }

            productGuiSizeUpdate $newState
            productInfoSet stateCommit $currProdIndex
            productInfoSet childStateCommit $currProdIndex
        }
        
        # check if product just selected is tornado-obj, if so we must
        # re-select the driver object products

        set drvObjRestored 0
        if {[info exists setupVals(tornadoIndex)]} {
            foreach torObj $setupVals(tornadoIndex) {
                
                set tornadoSelected [isCoreTorSelected [lindex $torObj 0]]
                set torIndex [lindex $torObj 0]
                set torArch [lindex $torObj 1]
                
                #dbgputs "tornadoSelected: $tornadoSelected"
                #dbgputs "torIndex: $torIndex"
                #dbgputs "torArch:  $torArch"
                      
                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]
                        
                        #dbgputs "drvObjSelected: $drvObjSelected"
                        #dbgputs "arch: $arch"
                        
                        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
#
# SYPSIS
# .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
        # setupVals(compList) in the instCfg.tcl script must be seeded
        # with the product descripts, parts with WTX are auto-selected

        if { $ctrlVals(useInputScript) } {
            set desc [productInfoGet desc $prodIndex]
            if {[lsearch $setupVals(compList) "$desc"] < 0 &&
                $setupVals(compList) != "ALL" } {
                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 [hostVerGet]    
    
    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 product

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -