Changeset 2750


Ignore:
Timestamp:
Jan 5, 2012 8:10:09 PM (12 years ago)
Author:
mmc
Message:

Added an icondir proc to append new directories onto the icon path.
A little cleaner than appending directly to the iconpath variable,
especially when the icon code has not yet been autoloaded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/icons.tcl

    r1929 r2750  
    1818    variable iconpath [list [file join $RapptureGUI::library scripts images]]
    1919    variable icons
     20}
     21
     22# ----------------------------------------------------------------------
     23# USAGE: Rappture::icondir ?<dirname> <dirname>...?
     24#
     25# Adds one or more directories onto the icon path searched when
     26# locating icons in Rappture::icon.  You can do the same thing by
     27# lappend'ing onto the "iconpath" variable, but this call avoids
     28# duplicates and makes it easier
     29# ----------------------------------------------------------------------
     30proc Rappture::icondir {args} {
     31    variable ::Rappture::icon::iconpath
     32    foreach dir $args {
     33        if {[file isdirectory $dir]} {
     34            if {[lsearch $iconpath $dir] < 0} {
     35                lappend iconpath $dir
     36            }
     37        }
     38    }
    2039}
    2140
Note: See TracChangeset for help on using the changeset viewer.