Changeset 02ea263 in tol for tolbase/lib
- Timestamp:
- Dec 14, 2011, 7:12:29 PM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 5b6b63c
- Parents:
- b7a4f8b
- Location:
- tolbase/lib/toltk
- Files:
-
- 2 edited
-
markuphelper.tcl (modified) (1 diff)
-
tolbase.tcl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tolbase/lib/toltk/markuphelper.tcl
rb7a4f8b r02ea263 125 125 } 126 126 127 proc BuildTolbaseInfo { args } { 128 foreach {icon grammar name content path desc objRef} $args {} 127 # esto deberia recibir un ObjectAddress 128 proc BuildTolbaseInfo {icon grammar name content path desc args } { 129 array set opts $args 129 130 130 if {$grammar eq "NameBlock" && [string length $objRef]} { 131 set classOf [Tol_ClassOfFromReference $objRef] 132 set insInfo [Tol_InstanceInfoFromReference $objRef] 133 set insCont [Tol_InstanceContentFromReference $objRef] 134 } else { 135 set classOf "" 136 set insInfo "" 137 set insCont "" 131 foreach {classOf insInfo insCont} {{} {} {}} break 132 if { $grammar eq "NameBlock" } { 133 if { [ info exists opts(-objref) ] } { 134 set objRef $opts(-objref) 135 set classOf [Tol_ClassOfFromReference $objRef] 136 set insInfo [Tol_InstanceInfoFromReference $objRef] 137 set insCont [Tol_InstanceContentFromReference $objRef] 138 } elseif { [ info exists opts(-objaddr) ] } { 139 set objAddr $opts(-objaddr) 140 set classOf [Tol_ClassOf $objAddr] 141 set insInfo [Tol_InstanceInfo $objAddr] 142 set insCont [Tol_InstanceContent $objAddr] 143 } 138 144 } 139 145 Text "Grammar: " -tags b -
tolbase/lib/toltk/tolbase.tcl
rb7a4f8b r02ea263 56 56 source [file join $toltk_script_path "panedw.tcl"] 57 57 } 58 59 source [file join $toltk_script_path "markuphelper.tcl"] 60 source [file join $toltk_script_path "tolpkg.tcl"] 61 source [file join $toltk_script_path "tolpkg_gui.tcl"] 58 62 59 63 #source [file join $toltk_script_path "scrollw.tcl"] … … 489 493 } 490 494 491 namespace eval ::MarkupHelper {492 variable markup493 494 proc Init { } {495 variable markup {}496 }497 498 proc Verbatim { text } {499 return [ string map {\n \n<br>} $text ]500 }501 502 proc Escape { text } {503 set specialChars {504 [ &lb;505 ] &rb;506 < <507 > >508 }509 return [ string map $specialChars $text ]510 }511 512 proc Preprocess { text } {513 set idx [ string first ";" $text ]514 set ismarkup 0515 if { $idx != -1 } {516 set header [ string range $text 0 [ expr { $idx -1 } ] ]517 if { [ string range [ string trimleft $header ] 0 3 ] eq "#!NB" } {518 set ismarkup 1519 set body [ string range $text [ expr { $idx +1 } ] end ]520 } else {521 set body $text522 }523 } else {524 set body $text525 }526 if { $ismarkup } {527 return $body528 } else {529 return [ Verbatim [ Escape $body ] ]530 }531 }532 533 proc GetText { } {534 variable markup535 536 return $markup537 }538 539 proc Text { text args } {540 variable markup541 542 array set opts { -tags {} -br 0 }543 array set opts $args544 foreach t $opts(-tags) {545 append markup "<$t>"546 }547 append markup $text548 foreach t [ lreverse $opts(-tags) ] {549 append markup "</$t>"550 }551 BR $opts(-br)552 }553 554 proc Image { image {br 0} } {555 variable markup556 557 append markup "\[!image $image !\]"558 BR $br559 }560 561 proc LabelValue { name value {br 0}} {562 variable markup563 564 append markup "<b>$name:</b> "565 append markup "$value"566 BR $br567 }568 569 proc InlineHeader { text } {570 Text $text -tags h571 }572 573 proc Header1 { text } {574 variable markup575 576 NeedNewLine577 append markup "= $text =\n"578 }579 580 proc Header2 { text } {581 variable markup582 583 append markup "\n\n== $text ==\n"584 }585 586 proc Header3 { text } {587 variable markup588 589 append markup "\n\n=== $text ===\n"590 }591 592 proc BR { { br 1 } } {593 variable markup594 595 if { $br } {596 append markup " <br>"597 }598 }599 600 proc NeedNewLine { } {601 variable markup602 603 if { [ string index $markup end ] ne "\n" } {604 append markup "\n"605 }606 }607 608 proc Line { } {609 variable markup610 611 if { [ string index $markup end ] ne "\n" } {612 append markup "\n"613 }614 append markup "#---\n"615 }616 }617 618 495 #///////////////////////////////////////////////////////////////////////////// 619 496 proc ::TolConsole::OnInfo { args } { … … 650 527 } 651 528 default { 652 #(pgea) se modifica el mecanismo de escritura de la informacion653 #(pgea) en tolbase incluyendo la informacion de instancia654 proc w_insert {w_info w_text w_token w_tag} {655 set idx_start [$w_info index "end -1 chars"]656 $w_info insert end $w_text657 $w_info insert end $w_token658 set idx_end [$w_info index "end -1 chars"]659 $w_info tag add $w_tag $idx_start $idx_end660 }661 662 #$w_info configure -wrap none663 529 foreach {icon grammar name content path desc objRef} $args {} 664 set w_info $widgets(info,text)665 530 666 531 if { $grammar eq "Anything" } { … … 673 538 } 674 539 } 540 MarkupHelper::Init 541 $data(notebookdb) set "info" \ 542 [ MarkupHelper::BuildTolbaseInfo \ 543 $icon $grammar $name $content $path $desc -objref $objRef ] 544 $widgets(info,markupviewer) showpage "info" 675 545 ActivateInfoWidget "markup" 676 if { 0 } {677 $widgets(tabset,info) setwidget $widgets(info,text)678 }679 #(pgea) Si es NameBlock busco su clase e información de instancia680 if {$grammar eq "NameBlock" && [string length $objRef]} {681 set classOf [Tol_ClassOfFromReference $objRef]682 set insInfo [Tol_InstanceInfoFromReference $objRef]683 set insCont [Tol_InstanceContentFromReference $objRef]684 } else {685 set classOf ""686 set insInfo ""687 set insCont ""688 }689 MarkupHelper::Init690 MarkupHelper::Text "Grammar: " -tags b691 MarkupHelper::Image $icon692 if {$classOf eq ""} {693 MarkupHelper::Text " $grammar"694 } else {695 MarkupHelper::Text " $classOf"696 }697 MarkupHelper::BR698 MarkupHelper::LabelValue "Name" $name699 if {$insCont ne ""} {700 set _content $insCont701 } elseif {$classOf ne ""} {702 set _content $classOf703 } else {704 set _content $content705 }706 MarkupHelper::BR707 MarkupHelper::LabelValue "Content" [ MarkupHelper::Escape $_content ]708 if {$path ne ""} {709 MarkupHelper::BR710 MarkupHelper::LabelValue "Path" $path711 }712 if {$desc ne ""} {713 MarkupHelper::BR714 MarkupHelper::Text "Description:" -tags b -br 1715 MarkupHelper::Text \716 [ MarkupHelper::Preprocess [ string trimright $desc ] ]717 }718 if { $insInfo ne "" } {719 MarkupHelper::Header2 "Instance's Info"720 foreach line [ split $insInfo \n ] {721 set s [ string index $line 0 ]722 set e [ string index $line end ]723 if { $s eq "\[" && $e eq "\]" } {724 MarkupHelper::Text "[ string range $line 1 end-1 ]:" \725 -tags {b i} -br 1726 } elseif { $s eq "{" && $e eq "}" } {727 MarkupHelper::Text "[ string range $line 1 end-1 ]: " -tags {b i}728 } else {729 MarkupHelper::Text \730 [ MarkupHelper::Preprocess [ string trimright $line ] ] -br 1731 }732 }733 }734 $data(notebookdb) set "info" [ MarkupHelper::GetText ]735 $widgets(info,markupviewer) showpage "info"736 return737 if { 0 } {738 if {$classOf eq ""} {739 w_insert $w_info Grammar ": " tagLabel740 $w_info image create end -image $icon741 $w_info insert end " "742 w_insert $w_info $grammar "\n" tagValue743 } else {744 w_insert $w_info Class ": " tagLabel745 $w_info image create end -image $icon746 $w_info insert end " "747 w_insert $w_info $classOf "\n" tagValue748 }749 750 w_insert $w_info Name ": " tagLabel751 w_insert $w_info $name "\n" tagValue752 w_insert $w_info Content ": " tagLabel753 if {$insCont ne ""} {754 w_insert $w_info $insCont "\n" tagValue755 } elseif {$classOf ne ""} {756 w_insert $w_info $classOf "\n" tagValue757 } else {758 w_insert $w_info $content "\n" tagValue759 }760 if {$path ne ""} {761 w_insert $w_info Path ": " tagLabel762 w_insert $w_info $path "\n" tagValue763 }764 if {$desc ne ""} {765 w_insert $w_info Description ":\n" tagLabel766 w_insert $w_info $desc "\n" tagValue767 }768 }769 #(pgea) se añade la información de instancia (si hay)770 if { [string length $insInfo] } {771 set brNeed 0772 set attr 0773 set lines [split $insInfo \n]774 foreach line $lines {775 set lineLen [string length $line]776 set lineIni [string index $line 0]777 set lineFin [string index $line [expr $lineLen-1]]778 set lineIF "$lineIni$lineFin"779 if { [string eq $lineIF {[]}] } {780 set lineLabel [string range $line 1 [expr $lineLen-2]]781 w_insert $w_info $lineLabel ":\n" tagLabelB782 } elseif { [string eq $lineIF {{}}] } {783 set lineLabel [string range $line 1 [expr $lineLen-2]]784 w_insert $w_info $lineLabel ": " tagLabelB785 } else {786 w_insert $w_info $line "\n" tagValue787 }788 }789 }790 $w_info tag configure tagLabel -font fnBold791 $w_info tag configure tagValue -wrap none792 $w_info tag configure tagLabelB -font fnBold -foreground navy793 $w_tabset select 2794 $w_info configure -state disabled795 546 } 796 547 } … … 2569 2320 2570 2321 $md add $id separator 2322 $md add $id command -label "[mc {Manage Packages}]..." \ 2323 -command ::TolPkgGUI::Show 2571 2324 set cid [$md add $id cascade -label [mc "Analysis Tools"]] 2572 2325 set cid2 [$md add $cid cascade -label [mc "ARIMA"]]
Note: See TracChangeset
for help on using the changeset viewer.
