Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Include plugin options in plugin dialog. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c9e28d0c536d7cb1fa5ac8ac8c62d347 |
User & Date: | peter 2016-07-29 22:03:40.256 |
Context
2016-08-14
| ||
23:07 | Bumped revision to 2.7.2 check-in: e2431aa5ca user: peter tags: trunk | |
2016-08-03
| ||
17:45 | Merge from trunk check-in: d1d44e3aed user: peter tags: thread | |
2016-07-29
| ||
22:03 | Include plugin options in plugin dialog. check-in: c9e28d0c53 user: peter tags: trunk | |
20:14 | Restructured plugin dialog. check-in: a8c940bcc5 user: peter tags: trunk | |
Changes
Changes to Changes.
1 2 3 4 5 6 7 8 9 | 2016-07-29 Include plugin command line options in command line help. 2016-07-29 Corrected right side numbering when parsing patch. [288be8f321] 2016-07-06 Support negative revisions with GIT. Added log view for GIT. | > | 1 2 3 4 5 6 7 8 9 10 | 2016-07-29 Include plugin command line options in command line help. Include plugin options in plugin dialog. 2016-07-29 Corrected right side numbering when parsing patch. [288be8f321] 2016-07-06 Support negative revisions with GIT. Added log view for GIT. |
︙ | ︙ |
Changes to src/plugin.tcl.
︙ | ︙ | |||
26 27 28 29 30 31 32 | set dirs [list . ./plugins] lappend dirs [file join $::eskil(thisDir) .. ..] lappend dirs [file join $::eskil(thisDir) .. .. plugins] lappend dirs [file join $::eskil(thisDir) .. plugins] return $dirs } | | > | | | > > > > > > > > > > > > > > > > > > > | | > | 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 | set dirs [list . ./plugins] lappend dirs [file join $::eskil(thisDir) .. ..] lappend dirs [file join $::eskil(thisDir) .. .. plugins] lappend dirs [file join $::eskil(thisDir) .. plugins] return $dirs } # Locate plugin source and extract some info proc LocatePlugin {plugin} { set res [dict create name "" src "" opts ""] set fSrc "" set dirs [PluginSearchPath] foreach dir $dirs { set dir [file normalize $dir] set files {} lappend files [file join $dir $plugin] lappend files [file join $dir $plugin.tcl] foreach file $files { if {![file exists $file]} continue if {![file isfile $file]} continue if {![file readable $file]} continue set ch [open $file r] set data [read $ch 20] close $ch if {[string match "##Eskil Plugin*" $data]} { set fSrc $file break } } if {$fSrc ne ""} break } if {$fSrc ne ""} { dict set res name $plugin dict set res src $fSrc # Look for declarations of command line options set ch [open $fSrc r] while {[gets $ch line] >= 0} { # Only look until empty line if {[string trim $line] eq ""} break if {[regexp {^\#\# Option\s+(\S+)(.*)} $line -> name rest]} { # structure is name flag doc dict lappend res opts $name 0 [string trim $rest " :"] } if {[regexp {^\#\# Flag\s+(\S+)(.*)} $line -> name rest]} { dict lappend res opts $name 1 [string trim $rest " :"] } } close $ch } return $res } proc createPluginInterp {plugin info allow pinfoName} { upvar 1 $pinfoName pinfo set res [LocatePlugin $plugin] set src [dict get $res src] if {$src eq ""} { return "" } # Create interpreter and load source if {$allow} { |
︙ | ︙ | |||
95 96 97 98 99 100 101 | dict set pinfo dir 1 } return $pi } proc printPlugin {plugin {short 0}} { | | > | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | dict set pinfo dir 1 } return $pi } proc printPlugin {plugin {short 0}} { set res [LocatePlugin $plugin] set src [dict get $res src] if {$src eq ""} { printPlugins return } set ch [open $src] set lines [split [read $ch] \n] foreach line $lines { |
︙ | ︙ | |||
179 180 181 182 183 184 185 | } } proc preparePlugin {top} { disallowEdit $top set allow [dict get $::eskil($top,pluginpinfo) allow] # Pass ::argv to plugin | > > > > | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | } } proc preparePlugin {top} { disallowEdit $top set allow [dict get $::eskil($top,pluginpinfo) allow] # Pass ::argv to plugin set pArgv $::eskil(argv) if {[info exists ::eskil($top,pluginargv)]} { lappend pArgv {*}$::eskil($top,pluginargv) } $::eskil($top,plugin) eval [list set ::argv $pArgv] # Pass ::Pref to plugin $::eskil($top,plugin) eval [list array set ::Pref [array get ::Pref]] # Pass File info to plugin $::eskil($top,plugin) eval [list set ::File(left) $::eskil($top,leftFile)] $::eskil($top,plugin) eval [list set ::File(right) $::eskil($top,rightFile)] set out1 [tmpFile] |
︙ | ︙ | |||
310 311 312 313 314 315 316 | -value $plugin -text $plugin ttk::label $wt.l$t -text $descr -anchor w grid $wt.rb$t $wt.l$t -in $wt.lfs -sticky we -padx 3 -pady 3 incr t } ttk::radiobutton $wt.rb$t -variable ::eskil($top,edit,pluginname) \ -value "" -text "No Plugin" | > > > | > | | | | < < | | | | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > > > > > > > > > > > > > | > | 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 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | -value $plugin -text $plugin ttk::label $wt.l$t -text $descr -anchor w grid $wt.rb$t $wt.l$t -in $wt.lfs -sticky we -padx 3 -pady 3 incr t } ttk::radiobutton $wt.rb$t -variable ::eskil($top,edit,pluginname) \ -value "" -text "No Plugin" ttk::button $wt.bs -text "Show" \ -command "ShowPlugin $wt \$::eskil($top,edit,pluginname)" addBalloon $wt.bs "Show plugin source code." grid $wt.rb$t $wt.bs -in $wt.lfs -sticky we -padx 3 -pady 3 grid $wt.bs -sticky e ttk::labelframe $wt.lfgc -text "Generic Configuration" grid columnconfigure $wt.lfgc 1 -weight 1 ttk::label $wt.li -text "Info" -anchor w addBalloon $wt.li "Info passed to plugin. Plugin specific." ttk::entry $wt.ei -textvariable ::eskil($top,edit,plugininfo) grid $wt.li $wt.ei -in $wt.lfgc -sticky we -padx 3 -pady 3 ttk::checkbutton $wt.cb -text "Privilege" \ -variable ::eskil($top,edit,pluginallow) addBalloon $wt.cb "Run plugin with raised privileges" grid $wt.cb - -in $wt.lfgc -sticky w -padx 3 -pady 3 ttk::labelframe $wt.lfsc -text "Specific Configuration" set ::widgets($top,prefPluginsSpec) $wt.lfsc trace add variable ::eskil($top,edit,pluginname) write \ [list UpdateSpecificPluginConf $top] UpdateSpecificPluginConf $top ttk::frame $wt.fb -padding 3 ttk::button $wt.fb.b1 -text "Ok" \ -command [list EditPrefPluginsOk $top $wt 0] ttk::button $wt.fb.b2 -text "Apply" \ -command [list EditPrefPluginsOk $top $wt 1] ttk::button $wt.fb.b3 -text "Cancel" -command [list destroy $wt] set ::widgets($top,prefPluginsOk) $wt.fb.b1 grid $wt.fb.b1 x $wt.fb.b2 x $wt.fb.b3 -sticky we grid columnconfigure $wt.fb {0 2 4} -uniform a grid columnconfigure $wt.fb {1 3} -weight 1 grid $wt.lfs -sticky we -padx 3 -pady 3 grid $wt.lfgc -sticky we -padx 3 -pady 3 grid $wt.lfsc -sticky we -padx 3 -pady 3 grid $wt.fb -sticky we -padx 3 -pady 3 grid columnconfigure $wt 0 -weight 1 } proc UpdateSpecificPluginConf {top args} { set w $::widgets($top,prefPluginsSpec) # If the dialog is closed w might not exist if {![winfo exists $w]} return eval destroy [winfo children $w] set arg $::eskil($top,edit,pluginname) set pOpts {} if {$arg ne ""} { set res [LocatePlugin $arg] set pOpts [dict get $res opts] } # Look for declarations of command line options set n 0 set ::eskil($top,edit,opts) $pOpts foreach {name flag doc} $pOpts { ttk::label $w.l$n -text $name addBalloon $w.l$n $doc grid $w.l$n -sticky "w" -padx 3 -pady 3 if {$flag} { ttk::checkbutton $w.s$n -text "On" \ -variable ::eskil($top,edit,$name) grid $w.s$n -row $n -column 1 -sticky "w" -padx 3 -pady 3 } else { ttk::entry $w.s$n \ -textvariable ::eskil($top,edit,$name) grid $w.s$n -row $n -column 1 -sticky we -padx 3 -pady 3 } incr n } grid columnconfigure $w 1 -weight 1 if {$n == 0} { ttk::label $w.l -text "No specific configuration" grid $w.l -sticky "w" -padx 3 -pady 3 return } } proc EditPrefPluginsOk {top wt apply} { if {!$apply} { destroy $wt } set ::eskil($top,pluginname) $::eskil($top,edit,pluginname) set ::eskil($top,plugininfo) $::eskil($top,edit,plugininfo) set ::eskil($top,pluginallow) $::eskil($top,edit,pluginallow) if {$::eskil($top,pluginname) ne ""} { set pinterp [createPluginInterp $::eskil($top,pluginname) \ $::eskil($top,plugininfo) \ $::eskil($top,pluginallow) pinfo] } else { set pinterp "" set pinfo "" } set ::eskil($top,plugin) $pinterp set ::eskil($top,pluginpinfo) $pinfo set ::eskil($top,pluginargv) {} foreach {name flag doc} $::eskil($top,edit,opts) { if {$flag} { if {[info exists ::eskil($top,edit,$name)] && \ $::eskil($top,edit,$name)} { lappend ::eskil($top,pluginargv) $name } } else { if {[info exists ::eskil($top,edit,$name)] && \ $::eskil($top,edit,$name) ne ""} { lappend ::eskil($top,pluginargv) $name $::eskil($top,edit,$name) } } } } # Put Tcl code in a text widget, with some syntax highlighting proc TextViewTcl {t data} { $t tag configure comment -foreground "#b22222" foreach line [split $data \n] { if {[regexp {^\s*#} $line]} { $t insert end $line\n comment } elseif {[regexp {^(.*;\s*)(#.*)$} $line -> pre post]} { $t insert end $pre $t insert end $post\n comment } else { $t insert end $line\n } } } # Show plugin source proc ShowPlugin {parent plugin} { set res [LocatePlugin $plugin] set src [dict get $res src] if {$src eq ""} return set ch [open $src] set data [read $ch] close $ch set wt $parent.plugin if {[winfo exists $wt]} { wm deiconify $wt |
︙ | ︙ |
Changes to src/startup.tcl.
︙ | ︙ | |||
404 405 406 407 408 409 410 | puts [join [lsort -dictionary [pdf4tcl::getPaperSizeList]] \n] exit } } proc optValidatePlugin {opt arg} { # We must start up completely to check a plugin Init | | > | < < | | > < < < < | | | < < | 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | puts [join [lsort -dictionary [pdf4tcl::getPaperSizeList]] \n] exit } } proc optValidatePlugin {opt arg} { # We must start up completely to check a plugin Init set res [LocatePlugin $arg] set src [dict get $res src] if {$src eq ""} { puts "Bad plugin: $arg" printPlugins exit } # Look for declarations of command line options foreach {name flag doc} [dict get $res opts] { if {$flag} { addFlags $name } else { addOpt $name } docFlag $name "Plugin $arg : $doc" addSource $name $arg } } # Option database setup proc initOpts {} { set ::eskil(opts) {} set ::eskil(opts,info) {} set ::eskil(opts,src) "" set ::eskil(defoptinfo) { |
︙ | ︙ |