visualruby 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -1,40 +1,40 @@
1
1
 
2
2
  class ProjectChooserView < VR::ListView
3
3
 
4
- PIX = Gdk::Pixbuf.new(File.dirname(__FILE__) + "/../../img/folder.png")
4
+ PIX = Gdk::Pixbuf.new(File.dirname(__FILE__) + "/../../img/folder.png")
5
5
 
6
- def initialize()
7
- super(:folder => {:pix => Gdk::Pixbuf, :file_name => String}, :modified => DateTime)
8
- ren_xalign(:modified => 1)
9
- col_xalign(:modified => 1)
10
- col_sort_column_id(:modified => id(:modified), :pix => id(:file_name))
11
- end
6
+ def initialize()
7
+ super(:folder => {:pix => Gdk::Pixbuf, :file_name => String}, :modified => DateTime)
8
+ ren_xalign(:modified => 1)
9
+ col_xalign(:modified => 1)
10
+ col_sort_column_id(:modified => id(:modified), :pix => id(:file_name))
11
+ end
12
12
 
13
- def refresh(show_backup = false)
14
- # model.set_sort_column_id(1, :ascending)
15
- self.model.clear
16
- pattern = ""
17
- backup_path = Dir.pwd.gsub(ENV["HOME"], File.join(ENV["HOME"], "visualruby_backup"))
18
- backup_ar = File.split(backup_path)
19
- backup_ar << ["**", VR_ENV::SETTINGS_FILE]
20
- if show_backup
21
- pattern = File.join(*backup_ar)
22
- else
23
- pattern = File.join(ENV["HOME"], "visualruby", "**", VR_ENV::SETTINGS_FILE)
24
- end
25
- Dir.glob(pattern, File::FNM_DOTMATCH).each do |fn|
26
- next if not show_backup and fn =~ / Backup /
27
- next if show_backup and not fn =~ / Backup /
28
- t = File.stat(fn).mtime
29
- row = add_row()
30
- row[:pix] = PIX
31
- row[:file_name] = File.dirname(fn)
32
- row[:modified] = DateTime.parse(t.to_s)
33
- end
13
+ def refresh(show_backup = false)
14
+ # model.set_sort_column_id(1, :ascending)
15
+ self.model.clear
16
+ pattern = ""
17
+ backup_path = Dir.pwd.gsub(ENV["HOME"], File.join(ENV["HOME"], "visualruby_backup"))
18
+ backup_ar = File.split(backup_path)
19
+ backup_ar << ["**", VR_ENV::SETTINGS_FILE]
20
+ if show_backup
21
+ pattern = File.join(*backup_ar)
22
+ else
23
+ pattern = File.join(ENV["HOME"], "visualruby", "**", VR_ENV::SETTINGS_FILE)
24
+ end
25
+ Dir.glob(pattern, File::FNM_DOTMATCH).each do |fn|
26
+ next if not show_backup and fn =~ / Backup /
27
+ next if show_backup and not fn =~ / Backup /
28
+ t = File.stat(fn).mtime
29
+ row = add_row()
30
+ row[:pix] = PIX
31
+ row[:file_name] = File.dirname(fn)
32
+ row[:modified] = DateTime.parse(t.to_s)
33
+ end
34
34
 
35
- # model.set_sort_column_id(id(:modified), :descending)
36
- end
37
-
35
+ # model.set_sort_column_id(id(:modified), :descending)
36
+ end
37
+
38
38
  end
39
39
 
40
40
 
@@ -1,25 +1,25 @@
1
1
 
2
2
  class ProjectTree < VR::FileTreeView #(change name)
3
3
 
4
- attr_accessor :ftv
4
+ attr_accessor :ftv
5
5
 
6
- include GladeGUI
6
+ include GladeGUI
7
7
 
8
- def initialize()
9
- path = $VR_ENV_GLOBAL.projects_home
10
- icon_path = File.expand_path(File.join(File.path(__FILE__), "..", "..", "..", "img"))
11
- super(path, icon_path)
12
- @test_block = proc { |folder| has_settings_file?(folder) }
13
- open_folders($VR_ENV_GLOBAL.projects_home_open_folders)
14
- end
8
+ def initialize()
9
+ path = $VR_ENV_GLOBAL.projects_home
10
+ icon_path = File.expand_path(File.join(File.path(__FILE__), "..", "..", "..", "img"))
11
+ super(path, icon_path)
12
+ @test_block = proc { |folder| has_settings_file?(folder) }
13
+ open_folders($VR_ENV_GLOBAL.projects_home_open_folders)
14
+ end
15
15
 
16
- def has_settings_file?(path)
17
- Find.find(path) do |file|
18
- if File.basename(file) == VR_ENV::SETTINGS_FILE
19
- return true
20
- end
21
- end
22
- return false
23
- end
16
+ def has_settings_file?(path)
17
+ Find.find(path) do |file|
18
+ if File.basename(file) == VR_ENV::SETTINGS_FILE
19
+ return true
20
+ end
21
+ end
22
+ return false
23
+ end
24
24
 
25
25
  end
@@ -1,97 +1,107 @@
1
1
 
2
2
  class RubygemsAPI
3
3
 
4
- include GladeGUI
4
+ include GladeGUI
5
5
 
6
- CREDENTIALS_FILE = File.join(ENV['HOME'], ".gem", "credentials")
6
+ CREDENTIALS_FILE = File.join(ENV['HOME'], ".gem", "credentials")
7
7
 
8
- def initialize
9
- uri = URI.parse("https://rubygems.org")
10
- @http = Net::HTTP.new(uri.host, uri.port)
11
- @http.use_ssl = true
12
- @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
8
+ def initialize
9
+ uri = URI.parse("https://rubygems.org")
10
+ @http = Net::HTTP.new(uri.host, uri.port)
11
+ @http.use_ssl = true
12
+ @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
13
13
  load_glade()
14
- end
14
+ end
15
15
 
16
- def get_key()
17
- if File.file?(CREDENTIALS_FILE)
18
- return Gem.configuration.rubygems_api_key
19
- end
20
- return set_up_key()
21
- end
16
+ def get_key()
17
+ if File.file?(CREDENTIALS_FILE)
18
+ return Gem.configuration.rubygems_api_key
19
+ end
20
+ return set_up_key()
21
+ end
22
+
23
+ def set_up_key()
24
+ @username = ""
25
+ @password = ""
26
+ key = nil
27
+ set_glade_all()
28
+ response_id = @builder["dialog1"].run
29
+ @builder["dialog1"].hide
30
+ return unless response_id == 1
31
+ get_glade_all() #gets @username, @password
32
+ begin
33
+ @http.start() do |h|
34
+ req = Net::HTTP::Get.new("/api/v1/api_key.yaml")
35
+ req.basic_auth @username, @password
36
+ response = h.request(req)
37
+ obj = YAML.load(response.body)
38
+ key = obj[:rubygems_api_key]
39
+ if key
40
+ File.open(CREDENTIALS_FILE,"w",0600) { |f| f.write(YAML.dump(obj)) }
41
+ else
42
+ alert "Rubygems response: \n" + obj.to_s
43
+ end
44
+ end
45
+ rescue
46
+ alert "Problem connecting to rubygems.org"
47
+ end
48
+ return key
49
+ end
22
50
 
23
- def set_up_key()
24
- @username = ""
25
- @password = ""
26
- key = nil
27
- set_glade_all()
28
- @builder["dialog1"].run do |response_id|
29
- if response_id == 1 #Ok Button
30
- get_glade_all() #gets @username, @password
31
- alert "You: " + @username + @password
32
- path = "/api/v1/api_key.yaml"
33
- @http.start() do |h|
34
- req = Net::HTTP::Get.new(path)
35
- req.basic_auth @username, @password
36
- response = h.request(req)
37
- obj = YAML.load(response.body)
38
- alert obj.to_s
39
- key = obj[:rubygems_api_key]
40
- if key
41
- File.open(CREDENTIALS_FILE,"w",0600) { |f| f.write(YAML.dump(obj)) }
42
- else
43
- alert obj.values[0]
44
- end
45
- end
46
- end
47
- end
48
- @builder["dialog1"].hide
49
- return key
50
- end
51
51
 
52
52
 
53
- def get_obj_url(path)
54
- return nil unless key = get_key()
55
- @http.start() {|h|
53
+ def get_obj_url(path)
54
+ return nil unless key = get_key()
55
+ @http.start() {|h|
56
56
  req = Net::HTTP::Get.new(path)
57
- response = h.request_get(path, 'Authorization' => key)
58
- return obj = YAML.load(response.body)
57
+ response = h.request_get(path, 'Authorization' => key)
58
+ return obj = YAML.load(response.body)
59
59
  }
60
- end
60
+ end
61
61
 
62
62
 
63
63
  # in Windows, the File.open { read } doesn't work for the gemfile.
64
64
  # also, you must set a variable (bod) to close the io stream
65
65
 
66
- def push_gem(fn)
66
+ def push_gem(fn)
67
67
  unless key = get_key()
68
68
  return "No Rubygems Credentials"
69
69
  end
70
70
  path = "https://rubygems.org/api/v1/gems"
71
- req = Net::HTTP::Post.new(path)
72
- req.add_field('Authorization', key)
71
+ req = Net::HTTP::Post.new(path)
72
+ req.add_field('Authorization', key)
73
73
  req.content_type = 'application/octet-stream'
74
74
  bod = File.open(fn, "rb") {|io| io.read } # no good in win: File.open(fn).read
75
75
  req.body = bod #must do it like this to close io ??!?!
76
- req.content_length = req.body.size
77
- @http.start() do |h|
78
- response = h.request(req)
79
- return response.message
76
+ req.content_length = req.body.size
77
+ begin
78
+ @http.start() do |h|
79
+ response = h.request(req)
80
+ return response.message
81
+ end
82
+ rescue
83
+ alert "Problem connecting to rubygems.org"
84
+ return "Problem connecting to rubygems.org"
80
85
  end
81
- end
86
+ end
82
87
 
83
- def yank_gem(name, ver)
88
+ def yank_gem(name, ver)
84
89
  return unless key = get_key()
85
90
  path = "/api/v1/gems/yank?gem_name=#{URI.encode(name)}&version=#{URI.encode(ver)}"
86
- req = Net::HTTP::Delete.new(path)
91
+ req = Net::HTTP::Delete.new(path)
87
92
  req.add_field('Authorization', key)
88
93
  req.add_field 'Connection', 'keep-alive'
89
94
  req.add_field 'Keep-Alive', '30'
90
95
  req.content_type = 'application/x-www-form-urlencoded'
91
- @http.start() do |h|
92
- response = h.request(req)
93
- return response.message
96
+ begin
97
+ @http.start() do |h|
98
+ response = h.request(req)
99
+ return response.message
100
+ end
101
+ rescue
102
+ alert "Problem connecting to rubygems.org"
103
+ return "Problem connecting to rubygems.org"
94
104
  end
95
- end
96
-
105
+ end
106
+
97
107
  end
data/bin/main/VR_ENV.rb CHANGED
@@ -1,38 +1,38 @@
1
1
  class VR_ENV
2
2
 
3
- include GladeGUI
3
+ include GladeGUI
4
4
 
5
- SETTINGS_FILE = ".vr_settings.yaml"
5
+ SETTINGS_FILE = ".vr_settings.yaml"
6
6
 
7
- attr_accessor :width, :height, :panel_pos, :rdoc_command_line
8
- attr_accessor :run_command_line, :open_files, :open_folders, :current_file
7
+ attr_accessor :width, :height, :panel_pos, :rdoc_command_line
8
+ attr_accessor :run_command_line, :open_files, :open_folders, :current_file
9
9
  attr_accessor :notebook_panel_position, :current_line
10
10
 
11
- #to add setting, just add to list
12
- def defaults
13
- @width ||= 800
14
- @height ||= 600
15
- @panel_pos ||= 360
16
- @notebook_panel_position ||= 400
17
- @run_command_line ||= "ruby main.rb"
18
- @open_files ||= []
19
- @open_folders ||= []
20
- @current_file ||= ""
21
- @current_line ||= 1
22
- @rdoc_command_line ||= "rdoc -x README"
23
- end
24
-
25
-
26
- #todo validate
27
- def buttonSave_clicked
28
- get_glade_variables
29
- VR::save_yaml(self)
30
- @builder["window1"].destroy
31
- end
32
-
33
- def buttonCancel__clicked(*args)
34
- @builder["window1"].destroy
35
- end
11
+ #to add setting, just add to list
12
+ def defaults
13
+ @width ||= 800
14
+ @height ||= 600
15
+ @panel_pos ||= 360
16
+ @notebook_panel_position ||= 400
17
+ @run_command_line ||= "ruby main.rb"
18
+ @open_files ||= []
19
+ @open_folders ||= []
20
+ @current_file ||= ""
21
+ @current_line ||= 1
22
+ @rdoc_command_line ||= "rdoc -x README"
23
+ end
24
+
25
+
26
+ #todo validate
27
+ def buttonSave_clicked
28
+ get_glade_variables
29
+ VR::save_yaml(self)
30
+ @builder["window1"].destroy
31
+ end
32
+
33
+ def buttonCancel__clicked(*args)
34
+ @builder["window1"].destroy
35
+ end
36
36
 
37
37
  end
38
38
 
@@ -1,65 +1,65 @@
1
1
 
2
2
  class VR_ENV_GLOBAL
3
-
4
- GLOBAL_SETTINGS_FILE = File.join(ENV["HOME"], "visualruby", ".global_settings.yaml")
3
+
4
+ GLOBAL_SETTINGS_FILE = File.join(ENV["HOME"], "visualruby", ".global_settings.yaml")
5
5
 
6
- include GladeGUI
7
-
8
- attr_accessor :browser, :tab_spaces, :glade_path, :default_project, :projects_home_open_folders
9
- attr_accessor :font_name, :settings_file_version, :projects_home
6
+ include GladeGUI
7
+
8
+ attr_accessor :browser, :tab_spaces, :glade_path, :default_project, :projects_home_open_folders
9
+ attr_accessor :font_name, :settings_file_version, :projects_home
10
10
 
11
- def defaults()
12
- @browser ||= "firefox"
13
- @tab_spaces ||= 2
14
- @font_name ||= "Monospace 10"
15
- @glade_path ||= "glade"
16
- @projects_home ||= File.join(ENV["HOME"], "visualruby")
17
- @projects_home_open_folders ||= [@projects_home]
18
- @default_project ||= File.join(ENV["HOME"], "visualruby", "examples", "treeview")
19
- end
11
+ def defaults()
12
+ @browser ||= "firefox"
13
+ @tab_spaces ||= 2
14
+ @font_name ||= "Monospace 10"
15
+ @glade_path ||= "glade"
16
+ @projects_home ||= File.join(ENV["HOME"], "visualruby")
17
+ @projects_home_open_folders ||= [@projects_home]
18
+ @default_project ||= File.join(ENV["HOME"], "visualruby", "examples", "treeview")
19
+ end
20
20
 
21
- def before_show
22
- @builder["font_name"].show_size = true
23
- end
21
+ def before_show
22
+ @builder["font_name"].show_size = true
23
+ end
24
24
 
25
- def buttonSave_clicked
26
- if valid?
27
- get_glade_variables
28
- @tab_spaces = @builder['tab_spaces'].text.to_i
29
- VR::save_yaml(self)
30
- @builder["window1"].destroy
31
- end
32
- end
25
+ def buttonSave_clicked
26
+ if valid?
27
+ get_glade_variables
28
+ @tab_spaces = @builder['tab_spaces'].text.to_i
29
+ VR::save_yaml(self)
30
+ @builder["window1"].destroy
31
+ end
32
+ end
33
33
 
34
- def valid? # must validate form, not variables
35
- tab_spaces = @builder['tab_spaces'].text.to_i
36
- if tab_spaces < 0 or tab_spaces > 9
37
- alert("Tab spaces must be between 1 and 9", :parent=>self)
38
- return false
39
- elsif not File.directory?(@builder[:projects_home].text)
40
- alert("Projects home folder is not valid.", :parent=>self)
41
- return false
42
- elsif not File.exists?(File.join(@builder[:default_project].text,VR_ENV::SETTINGS_FILE))
43
- alert("Default project is not valid.", :parent=>self)
44
- return false
45
- end
46
- return true
47
- end
34
+ def valid? # must validate form, not variables
35
+ tab_spaces = @builder['tab_spaces'].text.to_i
36
+ if tab_spaces < 0 or tab_spaces > 9
37
+ alert("Tab spaces must be between 1 and 9", :parent=>self)
38
+ return false
39
+ elsif not File.directory?(@builder[:projects_home].text)
40
+ alert("Projects home folder is not valid.", :parent=>self)
41
+ return false
42
+ elsif not File.exists?(File.join(@builder[:default_project].text,VR_ENV::SETTINGS_FILE))
43
+ alert("Default project is not valid.", :parent=>self)
44
+ return false
45
+ end
46
+ return true
47
+ end
48
48
 
49
- def buttonCancel__clicked(*args)
50
- @builder["window1"].destroy
51
- end
49
+ def buttonCancel__clicked(*args)
50
+ @builder["window1"].destroy
51
+ end
52
52
 
53
- def buttonTryGlade__clicked(*argv)
54
- VR_Tools.popen(@glade_path)
55
- end
53
+ def buttonTryGlade__clicked(*argv)
54
+ VR_Tools.popen(@glade_path)
55
+ end
56
56
 
57
- def buttonTryBrowser__clicked(*argv)
58
- VR_Tools.popen(@browser)
59
- end
57
+ def buttonTryBrowser__clicked(*argv)
58
+ VR_Tools.popen(@browser)
59
+ end
60
60
 
61
- def buttonCurrent__clicked(*argv)
62
- @builder["default_project"].text = Dir.pwd
63
- end
61
+ def buttonCurrent__clicked(*argv)
62
+ @builder["default_project"].text = Dir.pwd
63
+ end
64
64
 
65
65
  end