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

📄 insttk.tcl

📁 好东西,欢迎下在,联系方式E-mail:xoming117@tom.com
💻 TCL
📖 第 1 页 / 共 4 页
字号:
# insttk.tcl - Installation program For Unix platforms.
#
# history
# -------
# 02g,13jun97,pdn  replaced tclx id command w/ setupId.
# 02f,28mar97,pdn  fixed the problem that torVarCreate get call too early
# 02e,13mar97,pdn  catched error when grab fails.
# 02d,09mar97,pdn  fixed exit code.
# 02c,08mar97,tcy  undo last mod
# 02b,07mar97,tcy  moved needUpdateWlmd() to INSTALL.TCL
# 02a,05mar97,pdn  added hook for patch installation.
# 01z,25feb97,pdn  improved license installing.
# 01y,10feb97,pdn  added beginWaitCursor, and endWaitCursor functionality.
#                  updated the button layout.
# 01x,09feb97,pdn  added option to configure a floating license server
# 01w,22jan97,pdn  handled error when fails to obtain free disk space.
# 01v,20jan97,pdn  saved installation key
# 01u,16jan97,pdn  catched error when symbolic group id not defined.
# 01t,09jan97,pdn  updated the billboard cycling by product
# 01s,18dec96,sks  changed location of TCL and BITMAP files; renamed
#                  TEXT.TCL to MESSAGES.TCL                   
# 01r,12dec96,pdn  added BAD_CD_REVISION check
# 01q,11dec96,pdn  displayed the feature id/description
# 01p,09dec96,pdn  added hierarchy selection option
# 01o,14nov96,pdn  created and used the new interface to CD database.
# 01n,11nov96,pdn  centralized all strings to TEXT.TCL
# 01m,08nov96,pdn  fixed pageProcess(destDir) to correctly inittialize DLL
#                  before return. 
# 01l,25oct96,pdn  refined license setup pages. 
# 01k,18oct96,pdn  added license setup pages 
# 01j,01oct96,tcy  moved umaskGet(), umaskSet(), getSelection() to INSTALL.TCL 
# 01i,30aug96,pdn  added SIGINT handler
# 01h,30aug96,pdn  moved tk specific code from INSTALL.TCL here
# 01g,29aug96,pdn  used tclX funtionalities.
# 01f,27aug96,pdn  fixed umask problem.
# 01e,05jul96,pdn  added root privilege check.
# 01d,02jul96,pdn  added new color scheme, and fspace hook.
# 01c,01jul96,s_j  added billboard cycling feature.
# 01b,25jun96,pdn  modified the GUI to meet the specification.
# 01a,11jun96,jco  translated to tk from the uitcl/Windows.
#

#
# Create the Welcome page
#

proc pageCreate(welcome) {} {
    global ctrlVals
    global setupVals

    set w [dlgFrmCreate [strTableGet 1410_TITLE_WELCOME]]
    beginWaitCursor

    $w.msg config -text "[strTableGet 1000_WELCOME1]\
                     \n\n[strTableGet 1010_WELCOME2]\
                     \n\n[strTableGet 1020_WELCOME3]\
                     \n\n[strTableGet 1030_WELCOME4]\
                     \n\n[strTableGet 1040_WELCOME5]"

    # Disable the Back button since this is the first page
    .buts.back config -state disabled
    endWaitCursor
}

proc pageProcess(welcome) {w} {
    return 1
}

proc needUpdateWlmd {} {
    global ctrlVals setupVals
 
    set retVal 0
    set installedWlmd [destDirGet]/host/[windHostTypeGet]/bin/wlmd
    set cdWlmd [cdromBinDirGet]/WLM/WLMD
 
    if {[file exists $installedWlmd]} {
        set retVal [expr [file mtime $installedWlmd] < [file mtime $cdWlmd]]
    }
    return $retVal
}
 
proc pageCreate(wlmdDetect) {} {
    global ctrlVals
    global setupVals

    set w [dlgFrmCreate "[strTableGet 1261_LICENSE] Detect"]
    $w.msg config -text [strTableGet 1358_LICENSE_SERVER_DETECT]

    beginWaitCursor
    update
 
    set setupVals(isWlmdRunning) 0
    if [needUpdateWlmd] {
        set prog [cdromBinDirGet]/WLMUTILS
        set setupVals(isWlmdRunning) [exec $prog -pingServer [info host]]
    }

    endWaitCursor
    nextCallback
}

proc pageProcess(wlmdDetect) {w} {
    global setupVals ctrlVals

    if {$setupVals(isWlmdRunning)} {
        messageBox [strTableGet 1359_LICENSE_SERVER_SHUTDOWN]
        destroy .
        exit 0
    } {
        set ctrlVals(currPage) destDir
        pageRemove wlmdDetect
        set ctrlVals(pageListBack) $ctrlVals(pageList)
        return 1
    }
}

proc pageCreate(privilege) {} {
    global ctrlVals
    global setupVals

    # Check user privilege

    beginWaitCursor
    set w [dlgFrmCreate [strTableGet 1420_TITLE_WARNING]]
    $w.msg config -text [strTableGet 1050_ROOT_WARN]
    .buts.back config -state normal
    endWaitCursor
}

proc pageProcess(privilege) {w} {
    return 1
}

proc pageCreate(registration) {} {
    global ctrlVals
    global setupVals

    beginWaitCursor
    set w [dlgFrmCreate [strTableGet 1430_TITLE_REGISTRATION]]
    $w.msg config -text [strTableGet 1060_REGISTRATION]

    # Create username field
    labelCreate $w.nameLabel "Name:"
    place $w.nameLabel -in $w -y 100
    entry $w.nameText -relief sunken -width 35 -font 7x13 \
                  -textvariable setupVals(userName) 
    place $w.nameText -in $w -x 70 -y 100

    # Create companyname field
    labelCreate $w.companyLabel "Company:"
    place $w.companyLabel -in $w -y 150
    entry $w.companyText -relief sunken -width 35 -font 7x13 \
               -textvariable setupVals(companyName) 
    place $w.companyText -in $w -x 70 -y 150

    # Create keyname field
    labelCreate $w.keyLabel "Key:"
    place $w.keyLabel -in $w -y 200
    entry $w.keyText -relief sunken -width 35 -font 7x13 \
             -textvariable setupVals(instKey) 
    place $w.keyText -in $w -x 70 -y 200
    if {[instKeyGet] == "none"} {$w.keyText config -state disabled}

    if {"[userNameGet]" == ""} {
        focus $w.nameText

    } elseif {"[companyNameGet]" == ""} {
        focus $w.companyText

    } else {
        focus $w.keyText
    }

    .buts.back config -state normal
    endWaitCursor
}

proc pageProcess(registration) {w} {
    global setupVals
    global errorInfo

    beginWaitCursor

    if [catch {setupKeyValidate [instKeyGet]} error] {
        messageBox [strTableGet 1070_WARN_1]
        endWaitCursor
        return 0
    }

    if [catch {setupInit [cdromZipDirGet]} error] {

        if {"$error" == "BAD_CD_KEY"} {
            messageBox [strTableGet 1080_WARN_2]
            endWaitCursor
            return 0

        } elseif {"$error" == "BAD_CD_REVISION"} {
            tk_dialog  .setup "Setup" [strTableGet 1080_WARN_4]\
                       question 0 Abort
            exit 0

        } elseif {"$error" == "BAD_CD_VENDOR_ID"} {
            messageBox [strTableGet 1080_WARN_3]
            endWaitCursor
            return 0
        } {
            tk_dialog  .setup "Setup" [strTableGet 1090_WARN_3 $error]\
                       question 0 Abort
            exit 0
        }
    }

    objectConstruct

    endWaitCursor
    return 1
}

proc pageCreate(destDir) {} {
    global ctrlVals
    global setupVals

    beginWaitCursor
    set w [dlgFrmCreate [strTableGet 1440_TITLE_DESTDIR]]
    $w.msg config -text [strTableGet 1100_DEST_DIR]

    # Create directory field

    labelCreate $w.dirLabel "Directory:"
    place $w.dirLabel -in $w -y 165
    entry $w.dirText -relief sunken -width 30 -font $ctrlVals(textFont) \
             -textvariable setupVals(destDir) 
    place $w.dirText -in $w -y 190

    # Create browse button

    button $w.browse -text "Browse" -font $ctrlVals(bldFont) \
           -command {destDirSet [fileselect [destDirGet]]}
    place $w.browse -in $w -x 240 -y 185

    focus $w.dirText
    .buts.back config -state normal
    endWaitCursor
}

proc pageProcess(destDir) {w} {
    global setupVals

    beginWaitCursor
    if [regexp {~} [destDirGet]] {
        messageBox "Invalid directory specified"
        endWaitCursor
        return 0
    }

    if ![file isdirectory [destDirGet]] {

        set i [tk_dialog .dialog3 "Setup" [strTableGet 1110_DEST_DIR_WARN] \
                                  question 0 Yes No]

        switch $i {
            0   {
                if [catch {file mkdir [destDirGet]} error] {
                    messageBox "$error"
                    endWaitCursor
                    return 0
                } {
                    set status 1
                }
            }
            1 {
                endWaitCursor
                return 0
            }
        }
    } {
        set status 1
    }

    if ![file writable [destDirGet]] {
        messageBox [strTableGet 1130_DEST_DIR_WARN3]
        endWaitCursor
        return 0
    }

    update

    uninstStart [instTypeGet]
    licenseHomeDirSet [destDirGet]/.wind/license

    catch {
        set windDir [file dirname $setupVals(profile)]

        if ![file isdirectory $windDir] {
            file mkdir $windDir
        }

        set f [open $setupVals(profile) "w"]
        puts $f "userNameSet [userNameGet]"
        puts $f "companyNameSet [companyNameGet]"
        puts $f "destDirSet [destDirGet]"

	if {[instKeyGet] == "none"} {
             puts $f "instKeySet $setupVals(prevInstKey)"
        } {
             puts $f "instKeySet [instKeyGet]"
	}
        close $f
    }

    endWaitCursor
    return $status
}

proc pageCreate(compSelect) {} {
    global ctrlVals
    global setupVals
    global objGuiMap pickList

    beginWaitCursor
    set w [dlgFrmCreate [strTableGet 1450_TITLE_OPTION]]
    $w.msg config -text [strTableGet 1140_COMP_SELECT]

    labelCreate $w.infoLabel "Information:"
    place $w.infoLabel -in $w -y 195

    frame $w.infoFrm -width 320 -height 70 -relief sunken -borderwidth 1
    place $w.infoFrm -in $w -y 216
    
    frame $w.infoFrm.req
    labelCreate $w.infoFrm.req.text "Space Required:\t" 
    labelCreate $w.infoFrm.req.size "0.0 MB"

    pack $w.infoFrm.req.text -side left
    pack $w.infoFrm.req.size -side right
    place $w.infoFrm.req -in $w.infoFrm -y 15 -x 10

    set free [fspace [destDirGet]]
    if [regexp {^[0-9]+$} $free] {
        set availSpace [format "%3.1f" [expr $free / 1024.0]]
    } {
        set availSpace "???.?"
    }

    frame $w.infoFrm.avail
    labelCreate $w.infoFrm.avail.msg "Space Available:\t"
    labelCreate $w.infoFrm.avail.size "$availSpace MB"

    pack $w.infoFrm.avail.msg -side left
    pack $w.infoFrm.avail.size -side right
    place $w.infoFrm.avail -in $w.infoFrm -y 35 -x 10

    button $w.infoFrm.detail -text "Details" \
                     -command "onProductDetailButt" \
                     -font $ctrlVals(textFont) \
                     -padx 14 -pady 2

    place $w.infoFrm.detail -in $w.infoFrm -y 25 -x 220
    $w.infoFrm.detail config -state disabled

    frame $w.pick
    place $w.pick -in $w -y 60

    set cv $w.pick.canvas
    canvas $cv -width 300 -height 118 -relief sunken -borderwidth 1 \
        -yscrollcommand "$w.pick.vscroll set" -highlightthickness 0

    scrollbar $w.pick.vscroll -command "$cv yview" -highlightthickness 0
    pack $w.pick.vscroll -side right -fill y
    pack $cv -in $w.pick -expand yes -fill both

    productGuiUpdate $w
    endWaitCursor
}

proc productGuiUpdate {w} {
    productGuiChkLstUpdate $w
    productGuiSizeUpdate $w
}

proc productGuiSizeUpdate {w} {
    global setupVals
    global ctrlVals

    set totalSize [byteToMbyte [cdInfoGet size]]
    $w.infoFrm.req.size config -text "$totalSize MB"

    # if space required > space available, set background to red

    set avail [lindex [$w.infoFrm.avail.size cget -text] 0]

    if {"$avail" < "$totalSize"} {
        $w.infoFrm.avail.size config -bg red -fg white
    } else {
        $w.infoFrm.avail.size config -bg $ctrlVals(mainBg) -fg black
    }
}


proc productGuiChkLstUpdate {w} {
    global ctrlVals objGuiMap pickList

    set cv $w.pick.canvas

    # populate the list of check button.

    catch {
        unset objGuiMap
    }

    set i 0

    foreach prodIndex [cdInfoGet productIndexList] {

        set objGuiMap(gui2prod,$i) $prodIndex
        set objGuiMap(prod2gui,$prodIndex) $i

        if ![info exists pickList(prod,$prodIndex)] {
            set pickList(prod,$prodIndex) [productInfoGet instFlag $prodIndex] 
        }

        set mbSize [byteToMbyte [productInfoGet size $prodIndex]]
       
        if ![winfo exists $cv.lineItem$i] {
            frame $cv.lineItem$i
    
            checkbutton $cv.lineItem$i.cb \
                        -highlightthickness 0 \
                        -relief flat -pady 0 \
                        -variable pickList(prod,$prodIndex)

            button $cv.lineItem$i.butDesc \
                        -text [productInfoGet desc $prodIndex] \
                        -font $ctrlVals(smallFont) \
                        -command "currSelProdIndexSet $w.infoFrm.detail \
                                                      $prodIndex" \
                        -highlightthickness 0 \
                        -relief flat -pady 0
    
            label $cv.lineItem$i.size \
                        -justify right \
                        -font $ctrlVals(smallFont) \
                        -text $mbSize

            pack $cv.lineItem$i.cb $cv.lineItem$i.butDesc -side left
            pack $cv.lineItem$i.size -side right
    
            $cv create window 5 [expr $i * 20 + 2] \
                       -window $cv.lineItem$i \
                       -anchor nw -tags item \
                       -width 290 -height 16
    
            bind $cv.lineItem$i.cb <ButtonRelease-1> \
                 "onClickProdCheckButt $w $prodIndex"
        } {
            $cv.lineItem$i.size configure -text $mbSize
        }

        incr i
        update
    }

    $cv config -scrollregion "0 2 0 [expr ($i * 20) - 2]"
    $cv config -yscrollincrement 20
}

proc currSelProdIndexSet {detailButt prodIndex} {
    global currSelProdIndex

    set currSelProdIndex $prodIndex
    
    if {[llength [productInfoGet partIndexList $prodIndex]] == 1} {

⌨️ 快捷键说明

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