load an icon from the data directory
348455
def mp_icon(filename):
    ''''''
    # we have to jump through a lot of hoops to get an OpenCV image
    # when we may be in a package zip file
    try:
        import pkg_resources
        name = __name__
        if name == "__main__":
            name = "MAVProxy.modules.mavproxy_map.mp_tile"
        stream = pkg_resources.resource_stream(name, "data/%s" % filename).read()
        raw = np.fromstring(stream, dtype=np.uint8)
    except Exception:
        try:
            stream = open(os.path.join(__file__, 'data', filename)).read()
            raw = np.fromstring(stream, dtype=np.uint8)
        except Exception:
            #we're in a Windows exe, where pkg_resources doesn't work
            import pkgutil
            raw = pkgutil.get_data( 'MAVProxy', 'modules//mavproxy_map//data//' + filename)
    img = cv2.imdecode(raw, cv2.IMREAD_COLOR)
    return img
756419
function loadByID(id) {
    var iconConfig = config[id];
    return loadByURL(iconConfig.url).then(function(icon) {
      return new Icon(icon, iconConfig);
    });
  }
64723
def load_datafile(name, search_path, codecs=get_codecs(), **kwargs):
    
    return munge.load_datafile(name, search_path, codecs, **kwargs)
1275016
function resolveSync (iconPath) {
  var path = resolve(iconPath)
  var stat = fs.statSync(path)

  if (stat.isDirectory()) {
    throw createIsDirError(path)
  }

  return path
}
862311
def LoadImage(filename):
    ''''''
    app_dir = os.path.dirname(os.path.realpath(__file__))
    path = os.path.join(app_dir, 'images', filename)
    return Tkinter.PhotoImage(file=path)
984881
def set_icon(self, icon):
        ''''''
        self._icon = icon
        return self._listitem.setIconImage(icon)
884362
def load(data_path):
        
        with open(data_path, "r") as data_file:
            raw_data = data_file.read()

        data_file.close()
        return raw_data
924286
function getLocalNodeFiles(dir) {
    dir = path.resolve(dir);

    var result = [];
    var files = [];
    var icons = [];
    try {
        files = fs.readdirSync(dir);
    } catch(err) {
        return {files: [], icons: []};
    }
    files.sort();
    files.forEach(function(fn) {
        var stats = fs.statSync(path.join(dir,fn));
        if (stats.isFile()) {
            if (/\.js$/.test(fn)) {
                var info = getLocalFile(path.join(dir,fn));
                if (info) {
                    result.push(info);
                }
            }
        } else if (stats.isDirectory()) {
            // Ignore /.dirs/, /lib/ /node_modules/
            if (!/^(\..*|lib|icons|node_modules|test|locales)$/.test(fn)) {
                var subDirResults = getLocalNodeFiles(path.join(dir,fn));
                result = result.concat(subDirResults.files);
                icons = icons.concat(subDirResults.icons);
            } else if (fn === "icons") {
                var iconList = scanIconDir(path.join(dir,fn));
                icons.push({path:path.join(dir,fn),icons:iconList});
            }
        }
    });
    return {files: result, icons: icons};
}
758427
def get_filetype_icon(fname):
    """"""
    ext = osp.splitext(fname)[1]
    if ext.startswith('.'):
        ext = ext[1:]
    return get_icon( "%s.png" % ext, ima.icon('FileIcon') )
341623
def load(self , filename=None, data=None):
        

        self.__load(filename=filename, data=data)
167456
def mp_icon(filename):
        ''''''
        # we have to jump through a lot of hoops to get an OpenCV image
        # when we may be in a package zip file
        try:
                import pkg_resources
                name = __name__
                if name == "__main__":
                        name = "MAVProxy.modules.mavproxy_map.mp_tile"
                raw = pkg_resources.resource_stream(name, "data/%s" % filename).read()
        except Exception:
                raw = open(os.path.join(__file__, 'data', filename)).read()
        imagefiledata = cv.CreateMatHeader(1, len(raw), cv.CV_8UC1)
        cv.SetData(imagefiledata, raw, len(raw))
        img = cv.DecodeImage(imagefiledata, cv.CV_LOAD_IMAGE_COLOR)
        return img
69890
def get_icon(self, icon_id: str, size: "Gtk.IconSize") -> "Gtk.Image":
        """"""
        return Gtk.Image.new_from_gicon(self.get_gicon(icon_id), size)
1338349
function (options, dir, callback) {
  var iconFile = path.join(dir, getPixmapPath(options))
  options.logger('Creating icon file at ' + iconFile)

  fs.copy(options.icon, iconFile, function (err) {
    callback(err && new Error('Error creating icon file: ' + (err.message || err)))
  })
}
818827
def download_icon_font(icon_font, directory):
    """"""
    try:
        downloader = AVAILABLE_ICON_FONTS[icon_font]['downloader'](directory)
        downloader.download_files()
        return downloader
    except KeyError:  # pragma: no cover
        raise Exception("We don't support downloading font '{name}'".format(
            name=icon_font)
        )
530091
def load_from_resource(name):
  
  filepath = Path(USER_DIR) / name
  if filepath.exists():
    with filepath.open() as fh:
      return fh.read()
  else:
    return resource_string('wdiffhtml', 'data/' + name).decode('utf-8')
638046
def get_icon(name, as_qicon=False):
    """"""
    filename = name + ".png"
    icon = icons.get(filename)
    if not icon:
        path = os.path.dirname(__file__)
        path = os.path.join(path, "icons")
        filepath = os.path.join(path, filename)
        if not os.path.exists(filepath):
            filepath = os.path.join(path, "pink.png")

        icon = QtGui.QPixmap(filepath)
        icons[filename] = icon

    return QtGui.QIcon(icon) if as_qicon else icon
788609
public ImageIcon loadImageIcon(String filename, String description)
    {
        filename = Util.getImageFilename(filename, "buttons");
        URL url = null;
        if (this.getApplication() != null)
            url = this.getApplication().getResourceURL(filename, this);
        if (url == null)
        { // Not a resource, try reading it from the disk.
            try   {
                return new ImageIcon(filename, description);
            } catch (Exception ex)  { // File not found - try a fully qualified URL.
                ex.printStackTrace();
                return null;
            }
        }
        return new ImageIcon(url, description);
    }