PortAuthority

Check-in [9b73aef2f4]
Login

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

Overview
Comment:Revbump to 7.8
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9b73aef2f4296640e763ba64c8bf838a9d1ded11
User & Date: kevin 2017-12-04 03:31:27
Context
2017-12-05
03:23
Additional tweaks for 7.8 check-in: 2128935dd5 user: kevin tags: trunk
2017-12-04
03:31
Revbump to 7.8 check-in: 9b73aef2f4 user: kevin tags: trunk
2017-10-16
02:28
Version 7.7 check-in: 7d2212ef44 user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Deleted libs/Img1.4.2/libjpegtcl8.4.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libpngtcl1.4.12.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtifftcl3.9.4.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimg1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgbmp1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgdted1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimggif1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgico1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgjpeg1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgpcx1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgpixmap1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgpng1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgppm1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgps1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgraw1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgsgi1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgsun1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgtga1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgtiff1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgwindow1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgxbm1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libtkimgxpm1.4.2.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/libzlibtcl1.2.8.dylib.

cannot compute difference between binary files

Deleted libs/Img1.4.2/pkgIndex.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
package ifneeded zlibtcl 1.2.8     [list load [file join $dir libzlibtcl1.2.8.dylib]]
package ifneeded pngtcl 1.4.12     [list load [file join $dir libpngtcl1.4.12.dylib]]
package ifneeded tifftcl 3.9.4     [list load [file join $dir libtifftcl3.9.4.dylib]]
package ifneeded jpegtcl 8.4     [list load [file join $dir libjpegtcl8.4.dylib]]
# -*- tcl -*- Tcl package index file
# --- --- --- Handcrafted, final generation by configure.
#
# $Id: pkgIndex.tcl.in 209 2009-03-03 17:19:05Z nijtmans $

package ifneeded img::base 1.4.2 [list load [file join $dir libtkimg1.4.2.dylib]]

# Compatibility hack. When asking for the old name of the package
# then load all format handlers and base libraries provided by tkImg.
# Actually we ask only for the format handlers, the required base
# packages will be loaded automatically through the usual package
# mechanism.

# When reading images without specifying it's format (option -format),
# the available formats are tried in reversed order as listed here.
# Therefore file formats with some "magic" identifier, which can be
# recognized safely, should be added at the end of this list.

package ifneeded Img 1.4.2 {
    package require img::window
    package require img::tga
    package require img::ico
    package require img::pcx
    package require img::sgi
    package require img::sun
    package require img::xbm
    package require img::xpm
    package require img::ps
    package require img::jpeg
    package require img::png
    package require img::tiff
    package require img::bmp
    package require img::ppm
    package require img::gif
    package require img::pixmap
    package provide Img 1.4.2
}

package ifneeded img::bmp 1.4.2     [list load [file join $dir libtkimgbmp1.4.2.dylib]]
package ifneeded img::gif 1.4.2     [list load [file join $dir libtkimggif1.4.2.dylib]]
package ifneeded img::ico 1.4.2     [list load [file join $dir libtkimgico1.4.2.dylib]]
package ifneeded img::jpeg 1.4.2     [list load [file join $dir libtkimgjpeg1.4.2.dylib]]
package ifneeded img::pcx 1.4.2     [list load [file join $dir libtkimgpcx1.4.2.dylib]]
package ifneeded img::pixmap 1.4.2     [list load [file join $dir libtkimgpixmap1.4.2.dylib]]
package ifneeded img::png 1.4.2     [list load [file join $dir libtkimgpng1.4.2.dylib]]
package ifneeded img::ppm 1.4.2     [list load [file join $dir libtkimgppm1.4.2.dylib]]
package ifneeded img::ps 1.4.2     [list load [file join $dir libtkimgps1.4.2.dylib]]
package ifneeded img::sgi 1.4.2     [list load [file join $dir libtkimgsgi1.4.2.dylib]]
package ifneeded img::sun 1.4.2     [list load [file join $dir libtkimgsun1.4.2.dylib]]
package ifneeded img::tga 1.4.2     [list load [file join $dir libtkimgtga1.4.2.dylib]]
package ifneeded img::tiff 1.4.2     [list load [file join $dir libtkimgtiff1.4.2.dylib]]
package ifneeded img::window 1.4.2     [list load [file join $dir libtkimgwindow1.4.2.dylib]]
package ifneeded img::xbm 1.4.2     [list load [file join $dir libtkimgxbm1.4.2.dylib]]
package ifneeded img::xpm 1.4.2     [list load [file join $dir libtkimgxpm1.4.2.dylib]]
package ifneeded img::dted 1.4.2     [list load [file join $dir libtkimgdted1.4.2.dylib]]
package ifneeded img::raw 1.4.2     [list load [file join $dir libtkimgraw1.4.2.dylib]]
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































Deleted libs/fullscreen1.2/fullscreen.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
#fullscreen: provides Cocoa-native fullscreen windows for Tk apps on OS X in a manner consistent with wm attributes api's. 


namespace eval fullscreen {

    if {![info exists library]} {
	variable library [file dirname [info script]]
    }

    load [file join $library libfullscreen1.2.dylib]

    image create photo _resize -data {

	R0lGODlhEAAQAIABALm5uf///yH5BAEKAAEALAAAAAAQABAAAAIhjI+gim3LXIMy
	0RpglBfghU1h5o3kNnkXp4Wtu1ZaaZoFADs=

    }

    
    proc fullscreen {windowname} {

	variable w
	set w $windowname

	fullscreen::addfullscreenbutton $w
    }

    proc togglefullscreen {} {

	variable w

	if {[wm attributes $w -fullscreen] == 1} {
	    fullscreen::restorewindow
	} else {
	    fullscreen::makefullscreen
	}
	fullscreen::fullscreen $w
    }

    proc makefullscreen {} {

	variable originalsize
	variable title
	variable w
	
	set originalsize [wm geometry $w]
	set title [wm title $w]
	
	wm withdraw $w
	wm attributes $w -fullscreen 1
	
	set m [$w cget -menu]
	
	menu $m._resize
	$m add cascade -image _resize -menu $m._resize
	$m._resize add command -label "Restore Normal Window" -command fullscreen::restorewindow
	wm deiconify $w
	
    }

    proc restorewindow {} {

	variable originalsize
	variable w
	variable title

	set m [$w cget -menu]
	$m delete end
	destroy $m._resize

	wm attributes $w  -fullscreen 0

	wm geometry . $originalsize
	wm title $w $title
	
    }

    bind all <<ToggleFullScreen>> fullscreen::togglefullscreen
    namespace export *

}






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































Deleted libs/fullscreen1.2/libfullscreen1.2.dylib.

cannot compute difference between binary files

Deleted libs/fullscreen1.2/pkgIndex.tcl.

1
2
3
4
5
6
7
#
# Tcl package index file
#
package ifneeded fullscreen 1.2 "
    package require Tk 8.5-
    if {\"AppKit\" ni \[winfo server .\]} {error {TkAqua Cocoa required}}
        source [list [file join $dir fullscreen.tcl]]"
<
<
<
<
<
<
<














Changes to libs/machelp/help.txt.

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

The following open-source technologies have gone into the development of PortAuthority:

 * The Tcl/Tk GUI toolkit. Website: [http://www.tcl.tk]. License: [http://www.tcl.tk/software/tcltk/license.html]
 * The tcllib and tklib libraries for Tcl/Tk. Website and license: [http://tcllib.sourceforge.net].
 * The BWidget GUI library for Tcl/Tk. Website and license: [http://tcllib.sourceforge.net].
 * The MacPorts software management system. Website and license: [http://www.macports.org].
 * The Tkdock package for Dock icon manipulation. Website and license: [http://fossil.codebykevin.com].
 * The cocoaprint package for native printing. Website and license: [http://fossil.codebykevin.com].
 * The TclServices package. Website and license: [http://fossil.codebykevin.com].
 * The Aquahig package for OS X. Website and license: [http://fossil.codebykevin.com].
 * The fullscreen package for OS X. Website and license: [http://fossil.codebykevin.com].
 * The "windowlist" package. Website and license: [http://fossil.codebykevin.com]
 * App icon from the Gnome project. Website: [http://www.gnome.org]. License: [http://creativecommons.org/licenses/by-sa/3.0/].
 * Icon fonts from Iconic project. Website and license: [https://github.com/somerandomdude/Iconic].
 * TkImg for image formats. Website and license: [http://sourceforge.net/projects/tkimg/].
 * Help viewer by Keith Vetter: [http://wiki.tcl.tk/19649].
 * aem package for AppleScript support. Website and license: [http://fossil.codebykevin.com].

-------------------
title: PortAuthority Version History
alias: History




'''7.7 (October 15, 2017):'''
 * Multiple updates to improve stability and UI performance on 10.13.

'''7.6 (May 1, 2017):'''
 * Improved scrolling performance, security support on macOS.








<



<
<


<






>
>
>







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

The following open-source technologies have gone into the development of PortAuthority:

 * The Tcl/Tk GUI toolkit. Website: [http://www.tcl.tk]. License: [http://www.tcl.tk/software/tcltk/license.html]
 * The tcllib and tklib libraries for Tcl/Tk. Website and license: [http://tcllib.sourceforge.net].
 * The BWidget GUI library for Tcl/Tk. Website and license: [http://tcllib.sourceforge.net].
 * The MacPorts software management system. Website and license: [http://www.macports.org].

 * The cocoaprint package for native printing. Website and license: [http://fossil.codebykevin.com].
 * The TclServices package. Website and license: [http://fossil.codebykevin.com].
 * The Aquahig package for OS X. Website and license: [http://fossil.codebykevin.com].


 * App icon from the Gnome project. Website: [http://www.gnome.org]. License: [http://creativecommons.org/licenses/by-sa/3.0/].
 * Icon fonts from Iconic project. Website and license: [https://github.com/somerandomdude/Iconic].

 * Help viewer by Keith Vetter: [http://wiki.tcl.tk/19649].
 * aem package for AppleScript support. Website and license: [http://fossil.codebykevin.com].

-------------------
title: PortAuthority Version History
alias: History

'''7.8 (December 1, 2017):'''
 * UI enhancements.

'''7.7 (October 15, 2017):'''
 * Multiple updates to improve stability and UI performance on 10.13.

'''7.6 (May 1, 2017):'''
 * Improved scrolling performance, security support on macOS.

Deleted libs/macsheet1.1/libmacsheet1.1.dylib.

cannot compute difference between binary files

Deleted libs/macsheet1.1/macsheet.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
#macsheet: provides custom sheet windows for Tk-Cocoa. The macsheet.tcl file provides the public interface; macsheet.m provides the platform-specific primitives for animating and hiding the sheet.  (c) 2009 WordTech Communications LLC.  License: standard Tcl license, http://www.tcl.tk/software/tcltk/license.html


namespace eval macsheet {

    if {![info exists library]} {
	variable library [file dirname [info script]]
    }

    load [file join $library libmacsheet1.1.dylib]

    proc sheet {parent sheet src} {

	#first, hide the sheet window and make non-resizable; sheet does not display smoothly otherwise
	wm withdraw $sheet

	wm resizable $sheet 0 0

	#next, display the sheet
	wm deiconify $sheet
	macsheet::runsheet  $parent $sheet


	#compute the sheet's geometry proportional to parent window for proper placement; sheet will not slide down with perfect smoothness, but it will be placed correctly as a child window of the parent, and will animate back out fine.
	set sheetwidth [expr {int([winfo width $parent] * .5)}]
	set sheetheight [winfo reqheight $sheet]
	
	switch $src {
	    "btn" {
		set sheety [winfo y $parent]
	    } 
	    "mnu" {
		set sheety [winfo rooty $parent]
	    } 
	    "key" {
		set sheety [expr [winfo rooty $parent] - 24]
	    }
	}
	set parentwidth [winfo width $parent]
	set interimgap [expr $parentwidth - $sheetwidth ]
	set finalgap [expr $interimgap/2]
	set sheetx [expr [winfo x $parent] + $finalgap]

	#finally display the sheet!
	wm geometry $sheet ${sheetwidth}x${sheetheight}+$sheetx+$sheety

    }
    #running the "macsheet::hidesheet" command directly seems to generate an error because the window is destroyed at the Objective-C level; hence this procedure makes things tidier 
    proc closesheet {sheet} {

	catch "macsheet::hidesheet $sheet"

    }
    
    namespace export *

}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































Deleted libs/macsheet1.1/pkgIndex.tcl.

1
2
3
4
5
6
7
#
# Tcl package index file
#
package ifneeded macsheet 1.1 "
    package require Tk 8.5-
    if {\"AppKit\" ni \[winfo server .\]} {error {TkAqua Cocoa required}}
        source [list [file join $dir macsheet.tcl]]"
<
<
<
<
<
<
<














Changes to libs/portauthority/portauthority-main.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
...
332
333
334
335
336
337
338

339

340
341
342
343
344
345
346
347
348
...
393
394
395
396
397
398
399
400

401
402
403
404
405
406
407
...
684
685
686
687
688
689
690


691
692
693
694
695
696
697
...
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
....
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
....
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
....
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
....
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
....
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
....
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
....
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
....
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
....
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
....
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079

2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090

2091
2092
2093
2094
2095
2096
2097
....
2165
2166
2167
2168
2169
2170
2171













2172
2173
2174
2175
2176
2177
# PortAuthority: GUI for MacPorts.  

#Copyright (C) 2016 WordTech Communications LLC

#MIT license.


#initialize package requirements

package require Img
package require tkdock
package require tablelist_tile
package require regproc
package require machelp
package require BWidget
package require softwareupdate
package require aquahig
package require appname
package require windowlist
package require urltext
package require tclservices
package require cocoaprint
package require Tclapplescript
package require tclgrowl
package require aem
package require fullscreen
package require xplat

#handle errors in Tk
proc bgerror {args} {
    exec syslog -s -l Error "PortAuthority: An error occurred: $args"
}

................................................................................

    
    #Create window title
    wm title . "PortAuthority"

    bind . <Command-W> {wm state .  withdrawn}
    bind . <Command-w> {wm state .  withdrawn}



    set searchterm "" 
    ::fullscreen::fullscreen .

    ttk::style configure Toolbutton -font {Iconic 22} 

    #create menu bar
    menu .mb

    #apple menu
................................................................................
    #ports menu
    menu .mb.ports -tearoff 0 
    .mb.ports add command -label "Update MacPorts" -command updateBase -accelerator "Command-U" 
    .mb.ports add command -label "Add Port Descriptions" -command  updatePorts
    .mb add cascade  -label "MacPorts" -menu .mb.ports 

    #window menu
    windowlist::windowMenu .mb



    #help menu
    menu .mb.help -tearoff 0
    .mb.help add command -label "Contact Code by Kevin" -command machelp::usermail
    .mb.help add command -label "Web Site" -command machelp::appweb
    .mb add cascade -label "Help" -menu .mb.help
................................................................................
    .t.right add .t.right.lower

    .t add .t.left
    .t add .t.right

    wm geometry . 950x700



}


#put up busy cursor, display progress bar
proc showProgress {} {
    global log 
    global playsound
................................................................................

#hide progress bar, notify user action is done, reset cursor
proc endProgress {} {
    global log 
    

    . configure -cursor arrow
    tkdock::origIcon

    .bottom.progress stop
    pack forget .bottom.progress
    bgGetAllPorts
}

#show all available ports
................................................................................
    global portpath 
    global verboselevel 
    global installicon
    

    clearData
    showProgress
    tkdock::switchIcon $installicon

    #error handling
    if {[.t.right.upper.frame.listbox curselection] == ""} {	
	tk_messageBox -title "Wrong Selection" -icon warning -message "Please make a selection from the main table." -detail "This will start the installation process." -parent . 
	set status ""
	endProgress
	selectCat
................................................................................
    global portpath 
    global verboselevel 
    global installicon
    

    clearData
    showProgress
    tkdock::switchIcon $installicon

    set new $variantport
    set status "Installing $new"
    
    set script "$portpath $verboselevel install $new +$variantname > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt] &"

    set scripterr {   
................................................................................
    global deleteicon
    global portauthority_growl
    global playsound
    global showstatus

    clearData
    showProgress
    tkdock::switchIcon $deleteicon
    
    #error handling
    if {[.t.right.upper.frame.listbox curselection] == ""} {
	tk_messageBox -title "Wrong Selection" -icon warning -message "Please make a selection from the main table." -detail "This will start the removal process." -parent .
	set status ""
	endProgress
	selectCat
................................................................................
	tk_messageBox -title "Wrong Selection" -icon warning -message "Please make a selection from the main table." -detail "This will start the upgrade process." -parent . 
	set status "Done"
	return
    } else {
	set item [lindex [.t.right.upper.frame.listbox get [.t.right.upper.frame.listbox curselection]] 1]
	set new [lindex [split $item] 0]
	showProgress
	tkdock::switchIcon $installicon
	set status "Upgrading $new"
	
	set script "$portpath $verboselevel upgrade $new > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt] &"

	set scripterr {   
	    AppleScript execute "

................................................................................
    global status 
    global portpath 
    global verboselevel 
    global installicon
    
    clearData
    showProgress
    tkdock::switchIcon $installicon
    set status "Upgrading all installed ports"

    
    set script "$portpath $verboselevel upgrade installed  > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt] &"

    set scripterr {   
	AppleScript execute "
................................................................................
    global verboselevel 
    global installicon
    
    
    clearData
    set status "Getting updated ports"
    showProgress
    tkdock::switchIcon $installicon

    
    set script "$portpath $verboselevel sync > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt]  &"

    set scripterr {   
	AppleScript execute "

................................................................................
    global portpath 
    global verboselevel 
    global installicon
    

    clearData
    showProgress
    tkdock::switchIcon $installicon
    after 500
    set status "Updating MacPorts"
    set script "$portpath $verboselevel selfupdate > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt] &"

    set scripterr {   
	AppleScript execute "

................................................................................
#"about application" command
proc tkAboutDialog {} {
    aboutWindow
}


proc aboutWindow {} {
 tk_messageBox -parent . -icon info -title "About PortAuthority" -message "PortAuthority: GUI for MacPorts" -detail "Version 7.7\n(c)2017 WordTech Communications LLC"

}


#initialization routines on startup
proc startUp {} {

................................................................................

    if {![file exists $datadir/portauthority.rc]} {
	checkPref
    }    
    
    if { [file exists  $datadir/portauthority.rc]} {
	catch [list source $datadir/portauthority.rc ] 
	appname::setAppName PortAuthority 7.7
	softwareupdate::setVersion $appname::name $appname::version
	machelp::setAppName $appname::name $appname::version
	checkMacPorts
	drawGUI
	setPref
	getAllPorts
	catch {toggleCopyText}
................................................................................

      	after 50 
	regproc::readLic $appname::name $appname::version
}

#load images into memory
proc makeImage {} {
    global imagedir 
    global installicon 
    global deleteicon 
    global growlicon
    

    set imagedir [file join [file dirname [info script]] images]

    image create photo OSAScriptMenu -file [file join $imagedir OSAScriptMenu.png]

    
    set installicon [file join $imagedir portauthority-running.png]
    set deleteicon [file join $imagedir portauthority-running.png]
    
    tk::mac::iconBitmap logo 128 128 -imageFile [file join [softwareupdate::findCurrentInstallation] "Contents/Resources/PortAuthority.icns"]
    set growlicon  [file join [softwareupdate::findCurrentInstallation] "Contents/Resources/PortAuthority.icns"]

    growl::growlicon $growlicon

    softwareupdate::setIcon [image create photo -data {iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAPt0lEQVRo3u1ZaWxc13X+7n33zZt9ODOchZzhTlOSJVoSqTWiItWwitip66hx2qRJG9tI27hA0S1w4bQoUrcIigYI0LTNYie1azhGYNeJ66WuLcmRrM1aKInivojkcJ3hzHD25a23P2ao0KwsWYv/FL7AxX2Yeffcc+79zjnfuQ+4w23fgUdv6b9bbQQfQ/vaE9/H8NmTBCAE4OCcgzFmvHfkeew78CiOHXr2jq0lfBwGOCw+JzNJ25godjHR1MFEU5hziJHJi8nI5KU7uhb9OOBjcP53To/3hCdY/wtvsP5Vjz9wSGBseFfPb5vu9GbRW8H2jbBsGHpn167dRuO6TQh1bETnjp3w+PwyFdjGOyH/pg1Yi9uV57ULrfxus9vXKZpOx6ZjmJiKIRbPwFnjooTQDdeSfS35H9UIdjPKb93xsI8Q1HPOZy6efSW1eqGVd7p3PtzgrKmxKYoOSWQA51A1HS6XiwJYv3aXV+Zt3nbQarFaNlFK1Uw6c/nYoWf1j+LwwkdVflPX50KtrY3/EKwLfNdkllxma/340uJ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/jKHR+Gxycy44NHvg+AV5OoE4AKgCzNXe47oxafmpyeOqKq8uDU6LGzABghVDP0q0Ju3gfKpZwhmswsszy1fO799NOEEHO5sKwAsFTyCDeqCrEqedM516cWY/Gd7lYPNYBKCZrL8XQ6PV9V3FRV3ACgV0eWjE3MJ2MT/75iICFU49zQb/sLjaqUNcZEQy6m8uXCcqa6oAKgvKaXACiqWp6IxuIGE2nlAkAUMB+NGqomDwOQq++tdLk6V64aw6oGKJwbWvX59i+2NE3VV+2YvmrHV48MAFfkYv/M/ALVDBWCJEA3VIxNTgu6pvZV61lSlaFVu7pmXFnr9j8xrb2sXiV8pfoS1nSSSUXPTUxNX3r6hZ8FKCWEc65El+IxVS0dBrDC7/U13ah2fjMK3awBqw3h1QW16o6uMFuSTs5mE8nE701GZiRwDg4YNoskF7Lx6aqyq2XgZpX+pH3SPmn/j9r/AouYgb5+MVDFAAAAAElFTkSuQmCC}]
    

    
}


#save output to text file
proc saveLog {} {
    global log
................................................................................
display notification \"$text\"  with title \"$title\"

"
    }
    if {[catch $scripterr errmsg]} {endProgress; tk_messageBox -icon warning -parent . -message "Error" -detail "The following output was returned: $errmsg"; return}

    













}


#start application 
makeImage
startUp


|






<
<







<






|







 







>

>

<







 







|
>







 







>
>







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







|







 







<
<
<
<
|
<


<
>

<
<
<
<




|
|
>







 







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






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
...
329
330
331
332
333
334
335
336
337
338
339

340
341
342
343
344
345
346
...
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
...
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
...
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
....
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
....
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
....
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
....
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
....
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
....
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
....
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
....
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
....
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
....
2065
2066
2067
2068
2069
2070
2071




2072

2073
2074

2075
2076




2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
....
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
# PortAuthority: GUI for MacPorts.  

#Copyright (C) 2017 WordTech Communications LLC

#MIT license.


#initialize package requirements



package require tablelist_tile
package require regproc
package require machelp
package require BWidget
package require softwareupdate
package require aquahig
package require appname

package require urltext
package require tclservices
package require cocoaprint
package require Tclapplescript
package require tclgrowl
package require aem

package require xplat

#handle errors in Tk
proc bgerror {args} {
    exec syslog -s -l Error "PortAuthority: An error occurred: $args"
}

................................................................................

    
    #Create window title
    wm title . "PortAuthority"

    bind . <Command-W> {wm state .  withdrawn}
    bind . <Command-w> {wm state .  withdrawn}
    wm protocol . WM_DELETE_WINDOW {wm withdraw .} 


    set searchterm "" 


    ttk::style configure Toolbutton -font {Iconic 22} 

    #create menu bar
    menu .mb

    #apple menu
................................................................................
    #ports menu
    menu .mb.ports -tearoff 0 
    .mb.ports add command -label "Update MacPorts" -command updateBase -accelerator "Command-U" 
    .mb.ports add command -label "Add Port Descriptions" -command  updatePorts
    .mb add cascade  -label "MacPorts" -menu .mb.ports 

    #window menu
	menu .mb.window
	.mb add cascade -label Window -menu .mb.window


    #help menu
    menu .mb.help -tearoff 0
    .mb.help add command -label "Contact Code by Kevin" -command machelp::usermail
    .mb.help add command -label "Web Site" -command machelp::appweb
    .mb add cascade -label "Help" -menu .mb.help
................................................................................
    .t.right add .t.right.lower

    .t add .t.left
    .t add .t.right

    wm geometry . 950x700

    wm iconphoto . -default icon-main

}


#put up busy cursor, display progress bar
proc showProgress {} {
    global log 
    global playsound
................................................................................

#hide progress bar, notify user action is done, reset cursor
proc endProgress {} {
    global log 
    

    . configure -cursor arrow
    wm iconphoto . -default icon-main

    .bottom.progress stop
    pack forget .bottom.progress
    bgGetAllPorts
}

#show all available ports
................................................................................
    global portpath 
    global verboselevel 
    global installicon
    

    clearData
    showProgress
    wm iconphoto . -default icon-running

    #error handling
    if {[.t.right.upper.frame.listbox curselection] == ""} {	
	tk_messageBox -title "Wrong Selection" -icon warning -message "Please make a selection from the main table." -detail "This will start the installation process." -parent . 
	set status ""
	endProgress
	selectCat
................................................................................
    global portpath 
    global verboselevel 
    global installicon
    

    clearData
    showProgress
    wm iconphoto . -default icon-running

    set new $variantport
    set status "Installing $new"
    
    set script "$portpath $verboselevel install $new +$variantname > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt] &"

    set scripterr {   
................................................................................
    global deleteicon
    global portauthority_growl
    global playsound
    global showstatus

    clearData
    showProgress
    wm iconphoto . -default icon-running
    
    #error handling
    if {[.t.right.upper.frame.listbox curselection] == ""} {
	tk_messageBox -title "Wrong Selection" -icon warning -message "Please make a selection from the main table." -detail "This will start the removal process." -parent .
	set status ""
	endProgress
	selectCat
................................................................................
	tk_messageBox -title "Wrong Selection" -icon warning -message "Please make a selection from the main table." -detail "This will start the upgrade process." -parent . 
	set status "Done"
	return
    } else {
	set item [lindex [.t.right.upper.frame.listbox get [.t.right.upper.frame.listbox curselection]] 1]
	set new [lindex [split $item] 0]
	showProgress
	wm iconphoto . -default icon-running
	set status "Upgrading $new"
	
	set script "$portpath $verboselevel upgrade $new > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt] &"

	set scripterr {   
	    AppleScript execute "

................................................................................
    global status 
    global portpath 
    global verboselevel 
    global installicon
    
    clearData
    showProgress
    wm iconphoto . -default icon-running
    set status "Upgrading all installed ports"

    
    set script "$portpath $verboselevel upgrade installed  > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt] &"

    set scripterr {   
	AppleScript execute "
................................................................................
    global verboselevel 
    global installicon
    
    
    clearData
    set status "Getting updated ports"
    showProgress
    wm iconphoto . -default icon-running

    
    set script "$portpath $verboselevel sync > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt]  &"

    set scripterr {   
	AppleScript execute "

................................................................................
    global portpath 
    global verboselevel 
    global installicon
    

    clearData
    showProgress
    wm iconphoto . -default icon-running
    after 500
    set status "Updating MacPorts"
    set script "$portpath $verboselevel selfupdate > [file join $::env(TMPDIR) portauthority.txt] 2>&1 & echo $! > [file join $::env(TMPDIR) pid.txt] &"

    set scripterr {   
	AppleScript execute "

................................................................................
#"about application" command
proc tkAboutDialog {} {
    aboutWindow
}


proc aboutWindow {} {
 tk_messageBox -parent . -icon info -title "About PortAuthority" -message "PortAuthority: GUI for MacPorts" -detail "Version 7.8\n(c)2017 WordTech Communications LLC"

}


#initialization routines on startup
proc startUp {} {

................................................................................

    if {![file exists $datadir/portauthority.rc]} {
	checkPref
    }    
    
    if { [file exists  $datadir/portauthority.rc]} {
	catch [list source $datadir/portauthority.rc ] 
	appname::setAppName PortAuthority 7.8
	softwareupdate::setVersion $appname::name $appname::version
	machelp::setAppName $appname::name $appname::version
	checkMacPorts
	drawGUI
	setPref
	getAllPorts
	catch {toggleCopyText}
................................................................................

      	after 50 
	regproc::readLic $appname::name $appname::version
}

#load images into memory
proc makeImage {} {




   

    set imagedir [file join [file dirname [info script]] images]


    source $imagedir/images.tcl
    




    set growlicon  [file join [softwareupdate::findCurrentInstallation] "Contents/Resources/PortAuthority.icns"]

    growl::growlicon $growlicon

    softwareupdate::setIcon icon-update
	
	#icon-main, icon-running
    
}


#save output to text file
proc saveLog {} {
    global log
................................................................................
display notification \"$text\"  with title \"$title\"

"
    }
    if {[catch $scripterr errmsg]} {endProgress; tk_messageBox -icon warning -parent . -message "Error" -detail "The following output was returned: $errmsg"; return}

    
}

#raise window if closed--dock click
proc ::tk::mac::ReopenApplication {} {

    if { [wm state .] == "withdrawn"} {
	wm state . normal
	raise .
    } else {
	wm deiconify .
	raise .
    }

}


#start application 
makeImage
startUp

Deleted libs/tkdock1.0/libtkdock1.0.dylib.

cannot compute difference between binary files

Deleted libs/tkdock1.0/pkgIndex.tcl.

1
2
3
4
5
6
7
#
# Tcl package index file
#
package ifneeded tkdock 1.0 "
    package require Tk 8.5-
    if {\"AppKit\" ni \[winfo server .\]} {error {TkAqua Cocoa required}}
     load [list [file join $dir libtkdock1.0.dylib]] tkdock"
<
<
<
<
<
<
<














Deleted libs/windowlist/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 windowlist 1.5 [list source [file join $dir windowlist.tcl]]
<
<
<
<
<
<
<
<
<
<
<






















Deleted libs/windowlist/windowlist.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
#windowlist.tcl: provides routines for managing windows from menu, i.e. minimize, raise, bring all to front; standard menu item on Mac OS X. 

#(c) 2011 WordTech Communications LLC. License: standard Tcl license, http://www.tcl.tk/software/tcltk/license.html

#includes code from http://wiki.tcl.tk/1461

##"cycle through windows" code courtesy of Tom Hennigan, tomhennigan@gmail.com, (c) 2009

package provide windowlist 1.5

namespace eval windowlist {

    #make the window menu
    proc windowMenu {mainmenu} {

	menu $mainmenu.windowlist

	$mainmenu.windowlist add command -label "Minimize" -command [namespace current]::minimizeFrontWindow -accelerator Command-M
	$mainmenu.windowlist add separator
	$mainmenu.windowlist add command -label "Bring All to Front" -command [namespace current]::raiseAllWindows
	$mainmenu.windowlist add separator
	$mainmenu.windowlist add command -label "Cycle Through Windows" \
	    -command  {raise [lindex [wm stackorder .] 0]} \
	    -accelerator "Command-`"
       	bind all <Command-quoteleft> {raise [lindex [wm stackorder .] 0]}
	$mainmenu.windowlist add separator
	$mainmenu.windowlist add command -label "Main Window" -command ::tk::mac::ReopenApplication
	$mainmenu.windowlist add separator
	$mainmenu.windowlist add command -label [wm title .] -command ::tk::mac::ReopenApplication
	
	$mainmenu add cascade -label "Window" -menu $mainmenu.windowlist
	
        #bind the window menu to update whenever a new window is added, on menu selection
       	bind all <<MenuSelect>> +[list [namespace current]::updateWindowMenu $mainmenu.windowlist]
	bind all <Command-M>  [namespace current]::minimizeFrontWindow
	bind all <Command-m>  [namespace current]::minimizeFrontWindow
	bind . <Command-w> {wm state . withdrawn}
	bind .  <Command-W> {wm state . withdrawn}
	wm protocol . WM_DELETE_WINDOW {wm state . withdrawn}

    }

    
    #update the window menu with windows
    proc updateWindowMenu {windowmenu} {

	set windowlist [wm stackorder .]

	#search for drawer window first
	if {[lsearch $windowlist ".drawer"] >= 0 } {
	    set windowlist [lreplace $windowlist [lsearch $windowlist ".drawer"] [lsearch $windowlist ".drawer"]]
	    update
	}
	
	if {$windowlist == {}} {
	    return
	}

	$windowmenu delete 8 end
	foreach item $windowlist {
	    $windowmenu add command -label "[wm title $item]"  -command [list raise $item]

	}
    }



    #make all windows visible
    proc raiseAllWindows {} {

	#get list of mapped windows

	if {![winfo ismapped .]} {

	    wm deiconify .

	}

	set windowlist [wm stackorder .]

	#do nothing if all windows are minimized
	if {$windowlist == {}} {
	    return
	}

	#use [winfo children .] here to get windows that are minimized
	foreach item [winfo children .] {
	    
	    #get all toplevel windows, exclude menubar windows
	    if { [string equal [winfo toplevel $item] $item] && [catch {$item cget -tearoff}]} {
		wm deiconify $item
	    }
	}
	#be sure to deiconify ., since the above command only gets the child toplevels
	wm deiconify .
    }

    #minimize the selected window
    proc minimizeFrontWindow {} {

	#get list of mapped windows
	set windowlist [wm stackorder .]

	#do nothing if all windows are minimized
	if {$windowlist == {}} {
	    return
	} else {

	    #minimize topmost window
	    set topwindow [lindex $windowlist end]
	    wm iconify $topwindow

	}
    }
    
    namespace export *
}

#raise window if closed--dock click
proc ::tk::mac::ReopenApplication {} {

    if { [wm state .] == "withdrawn"} {
	wm state . normal
	raise .
    } else {
	wm deiconify .
	raise .
    }

    catch {fullscreen::fullscreen .}

}






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<