cbklib

Check-in [a75134832a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Minor updates
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:a75134832a523be9962f5996dcb64b86ceb35214
User & Date: admin 2015-09-20 05:07:08
Context
2015-10-09
02:06
Updates of various libs check-in: 7360c31fb1 user: admin tags: trunk
2015-09-20
05:07
Minor updates check-in: a75134832a user: admin tags: trunk
02:09
tweak softwareupdate check-in: 2dd7444328 user: admin tags: trunk
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to regproc/regproc.tcl.

98
99
100
101
102
103
104


105
106
107
108
109
110
111
...
146
147
148
149
150
151
152


153
154
155
156
157
158
159
...
354
355
356
357
358
359
360












361
362
363
364
365
366
	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
................................................................................
	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
................................................................................

    proc exitIfExpired {} {

	variable expired
	if {$expired == 1} {
	    exit
	} 













    }

    namespace export *
}








>
>







 







>
>







 







>
>
>
>
>
>
>
>
>
>
>
>






98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
...
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
	variable appname
	variable appstore

	toplevel .purchase
	wm title .purchase "Purchase $appname"
	wm resizable .purchase 0 0

	regproc::makeModal .purchase

	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
................................................................................
	variable appname
	variable appstore
	variable expired

	toplevel .expired
	wm title .expired "Purchase $appname"
	wm resizable .expired 0 0

	regproc::makeModal .expired

	wm withdraw .expired
	wm transient .expired .

	wm protocol .expired WM_DELETE_WINDOW {}

	ttk::frame .expired.top -padding 10
................................................................................

    proc exitIfExpired {} {

	variable expired
	if {$expired == 1} {
	    exit
	} 

    }

    proc makeModal {w} {

	if {[tk windowingsystem] eq "aqua" } {
	    tk::unsupported::MacWindowStyle style $w  modal
	}
	if {[tk windowingsystem] eq "win32"} {
	    raise $w
	    grab -global $w
	}

    }

    namespace export *
}

Changes to softwareupdate/softwareupdate.tcl.

97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
...
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
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
...
262
263
264
265
266
267
268

269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
...
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
...
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
...
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
...
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
...
387
388
389
390
391
392
393
394
395
396
397
398
399
400
	
	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 
................................................................................
		
	    }
	    
	    "x11" {
		return
	    }
	}
	
	return $currentinstall

    }

    #prompt user to update
    proc updatePitch {} {
	variable appname
................................................................................
	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
................................................................................

	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 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}

................................................................................
    }

    #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

................................................................................
	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
................................................................................

	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
................................................................................
	    }
	    
	    "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
................................................................................
		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 *

}







>







|







 







|







 







|







 







|







 







|




|
|





|







 







>








|







 







|







 







|







 







|
|







 







|







 







|






97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
...
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
...
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
...
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
...
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
...
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
...
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
...
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
...
389
390
391
392
393
394
395
396
397
398
399
400
401
402
	
	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 
................................................................................
	    
	}
	
	"x11" {
	    return
	}
    }
    
    return $currentinstall

}

#prompt user to update
proc updatePitch {} {
    variable appname
................................................................................
    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
................................................................................

    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 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 -width [image width $icon] -height [image height $icon]
    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}

................................................................................
}

#show progress of installation
proc progressDialog {} {

    variable appname
    variable status
    variable icon

    catch {destroy .downloadprogress}

    toplevel .downloadprogress
    wm title .downloadprogress "Updating $appname"

    wm transient .downloadprogress .

    label .downloadprogress.label -image $icon  -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

................................................................................
    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
................................................................................

    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
................................................................................
	}
	
	"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
................................................................................
	    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 *

}

Changes to xplat/xplat.tcl.

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

	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] .
	    }
	}
................................................................................
    proc launch {filename} {
	switch [tk windowingsystem] {

	    "x11" {
		exec xdg-open [list $filename]
	    }
	    "win32" {
		auto_execok start {} [list $filename]
	    }
	    
	    "aqua" {
		exec open $filename
	    }
	}
    }
................................................................................
    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"]
	    }   
	}
    }







|







 







|







 







|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

	switch [tk windowingsystem] {

	    "x11" {
		exec lpr [list $filename]
	    }
	    "win32" {
		eval exec [auto_execok start]  /min notepad /p [list $filename]
	    }
	    
	    "aqua" {
		package require cocoaprint
		cocoaprint::cocoaprint [list $filename] .
	    }
	}
................................................................................
    proc launch {filename} {
	switch [tk windowingsystem] {

	    "x11" {
		exec xdg-open [list $filename]
	    }
	    "win32" {
		eval exec [auto_execok start] [list $filename]
	    }
	    
	    "aqua" {
		exec open $filename
	    }
	}
    }
................................................................................
    proc appconfig {appname} {
	switch [tk windowingsystem] {

	    "x11" {
		return [file join $::env(HOME) "." [string tolower  "$appname"]]
	    }
	    "win32" {
		return [file join $::env(APPDATA) "$appname"]
	    }
	    
	    "aqua" {
		return [file join $::env(HOME) "Library" "Application Support" "$appname" "Preferences"]
	    }   
	}
    }