visualruby 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/.vr_settings.yaml +27 -0
  3. data/bin/editor/VR_Document.rb +156 -156
  4. data/bin/editor/VR_TabSearch.rb +37 -37
  5. data/bin/editor/VR_Tabs.rb +82 -82
  6. data/bin/editor/VR_TextShell.rb +49 -52
  7. data/bin/editor/VR_TextViewCommon.rb +31 -31
  8. data/bin/main/GemTree.rb +14 -14
  9. data/bin/main/NewProjectGUI.rb +24 -24
  10. data/bin/main/OpenProject.rb +53 -53
  11. data/bin/main/ProjectChooserView.rb +31 -31
  12. data/bin/main/ProjectTree.rb +17 -17
  13. data/bin/main/RubygemsAPI.rb +73 -63
  14. data/bin/main/VR_ENV.rb +29 -29
  15. data/bin/main/VR_ENV_GLOBAL.rb +52 -52
  16. data/bin/main/VR_File_Tree.rb +88 -88
  17. data/bin/main/VR_Local_Gem_Tree.rb +53 -53
  18. data/bin/main/VR_Main.rb +240 -238
  19. data/bin/main/VR_Remote_Gem_Tree.rb +41 -41
  20. data/bin/main/glade/Splash.glade +19 -0
  21. data/bin/tools/VR_Tools.rb +72 -72
  22. data/examples/active_record/.vr_settings.yaml +50 -0
  23. data/examples/active_record/active_record.rb +2 -2
  24. data/examples/active_record/bin/ChoosePerson.rb +10 -10
  25. data/examples/active_record/bin/Person.rb +6 -6
  26. data/examples/active_record2/.vr_settings.yaml +23 -0
  27. data/examples/active_record2/bin/CompanyGUI.rb +42 -42
  28. data/examples/active_record2/bin/Employee.rb +13 -13
  29. data/examples/active_record2/bin/Employer.rb +5 -5
  30. data/examples/active_record2/bin/Paycheck.rb +5 -5
  31. data/examples/active_record2/main.rb +4 -4
  32. data/examples/alert_box/bin/AlertBoxDemo.rb +40 -50
  33. data/examples/alert_box/bin/glade/AlertBoxDemo.glade +14 -45
  34. data/examples/all_widgets/.vr_settings.yaml +18 -0
  35. data/examples/all_widgets/bin/AllWidgets.rb +19 -16
  36. data/examples/calculator/.vr_settings.yaml +18 -0
  37. data/examples/calculator/bin/Calculator.rb +22 -22
  38. data/examples/child_window/.vr_settings.yaml +21 -0
  39. data/examples/child_window/bin/ChildWindowDemo.rb +10 -10
  40. data/examples/child_window/bin/ModalWindow.rb +4 -4
  41. data/examples/child_window/bin/ModelessWindow.rb +4 -4
  42. data/examples/child_window/bin/MyChildClass.rb +10 -10
  43. data/examples/drag_drop/.vr_settings.yaml +16 -0
  44. data/examples/drag_drop/bin/DragDropDemo.rb +28 -28
  45. data/examples/filetreeview/.vr_settings.yaml +20 -0
  46. data/examples/filetreeview/bin/ProjectTree.rb +13 -23
  47. data/examples/filetreeview/bin/ProjectTreeGUI.rb +18 -17
  48. data/examples/listview/.vr_settings.yaml +19 -0
  49. data/examples/listview/bin/SongListView.rb +72 -72
  50. data/examples/listview/bin/SongListViewGUI.rb +52 -52
  51. data/examples/listview_objects/.vr_settings.yaml +19 -0
  52. data/examples/listview_objects/bin/DataObject.rb +23 -23
  53. data/examples/listview_objects/bin/ListViewObjects.rb +29 -29
  54. data/examples/listview_objects/bin/ListViewObjectsGUI.rb +12 -12
  55. data/examples/settings_file/bin/MainApp.rb +25 -25
  56. data/examples/settings_file/bin/SavableSettings.rb +25 -26
  57. data/examples/settings_file/settings.yaml +1 -1
  58. data/examples/simple_ruby_gui/.vr_settings.yaml +20 -0
  59. data/examples/simple_ruby_gui/bin/DataObjectGUI.rb +12 -12
  60. data/examples/treeview/.vr_settings.yaml +17 -0
  61. data/examples/treeview/bin/MyClass.rb +18 -17
  62. data/examples/treeview/bin/glade/MyClass.glade +61 -6
  63. data/skeleton/document/NewWindow.rb +8 -8
  64. data/skeleton/project/.vr_settings.yaml +15 -0
  65. data/skeleton/project/bin/MyClass.rb +7 -7
  66. data/vr +38 -41
  67. data/vrlib/doc/images/add.png +0 -0
  68. data/vrlib/doc/images/arrow_up.png +0 -0
  69. data/vrlib/doc/images/brick.png +0 -0
  70. data/vrlib/doc/images/brick_link.png +0 -0
  71. data/vrlib/doc/images/bug.png +0 -0
  72. data/vrlib/doc/images/bullet_black.png +0 -0
  73. data/vrlib/doc/images/bullet_toggle_minus.png +0 -0
  74. data/vrlib/doc/images/bullet_toggle_plus.png +0 -0
  75. data/vrlib/doc/images/date.png +0 -0
  76. data/vrlib/doc/images/delete.png +0 -0
  77. data/vrlib/doc/images/find.png +0 -0
  78. data/vrlib/doc/images/macFFBgHack.png +0 -0
  79. data/vrlib/doc/images/package.png +0 -0
  80. data/vrlib/doc/images/page_green.png +0 -0
  81. data/vrlib/doc/images/page_white_text.png +0 -0
  82. data/vrlib/doc/images/page_white_width.png +0 -0
  83. data/vrlib/doc/images/plugin.png +0 -0
  84. data/vrlib/doc/images/ruby.png +0 -0
  85. data/vrlib/doc/images/tag_blue.png +0 -0
  86. data/vrlib/doc/images/tag_green.png +0 -0
  87. data/vrlib/doc/images/transparent.png +0 -0
  88. data/vrlib/doc/images/wrench.png +0 -0
  89. data/vrlib/doc/images/wrench_orange.png +0 -0
  90. data/vrlib/doc/images/zoom.png +0 -0
  91. data/vrlib/lib/Alert.rb +98 -55
  92. data/vrlib/lib/DragDrop.rb +43 -43
  93. data/vrlib/lib/GladeGUI.rb +207 -207
  94. data/vrlib/lib/IconHash.rb +10 -10
  95. data/vrlib/lib/SavableClass.rb +38 -38
  96. data/vrlib/lib/SimpleComboBoxEntry.rb +3 -3
  97. data/vrlib/lib/treeview/FileTreeView.rb +71 -70
  98. data/vrlib/lib/treeview/IterMethods.rb +35 -35
  99. data/vrlib/lib/treeview/ListView.rb +25 -25
  100. data/vrlib/lib/treeview/TreeView.rb +15 -15
  101. data/vrlib/lib/treeview/ViewCommon.rb +134 -131
  102. data/vrlib/lib/treeview/columns/CalendarCol.rb +48 -48
  103. data/vrlib/lib/treeview/columns/CellRendererCombo.rb +26 -26
  104. data/vrlib/lib/treeview/columns/CellRendererDate.rb +25 -25
  105. data/vrlib/lib/treeview/columns/CellRendererObject.rb +37 -37
  106. data/vrlib/lib/treeview/columns/CellRendererPhone.rb +25 -25
  107. data/vrlib/lib/treeview/columns/CellRendererPixbuf.rb +8 -8
  108. data/vrlib/lib/treeview/columns/CellRendererProgress.rb +8 -8
  109. data/vrlib/lib/treeview/columns/CellRendererSpin.rb +17 -17
  110. data/vrlib/lib/treeview/columns/CellRendererText.rb +18 -18
  111. data/vrlib/lib/treeview/columns/CellRendererToggle.rb +25 -25
  112. data/vrlib/lib/treeview/columns/ComboCol.rb +12 -12
  113. data/vrlib/lib/treeview/columns/CurrencyCol.rb +13 -13
  114. data/vrlib/lib/treeview/columns/DateCol.rb +10 -10
  115. data/vrlib/lib/treeview/columns/ImageCol.rb +16 -16
  116. data/vrlib/lib/treeview/columns/SpinCol.rb +5 -5
  117. data/vrlib/lib/treeview/columns/TextCol.rb +24 -24
  118. data/vrlib/lib/treeview/columns/TreeViewColumn.rb +71 -76
  119. data/vrlib/rdoc_replace.yaml +36 -36
  120. metadata +43 -6
  121. data/Splash.rb +0 -40
@@ -2,17 +2,17 @@ module VR
2
2
 
3
3
  class IconHash < Hash # :nodoc:
4
4
 
5
- def initialize(path)
6
- Dir.glob(path + "/*.png").each do |f|
7
- ext = File.basename(f, ".png")
8
- self[ext] = Gdk::Pixbuf.new(f)
9
- end
10
- end
5
+ def initialize(path)
6
+ Dir.glob(path + "/*.png").each do |f|
7
+ ext = File.basename(f, ".png")
8
+ self[ext] = Gdk::Pixbuf.new(f)
9
+ end
10
+ end
11
11
 
12
- def get_icon(file_name)
13
- ext = File.extname(file_name).gsub(".", "")
14
- self.has_key?(ext) ? self[ext] : self["unknown"]
15
- end
12
+ def get_icon(file_name)
13
+ ext = File.extname(file_name).gsub(".", "")
14
+ self.has_key?(ext) ? self[ext] : self["unknown"]
15
+ end
16
16
  end
17
17
 
18
18
  end
@@ -1,51 +1,51 @@
1
1
  module VR
2
2
 
3
- def self.load_yaml(flags)
4
- me = nil
5
- if File.file?(flags[:file_name])
6
- me = YAML.load(File.open(flags[:file_name]).read)
7
- elsif flags[:class]
8
- me = flags[:class].new()
9
- end
10
- me.instance_variable_set(:@vr_yaml_file, flags[:file_name])
11
- me.defaults() if me.respond_to?(:defaults)
12
- VR::save_yaml(me)
13
- return me
14
- end
15
-
16
- # todo create folders if don't exist
17
- def self.save_yaml(obj, filename = nil)
18
- filename ||= obj.instance_variable_get(:@vr_yaml_file)
19
- data = YAML.dump(obj)
20
- File.open(filename, "w") {|f| f.puts(data)}
21
- end
3
+ def self.load_yaml(flags)
4
+ me = nil
5
+ if File.file?(flags[:file_name])
6
+ me = YAML.load(File.open(flags[:file_name]).read)
7
+ elsif flags[:class]
8
+ me = flags[:class].new()
9
+ end
10
+ me.instance_variable_set(:@vr_yaml_file, flags[:file_name])
11
+ me.defaults() if me.respond_to?(:defaults)
12
+ VR::save_yaml(me)
13
+ return me
14
+ end
15
+
16
+ # todo create folders if don't exist
17
+ def self.save_yaml(obj, filename = nil)
18
+ filename ||= obj.instance_variable_get(:@vr_yaml_file)
19
+ data = YAML.dump(obj)
20
+ File.open(filename, "w") {|f| f.puts(data)}
21
+ end
22
22
 
23
23
  end
24
24
 
25
25
  #
26
26
  #class VR::SavableClass
27
27
  #
28
- # def initialize(filename = nil)
29
- # @filename = filename
30
- # defaults
31
- # end
28
+ # def initialize(filename = nil)
29
+ # @filename = filename
30
+ # defaults
31
+ # end
32
32
  #
33
- # def self.load_yaml(filename)
34
- # if File.file?(filename)
35
- # me = YAML.load(File.open(filename).read)
36
- # me.filename = filename
37
- # me.defaults()
38
- # return me
39
- # else
40
- # return nil
41
- # end
42
- # end
33
+ # def self.load_yaml(filename)
34
+ # if File.file?(filename)
35
+ # me = YAML.load(File.open(filename).read)
36
+ # me.filename = filename
37
+ # me.defaults()
38
+ # return me
39
+ # else
40
+ # return nil
41
+ # end
42
+ # end
43
43
  #
44
- # def save_yaml(new_filename = nil)
45
- # @filename = new_filename if new_filename
46
- # data = YAML.dump(self)
47
- # File.open(@filename, "w") {|f| f.puts(data)}
48
- # end
44
+ # def save_yaml(new_filename = nil)
45
+ # @filename = new_filename if new_filename
46
+ # data = YAML.dump(self)
47
+ # File.open(@filename, "w") {|f| f.puts(data)}
48
+ # end
49
49
  #
50
50
  #
51
51
  #end
@@ -2,7 +2,7 @@
2
2
  #This is for backwards compatibility. Before, there was an instance of
3
3
  #SimpleComboBoxEntry in the VR_ENV_GLOBAL yaml file. Older projects try to
4
4
  #load this instance.
5
- module VR
6
- class SimpleComboBoxEntry
7
- end
5
+ module VR # :nodoc:
6
+ class SimpleComboBoxEntry
7
+ end
8
8
  end
@@ -3,11 +3,11 @@ module VR
3
3
 
4
4
  class FileTreeView < VR::TreeView # :nodoc:
5
5
 
6
- include GladeGUI
6
+ include GladeGUI
7
7
 
8
- attr_accessor :root, :glob, :test_block
8
+ attr_accessor :root, :glob, :test_block
9
9
 
10
- def initialize(root = Dir.pwd, icon_path = nil, glob = "*")
10
+ def initialize(root = Dir.pwd, icon_path = nil, glob = "*")
11
11
  @root = root
12
12
  @glob = glob
13
13
  super(:file => {:pix => Gdk::Pixbuf, :file_name => String}, :empty => TrueClass, :path => String, :modified_date => VR::DateCol, :sort_on => String)
@@ -16,94 +16,95 @@ module VR
16
16
  @icons = File.directory?(icon_path) ? VR::IconHash.new(icon_path) : nil
17
17
  parse_signals()
18
18
  model.set_sort_column_id(id(:sort_on), :ascending )
19
- self.set_enable_search(false)
19
+ self.set_enable_search(false)
20
20
  refresh
21
- self.visible = true # necessary!
22
- end
21
+ self.visible = true # necessary!
22
+ end
23
23
 
24
24
  # flags: :root => root path, :open_folders => array of paths to open
25
- def refresh(flags={})
26
- @root = flags[:root] if flags[:root]
27
- open_folders = flags[:open_folders] ? flags[:open_folders] : get_open_folders()
28
- model.clear
29
- @root_iter = add_file(@root, nil)
30
- fill_folder(@root_iter)
31
- expand_row(@root_iter.path, false)
32
- open_folders(open_folders)
25
+ def refresh(flags={})
26
+ @root = flags[:root] if flags[:root]
27
+ open_folders = flags[:open_folders] ? flags[:open_folders] : get_open_folders()
28
+ model.clear
29
+ @root_iter = add_file(@root, nil)
30
+ open_folders([@root_iter[:path]])
31
+ # fill_folder(@root_iter)
32
+ # expand_row(@root_iter.path, false)
33
+ open_folders(open_folders)
33
34
  end
34
35
 
35
- def fill_folder(parent_iter)
36
- model.remove(parent_iter.first_child) #remove dummy record
37
- files = Dir.glob(File.join(parent_iter[id(:path)],@glob))
38
- files = files.select &@test_block if @test_block
39
- files.each do |fn|
40
- add_file(fn, parent_iter)
41
- end
42
- end
36
+ def fill_folder(parent_iter)
37
+ model.remove(parent_iter.first_child) #remove dummy record
38
+ files = Dir.glob(File.join(parent_iter[id(:path)],@glob))
39
+ files = files.select &@test_block if @test_block
40
+ files.each do |fn|
41
+ add_file(fn, parent_iter)
42
+ end
43
+ end
43
44
 
44
- def self__row_expanded(view, iter, path)
45
- iter = model.get_iter(path) #bug fix
46
- fill_folder(iter) if iter[id(:empty)]
47
- expand_row(iter.path, false)
48
- end
45
+ def self__row_expanded(view, iter, path)
46
+ iter = model.get_iter(path) #bug fix
47
+ fill_folder(iter) if iter[id(:empty)]
48
+ expand_row(iter.path, false)
49
+ end
49
50
 
50
- def expand_or_collapse_folder()
51
- return unless row = selected_rows.first
52
- if row_expanded?(row.path)
53
- collapse_row(row.path)
54
- else
55
- self__row_expanded(self, row, row.path)
56
- end
57
- end
51
+ def expand_or_collapse_folder()
52
+ return unless row = selected_rows.first
53
+ if row_expanded?(row.path)
54
+ collapse_row(row.path)
55
+ else
56
+ self__row_expanded(self, row, row.path)
57
+ end
58
+ end
58
59
 
59
- def get_open_folders()
60
- expanded = []
61
- map_expanded_rows {|view, path| expanded << model.get_iter(path)[id(:path)] }
62
- return expanded
63
- end
60
+ def get_open_folders()
61
+ expanded = []
62
+ map_expanded_rows {|view, path| expanded << model.get_iter(path)[id(:path)] }
63
+ return expanded
64
+ end
64
65
 
65
- def open_folders(folder_paths)
66
- model.each do |model, path, iter|
67
- if folder_paths.include?(iter[id(:path)])
68
- expand_row(path, false)
69
- end
70
- end
71
- end
66
+ def open_folders(folder_paths)
67
+ model.each do |model, path, iter|
68
+ if folder_paths.include?(iter[id(:path)])
69
+ expand_row(path, false)
70
+ end
71
+ end
72
+ end
72
73
 
73
- def add_file(filename, parent = @root_iter)
74
- my_path = File.dirname(filename)
75
- model.each do |model, path, iter|
76
- return if iter[id(:path)] == filename # duplicate
77
- parent = iter if iter[id(:path)] == my_path
78
- end
74
+ def add_file(filename, parent = @root_iter)
75
+ my_path = File.dirname(filename)
76
+ model.each do |model, path, iter|
77
+ return if iter[id(:path)] == filename # duplicate
78
+ parent = iter if iter[id(:path)] == my_path
79
+ end
79
80
  fn = filename.gsub("\\", "/")
80
81
  parent[id(:empty)] = false unless parent.nil?
81
82
  child = add_row(parent)
82
- child[:pix] = @icons.get_icon(File.directory?(fn) ? "x.folder" : fn) if @icons
83
+ child[:pix] = @icons.get_icon(File.directory?(fn) ? "x.folder" : fn) if @icons
83
84
  child[:file_name] = File.basename(fn)
84
85
  child[:path] = fn
85
86
  if File.directory?(fn)
86
- child[:sort_on] = "0" + child[:file_name]
87
- child[:empty] = true
88
- add_row(child) # dummy record so expander appears
87
+ child[:sort_on] = "0" + child[:file_name]
88
+ child[:empty] = true
89
+ add_row(child) # dummy record so expander appears
89
90
  else
90
- child[id(:sort_on)] = "1" + child[id(:file_name)]
91
- end
92
- return child
93
- end
91
+ child[id(:sort_on)] = "1" + child[id(:file_name)]
92
+ end
93
+ return child
94
+ end
94
95
 
95
- def set_show_expanders(expand)
96
- self.show_expanders = expand
97
- self.level_indentation = expand ? 0 : 12
98
- end
96
+ def set_show_expanders(expand)
97
+ self.show_expanders = expand
98
+ self.level_indentation = expand ? 0 : 12
99
+ end
99
100
 
100
- def folder?(iter)
101
- iter[id(:sort_on)][0,1] == "0"
102
- end
101
+ def folder?(iter)
102
+ iter[id(:sort_on)][0,1] == "0"
103
+ end
103
104
 
104
- def get_selected_path() (selection.selected ? selection.selected[id(:path)] : nil) end
105
+ def get_selected_path() (selection.selected ? selection.selected[id(:path)] : nil) end
105
106
 
106
- end
107
+ end
107
108
 
108
109
 
109
110
 
@@ -7,8 +7,8 @@ module VR
7
7
 
8
8
  module IterMethods
9
9
 
10
- attr_accessor :column_keys
11
- @column_keys = nil
10
+ attr_accessor :column_keys
11
+ @column_keys = nil
12
12
 
13
13
  # The [] method returns the value from the specified column in the iter:
14
14
  #
@@ -16,15 +16,15 @@ module IterMethods
16
16
  #
17
17
  # - col_id -- Either a visualruby column ID symbol, as above, or an integer.
18
18
  #
19
-
20
- def [](col_id)
21
- get_value(id(col_id))
22
- end
19
+
20
+ def [](col_id)
21
+ get_value(id(col_id))
22
+ end
23
23
 
24
- def []=(col_id,val)
25
- i = id(col_id)
26
- set_value(i, val)
27
- end
24
+ def []=(col_id,val)
25
+ i = id(col_id)
26
+ set_value(i, val)
27
+ end
28
28
 
29
29
  # The id() method translates visualruby's colum ID symbols into integers that
30
30
  # GtkTreeIter can use:
@@ -34,9 +34,9 @@ module IterMethods
34
34
  #
35
35
  # Normally, its best to use VR's "rows" instead. They will already use the column ID symbols.
36
36
  #
37
- def id(col_id) # :nodoc:
38
- return (col_id.is_a? Fixnum) ? col_id : @column_keys.index(col_id)
39
- end
37
+ def id(col_id) # :nodoc:
38
+ return (col_id.is_a? Fixnum) ? col_id : @column_keys.index(col_id)
39
+ end
40
40
 
41
41
  # This will load the values of any object into the iter. It will look at all the
42
42
  # instance variables, methods, and ActiveRecord fields and match them to
@@ -55,28 +55,28 @@ module IterMethods
55
55
  #
56
56
  # -obj--any ruby object or object subclassed from ActiveRecord::Base.
57
57
  #
58
- def load_object(obj)
59
- class_sym = obj.class.name.to_sym
60
- self[class_sym] = obj if @column_keys.include?(class_sym)
61
- @column_keys.each do |k|
62
- begin
63
- self[k] = obj.send(k) if obj.respond_to?(k.to_s)
64
- rescue
65
- end
66
- end
67
- keys = @column_keys.inject([]) { |ar, e| ar << e.to_s }
68
- matches = obj.attributes.keys & keys if obj.attributes.is_a? Hash
69
- matches.each do |field|
70
- begin
71
- self[field.to_sym] = obj.attributes[field]
72
- rescue
73
- end
74
- end
75
- obj.instance_variables.each do |name|
76
- self[name] = instance_variable_get(name) if @column_keys.include?(name)
77
- end
78
- end
79
-
58
+ def load_object(obj)
59
+ class_sym = obj.class.name.to_sym
60
+ self[class_sym] = obj if @column_keys.include?(class_sym)
61
+ @column_keys.each do |k|
62
+ begin
63
+ self[k] = obj.send(k) if obj.respond_to?(k.to_s)
64
+ rescue
65
+ end
66
+ end
67
+ keys = @column_keys.inject([]) { |ar, e| ar << e.to_s }
68
+ matches = obj.attributes.keys & keys if obj.attributes.is_a? Hash
69
+ matches.each do |field|
70
+ begin
71
+ self[field.to_sym] = obj.attributes[field]
72
+ rescue
73
+ end
74
+ end
75
+ obj.instance_variables.each do |name|
76
+ self[name] = instance_variable_get(name) if @column_keys.include?(name)
77
+ end
78
+ end
79
+
80
80
 
81
81
  end
82
82
  end
@@ -3,7 +3,7 @@ module VR
3
3
 
4
4
  class ListView < Gtk::TreeView
5
5
 
6
- include ViewCommon
6
+ include ViewCommon
7
7
 
8
8
  #The new() constructor takes a Hash that defines the columns as its only argument. The Hash defines
9
9
  #symbols as the keys to give an ID to each column. The Hash also defines the type (class) of the column.
@@ -32,28 +32,28 @@ module VR
32
32
  #
33
33
 
34
34
  def initialize(cls)
35
- super()
35
+ super()
36
36
  hash = flatten_hash(cls)
37
37
  vals = hash.values
38
- self.model = Gtk::ListStore.new(*vals)
39
- load_columns(cls)
38
+ self.model = Gtk::ListStore.new(*vals)
39
+ load_columns(cls)
40
40
  end
41
41
 
42
- def add_active_record_rows(ar) # :nodoc:
43
- ar.each do |obj|
44
- row = add_row()
45
- matches = obj.attributes.keys & @column_keys #intersection
46
- matches.each { |field| row[field] = obj.attributes[field] }
47
- end
48
- end
42
+ def add_active_record_rows(ar) # :nodoc:
43
+ ar.each do |obj|
44
+ row = add_row()
45
+ matches = obj.attributes.keys & @column_keys #intersection
46
+ matches.each { |field| row[field] = obj.attributes[field] }
47
+ end
48
+ end
49
49
 
50
- def []( row ) # :nodoc:
51
- model.get_iter(Gtk::TreePath.new("#{row}"))
52
- end
50
+ def []( row ) # :nodoc:
51
+ model.get_iter(Gtk::TreePath.new("#{row}"))
52
+ end
53
53
 
54
- def []( row, col ) # :nodoc:
55
- model.get_iter(Gtk::TreePath.new("#{row}"))[col]
56
- end
54
+ def []( row, col ) # :nodoc:
55
+ model.get_iter(Gtk::TreePath.new("#{row}"))[col]
56
+ end
57
57
 
58
58
  # This method will select a given row number. The row will be hilighted, and the
59
59
  # GtkSelection object will point to that row. It uses the GtkTreeView#set_cursor
@@ -62,9 +62,9 @@ module VR
62
62
  #- row_number: Integer (FixNum)
63
63
  #
64
64
 
65
- def select_row(row_number = 0)
66
- set_cursor(Gtk::TreePath.new(row_number), nil, false)
67
- end
65
+ def select_row(row_number = 0)
66
+ set_cursor(Gtk::TreePath.new(row_number), nil, false)
67
+ end
68
68
 
69
69
  #This will add a row to the data model, and fill-in the values from a Hash.
70
70
  #This example would add a row to the model and set the name and email fields:
@@ -74,11 +74,11 @@ module VR
74
74
  #
75
75
  #- hash: A ruby Hash object with pairs of column ISs (symbols) and values.
76
76
 
77
- def add_row(hash = {})
78
- row = vr_row(model.append)
79
- hash.each_pair { |key, val| row[key] = val }
80
- return row
81
- end
77
+ def add_row(hash = {})
78
+ row = vr_row(model.append)
79
+ hash.each_pair { |key, val| row[key] = val }
80
+ return row
81
+ end
82
82
 
83
83
  end
84
84
 
@@ -8,17 +8,17 @@ module VR
8
8
  # Also, most of the useful methods for VR::TreeView are found in VR::ViewCommon.
9
9
  # All the methods in VR::ViewCommon work on VR::TreeViews and VR::ListViews.
10
10
  #
11
- class TreeView < Gtk::TreeView
12
-
13
- include ViewCommon
11
+ class TreeView < Gtk::TreeView
12
+
13
+ include ViewCommon
14
14
 
15
15
  # See VR::ListView constructor. (exactly the same)
16
16
 
17
- def initialize(cols)
18
- super()
19
- self.model = Gtk::TreeStore.new(*flatten_hash(cols).values)
20
- load_columns(cols)
21
- end
17
+ def initialize(cols)
18
+ super()
19
+ self.model = Gtk::TreeStore.new(*flatten_hash(cols).values)
20
+ load_columns(cols)
21
+ end
22
22
  #
23
23
  # Adds row to the model. This will return a "row" type iter that responds
24
24
  # to column IDs (symbols). You need to provide a parent row (iter).
@@ -28,16 +28,16 @@ module VR
28
28
  #
29
29
  # @view.add_row(iter, :name => "Chester", :email => "chester@chesterizer.com")
30
30
  #
31
- #
31
+ #
32
32
 
33
33
 
34
34
 
35
- def add_row(parent, hash = {})
36
- row = vr_row(model.append(parent))
37
- hash.each_pair { |key, val| row[key] = val }
38
- return row
39
- end
35
+ def add_row(parent, hash = {})
36
+ row = vr_row(model.append(parent))
37
+ hash.each_pair { |key, val| row[key] = val }
38
+ return row
39
+ end
40
40
 
41
- end
41
+ end
42
42
 
43
43
  end