Eskil

Diff
Login

Differences From Artifact [8a027cad80]:

To Artifact [685a61d104]:


108
109
110
111
112
113
114
115





116
117
118
119
120
121
122
108
109
110
111
112
113
114

115
116
117
118
119
120
121
122
123
124
125
126







-
+
+
+
+
+







            set data [read $ch 200]
            close $ch
            if {[regexp {^\#\#Eskil Plugin :(.*?)(\n|$)} $data -> descr]} {
                set result([file rootname [file tail $file]]) $descr
            }
        }
    }
    return [array get result]
    set resultSort {}
    foreach elem [lsort -dictionary [array names result]] {
        lappend resultSort $elem $result($elem)
    }
    return $resultSort
}

proc printPlugins {} {
    set plugins [listPlugins]
    if {[llength $plugins] == 0} {
        puts "No plugins found."
        return
219
220
221
222
223
224
225
226



227
228
229
230
231



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247

























223
224
225
226
227
228
229

230
231
232
233
234



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278







-
+
+
+


-
-
-
+
+
+
















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

    ttk::label $w.li -text "Info" -anchor "w"
    ttk::entry $w.ei -textvariable ::eskil($top,edit,plugininfo)
    grid $w.li $w.ei -sticky we -padx 3 -pady 3

    ttk::frame $w.fb -padding 3
    ttk::button $w.fb.b1 -text "Ok"     -command [list EditPrefPluginsOk $top $w]
    ttk::button $w.fb.b2 -text "Cancel" -command [list destroy $w]
    ttk::button $w.fb.b2 -text "Show" \
            -command "ShowPlugin $w \$::eskil($top,edit,pluginname)"
    ttk::button $w.fb.b3 -text "Cancel" -command [list destroy $w]
    set ::widgets($top,prefPluginsOk) $w.fb.b1

    grid $w.fb.b1 x $w.fb.b2 -sticky we
    grid columnconfigure $w.fb {0 2} -uniform a
    grid columnconfigure $w.fb 1 -weight 1
    grid $w.fb.b1 x $w.fb.b2 x $w.fb.b3 -sticky we
    grid columnconfigure $w.fb {0 2 4} -uniform a
    grid columnconfigure $w.fb {1 3} -weight 1

    grid $w.fb - -sticky we
    grid columnconfigure $w 1 -weight 1
}

proc EditPrefPluginsOk {top w} {
    destroy $w
    set ::eskil($top,pluginname) $::eskil($top,edit,pluginname) 
    set ::eskil($top,plugininfo) $::eskil($top,edit,plugininfo)
    if {$::eskil($top,pluginname) ne ""} {
        set pinterp [createPluginInterp $::eskil($top,pluginname) $::eskil($top,plugininfo)]
    } else {
        set pinterp ""
    }
    set ::eskil($top,plugin) $pinterp
}

proc ShowPlugin {parent plugin} {
    set src [LocatePlugin $plugin]
    if {$src eq ""} return
    set ch [open $src]
    set data [read $ch]
    close $ch
    set w $parent.plugin
    if {[winfo exists $w]} {
        wm deiconify $w
    } else {
        toplevel $w -padx 3 -pady 3
    }
    destroy {*}[winfo children $w]
    ttk::frame $w._bg
    place $w._bg -x 0 -y 0 -relwidth 1.0 -relheight 1.0 -border outside
    wm title $w "Plugin: $plugin"

    set t [Scroll both text $w.t -width 80 -height 20 -font myfont]
    pack $w.t -fill both -expand 1
    bind $t <Control-a> "[list $t tag add sel 1.0 end];break"

    $t insert end $data
}