Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Tweak libs for Windows support |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
8d57bbfd5f61207738115c3df8f26d13 |
User & Date: | admin 2015-09-16 10:44:37 |
Context
2015-09-20
| ||
02:09 | tweak softwareupdate check-in: 2dd7444328 user: admin tags: trunk | |
2015-09-16
| ||
10:44 | Tweak libs for Windows support check-in: 8d57bbfd5f user: admin tags: trunk | |
10:43 | Tweak xplat for Windows support check-in: 9b9159ddfe user: admin tags: trunk | |
Changes
Added regproc/pkgIndex.tcl.
> > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 | # Tcl package index file, version 1.1 # This file is generated by the "pkg_mkIndex" command # and sourced either when an application starts up or # by a "package unknown" script. It invokes the # "package ifneeded" command to set up package-related # information so that packages will be loaded automatically # in response to "package require" commands. When this # script is sourced, the variable $dir must contain the # full path name of this file's directory. package ifneeded regproc 1.4 [list source [file join $dir regproc.tcl]] |
Added regproc/regproc.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | #regproc.tcl routines to register serial numbers #Copyright 2015 WordTech Communications LLC #MIT license package provide regproc 1.4 package require http package require xplat image create photo _unlock -data { R0lGODlhGAAgAIABAAAAAP///yH+GkNyZWF0ZWQgd2l0aCBHSU1QIG9uIGEgTWFj ACH5BAEKAAEALAAAAAAYACAAAAJRjI+gq+jO4npQWmqsBvQenzBYVE1YQH7imWbm ib5xA89cPcp4uPX+DwwKh7SdbWXUGF2S5VHn6oBURWrL+lBmb6UrTpucfsE14u85 tKZ5wkMBADs= } image create photo _check -data { R0lGODlhIAAaAIABAAQHB////yH+GkNyZWF0ZWQgd2l0aCBHSU1QIG9uIGEgTWFj ACH5BAEKAAEALAAAAAAgABoAAAJMjI+pCeuvgIR0yVtzuFxDDnoWGIoHWZobikUV 2zLTA89yfLNjetY7iag1Ir4VzCFMfpI6ChOYeeJeTxVTZRBie6htEOrl2sJcsmVb AAA7 } namespace eval regproc { if {![info exists library]} { variable library [file dirname [info script]] } variable datadir variable expired set expired 0 #set the 30-day clock for application/version proc setClock {} { variable datadir variable appname variable appversion variable appstore puts "datadir is $datadir" set launchTime [clock seconds] set saveTime [open $datadir/$appname$appversion.dat w] puts $saveTime $launchTime close $saveTime } #read the time set proc readClock {} { variable datadir variable appstatus variable expstatus variable appname variable appversion variable appstore variable expired set curTime [clock seconds] set oldTime [read [open $datadir/$appname$appversion.dat r]] set expDate [clock scan "30 days" -base $oldTime] if {$curTime < $expDate } { set expired 0 regproc::makePitch } else { set expired 1 regproc::expiredPitch } } #check to see if a time has been set proc checkClock {} { variable datadir variable appname variable appversion variable appstore variable expired if {[file exists $datadir/.$appname$appversion.rc]} { catch "file rename $datadir/.$appname$appversion.rc $datadir/$appname$appversion.dat" regproc::readClock return } if {![file exists $datadir/$appname$appversion.dat]} { regproc::setClock regproc::readClock } else { regproc::readClock } } #dialog before demo has expired proc makePitch {} { variable version variable appname variable appstore toplevel .purchase wm title .purchase "Purchase $appname" wm resizable .purchase 0 0 wm withdraw .purchase wm transient .purchase . wm protocol .purchase WM_DELETE_WINDOW {} ttk::frame .purchase.top -padding 10 pack .purchase.top -side top -fill both -expand yes ttk::label .purchase.top.label -text "You are currently using a demo of $appname. This version will give you the chance to try \n$appname free of charge for 30 days. Would you like to buy $appname now?" -image _unlock -compound left -anchor n pack .purchase.top.label -side top -fill x -expand yes ttk::frame .purchase.bottom -padding 5 pack .purchase.bottom -side bottom -fill both -expand yes ttk::frame .purchase.bottom.upper pack .purchase.bottom.upper -side top -fill both -expand no ttk::frame .purchase.bottom.lower -padding 5 pack .purchase.bottom.lower -side bottom -fill both -expand no ttk::button .purchase.bottom.lower.install -text "Purchase" -default active -command "xplat::launch http://www.codebykevin.com/$appname.html; regproc::getReg; destroy .purchase" ttk::button .purchase.bottom.lower.cancel -text "Cancel" -command " destroy .purchase; raise ." pack .purchase.bottom.lower.install .purchase.bottom.lower.cancel -side right -fill both -expand no ::tk::PlaceWindow .purchase widget . wm deiconify .purchase focus .purchase.bottom.lower.install if {[tk windowingsystem] eq "aqua"} { after idle [list after 0 wm attributes .purchase -notify 1] bind all <FocusIn> [list add [list wm attributes . -notify 0]] } } #dialog after demo has expired proc expiredPitch {} { variable version variable appname variable appstore variable expired toplevel .expired wm title .expired "Purchase $appname" wm resizable .expired 0 0 wm withdraw .expired wm transient .expired . wm protocol .expired WM_DELETE_WINDOW {} ttk::frame .expired.top -padding 10 pack .expired.top -side top -fill both -expand yes ttk::label .expired.top.label -text "This demo of $appname is now expired. Would you like to buy $appname now?" -image _unlock -compound left -anchor n pack .expired.top.label -side top -fill x -expand yes ttk::frame .expired.bottom -padding 5 pack .expired.bottom -side bottom -fill both -expand yes ttk::frame .expired.bottom.upper pack .expired.bottom.upper -side top -fill both -expand no ttk::frame .expired.bottom.lower -padding 5 pack .expired.bottom.lower -side bottom -fill both -expand no ttk::button .expired.bottom.lower.install -text "Purchase" -default active -command "xplat::launch http://www.codebykevin.com/$appname.html; regproc::getReg; destroy .expired" ttk::button .expired.bottom.lower.cancel -text "Cancel" -command " destroy .expired; exit" pack .expired.bottom.lower.install .expired.bottom.lower.cancel -side right -fill both -expand no ::tk::PlaceWindow .expired widget . wm deiconify .expired focus .expired.bottom.lower.install if {[tk windowingsystem] eq "aqua"} { after idle [list after 0 wm attributes .expired -notify 1] bind all <FocusIn> [list add [list wm attributes . -notify 0]] } } #check for license, validate if found, set demo pitch if not found proc readLic {application version} { variable serial variable datadir variable appname variable appversion variable appstore set appname $application set appversion $version set datadir [xplat::appconfig $appname] if {[file exists $datadir/.lic] } { file rename $datadir/.lic $datadir/lic.dat } if {[file exists $datadir/lic.dat]} { set licnum [open $datadir/lic.dat r] set serial [read $licnum] close $licnum return } else { set serial "Demo" regproc::checkClock } } #write license to file proc setLic {} { variable serial variable serialbase variable datadir variable appname variable regwindow variable appstore if {$serial == ""} { tk_messageBox -icon warning -title "Incorrect Serial Number" -message "Incorrect Serial Number" -detail "Incorrect serial number. The application will exit now." -parent .number exit } set count 20000 for {set i 1} {$i < $count} {incr i 1} { lappend serialbase [string toupper $appname]-[expr $i * 5]-[expr $i/11]-[expr $i - 1]-[string toupper [string trim [string range $appname 0 1]]] } set output [lsearch -inline $serialbase $serial] puts $serial puts $output if {$output >= 0} { cd $datadir set lic [open $datadir/lic.dat w] puts $lic "$serial" close $lic tk_messageBox -icon info -title "Thank You" -message "Thank You" -detail "Thank you for registering $appname." -parent .number destroy .number #display window that was hidden catch {wm deiconify .} } else { if {$expired == 1} { tk_messageBox -icon warning -title "Incorrect Serial Number" -message "Incorrect Serial Number" -detail "Incorrect serial number. The application will exit now." -parent .number exit } tk_messageBox -icon warning -title "Incorrect Serial Number" -message "Incorrect Serial Number" -detail "Incorrect serial number. Please try again." -parent .number regproc::getReg } } #generate license numbers proc genList {application} { variable appname variable regwindow variable appstore set appname $application set count 20000 for {set i 1} {$i < $count} {incr i 1} { lappend serialbase [string toupper $appname]-[expr $i * 5]-[expr $i/11]-[expr $i - 1]-[string toupper [string trim [string range $appname 0 1]]] } if [file exists $::env(HOME)/[list $appname]-list] { file delete $::env(HOME)/[list $appname]-list } foreach item $serialbase { split $item\n set keylist [open $::env(HOME)/[list $appname]-list a] puts $keylist $item close $keylist } } #dialog to input registration number from demo prompt proc getReg {} { variable serial variable regwindow variable appstore variable expired variable appname toplevel .number wm title .number "License" wm resizable .number 0 0 wm withdraw .number wm transient .number . wm protocol .number WM_DELETE_WINDOW {} ttk::frame .number.top -padding 10 pack .number.top -side top -fill both -expand yes ttk::label .number.top.label -text "Please enter your serial number for $appname\nin the field below:" -image _check -compound left -anchor n -padding 10 pack .number.top.label -side top -fill both -expand yes ttk::entry .number.top.entry -textvariable [namespace current]::serial pack .number.top.entry -side bottom -fill both -expand yes ttk::frame .number.bottom -padding 5 pack .number.bottom -side bottom -fill both -expand yes ttk::frame .number.bottom.upper pack .number.bottom.upper -side top -fill both -expand no ttk::frame .number.bottom.lower -padding 5 pack .number.bottom.lower -side bottom -fill both -expand no bind .number <Return> {regproc::setLic; destroy .number; raise .} ttk::button .number.bottom.lower.install -text "Register" -default active -command {regproc::setLic; destroy .number; raise .} ttk::button .number.bottom.lower.cancel -text "Cancel" -command "regproc::exitIfExpired; destroy .number; raise ." pack .number.bottom.lower.install .number.bottom.lower.cancel -side right -fill both -expand no ::tk::PlaceWindow .number widget . wm deiconify .number focus .number.bottom.lower.install if {[tk windowingsystem] eq "aqua"} { after idle [list after 0 wm attributes .number -notify 1] bind all <FocusIn> [list wm attributes . -notify 0] } } proc exitIfExpired {} { variable expired if {$expired == 1} { exit } } namespace export * } |
Added softwareupdate/pkgIndex.tcl.
> > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 | # Tcl package index file, version 1.1 # This file is generated by the "pkg_mkIndex" command # and sourced either when an application starts up or # by a "package unknown" script. It invokes the # "package ifneeded" command to set up package-related # information so that packages will be loaded automatically # in response to "package require" commands. When this # script is sourced, the variable $dir must contain the # full path name of this file's directory. package ifneeded softwareupdate 1.4 [list source [file join $dir softwareupdate.tcl]] |
Added softwareupdate/softwareupdate.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | #softwareupdate.tcl routines to manage spoftware updates # Copyright (C) 2014 WordTech Communications LLC #MIT license package provide softwareupdate 1.4 package require http package require tdom namespace eval softwareupdate { if {![info exists library]} { variable library [file dirname [info script]] } variable icon variable appname variable tmpdir variable currentinstall switch [tk windowingsystem] { "aqua" { set tmpdir $::env(TMPDIR) } "win32" { set tmpdir $::env(TMP) } "x11" { set tmpdir $::env(TMP) } } proc setIcon {appicon} { variable icon set icon $appicon return $icon } proc setAppName {name} { variable appname set appname $name return $appname } #check version of installed software proc checkVersion {app version} { variable appversion variable appname variable currentversion variable versionnumber variable appcast variable sparkledata variable changedata set appname $app softwareupdate::checkingForUpdates set appcast http://www.codebykevin.com/[string tolower $appname].xml http::config -useragent "$appname Update Check" set xml [http::data [http::geturl $appcast]] if [catch {http::geturl $appcast} msg] { puts "error: $msg" tk_messageBox -icon info -title "" -message "Update Error!" -detail "An error occurred in retrieving update information.\nPlease try again later." return } dom parse $xml sparkledata set versionnumber [string trim [$sparkledata selectNodes -namespaces [list x "http://www.andymatuschak.org/xml-namespaces/sparkle"] {string(//enclosure/@x:version)}] .0] set changedata [$sparkledata selectNodes {string(//description/text())}] set minOS [$sparkledata selectNodes -namespaces [list x "http://www.andymatuschak.org/xml-namespaces/sparkle"] {string(//x:minimumSystemVersion)}] set hostOS [exec sw_vers -productVersion] if {![package vsatisfies $hostOS $minOS]} { tk_messageBox -icon warning -message "Error!" -detail "$appname is not supported on Mac OS X $hostOS. The minimum supported OS version is $minOS." return } if {[expr $currentversion < $versionnumber]} { softwareupdate::updatePitch } else { softwareupdate::upToDate } } #define the current version of the software proc setVersion {app number} { variable currentversion variable appname set currentversion $number set appname $app } #get the current installation path proc findCurrentInstallation {} { variable currentinstall variable appname switch [tk windowingsystem] { "aqua" { set approot [info nameofexecutable] set apppath [split $approot /] set currentinstall [join [lrange $apppath 0 [lsearch $apppath "*.app"]] / ] } "win32" { set currentinstall [file join $::env(APPDATA) CodebyKevin $appname] } "x11" { return } } return $currentinstall } #prompt user to update proc updatePitch {} { variable appname variable icon variable changedata variable currentversion variable versionnumber catch {destroy .updateprogress} catch {destroy .update} toplevel .update wm title .update "Software Update" wm withdraw .update frame .update.f -bg gray95 pack .update.f -fill both -expand yes frame .update.f.top -bg gray95 pack .update.f.top -fill both -expand yes label .update.f.top.i -image $icon -bg gray95 -relief flat -highlightthickness 0 pack .update.f.top.i -side left -fill both -expand yes frame .update.f.top.r -bg gray95 pack .update.f.top.r -side right -fill both -expand yes label .update.f.top.r.title -text "A new version of $appname is available!" -font {-weight bold} -bg gray95 -relief flat -highlightthickness 0 pack .update.f.top.r.title -fill both -expand yes -side top label .update.f.top.r.msg -text "$appname $versionnumber is available--you have $currentversion. Would you like to download it now?" -font {-size 10} -bg gray95 -relief flat -highlightthickness 0 pack .update.f.top.r.msg -fill both -expand yes -side top label .update.f.top.r.release -text "Release Notes:" -font {-size 10 -weight bold} -relief flat -highlightthickness 0 -bg gray95 pack .update.f.top.r.release -side top -fill both -expand yes text .update.f.top.r.text -font TkDefaultFont pack .update.f.top.r.text -side top -fill both -expand yes ttk::frame .update.f.top.r.bottom -padding 5 pack .update.f.top.r.bottom -side bottom -fill both -expand yes ttk::button .update.f.top.r.bottom.skip -text "Skip This Version" -command {destroy .update} ttk::button .update.f.top.r.bottom.install -text "Install Update" -default active -command softwareupdate::installUpdate pack .update.f.top.r.bottom.install .update.f.top.r.bottom.skip -side right -fill both -expand yes .update.f.top.r.text insert end $changedata .update.f.top.r.text configure -state disabled wm resizable .update 0 0 wm deiconify .update raise .update wm transient .update . } #"busy" dialog proc checkingForUpdates {} { variable appname variable icon catch {destroy .updateprogress} toplevel .updateprogress wm title .updateprogress "Updating $appname" wm withdraw .updateprogress update idletasks ttk::frame .updateprogress.f -padding 5 pack .updateprogress.f -fill both -expand yes label .updateprogress.f.l -bg gray95 -image $icon -bd 0 -relief flat -highlightthickness 0 pack .updateprogress.f.l -side left -fill both -expand yes frame .updateprogress.f.r -bg gray95 -bd 0 -highlightcolor gray95 pack .updateprogress.f.r -side right -fill both -expand yes ttk::label .updateprogress.f.r.t -text "Checking for updates..." -padding 5 pack .updateprogress.f.r.t -side top -fill both -expand yes ttk::frame .updateprogress.f.r.f -padding 5 pack .updateprogress.f.r.f -side top -fill both -expand yes ttk::progressbar .updateprogress.f.r.f.progress -mode indeterminate -orient horizontal pack .updateprogress.f.r.f.progress -fill both -expand yes -side top .updateprogress.f.r.f.progress start ttk::button .updateprogress.f.r.f.b -text "Cancel" -command {destroy .updateprogress} pack .updateprogress.f.r.f.b -side bottom -fill both -expand no wm geometry .updateprogress 400x100 wm resizable .updateprogress 0 0 wm deiconify .updateprogress raise .updateprogress wm transient .updateprogress . } #dialog if current version is installed proc upToDate {} { variable appname variable versionnumber catch {destroy .updateprogress} tk_messageBox -icon info -message "You're up to date!" -detail "$appname $versionnumber is the currently the newest version available." } #show progress of installation proc progressDialog {} { variable appname variable status catch {destroy .downloadprogress} toplevel .downloadprogress wm title .downloadprogress "Updating $appname" wm transient .downloadprogress . label .downloadprogress.label -bitmap myicon -anchor w -bg gray95 -highlightthickness 0 pack .downloadprogress.label -side left -fill both -expand yes ttk::frame .downloadprogress.frame -padding 5 pack .downloadprogress.frame -side right -fill both -expand yes ttk::label .downloadprogress.frame.l -textvariable softwareupdate::status -width 40 -text "" pack .downloadprogress.frame.l -side top -fill both -expand yes ttk::progressbar .downloadprogress.frame.bar -mode indeterminate -orient horizontal -maximum 100 pack .downloadprogress.frame.bar -side top -fill both -expand yes .downloadprogress.frame.bar start update ttk::button .downloadprogress.frame.b -text "Cancel" -command {destroy .updateprogress} pack .downloadprogress.frame.b -side right -fill both -expand no wm geometry .downloadprogress 400x100 wm resizable .downloadprogress 0 0 } #download and install the update proc installUpdate {} { variable currentinstall variable status variable appname variable tmpdir catch {destroy .update} softwareupdate::findCurrentInstallation softwareupdate::progressDialog set status "Downloading update for $appname" switch [tk windowingsystem] { "aqua" { http::geturl http://www.codebykevin.com/updates/[list $appname].tgz -channel [open $tmpdir/[list $appname].tgz w] update after 1000 cd $tmpdir set status "Unpacking update for $appname" update after 1000 catch {exec tar xvfz [list $appname].tgz} } "win32" { http::geturl http://www.codebykevin.com/updates/[list $appname].exe -channel [open $tmpdir/[list $appname].exe w] } "x11" { tk_messageBox -icon info -parent . -message "Please ask the maintainer of $appname on your platform to prepare a release of the latest version." return } } set status "Ready to install" .downloadprogress.frame.bar configure -mode determinate .downloadprogress.frame.bar configure -value 100 .downloadprogress.frame.bar stop destroy .downloadprogress.frame.b pack [ttk::button .downloadprogress.frame.b -text "Install and Relaunch" -command softwareupdate::launchUpdate] -side right -fill both -expand no return } #launch the update proc launchUpdate {} { variable currentinstall variable appname variable tmpdir switch [tk windowingsystem] { "aqua" { if {[catch {exec codesign -v $tmpdir/$appname.app} msg]} { bgerror $msg tk_messageBox -icon warning -message "Error!" -detail "An error occurred in the installation of $appname. Please try again later." return } else { file rename -force $currentinstall [file join /Users [exec whoami] .Trash [file tail $currentinstall]] file rename -force /tmp/$appname.app $currentinstall exec $currentinstall/Contents/MacOS/$appname & exit } } "win32" { file rename -force $currentinstall/[list $appname].exe $tmpdir/[list $appname].exe~ file copy $tmpdir/[list $appname].exe $currentinstall/[list $appname.exe] exec $currentinstall/[list $appname].exe & exit } "x11" { tk_messageBox -icon info -parent . -message "Please ask the maintainer of $appname on your platform to prepare a release of the latest version." return } } catch {destroy .downloadprogress} } namespace export * } |
Added xplat/pkgIndex.tcl.
> > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 | # Tcl package index file, version 1.1 # This file is generated by the "pkg_mkIndex" command # and sourced either when an application starts up or # by a "package unknown" script. It invokes the # "package ifneeded" command to set up package-related # information so that packages will be loaded automatically # in response to "package require" commands. When this # script is sourced, the variable $dir must contain the # full path name of this file's directory. package ifneeded xplat 1.0 [list source [file join $dir xplat.tcl]] |
Added xplat/xplat.tcl.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | #xplat.tcl: utility shell routines for cross-platform applications. Execute appropriate platform-specific shell command for specified call. #(c) 2015 Kevin Walzer/WordTech Communications LLC. License: standard Tcl license, http://www.tcl.tk/software/tcltk/license.html package provide xplat 1.0 namespace eval xplat { #print text files: HTML and image files not supported proc print {filename} { switch [tk windowingsystem] { "x11" { exec lpr [list $filename] } "win32" { auto_execok start /min notepad /p [list $filename] } "aqua" { package require cocoaprint cocoaprint::cocoaprint [list $filename] . } } } #launch file with system default application proc launch {filename} { switch [tk windowingsystem] { "x11" { exec xdg-open [list $filename] } "win32" { auto_execok start {} [list $filename] } "aqua" { exec open $filename } } } #keyboard accelerator key proc controlkey {} { switch [tk windowingsystem] { "x11" { return "Control" } "win32" { return "Control" } "aqua" { return "Command" } } } #system location for storing app data proc appconfig {appname} { switch [tk windowingsystem] { "x11" { return [file join $::env(HOME) "." [string tolower "$appname"]] } "win32" { return [file join $::env(APPDATA) "CodebyKevin" "$appname"_config] } "aqua" { return [file join $::env(HOME) "Library" "Application Support" "$appname" "Preferences"] } } } #manipulate appeareance of app icon proc seticon {win imgpath} { switch [tk windowingsystem] { "x11" { return [wm iconphoto $win $imgpath] } "win32" { return [wm iconphoto $win $imgpath] } "aqua" { package require tkdock tkdock::switchIcon $imgpath } } } namespace export * } |