Manpower

Check-in [1dd379503a]
Login

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

Overview
Comment:Fix URL processing
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1dd379503a279ae8f84da48bc9902d847eac32fd
User & Date: kevin 2019-08-25 02:26:53
Context
2019-10-14
02:48
Minor revisions check-in: 9756567527 user: kevin tags: trunk
2019-08-25
02:26
Fix URL processing check-in: 1dd379503a user: kevin tags: trunk
2019-08-24
15:41
More fixes check-in: c1e83138e0 user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to libs/manpower/manpower-main.tcl.

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
...
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
...
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
...
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
...
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
    py+1LIsJHiBAh+BgmiEAJQITgW6DgUQIAECH4JN8IPqYuNxUAOw==}
image create photo downArrow -data {
    R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAInhI+
    py+1I4ocQ/IgDEYIPgYJICUCE4F+YIBolEoKPEJKZmVJK6ZACADs=}
image create photo noArrow -height 14 -width 14

#handle "get URL" event for man page
proc showManURL {man} {

    global manitem
    set manitem [lindex [split $man "//"] 2]
    singleManPage
    
}

#main AppleScript command
proc showPage {man} {

................................................................................
	file-system xbm_folder_sans_16
	other xbm_star_16
	macro xbm_script_16
	admin xbm_home_16
	kernel xbm_refresh_16
    } 
    
   
    #tree display for categories
    ttk::treeview .middle.left.tree -yscrollcommand [list .middle.left.scroll set] -show tree
    
    pack .middle.left.tree -fill both -side left -expand yes

    ttk::scrollbar .middle.left.scroll -command [list .middle.left.tree yview]
    pack .middle.left.scroll -side right -fill y -expand no
................................................................................

    ttk::scrollbar .middle.right.upper.frame.row.vsb -orient vertical -command [list .middle.right.upper.frame.listbox yview]
    pack .middle.right.upper.frame.row.vsb -side bottom -fill y -expand 1

    #main data display
    ttk::treeview .middle.right.upper.frame.listbox -columns {"Man Page" "Description"} -show headings -yscrollcommand [list .middle.right.upper.frame.row.vsb set] -displaycolumns #all

        foreach col [list "Man Page" "Description"] {
	.middle.right.upper.frame.listbox heading $col -text $col -anchor w -command [list SortBy .middle.right.upper.frame.listbox $col 0] -image noArrow
    }

    
    pack .middle.right.upper.frame.listbox -side left -fill both -expand yes
    bind .middle.right.upper.frame.listbox <<TreeviewSelect>> {getManPage}

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

    .middle.left.tree selection remove [.middle.left.tree selection]

    clearData
    clearText
    .middle.right.lower.right.log configure -state normal

     set rawman [exec man $manitem > $cachedir/$manitem-man.txt  2>$cachedir/manerror]
    set getman [exec $rmanpath -f Tk $cachedir/$manitem-man.txt > $cachedir/$manitem.txt 2>$cachedir/rmanerror]
    
    after 50
    set readman [open $cachedir/$manitem.txt ]
    set mantext [read $readman]
    close $readman

................................................................................
    if {$searchterm == ""} {
	return
    }

    clearData
    clearText

  
    set status "Man pages with keyword \"$searchterm\""

    set parsesearch [lsearch -all -inline $manlist *$searchterm*]
    foreach "item" $parsesearch {
	.middle.right.upper.frame.listbox insert {} end -values $item
    }
}
................................................................................
    set catlist ""

    clearData
    clearText

    set basecat [.middle.left.tree item [.middle.left.tree selection] -text]
    set interimnum [lindex [split $basecat \.] 0]
  
    foreach item $manlist {
	if {[regexp \\($interimnum\\) [lindex $item 0]]} {
	    set manpage [lindex $item 0]
	    set description [lindex $item 1]
	    lappend interimcat [list $manpage $description]
	} else {
	    continue







|


|







 







|







 







|







 







|







 







|







 







|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
...
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
...
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
...
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
...
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
    py+1LIsJHiBAh+BgmiEAJQITgW6DgUQIAECH4JN8IPqYuNxUAOw==}
image create photo downArrow -data {
    R0lGODlhDgAOAJEAANnZ2YCAgPz8/P///yH5BAEAAAAALAAAAAAOAA4AAAInhI+
    py+1I4ocQ/IgDEYIPgYJICUCE4F+YIBolEoKPEJKZmVJK6ZACADs=}
image create photo noArrow -height 14 -width 14

#handle "get URL" event for man page
proc tk::mac::LaunchURL {url} {

    global manitem
    set manitem [lindex [split $url "//"] 2]
    singleManPage
    
}

#main AppleScript command
proc showPage {man} {

................................................................................
	file-system xbm_folder_sans_16
	other xbm_star_16
	macro xbm_script_16
	admin xbm_home_16
	kernel xbm_refresh_16
    } 
    
    
    #tree display for categories
    ttk::treeview .middle.left.tree -yscrollcommand [list .middle.left.scroll set] -show tree
    
    pack .middle.left.tree -fill both -side left -expand yes

    ttk::scrollbar .middle.left.scroll -command [list .middle.left.tree yview]
    pack .middle.left.scroll -side right -fill y -expand no
................................................................................

    ttk::scrollbar .middle.right.upper.frame.row.vsb -orient vertical -command [list .middle.right.upper.frame.listbox yview]
    pack .middle.right.upper.frame.row.vsb -side bottom -fill y -expand 1

    #main data display
    ttk::treeview .middle.right.upper.frame.listbox -columns {"Man Page" "Description"} -show headings -yscrollcommand [list .middle.right.upper.frame.row.vsb set] -displaycolumns #all

    foreach col [list "Man Page" "Description"] {
	.middle.right.upper.frame.listbox heading $col -text $col -anchor w -command [list SortBy .middle.right.upper.frame.listbox $col 0] -image noArrow
    }

    
    pack .middle.right.upper.frame.listbox -side left -fill both -expand yes
    bind .middle.right.upper.frame.listbox <<TreeviewSelect>> {getManPage}

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

    .middle.left.tree selection remove [.middle.left.tree selection]

    clearData
    clearText
    .middle.right.lower.right.log configure -state normal

    set rawman [exec man $manitem > $cachedir/$manitem-man.txt  2>$cachedir/manerror]
    set getman [exec $rmanpath -f Tk $cachedir/$manitem-man.txt > $cachedir/$manitem.txt 2>$cachedir/rmanerror]
    
    after 50
    set readman [open $cachedir/$manitem.txt ]
    set mantext [read $readman]
    close $readman

................................................................................
    if {$searchterm == ""} {
	return
    }

    clearData
    clearText

    
    set status "Man pages with keyword \"$searchterm\""

    set parsesearch [lsearch -all -inline $manlist *$searchterm*]
    foreach "item" $parsesearch {
	.middle.right.upper.frame.listbox insert {} end -values $item
    }
}
................................................................................
    set catlist ""

    clearData
    clearText

    set basecat [.middle.left.tree item [.middle.left.tree selection] -text]
    set interimnum [lindex [split $basecat \.] 0]
    
    foreach item $manlist {
	if {[regexp \\($interimnum\\) [lindex $item 0]]} {
	    set manpage [lindex $item 0]
	    set description [lindex $item 1]
	    lappend interimcat [list $manpage $description]
	} else {
	    continue