Module: Vtk

Defined in:
lib/VTK/util/colors.rb

Overview

This module defines many standard colors that should be useful. These colors should be exactly the same as the ones defined in colors.tcl.

Defined Under Namespace

Modules: Colors Classes: TkPhotoImage, TkRenderWidget, TkRenderWindowInteractor

Class Method Summary collapse

Class Method Details

.LoadRubyTkWidgetsObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
# File 'lib/VTK/tk/vtkLoadRubyTkWidgets.rb', line 4

def Vtk.LoadRubyTkWidgets
=begin
    vtkLoadRubyTkWidgets(interp) -- load vtk-tk widget extensions

    This is a mess of mixed python and tcl code that searches for the
    shared object file that contains the python-vtk-tk widgets.  Both
    the ruby path and the tcl path are searched.
=end
  name = 'vtkRenderingRubyTkWidgets'
  pkgname = name.downcase.capitalize

  # find out if the file is already loaded
  loaded = Tk.tk_call('info', 'loaded')
  if loaded.include?(pkgname)
    return false
  end

  # create the platform-dependent file name
  prefix = ''
  if Config::CONFIG['arch']=~/linux/
    prefix = 'lib'
  end
  extension = Tk.tk_call('info', 'sharedlibextension')
  filename = prefix+name+extension

  # create an extensive list of paths to search
  pathlist = $LOAD_PATH
  # add tcl paths, ensure that {} is handled properly
  auto_paths = Tk::AUTO_PATH.to_a
  pathlist += auto_paths

  # a common place for these sorts of things  
  if Config::CONFIG['arch']=~/linux/
    pathlist += ['/usr/local/lib']
  end

  # attempt to load
  for path in pathlist
    fullpath = File.join(path, filename)
    begin
      Tk.load_tcllibrary(fullpath, pkgname)
      return true
    rescue
      next
    end
  end

  # re-generate the error
  Tk.tk_call('load', filename)
  return nil
end