Method: GUI.load_toolkit

Defined in:
lib/wiki_lyrics/gui/gui.rb

.load_toolkit(toolkit) ⇒ Object



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
# File 'lib/wiki_lyrics/gui/gui.rb', line 55

def GUI.load_toolkit( toolkit )
  toolkit = toolkit.downcase()
  if toolkit == "qt" || toolkit == "qt4"
    begin
      return require( File.expand_path( File.dirname( __FILE__ ) + "/gui-qt4" ) )
    rescue LoadError => e
      $stderr << "Error loading Qt4 GUI backend: #{e}\n"
    end
  elsif toolkit == "qt3"
    begin
      return require( File.expand_path( File.dirname( __FILE__ ) + "/gui-qt3" ) )
    rescue LoadError => e
      $stderr << "Error loading Qt3 GUI backend: #{e}\n"
    end
  elsif toolkit == "gtk"
    begin
      return require( File.expand_path( File.dirname( __FILE__ ) + "/gui-gtk" ) )
    rescue LoadError => e
      $stderr << "Error loading GTK GUI backend: #{e}\n"
    end
  elsif toolkit == "tk"
    begin
      return require( File.expand_path( File.dirname( __FILE__ ) + "/gui-tk" ) )
    rescue LoadError => e
      $stderr << "Error loading Tk GUI backend: #{e}\n"
    end
  end
  return false
end