visualruby 3.6.3 → 3.6.4

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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/.vr_settings.yaml +22 -10
  3. data/all_requires.rb +35 -0
  4. data/examples/01_phantom/main.rb +6 -0
  5. data/examples/02_hello/.vr_settings.yaml +21 -0
  6. data/examples/{phantom → 02_hello}/main.rb +2 -3
  7. data/examples/02_hello/src/MyClass.rb +11 -0
  8. data/examples/02_hello/src/glade/MyClass.glade +36 -0
  9. data/examples/03_simple_ruby_gui/main.rb +11 -0
  10. data/examples/04_calculator/.vr_settings.yaml +21 -0
  11. data/examples/04_calculator/calculator.rb +7 -0
  12. data/examples/{calculator/bin/Calculator.rb → 04_calculator/src/CalculatorGUI.rb} +3 -3
  13. data/examples/07_event_handlers/.vr_settings.yaml +23 -0
  14. data/examples/07_event_handlers/main.rb +9 -0
  15. data/examples/07_event_handlers/src/MyClass.rb +26 -0
  16. data/examples/07_event_handlers/src/MyTextView.rb +13 -0
  17. data/examples/07_event_handlers/src/glade/MyClass.glade +90 -0
  18. data/examples/active_record/.vr_settings.yaml +2 -3
  19. data/examples/active_record/active_record.rb +1 -1
  20. data/examples/alert_box/.vr_settings.yaml +11 -8
  21. data/examples/alert_box/alertdemo.rb +11 -0
  22. data/examples/alert_box/{bin → src}/AlertBoxDemo.rb +19 -6
  23. data/examples/alert_box/{bin → src}/glade/AlertBoxDemo.glade +37 -4
  24. data/examples/all_widgets/.vr_settings.yaml +8 -7
  25. data/examples/all_widgets/{main.rb → all_widgets.rb} +1 -4
  26. data/examples/all_widgets/{bin → src}/AllWidgets.rb +1 -1
  27. data/examples/child_window/.vr_settings.yaml +10 -9
  28. data/examples/child_window/child_window.rb +11 -0
  29. data/examples/drag_drop/.vr_settings.yaml +6 -5
  30. data/examples/drag_drop/{main.rb → drag_drop.rb} +1 -3
  31. data/examples/filetreeview/.vr_settings.yaml +10 -8
  32. data/examples/filetreeview/filetreeview.rb +10 -0
  33. data/examples/filetreeview/{bin → src}/ProjectTree.rb +1 -12
  34. data/examples/filetreeview/{bin → src}/ProjectTreeGUI.rb +9 -0
  35. data/examples/filetreeview/{bin → src}/glade/ProjectTreeGUI.glade +37 -37
  36. data/examples/golf_handicap/.vr_settings.yaml +5 -6
  37. data/examples/golf_handicap/eric_cunningham.yaml +106 -0
  38. data/examples/golf_handicap/golf_handicap.rb +18 -0
  39. data/examples/golf_handicap/src/Handicap.rb +31 -29
  40. data/examples/golf_handicap/src/LoadGolfer.rb +27 -27
  41. data/examples/golf_handicap/src/Score.rb +10 -9
  42. data/examples/golf_handicap/src/glade/Handicap.glade +46 -42
  43. data/examples/golf_handicap/src/glade/Score.glade +58 -80
  44. data/examples/listview/.vr_settings.yaml +10 -8
  45. data/examples/listview/listview.rb +7 -0
  46. data/examples/listview/{bin → src}/SongListView.rb +2 -1
  47. data/examples/listview/{bin → src}/SongListViewGUI.rb +1 -0
  48. data/lib/Alert.rb +2 -2
  49. data/lib/GladeGUI.rb +10 -11
  50. data/lib/TestWindow.rb +33 -0
  51. data/lib/VR_GtkWindow.rb +7 -0
  52. data/lib/glade/TestWindow.glade +73 -0
  53. data/lib/treeview/TreeView.rb +0 -2
  54. data/lib/vrlib.rb +1 -0
  55. data/skeleton/project/main.rb +1 -4
  56. data/src/editor/VR_Document.rb +1 -4
  57. data/src/editor/VR_TabSearch.rb +1 -1
  58. data/src/main/RubygemsAPI.rb +3 -8
  59. data/src/main/SplashWindow.rb +18 -0
  60. data/src/main/VR_Main.rb +19 -26
  61. data/src/main/VR_Tools.rb +10 -8
  62. data/src/main/glade/VR_Main.glade +173 -178
  63. data/src/version.rb +1 -1
  64. data/test.rb +7 -0
  65. data/vr +40 -70
  66. metadata +59 -41
  67. data/examples/alert_box/main.rb +0 -9
  68. data/examples/calculator/.vr_settings.yaml +0 -19
  69. data/examples/calculator/main.rb +0 -9
  70. data/examples/filetreeview/main.rb +0 -11
  71. data/examples/listview/main.rb +0 -8
  72. data/examples/simple_ruby_gui/main.rb +0 -14
  73. /data/examples/{phantom → 01_phantom}/.vr_settings.yaml +0 -0
  74. /data/examples/{phantom → 01_phantom}/src/MyClass.rb +0 -0
  75. /data/examples/{phantom → 01_phantom}/src/glade/MyClass.glade +0 -0
  76. /data/examples/{simple_ruby_gui → 03_simple_ruby_gui}/.vr_settings.yaml +0 -0
  77. /data/examples/{simple_ruby_gui → 03_simple_ruby_gui}/bin/DataObjectGUI.rb +0 -0
  78. /data/examples/{simple_ruby_gui → 03_simple_ruby_gui}/bin/glade/DataObjectGUI.glade +0 -0
  79. /data/examples/{calculator/bin/glade/Calculator.glade → 04_calculator/src/glade/CalculatorGUI.glade} +0 -0
  80. /data/examples/all_widgets/{bin → src}/glade/AllWidgets.glade +0 -0
  81. /data/examples/all_widgets/{bin → src}/splash.png +0 -0
  82. /data/examples/child_window/{bin → src}/ChildWindowDemo.rb +0 -0
  83. /data/examples/child_window/{bin → src}/ModalWindow.rb +0 -0
  84. /data/examples/child_window/{bin → src}/ModelessWindow.rb +0 -0
  85. /data/examples/child_window/{bin → src}/MyChildClass.rb +0 -0
  86. /data/examples/child_window/{bin → src}/glade/ChildWindowDemo.glade +0 -0
  87. /data/examples/child_window/{bin → src}/glade/ModalWindow.glade +0 -0
  88. /data/examples/child_window/{bin → src}/glade/ModelessWindow.glade +0 -0
  89. /data/examples/child_window/{bin → src}/glade/MyChildClass.glade +0 -0
  90. /data/examples/drag_drop/{bin → src}/DragDropDemo.rb +0 -0
  91. /data/examples/drag_drop/{bin → src}/glade/DragDropDemo.glade +0 -0
  92. /data/examples/listview/{bin → src}/audio-x-generic.png +0 -0
  93. /data/examples/listview/{bin → src}/glade/SongListViewGUI.glade +0 -0
data/lib/TestWindow.rb ADDED
@@ -0,0 +1,33 @@
1
+
2
+
3
+ class TestWindow < VR_GtkWindow
4
+
5
+ def change
6
+ l = @builder["entry1"]
7
+ l.text = "Chicken"
8
+ end
9
+
10
+ def button1__clicked(*args)
11
+ test
12
+ return
13
+ @model = @builder["tree1"].model
14
+ oinspect @model
15
+ row = @model.append
16
+ row[0] = 23.5
17
+ row[1] = 190
18
+ @builder["tree1"].hide
19
+ @builder["tree1"].show
20
+
21
+ end
22
+
23
+ def test
24
+ @items_model = Gtk::ListStore.new(Integer, String)
25
+ iter = @items_model.append
26
+ iter[0] = 132
27
+ iter[1] = "Chicken"
28
+ @builder["tree1"].model = @item_model
29
+
30
+ end
31
+
32
+
33
+ end
@@ -0,0 +1,7 @@
1
+
2
+
3
+ class VR_GtkWindow < Gtk::Window
4
+
5
+ include GladeGUI
6
+
7
+ end
@@ -0,0 +1,73 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generated with glade 3.40.0 -->
3
+ <interface>
4
+ <requires lib="gtk+" version="3.0"/>
5
+ <object class="GtkListStore" id="liststore1">
6
+ <columns>
7
+ <!-- column-name num1 -->
8
+ <column type="gfloat"/>
9
+ <!-- column-name num2 -->
10
+ <column type="gfloat"/>
11
+ </columns>
12
+ </object>
13
+ <object class="GtkWindow" id="window1">
14
+ <property name="width-request">100</property>
15
+ <property name="height-request">400</property>
16
+ <property name="can-focus">False</property>
17
+ <property name="modal">True</property>
18
+ <property name="window-position">center-always</property>
19
+ <child>
20
+ <object class="GtkBox">
21
+ <property name="visible">True</property>
22
+ <property name="can-focus">False</property>
23
+ <property name="orientation">vertical</property>
24
+ <property name="spacing">100</property>
25
+ <child>
26
+ <object class="GtkButton" id="button1">
27
+ <property name="label" translatable="yes">button</property>
28
+ <property name="visible">True</property>
29
+ <property name="can-focus">True</property>
30
+ <property name="receives-default">True</property>
31
+ </object>
32
+ <packing>
33
+ <property name="expand">False</property>
34
+ <property name="fill">True</property>
35
+ <property name="position">0</property>
36
+ </packing>
37
+ </child>
38
+ <child>
39
+ <object class="GtkLabel" id="label1">
40
+ <property name="visible">True</property>
41
+ <property name="can-focus">False</property>
42
+ <property name="margin-left">10</property>
43
+ <property name="margin-right">10</property>
44
+ <property name="margin-top">10</property>
45
+ <property name="margin-bottom">10</property>
46
+ <property name="label" translatable="yes">Test</property>
47
+ </object>
48
+ <packing>
49
+ <property name="expand">False</property>
50
+ <property name="fill">False</property>
51
+ <property name="position">1</property>
52
+ </packing>
53
+ </child>
54
+ <child>
55
+ <object class="GtkTreeView" id="tree1">
56
+ <property name="visible">True</property>
57
+ <property name="can-focus">True</property>
58
+ <property name="model">liststore1</property>
59
+ <property name="enable-grid-lines">both</property>
60
+ <child internal-child="selection">
61
+ <object class="GtkTreeSelection"/>
62
+ </child>
63
+ </object>
64
+ <packing>
65
+ <property name="expand">True</property>
66
+ <property name="fill">True</property>
67
+ <property name="position">2</property>
68
+ </packing>
69
+ </child>
70
+ </object>
71
+ </child>
72
+ </object>
73
+ </interface>
@@ -30,8 +30,6 @@ module VR
30
30
  #
31
31
  #
32
32
 
33
-
34
-
35
33
  def add_row(parent, hash = {})
36
34
  row = vr_row(model.append(parent))
37
35
  hash.each_pair { |key, val| row[key] = val }
data/lib/vrlib.rb CHANGED
@@ -7,6 +7,7 @@ require "fileutils"
7
7
 
8
8
  #tools go first
9
9
  require_relative "GladeGUI"
10
+ require_relative "VR_GtkWindow"
10
11
  require_relative "Alert"
11
12
  require_relative "DragDrop"
12
13
  require_relative "SavableClass"
@@ -1,10 +1,7 @@
1
- #!/usr/bin/ruby
2
1
 
3
2
  require "vrlib"
4
3
 
5
- # from require_all gem:
6
- require_rel 'src/'
7
-
4
+ require_relative "src/MyClass"
8
5
 
9
6
  MyClass.new.show_glade()
10
7
 
@@ -75,10 +75,7 @@ class VR_Document < GtkSource::View
75
75
  end
76
76
 
77
77
  def jump_to_line(line_num, search_str = nil)
78
- clear_events
79
- # while (Gtk.events_pending?)
80
- # Gtk.main_iteration
81
- # end
78
+ clear_events
82
79
  hilight_line(line_num)
83
80
  iter = buffer.get_iter_at(:line => line_num - 1)
84
81
  buffer.place_cursor(iter)
@@ -15,7 +15,7 @@ module VR_TabSearch
15
15
  def find_in_all(str)
16
16
  out = "Search Results for: " + str + "\n"
17
17
  Find.find(Dir.pwd) do |path|
18
- Find.prune if path =~ /\/glade$/ or path =~ /\/doc$/ #or File.directory?(path)
18
+ Find.prune if path =~ /\/glade$/ or path =~ /\/docs$/ #or File.directory?(path)
19
19
  if (File.extname(path) == ".rb" or File.extname(path) == ".erb") and not File.directory?(path)
20
20
  txt = File.open(path, "r").read
21
21
  out += scan_for_text(str, txt, path)
@@ -29,18 +29,13 @@ def set_up_key()
29
29
  @builder["dialog1"].hide
30
30
  return unless response_id == 1
31
31
  get_glade_all() #gets @username, @password
32
- alert(@username + @password)
33
32
  begin
34
33
  @http.start() do |h|
35
34
  req = Net::HTTP::Get.new("/api/v1/api_key.yaml")
36
- alert("1")
37
35
  req.basic_auth @username, @password
38
- response = h.request(req)
39
- alert("2")
40
- alert(response)
41
- obj = YAML.unsecure_load(response.body)
42
- key = obj[:rubygems_api_key]
43
- alert(key)
36
+ response = h.request(req)
37
+ obj = YAML.load(response.body)
38
+ key = obj[:rubygems_api_key]
44
39
  if key
45
40
  File.open(CREDENTIALS_FILE,"w",0600) { |f| f.write(YAML.dump(obj)) }
46
41
  else
@@ -0,0 +1,18 @@
1
+
2
+ class SplashWindow < Gtk::Window
3
+
4
+ def initialize()
5
+ super()
6
+ self.decorated = false
7
+ img = Gtk::Image.new(file: File.join($root, "img", "splash.png"))
8
+ img.visible = true
9
+ self.set_child(img)
10
+ # self.set_position(:center)
11
+ self.position = :center_always
12
+ self.set_keep_above(true)
13
+ self.position = :center_always
14
+ # puts File.join("..", "..", "img", "splash.png")
15
+
16
+ end
17
+
18
+ end
data/src/main/VR_Main.rb CHANGED
@@ -1,11 +1,13 @@
1
+
2
+
1
3
  class VR_Main
2
4
 
3
5
  include GladeGUI
4
6
 
5
7
  attr_accessor :proj_path, :tabs, :shell, :builder, :file_tree
6
8
 
7
- def initialize(argv, splash)
8
- @splash = splash
9
+ def initialize(argv)
10
+ # @splash = splash
9
11
  @proj_path = argv[0] ? argv[0] : Dir.pwd
10
12
  @proj_path = @proj_path.chomp("/")
11
13
  end
@@ -17,7 +19,10 @@ class VR_Main
17
19
 
18
20
  # load global settings (requires /home/visuaruby folder exists
19
21
  $VR_ENV_GLOBAL = VR::load_yaml(VR_ENV_GLOBAL, VR_ENV_GLOBAL::GLOBAL_SETTINGS_FILE)
20
-
22
+ if !File.exists?($VR_ENV_GLOBAL.default_project) or !File.exists?($VR_ENV_GLOBAL.projects_home) #start over
23
+ File.delete(VR_ENV_GLOBAL::GLOBAL_SETTINGS_FILE)
24
+ $VR_ENV_GLOBAL = VR::load_yaml(VR_ENV_GLOBAL, VR_ENV_GLOBAL::GLOBAL_SETTINGS_FILE)
25
+ end
21
26
 
22
27
  # try to open right project
23
28
  if not project_valid?(@proj_path)
@@ -51,11 +56,11 @@ class VR_Main
51
56
  @builder["scrolledRemoteGems"].add(@remote_gem_tree)
52
57
  @remote_gem_tree.show
53
58
 
54
- if not @splash.nil?
55
- @splash.destroy
56
- end
59
+ # if not @splash.nil?
60
+ # @splash.destroy
61
+ # end
57
62
 
58
- Gtk.main_quit #for splash
63
+ # Gtk.main_quit #for splash
59
64
 
60
65
  unless project_valid?(@proj_path)
61
66
  toolOpenFolder__clicked # should never gets here.
@@ -152,15 +157,16 @@ class VR_Main
152
157
  # @shell.buffer.text += `#{$VR_ENV.rdoc_command_line} 2>&1`
153
158
  # VR_Tools.replace_html_in_docs()
154
159
  # if File.exists?("yard_hack/index.html.replace")
155
- # FileUtils.copy("yard_hack/index.html.replace", "doc/index.html")
156
- # FileUtils.copy("yard_hack/index.html.replace", "doc/frames.html")
157
- # FileUtils.copy("yard_hack/common.css", "doc/css/common.css")
160
+ # FileUtils.copy("yard_hack/index.html.replace", "docs/index.html")
161
+ # FileUtils.copy("yard_hack/index.html.replace", "docs/frames.html")
162
+ # FileUtils.copy("yard_hack/common.css", "docs/css/common.css")
158
163
  # end
159
164
  #
160
165
  # end
161
166
 
162
167
  def toolMyYard__clicked(*a)
163
- return alert "Not available yet."
168
+ TestWindow.new.show_glade
169
+ return # alert "Not available yet."
164
170
  begin
165
171
  require "my_yard"
166
172
  rescue LoadError
@@ -170,7 +176,7 @@ class VR_Main
170
176
  end
171
177
 
172
178
  def toolViewRDoc__clicked(*a)
173
- VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{Dir.pwd}/doc/index.html")
179
+ VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} #{Dir.pwd}/docs/index.html")
174
180
  end
175
181
 
176
182
  def toolSave__clicked(*a) # saves open tab
@@ -194,19 +200,6 @@ class VR_Main
194
200
  end
195
201
  end
196
202
 
197
- def toolHome__clicked(*a)
198
- default_project = $VR_ENV_GLOBAL.default_project
199
- return if default_project == @proj_path
200
- if not project_valid?(default_project)
201
- alert("Your default home project is invalid:\n\n<b>#{default_project}</b>.\n\nGo to: Tools > Global Settings to set it.",
202
- parent: self, headline: "Invalid Home Project")
203
- return
204
- end
205
- return unless @tabs.try_to_save_all( ask: true, close: true)
206
- @proj_path = default_project
207
- load_project
208
- end
209
-
210
203
  def toolBackUp__clicked(*a)
211
204
  return unless @tabs.try_to_save_all(:ask=>true)
212
205
  VR_Tools.back_up()
@@ -295,7 +288,7 @@ class VR_Main
295
288
  end
296
289
 
297
290
  def menuTutorials__activate(*a)
298
- VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} http://www.visualruby.net")
291
+ VR_Tools.popen("#{$VR_ENV_GLOBAL.browser} https://beagle123.github.io/visualruby")
299
292
  end
300
293
 
301
294
  def menuInstallExamples__activate(*a)
data/src/main/VR_Tools.rb CHANGED
@@ -1,12 +1,14 @@
1
1
  module VR_Tools
2
2
 
3
- def VR_Tools.popen(cmd)
4
- begin
5
- IO.popen(cmd)
6
- rescue
3
+ def VR_Tools.popen(cmd)
4
+ begin
5
+ lines = IO.popen(cmd).readlines
6
+ lines ||= [""]
7
+ return lines.join()
8
+ rescue
7
9
  alert("The following command couldn't run:\n\n<b>#{cmd}</b>\n\nCheck the path in Tools > Settings." +
8
- "\n\nIn MS Windows you may need to add the 'start' command i.e. <b>'start glade'</b>")
9
- end
10
+ "\n\nIn MS Windows you may need to add the 'start' command i.e. <b>'start glade'</b>")
11
+ end
10
12
  end
11
13
 
12
14
  def VR_Tools.back_up()
@@ -62,14 +64,14 @@ END
62
64
  def VR_Tools.replace_html_in_docs()
63
65
  return if not File.file? "yard_hack/rdoc_replace.yaml"
64
66
  ar = YAML.load_file "yard_hack/rdoc_replace.yaml"
65
- Dir.glob("#{Dir.pwd}/doc/**/*.html") do |f|
67
+ Dir.glob("#{Dir.pwd}/docs/**/*.html") do |f|
66
68
  str = File.open(f).read
67
69
  ar.each do |pair|
68
70
  str.gsub!(pair[0], pair[1])
69
71
  end
70
72
  File.open(f, "w") { |file| file.puts(str) }
71
73
  end
72
- # FileUtils.cp "#{Dir.pwd}/rdoc.css", "#{Dir.pwd}/doc/rdoc.css" if File.file?("#{Dir.pwd}/rdoc.css") and File.directory?("#{Dir.pwd}/doc")
74
+ # FileUtils.cp "#{Dir.pwd}/rdoc.css", "#{Dir.pwd}/docs/rdoc.css" if File.file?("#{Dir.pwd}/rdoc.css") and File.directory?("#{Dir.pwd}/doc")
73
75
  end
74
76
 
75
77
  end