visualruby 3.0.11 → 3.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.vr_settings.yaml +7 -17
  3. data/examples/alert_box/.vr_settings.yaml +17 -0
  4. data/examples/filetreeview/bin/ProjectTree.rb +2 -2
  5. data/examples/phantom/.vr_settings.yaml +22 -0
  6. data/examples/phantom/main.rb +10 -0
  7. data/examples/phantom/src/MyClass.rb +5 -0
  8. data/examples/phantom/src/glade/MyClass.glade +92 -0
  9. data/examples/pop_up/.vr_settings.yaml +19 -0
  10. data/examples/pop_up/main.rb +10 -0
  11. data/{skeleton/project/bin → examples/pop_up/src}/MyClass.rb +0 -0
  12. data/{skeleton/project/bin → examples/pop_up/src}/glade/MyClass.glade +0 -0
  13. data/examples/settings_file/.vr_settings.yaml +22 -0
  14. data/{vrlib/lib → lib}/Alert.rb +0 -0
  15. data/{vrlib/lib → lib}/DragDrop.rb +0 -0
  16. data/{vrlib/lib → lib}/GladeGUI.rb +0 -0
  17. data/{vrlib/lib → lib}/IconHash.rb +0 -0
  18. data/{vrlib/lib → lib}/SavableClass.rb +0 -0
  19. data/{vrlib/lib → lib}/SimpleComboBoxEntry.rb +0 -0
  20. data/{vrlib/lib → lib}/glade/Alert.glade +0 -0
  21. data/lib/oinspect/MethodsListView.rb +16 -0
  22. data/lib/oinspect/ObjectInspectorGUI.rb +26 -0
  23. data/lib/oinspect/VariablesListView.rb +38 -0
  24. data/lib/oinspect/glade/ObjectInspectorGUI.glade +119 -0
  25. data/{vrlib/lib → lib}/treeview/FileTreeView.rb +27 -22
  26. data/{vrlib/lib → lib}/treeview/IterMethods.rb +0 -0
  27. data/{vrlib/lib → lib}/treeview/ListView.rb +0 -0
  28. data/{vrlib/lib → lib}/treeview/TreeView.rb +0 -0
  29. data/{vrlib/lib → lib}/treeview/ViewCommon.rb +0 -0
  30. data/{vrlib/lib → lib}/treeview/columns/CalendarCol.rb +0 -0
  31. data/{vrlib/lib → lib}/treeview/columns/CellRendererCombo.rb +0 -0
  32. data/{vrlib/lib → lib}/treeview/columns/CellRendererDate.rb +0 -0
  33. data/{vrlib/lib → lib}/treeview/columns/CellRendererObject.rb +0 -0
  34. data/{vrlib/lib → lib}/treeview/columns/CellRendererPhone.rb +0 -0
  35. data/{vrlib/lib → lib}/treeview/columns/CellRendererPixbuf.rb +0 -0
  36. data/{vrlib/lib → lib}/treeview/columns/CellRendererProgress.rb +0 -0
  37. data/{vrlib/lib → lib}/treeview/columns/CellRendererSpin.rb +0 -0
  38. data/{vrlib/lib → lib}/treeview/columns/CellRendererText.rb +0 -0
  39. data/{vrlib/lib → lib}/treeview/columns/CellRendererToggle.rb +0 -0
  40. data/{vrlib/lib → lib}/treeview/columns/ComboCol.rb +0 -0
  41. data/{vrlib/lib → lib}/treeview/columns/CurrencyCol.rb +0 -0
  42. data/{vrlib/lib → lib}/treeview/columns/DateCol.rb +0 -0
  43. data/{vrlib/lib → lib}/treeview/columns/ImageCol.rb +0 -0
  44. data/{vrlib/lib → lib}/treeview/columns/ProgressCol.rb +0 -7
  45. data/{vrlib/lib → lib}/treeview/columns/SpinCol.rb +0 -0
  46. data/{vrlib/lib → lib}/treeview/columns/TextCol.rb +0 -0
  47. data/{vrlib/lib → lib}/treeview/columns/TreeViewColumn.rb +0 -0
  48. data/{vrlib/lib → lib}/treeview/columns/glade/CalendarCol.glade +0 -0
  49. data/{vrlib/lib → lib}/treeview/columns/glade/ImageCol.glade +0 -0
  50. data/{vrlib/lib → lib}/treeview/columns/glade/TextCol.glade +0 -0
  51. data/{vrlib → lib}/vrlib.rb +1 -1
  52. data/skeleton/project/main.rb +1 -1
  53. data/skeleton/project/src/MyClass.rb +15 -0
  54. data/skeleton/project/src/glade/MyClass.glade +36 -0
  55. data/{bin → src}/editor/VR_Document.rb +9 -8
  56. data/{bin → src}/editor/VR_TabSearch.rb +0 -0
  57. data/{bin → src}/editor/VR_Tabs.rb +0 -0
  58. data/{bin → src}/editor/VR_TextShell.rb +0 -0
  59. data/{bin → src}/editor/VR_TextViewCommon.rb +0 -0
  60. data/{bin → src}/main/GemTree.rb +0 -0
  61. data/{bin → src}/main/NewProjectGUI.rb +0 -0
  62. data/{bin → src}/main/OpenProject.rb +0 -0
  63. data/{bin → src}/main/ProjectChooserView.rb +0 -0
  64. data/{bin → src}/main/ProjectTree.rb +1 -2
  65. data/{bin → src}/main/RubygemsAPI.rb +0 -0
  66. data/{bin → src}/main/VR_ENV.rb +0 -0
  67. data/{bin → src}/main/VR_ENV_GLOBAL.rb +0 -0
  68. data/{bin → src}/main/VR_File_Tree.rb +4 -2
  69. data/{bin → src}/main/VR_Local_Gem_Tree.rb +0 -0
  70. data/{bin → src}/main/VR_Main.rb +6 -3
  71. data/{bin → src}/main/VR_Remote_Gem_Tree.rb +0 -0
  72. data/{bin → src}/main/VR_Tools.rb +4 -4
  73. data/{bin → src}/main/glade/NewProjectGUI.glade +0 -0
  74. data/{bin → src}/main/glade/OpenProject.glade +1 -0
  75. data/{bin → src}/main/glade/RubygemsAPI.glade +0 -0
  76. data/{bin → src}/main/glade/Splash.glade +0 -0
  77. data/{bin → src}/main/glade/VR_ENV.glade +0 -0
  78. data/{bin → src}/main/glade/VR_ENV_GLOBAL.glade +0 -0
  79. data/{bin → src}/main/glade/VR_File_Tree.glade +0 -0
  80. data/{bin → src}/main/glade/VR_Local_Gem_Tree.glade +0 -0
  81. data/{bin → src}/main/glade/VR_Main.glade +0 -0
  82. data/{bin → src}/main/glade/VR_Remote_Gem_Tree.glade +0 -0
  83. data/vr +6 -4
  84. data/{vrlib → yard_hack}/rdoc_replace.yaml +1 -1
  85. metadata +83 -69
@@ -5,21 +5,22 @@ module VR
5
5
 
6
6
  include GladeGUI
7
7
 
8
+ attr_accessor :root, :glob
8
9
 
9
-
10
- # A code block that further eliminates files included in the tree. If this block returns false
11
- # for the entry, it will be excluded.
12
-
13
- attr_accessor :validation_block, :root, :glob
10
+ # A Code block that further excludes files and folders included in the tree. If this block returns false
11
+ # for the entry, it will be excluded. If it returns true, it will be included...
12
+ attr_accessor :validate_block
14
13
 
15
14
  # FileTreeView creates a TreeView of files with folders and icons.
16
15
  # Often you should subclass this class for a particular use.
17
- # @param [String] root Root folder of the tree
16
+ # @param [String] Root Root folder of the tree
18
17
  # @param [String] icon_path Path to a folder where icons are stored. See VR::IconHash
19
- # @param [String] glob Glob designating the files to be included. Google: "ruby glob" for more.
20
- def initialize(root = Dir.pwd, icon_path = nil, glob = "*")
18
+ # @param [String] glob Glob designating the files to be included. Google: "ruby glob" for more.
19
+ # @param [Proc] validate_block Block that limits files and folders to include. When block returns true file is includud. (false = excluded)
20
+ def initialize(root = Dir.pwd, icon_path = nil, glob = "*", validate_block = nil)
21
21
  @root = File.expand_path(root)
22
- @glob = glob
22
+ @glob = glob
23
+ @validate_block = validate_block
23
24
  super(:file => {:pix => Gdk::Pixbuf, :file_name => String}, :empty => TrueClass, :path => String, :modified_date => VR::DateCol, :sort_on => String)
24
25
  col_visible( :path => false, :modified_date => false, :sort_on => false, :empty => false)
25
26
  self.headers_visible = false
@@ -31,8 +32,8 @@ module VR
31
32
  self.visible = true # necessary!
32
33
  end
33
34
 
34
- # Refreshes the file tree, optionally with a new root folder, and optionally opening an array of folders.
35
- # @param [Hash] flags Optionally pass a root or array of folders to open.
35
+ # Refresh the file tree, optionally with a new root folder, and optionally opening an array of folders.
36
+ # @param [Hash] flags You can change the root and/or open an array of folders.
36
37
  # @option flags [String] :root Path to root folder to open
37
38
  # @option flags [Array] :open_folders A list of folders to open, possibly from #get_open_folders.
38
39
  # Default: the currently open folders, so the tree doesn't collapse when refreshed.
@@ -41,22 +42,21 @@ module VR
41
42
  open_folders = flags[:open_folders] ? flags[:open_folders] : get_open_folders()
42
43
  model.clear
43
44
  @root_iter = add_file(@root, nil)
44
- open_folders([@root_iter[:path]])
45
- # fill_folder(@root_iter)
46
- # expand_row(@root_iter.path, false)
45
+ open_folders([@root_iter[:path]])
47
46
  open_folders(open_folders)
48
47
  end
49
48
 
50
49
  # reads a folder from the disk and expands it.
51
50
  private def fill_folder(parent_iter)
52
51
  model.remove(parent_iter.first_child) #remove dummy record
53
- files = Dir.glob(File.join(parent_iter[id(:path)],@glob))
54
- files = files.select &@validation_block if @validation_block
52
+ files = Dir.glob(File.join(parent_iter[id(:path)], @glob))
53
+ files = files.select &@validate_block if @validate_block
55
54
  files.each do |fn|
56
55
  add_file(fn, parent_iter)
57
56
  end
58
- end
59
-
57
+ end
58
+
59
+ #Ignore this, it is called when a folder is clicked, and expands the folder.
60
60
  def self__row_expanded(view, iter, path)
61
61
  iter = model.get_iter(path) #bug fix
62
62
  fill_folder(iter) if iter[id(:empty)]
@@ -73,14 +73,17 @@ module VR
73
73
  end
74
74
  end
75
75
 
76
- # returns an array of open folders.
76
+ # returns an array of open folders. The array of folders can be saved, and then you can
77
+ # pass the array to #open_folders to restore the state of the file tree.
78
+ # @return [Array] Returns array of strings with the full expanded paths of the open folders.
77
79
  def get_open_folders()
78
80
  expanded = []
79
81
  map_expanded_rows {|view, path| expanded << model.get_iter(path)[id(:path)] }
80
82
  return expanded
81
83
  end
82
84
 
83
- # Opens a list of folders.
85
+ # Opens a list of folders.
86
+ # @param [Array] folder_paths Array of Strings of folder names to expand, possibly from the #get_open_folders method.
84
87
  def open_folders(folder_paths)
85
88
  model.each do |model, path, iter|
86
89
  if folder_paths.include?(iter[id(:path)])
@@ -89,7 +92,8 @@ module VR
89
92
  end
90
93
  end
91
94
 
92
- # Adds a file to the tree under a given parent iter.
95
+ # Adds a file to the tree under a given parent iter.
96
+ # @param [String] filename Full path to file to add.
93
97
  def add_file(filename, parent = @root_iter)
94
98
  my_path = File.dirname(filename)
95
99
  model.each do |model, path, iter|
@@ -119,7 +123,8 @@ module VR
119
123
  self.level_indentation = expand ? 0 : 12
120
124
  end
121
125
 
122
- # Returns the full filename with path of the selected file
126
+ # Returns the full filename with path of the selected file.
127
+ # @return [String, nil] Full file path to selected file.
123
128
  def get_selected_path()
124
129
  selection.selected ? selection.selected[id(:path)] : nil
125
130
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,10 +1,3 @@
1
-
2
- # ==The VR Module hold all the classes of the vrlib gem. The most useful APIs are:
3
- #
4
- # ===GladeGUI -- loads glade form
5
- # ===VR::ListView -- makes Gtk::TreeView easy!
6
-
7
-
8
1
  module VR
9
2
 
10
3
  # This class is simply a wrapper for an Integer. It signals VR::Listview's
File without changes
File without changes
@@ -3,5 +3,5 @@ require "require_all"
3
3
  require "date"
4
4
  require "yaml"
5
5
 
6
- require_rel 'lib/'
6
+ require_rel '/'
7
7
 
@@ -3,7 +3,7 @@
3
3
  require "vrlib"
4
4
 
5
5
  # from require_all gem:
6
- require_rel 'bin/'
6
+ require_rel 'src/'
7
7
 
8
8
 
9
9
  MyClass.new.show_glade()
@@ -0,0 +1,15 @@
1
+
2
+ class MyClass #(change name)
3
+
4
+ include GladeGUI
5
+
6
+ def before_show()
7
+ @button1 = "Hello World"
8
+ end
9
+
10
+ def button1__clicked(*args)
11
+ @builder["button1"].label = "Goodbye World"
12
+ end
13
+
14
+ end
15
+
@@ -0,0 +1,36 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generated with glade 3.16.1 -->
3
+ <interface>
4
+ <requires lib="gtk+" version="3.0"/>
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="can_focus">False</property>
7
+ <property name="window_position">center</property>
8
+ <child>
9
+ <object class="GtkButtonBox" id="buttonbox1">
10
+ <property name="visible">True</property>
11
+ <property name="can_focus">False</property>
12
+ <property name="halign">center</property>
13
+ <property name="valign">center</property>
14
+ <property name="margin_left">50</property>
15
+ <property name="margin_right">50</property>
16
+ <property name="margin_top">50</property>
17
+ <property name="margin_bottom">50</property>
18
+ <property name="orientation">vertical</property>
19
+ <property name="layout_style">start</property>
20
+ <child>
21
+ <object class="GtkButton" id="button1">
22
+ <property name="label" translatable="yes">button</property>
23
+ <property name="visible">True</property>
24
+ <property name="can_focus">True</property>
25
+ <property name="receives_default">True</property>
26
+ </object>
27
+ <packing>
28
+ <property name="expand">True</property>
29
+ <property name="fill">True</property>
30
+ <property name="position">0</property>
31
+ </packing>
32
+ </child>
33
+ </object>
34
+ </child>
35
+ </object>
36
+ </interface>
@@ -16,7 +16,8 @@ class VR_Document < GtkSource::View
16
16
  show_right_margin = true
17
17
  right_margin_position = 80
18
18
  auto_indent = true
19
- lang = GtkSource::LanguageManager.new.get_language(get_language(full_path_file))
19
+ # lang = GtkSource::LanguageManager.new.get_language(get_language(full_path_file))
20
+ lang = GtkSource::LanguageManager.new.guess_language(full_path_file)
20
21
  buffer.language = lang
21
22
  buffer.highlight_syntax = true
22
23
  buffer.highlight_matching_brackets = false
@@ -30,13 +31,13 @@ class VR_Document < GtkSource::View
30
31
  update_style()
31
32
  end
32
33
 
33
- def get_language(fn)
34
- case File.extname(full_path_file)
35
- when ".rb", "", ".gemspec" ; return "ruby"
36
- when ".erb", ".html" ; return "html"
37
- else ; return ""
38
- end
39
- end
34
+ # def get_language(fn)
35
+ # case File.extname(full_path_file)
36
+ # when ".rb", "", ".gemspec" ; return "ruby"
37
+ # when ".erb", ".html" ; return "html"
38
+ # else ; return ""
39
+ # end
40
+ # end
40
41
 
41
42
  def update_style()
42
43
  override_font(Pango::FontDescription.new($VR_ENV_GLOBAL.font_name))
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -8,8 +8,7 @@ class ProjectTree < VR::FileTreeView #(change name)
8
8
  def initialize()
9
9
  path = $VR_ENV_GLOBAL.projects_home
10
10
  icon_path = File.expand_path(File.join(File.path(__FILE__), "..", "..", "..", "img"))
11
- super(path, icon_path)
12
- @validation_block = proc { |folder| has_settings_file?(folder) }
11
+ super(path, icon_path, "*", proc { |folder| has_settings_file?(folder) })
13
12
  open_folders($VR_ENV_GLOBAL.projects_home_open_folders)
14
13
  end
15
14
 
File without changes
File without changes
File without changes
@@ -57,8 +57,10 @@ class VR_File_Tree < VR::FileTreeView
57
57
  @main.shell.buffer.text += `#{$VR_ENV.rdoc_command_line} 2>&1`
58
58
  VR_Tools.replace_html_in_docs()
59
59
  FileUtils.copy("yard_hack/common.css", "#{fn}/doc/css/common.css") if File.exists?("yard_hack/common.css")
60
- FileUtils.copy("yard_hack/index.html", "#{fn}/doc/index.html") if File.exists?("yard_hack/index.html")
61
- FileUtils.copy("yard_hack/index.html", "#{fn}/doc/frames.html") if File.exists?("yard_hack/index.html")
60
+ if File.exists?("yard_hack/index.html.replace")
61
+ FileUtils.copy("yard_hack/index.html.replace", "#{fn}/doc/index.html")
62
+ FileUtils.copy("yard_hack/index.html.replace", "#{fn}/doc/frames.html")
63
+ end
62
64
  FileUtils.cd(old_dir)
63
65
  VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{fn}/doc/index.html")
64
66
  @main.file_tree.refresh()
File without changes
@@ -145,8 +145,11 @@ class VR_Main
145
145
  end
146
146
  end
147
147
 
148
- def toolSave__clicked(*a) # saves open tab
149
- @tabs.docs[@tabs.page].try_to_save(false) # false = don't ask
148
+ def toolSave__clicked(*a) # saves open tab
149
+ @tabs.docs[@tabs.page].try_to_save(false) # false = don't ask
150
+ # command = $VR_ENV.rdoc_command_line.split(" ")[0]
151
+ # file = @tabs.docs[@tabs.page].full_path_file
152
+ # run_command("#{command} #{file}")
150
153
  end
151
154
 
152
155
  def menuNewWindow__activate(*a)
@@ -180,7 +183,7 @@ class VR_Main
180
183
  end
181
184
 
182
185
  def toolBackUp__clicked(*a)
183
- return unless @tabs.try_to_save_all(:ask=>true)
186
+ return unless @tabs.try_to_save_all(:ask=>true)
184
187
  VR_Tools.back_up()
185
188
  end
186
189
 
File without changes
@@ -84,8 +84,8 @@ END
84
84
  #
85
85
  #this works on Dir.pwd that's maybe different from project
86
86
  def VR_Tools.replace_html_in_docs()
87
- return if not File.file? "rdoc_replace.yaml"
88
- ar = YAML.load_file "rdoc_replace.yaml"
87
+ return if not File.file? "yard_hack/rdoc_replace.yaml"
88
+ ar = YAML.load_file "yard_hack/rdoc_replace.yaml"
89
89
  Dir.glob("#{Dir.pwd}/doc/**/*.html") do |f|
90
90
  str = File.open(f).read
91
91
  ar.each do |pair|
@@ -93,8 +93,8 @@ END
93
93
  end
94
94
  File.open(f, "w") { |file| file.puts(str) }
95
95
  end
96
- FileUtils.cp "#{Dir.pwd}/rdoc.css", "#{Dir.pwd}/doc/rdoc.css" if File.file?("#{Dir.pwd}/rdoc.css") and File.directory?("#{Dir.pwd}/doc")
97
- end
96
+ # FileUtils.cp "#{Dir.pwd}/rdoc.css", "#{Dir.pwd}/doc/rdoc.css" if File.file?("#{Dir.pwd}/rdoc.css") and File.directory?("#{Dir.pwd}/doc")
97
+ end
98
98
 
99
99
  end
100
100
  # def VR_Tools.sudo_command(command)
File without changes
@@ -9,6 +9,7 @@
9
9
  <property name="title" translatable="yes">Open Project</property>
10
10
  <property name="modal">True</property>
11
11
  <property name="window_position">center</property>
12
+ <property name="destroy_with_parent">True</property>
12
13
  <property name="type_hint">dialog</property>
13
14
  <child>
14
15
  <object class="GtkBox" id="box1">
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/vr CHANGED
@@ -16,16 +16,18 @@ def load_everything
16
16
 
17
17
  require 'require_all'
18
18
 
19
- require_rel 'vrlib/lib/'
20
- require_rel 'bin/'
19
+ require_rel 'lib/'
20
+ require_rel 'src/'
21
21
 
22
22
  VR_Main.new(ARGV, @bldr).show_glade()
23
23
 
24
24
  end
25
+
26
+ $root = File.dirname(__FILE__)
25
27
 
26
28
  @bldr = Gtk::Builder.new
27
- @bldr << File.join(File.dirname(__FILE__), "bin", "main", "glade", "Splash.glade")
28
- @bldr[:image1].file = File.join(File.dirname(__FILE__), "img", "splash.png")
29
+ @bldr << File.join($root, "src", "main", "glade", "Splash.glade")
30
+ @bldr[:image1].file = File.join($root, "img", "splash.png")
29
31
  @bldr[:window1].show_all
30
32
 
31
33
 
@@ -49,7 +49,7 @@
49
49
  - "<A href=http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ASelection>Gtk::Selection</a>"
50
50
  - - <li class="r1"><span class="object_link"><a href="index.html" title="README">README</a></a></li>
51
51
  - "<!-- README deleted makes problem. -->"
52
- - - '<div id="search">Search: <input type="text" /></div>'
52
+ - - '<div id="search">Search: <input type="text" /></div>x'
53
53
  - "<title>Visual Ruby -- GUI with Ruby and Glade</title>"
54
54
  - - video:activerecord.avi
55
55
  - <iframe width="640" height="480" src="http://www.youtube.com/embed/uySVKltD7fk"