visualruby 1.0.12

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 (114) hide show
  1. checksums.yaml +7 -0
  2. data/bin/editor/VR_Document.rb +219 -0
  3. data/bin/editor/VR_TabSearch.rb +50 -0
  4. data/bin/editor/VR_Tabs.rb +99 -0
  5. data/bin/editor/VR_TextShell.rb +83 -0
  6. data/bin/editor/VR_TextViewCommon.rb +65 -0
  7. data/bin/editor/glade/VR_Document.glade +160 -0
  8. data/bin/main/GemTree.rb +23 -0
  9. data/bin/main/NewProjectGUI.rb +28 -0
  10. data/bin/main/ProjectChooserGUI.rb +41 -0
  11. data/bin/main/ProjectChooserView.rb +39 -0
  12. data/bin/main/RubygemsAPI.rb +93 -0
  13. data/bin/main/Splash.rb +22 -0
  14. data/bin/main/VR_ENV.rb +61 -0
  15. data/bin/main/VR_ENV_GLOBAL.rb +64 -0
  16. data/bin/main/VR_File_Tree.rb +120 -0
  17. data/bin/main/VR_Local_Gem_Tree.rb +80 -0
  18. data/bin/main/VR_Main.rb +313 -0
  19. data/bin/main/VR_Remote_Gem_Tree.rb +70 -0
  20. data/bin/main/glade/NewProjectGUI.glade +141 -0
  21. data/bin/main/glade/ProjectChooserGUI.glade +140 -0
  22. data/bin/main/glade/RubygemsAPI.glade +130 -0
  23. data/bin/main/glade/Splash.glade +18 -0
  24. data/bin/main/glade/VR_ENV.glade +168 -0
  25. data/bin/main/glade/VR_ENV_GLOBAL.glade +268 -0
  26. data/bin/main/glade/VR_File_Tree.glade +65 -0
  27. data/bin/main/glade/VR_Local_Gem_Tree.glade +45 -0
  28. data/bin/main/glade/VR_Main.glade +707 -0
  29. data/bin/main/glade/VR_Remote_Gem_Tree.glade +76 -0
  30. data/bin/tools/VR_Tools.rb +120 -0
  31. data/img/close.png +0 -0
  32. data/img/folder.png +0 -0
  33. data/img/glade.png +0 -0
  34. data/img/gtk-edit.png +0 -0
  35. data/img/obj.png +0 -0
  36. data/img/png.png +0 -0
  37. data/img/rb.png +0 -0
  38. data/img/ruby.png +0 -0
  39. data/img/splash.png +0 -0
  40. data/img/unknown.png +0 -0
  41. data/skeleton/document/New.glade +13 -0
  42. data/skeleton/document/NewWindow.rb +15 -0
  43. data/skeleton/project/bin/MyClass.rb +15 -0
  44. data/skeleton/project/bin/glade/MyClass.glade +45 -0
  45. data/skeleton/project/main.rb +14 -0
  46. data/visualruby_examples/active_record/.vr_settings.yaml +47 -0
  47. data/visualruby_examples/active_record/active_record.rb +52 -0
  48. data/visualruby_examples/active_record/bin/ChoosePerson.rb +17 -0
  49. data/visualruby_examples/active_record/bin/Person.rb +13 -0
  50. data/visualruby_examples/active_record/bin/glade/ChoosePerson.glade +61 -0
  51. data/visualruby_examples/active_record/bin/glade/Person.glade +148 -0
  52. data/visualruby_examples/active_record/db/development.sqlite3 +0 -0
  53. data/visualruby_examples/active_record2/.vr_settings.yaml +48 -0
  54. data/visualruby_examples/active_record2/active_record2.rb +142 -0
  55. data/visualruby_examples/active_record2/bin/CompanyGUI.rb +54 -0
  56. data/visualruby_examples/active_record2/bin/Employee.rb +20 -0
  57. data/visualruby_examples/active_record2/bin/Employer.rb +11 -0
  58. data/visualruby_examples/active_record2/bin/Paycheck.rb +11 -0
  59. data/visualruby_examples/active_record2/bin/glade/CompanyGUI.glade +167 -0
  60. data/visualruby_examples/active_record2/bin/glade/Employee.glade +123 -0
  61. data/visualruby_examples/active_record2/bin/glade/Employer.glade +147 -0
  62. data/visualruby_examples/active_record2/bin/glade/Paycheck.glade +145 -0
  63. data/visualruby_examples/active_record2/db/development.sqlite3 +0 -0
  64. data/visualruby_examples/all_widgets/.vr_settings.yaml +20 -0
  65. data/visualruby_examples/all_widgets/all_widgets.rb +13 -0
  66. data/visualruby_examples/all_widgets/bin/AllWidgets.rb +43 -0
  67. data/visualruby_examples/all_widgets/bin/glade/AllWidgets.glade +166 -0
  68. data/visualruby_examples/all_widgets/bin/splash.png +0 -0
  69. data/visualruby_examples/calculator/.vr_settings.yaml +21 -0
  70. data/visualruby_examples/calculator/bin/Calculator.rb +63 -0
  71. data/visualruby_examples/calculator/bin/glade/Calculator.glade +243 -0
  72. data/visualruby_examples/calculator/main.rb +13 -0
  73. data/visualruby_examples/child_window/.vr_settings.yaml +46 -0
  74. data/visualruby_examples/child_window/bin/ChildWindowDemo.rb +41 -0
  75. data/visualruby_examples/child_window/bin/MyChildClass.rb +42 -0
  76. data/visualruby_examples/child_window/bin/glade/ChildWindowDemo.glade +101 -0
  77. data/visualruby_examples/child_window/bin/glade/MyChildClass.glade +58 -0
  78. data/visualruby_examples/child_window/main.rb +13 -0
  79. data/visualruby_examples/drag_drop/.vr_settings.yaml +19 -0
  80. data/visualruby_examples/drag_drop/bin/DragDropDemo.rb +45 -0
  81. data/visualruby_examples/drag_drop/bin/glade/DragDropDemo.glade +143 -0
  82. data/visualruby_examples/drag_drop/img/folder.png +0 -0
  83. data/visualruby_examples/drag_drop/img/glade.png +0 -0
  84. data/visualruby_examples/drag_drop/img/gtk-edit.png +0 -0
  85. data/visualruby_examples/drag_drop/img/obj.png +0 -0
  86. data/visualruby_examples/drag_drop/img/png.png +0 -0
  87. data/visualruby_examples/drag_drop/img/rb.png +0 -0
  88. data/visualruby_examples/drag_drop/img/ruby.png +0 -0
  89. data/visualruby_examples/drag_drop/img/unknown.png +0 -0
  90. data/visualruby_examples/drag_drop/main.rb +14 -0
  91. data/visualruby_examples/listview/.vr_settings.yaml +46 -0
  92. data/visualruby_examples/listview/bin/SongListView.rb +89 -0
  93. data/visualruby_examples/listview/bin/SongListViewGUI.rb +67 -0
  94. data/visualruby_examples/listview/bin/audio-x-generic.png +0 -0
  95. data/visualruby_examples/listview/bin/glade/SongListViewGUI.glade +220 -0
  96. data/visualruby_examples/listview/main.rb +19 -0
  97. data/visualruby_examples/listview_objects/.vr_settings.yaml +46 -0
  98. data/visualruby_examples/listview_objects/bin/DataObject.rb +32 -0
  99. data/visualruby_examples/listview_objects/bin/DataObjectGUI.rb +41 -0
  100. data/visualruby_examples/listview_objects/bin/ListViewObjects.rb +34 -0
  101. data/visualruby_examples/listview_objects/bin/ListViewObjectsGUI.rb +18 -0
  102. data/visualruby_examples/listview_objects/bin/glade/DataObject.glade +198 -0
  103. data/visualruby_examples/listview_objects/bin/glade/ListViewObjectsGUI.glade +102 -0
  104. data/visualruby_examples/listview_objects/main.rb +13 -0
  105. data/visualruby_examples/simple_ruby_gui/.vr_settings.yaml +45 -0
  106. data/visualruby_examples/simple_ruby_gui/bin/DataObjectGUI.rb +20 -0
  107. data/visualruby_examples/simple_ruby_gui/bin/glade/DataObjectGUI.glade +163 -0
  108. data/visualruby_examples/simple_ruby_gui/simple_ruby_gui +16 -0
  109. data/visualruby_examples/treeview/.vr_settings.yaml +18 -0
  110. data/visualruby_examples/treeview/bin/MyClass.rb +28 -0
  111. data/visualruby_examples/treeview/bin/glade/MyClass.glade +48 -0
  112. data/visualruby_examples/treeview/main.rb +14 -0
  113. data/vr +40 -0
  114. metadata +202 -0
@@ -0,0 +1,76 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkMenu" id="popGem">
6
+ <property name="visible">True</property>
7
+ <child>
8
+ <object class="GtkMenuItem" id="popOpenRubygemsPage">
9
+ <property name="visible">True</property>
10
+ <property name="tooltip_text" translatable="yes">Open this gem's page on rubygems.org</property>
11
+ <property name="label" translatable="yes">Open rubygems Project Page</property>
12
+ <property name="use_underline">True</property>
13
+ <signal name="activate" handler="popOpenRubygemsPage_clicked"/>
14
+ </object>
15
+ </child>
16
+ <child>
17
+ <object class="GtkMenuItem" id="popOpenHomepage">
18
+ <property name="visible">True</property>
19
+ <property name="tooltip_text" translatable="yes">Open gem's homepage in the default web browser.</property>
20
+ <property name="label" translatable="yes">Open Homepage</property>
21
+ <property name="use_underline">True</property>
22
+ <signal name="activate" handler="popOpenHomepage_clicked"/>
23
+ </object>
24
+ </child>
25
+ <child>
26
+ <object class="GtkMenuItem" id="popYank">
27
+ <property name="visible">True</property>
28
+ <property name="tooltip_text" translatable="yes">Removes the gem from rubygems.org so nobody can download it.</property>
29
+ <property name="label" translatable="yes">Yank Gem From rubygems.org</property>
30
+ <property name="use_underline">True</property>
31
+ <signal name="activate" handler="popYank_clicked"/>
32
+ </object>
33
+ </child>
34
+ </object>
35
+ <object class="GtkWindow" id="window1">
36
+ <property name="window_position">center-on-parent</property>
37
+ <signal name="destroy" handler="destroy_window"/>
38
+ <child>
39
+ <object class="GtkHBox" id="hbox1">
40
+ <property name="visible">True</property>
41
+ <child>
42
+ <object class="GtkVBox" id="vbox1">
43
+ <property name="visible">True</property>
44
+ <child>
45
+ <object class="GtkLabel" id="label2">
46
+ <property name="visible">True</property>
47
+ <property name="label" translatable="yes">&lt;big&gt;&lt;big&gt;Contacting Rubygems.org...&lt;/big&gt;&lt;/big&gt;
48
+ Please wait while the names of your gems are downloaded. Yanking old versions of your gems, makes this process faster.</property>
49
+ <property name="use_markup">True</property>
50
+ <property name="wrap">True</property>
51
+ </object>
52
+ <packing>
53
+ <property name="padding">15</property>
54
+ <property name="position">0</property>
55
+ </packing>
56
+ </child>
57
+ <child>
58
+ <object class="GtkProgressBar" id="progressbar1">
59
+ <property name="visible">True</property>
60
+ </object>
61
+ <packing>
62
+ <property name="expand">False</property>
63
+ <property name="padding">20</property>
64
+ <property name="position">1</property>
65
+ </packing>
66
+ </child>
67
+ </object>
68
+ <packing>
69
+ <property name="padding">15</property>
70
+ <property name="position">0</property>
71
+ </packing>
72
+ </child>
73
+ </object>
74
+ </child>
75
+ </object>
76
+ </interface>
@@ -0,0 +1,120 @@
1
+ module VR_Tools
2
+
3
+ def VR_Tools.popen(cmd)
4
+ begin
5
+ IO.popen(cmd)
6
+ rescue
7
+ VR::Dialog.message_box("The following command couldn't run:\n\n#{cmd}\n\nCheck the path in Tools > Settings")
8
+ end
9
+ end
10
+
11
+ # def VR_Tools.sudo_command(command)
12
+ # @pass ||= ""
13
+ # if @pass.strip() == ""
14
+ # @pass = VR::Dialog.input_box("Enter System Password:")
15
+ # end
16
+ # result = command + "\n" + `echo #{@pass} | sudo -S #{command}`
17
+ # @pass = "" if result.include? "incorrect password"
18
+ # return result
19
+ # end
20
+
21
+ def VR_Tools.create_desktop_launcher()
22
+ command = "vr " + Dir.pwd
23
+ name = File.basename(Dir.pwd) + " Project"
24
+ str = <<END
25
+
26
+ #!/usr/bin/env xdg-open
27
+
28
+ [Desktop Entry]
29
+ Version=1.0
30
+ Type=Application
31
+ Terminal=false
32
+ Icon[en_US]=gnome-panel-launcher
33
+ Name[en_US]=#{name}
34
+ Exec=#{command}
35
+ Comment[en_US]=Opens a Visual Ruby project
36
+ Name=#{name}
37
+ Comment=Opens a Visual Ruby project
38
+ Icon=gnome-panel-launcher
39
+
40
+ END
41
+ return unless File.directory?(ENV["HOME"] + "/Desktop")
42
+ fn = ENV["HOME"] + "/Desktop/" + name + ".desktop"
43
+ File.open(fn,"w") { |f| f.puts(str) }
44
+ File.chmod(0755, fn)
45
+ VR::Dialog.message_box("Created launcher:\n" + name + "\non your computer's desktop")
46
+ end
47
+
48
+ def VR_Tools.back_up()
49
+ path = File.join(ENV["HOME"], "visualruby_backup", Dir.pwd.gsub(ENV["HOME"], ""))
50
+ t = Time.now
51
+ out_dir = path + "/" + Dir.pwd.split("/").last + " Backup " + t.month().to_s + '-' + t.day().to_s + "-" + t.year().to_s + " at " + t.strftime('%I %M%p')
52
+ copy_recursively(Dir.pwd, out_dir)
53
+ VR::Dialog.message_box("Files backed up to: \n\n" + path)
54
+ end
55
+
56
+ def VR_Tools.copy_recursively(from, out_dir)
57
+ Find.find(from) do |path|
58
+ next if path == from
59
+ rel_path = path.gsub(from, "")
60
+ if File.directory?(path)
61
+ FileUtils.makedirs(out_dir + rel_path)
62
+ else
63
+ if not File.directory?(out_dir + File.dirname(rel_path))
64
+ FileUtils.makedirs(out_dir + File.dirname(rel_path))
65
+ end
66
+ FileUtils.copy(path, out_dir + rel_path)
67
+ end
68
+ end
69
+ end
70
+
71
+ def self.create_gemspec()
72
+ main_file = $VR_ENV.run_command_line.split(" ")[1]
73
+ main_path = "."
74
+ bindir = "'.'" #( main_path == "bin") ? "'bin'" : "'#{main_path}', 'bin'"
75
+ libdir = "'.'" #(main_path == "lib") ? "'lib'" : "'#{main_path}', 'lib'"
76
+ str = <<END
77
+ Gem::Specification.new do |s|
78
+ s.name = "#{File.basename(Dir.pwd).downcase}" # i.e. visualruby. This name will show up in the gem list.
79
+ s.version = "0.0.1" # i.e. (major,non-backwards compatable).(backwards compatable).(bugfix)
80
+ s.add_dependency "vrlib", ">= 0.0.1"
81
+ s.add_dependency "gtk2", ">= 0.0.1"
82
+ s.add_dependency "require_all", ">= 0.0.1"
83
+ s.has_rdoc = false
84
+ s.authors = ["Your Name"]
85
+ s.email = "you@yoursite.com" # optional
86
+ s.summary = "Short Description Here." # optional
87
+ s.homepage = "http://www.yoursite.org/" # optional
88
+ s.description = "Full description here" # optional
89
+ s.executables = ['#{main_file}'] # i.e. 'vr' (optional, blank if library project)
90
+ s.default_executable = ['#{main_file}'] # i.e. 'vr' (optional, blank if library project)
91
+ s.bindir = [#{bindir}] # optional, default = bin
92
+ s.require_paths = [#{libdir}] # optional, default = lib
93
+ s.files = Dir.glob(File.join("**", "*.{rb,glade}"))
94
+ s.rubyforge_project = "nowarning" # supress warning message
95
+ end
96
+ END
97
+ name = Dir.pwd + "/" + File.basename(Dir.pwd).downcase + ".gemspec"
98
+ if File.file?(name)
99
+ return false if not VR::Dialog.ok_box("Do you want to overwrite existing #{name}?")
100
+ end
101
+ File.open(name, "w") { |f| f.puts(str) }
102
+ return name
103
+ end
104
+
105
+ #this works on Dir.pwd that's maybe different from project
106
+ def VR_Tools.replace_html_in_docs()
107
+ ar = YAML.load_file "rdoc_replace.yaml"
108
+ Dir.glob("#{Dir.pwd}/doc/**/*.html") do |f|
109
+ str = File.open(f).read
110
+ ar.each do |pair|
111
+ str.gsub!(pair[0], pair[1])
112
+ end
113
+ File.open(f, "w") { |file| file.puts(str) }
114
+ end
115
+ FileUtils.cp "#{Dir.pwd}/rdoc.css", "#{Dir.pwd}/doc/rdoc.css" if File.file?("#{Dir.pwd}/rdoc.css") and File.directory?("#{Dir.pwd}/doc")
116
+ end
117
+
118
+ end
119
+
120
+
data/img/close.png ADDED
Binary file
data/img/folder.png ADDED
Binary file
data/img/glade.png ADDED
Binary file
data/img/gtk-edit.png ADDED
Binary file
data/img/obj.png ADDED
Binary file
data/img/png.png ADDED
Binary file
data/img/rb.png ADDED
Binary file
data/img/ruby.png ADDED
Binary file
data/img/splash.png ADDED
Binary file
data/img/unknown.png ADDED
Binary file
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="modal">True</property>
8
+ <signal name="destroy" handler="destroy_window"/>
9
+ <child>
10
+ <placeholder/>
11
+ </child>
12
+ </object>
13
+ </interface>
@@ -0,0 +1,15 @@
1
+
2
+ class MyClass #(change name)
3
+
4
+ include GladeGUI
5
+
6
+ #code that runs immediately before the #show method of this class
7
+ def before_show()
8
+ @var1 = "Hello World"
9
+ end
10
+
11
+ def widget__clicked(*args)
12
+ #code that runs when widget named "widget" in glade is clicked.
13
+ end
14
+
15
+ end
@@ -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 = @builder["button1"].label == "Hello World" ? "Goodbye World" : "Hello World"
12
+ end
13
+
14
+ end
15
+
@@ -0,0 +1,45 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="can_focus">False</property>
8
+ <property name="modal">True</property>
9
+ <property name="window_position">center-always</property>
10
+ <property name="default_width">300</property>
11
+ <property name="default_height">200</property>
12
+ <signal name="destroy" handler="destroy_window" swapped="no"/>
13
+ <child>
14
+ <object class="GtkVBox" id="vbox1">
15
+ <property name="visible">True</property>
16
+ <property name="can_focus">False</property>
17
+ <child>
18
+ <object class="GtkHButtonBox" id="hbuttonbox1">
19
+ <property name="visible">True</property>
20
+ <property name="can_focus">False</property>
21
+ <child>
22
+ <object class="GtkButton" id="button1">
23
+ <property name="label" translatable="yes">button</property>
24
+ <property name="visible">True</property>
25
+ <property name="can_focus">True</property>
26
+ <property name="receives_default">True</property>
27
+ <property name="use_action_appearance">False</property>
28
+ </object>
29
+ <packing>
30
+ <property name="expand">False</property>
31
+ <property name="fill">False</property>
32
+ <property name="position">0</property>
33
+ </packing>
34
+ </child>
35
+ </object>
36
+ <packing>
37
+ <property name="expand">True</property>
38
+ <property name="fill">True</property>
39
+ <property name="position">0</property>
40
+ </packing>
41
+ </child>
42
+ </object>
43
+ </child>
44
+ </object>
45
+ </interface>
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'vrlib'
4
+
5
+ #make program output in real time so errors visible in VR.
6
+ STDOUT.sync = true
7
+ STDERR.sync = true
8
+
9
+ #everything in these directories will be included
10
+ my_path = File.expand_path(File.dirname(__FILE__))
11
+ require_all Dir.glob(my_path + "/bin/**/*.rb")
12
+
13
+ MyClass.new.show
14
+
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:VR_ENV
2
+ backup_path: /home/eric
3
+ browser: firefox
4
+ current_file: /home/eric/vrp/vrx/visualruby_examples/active_record/active_record.rb
5
+ font_name: Monospace 10
6
+ glade_path: glade-gtk2
7
+ height: 674
8
+ open_files:
9
+ - /home/eric/vrp/vrx/visualruby_examples/active_record/bin/Person.rb
10
+ - /home/eric/vrp/vrx/visualruby_examples/active_record/bin/ChoosePerson.rb
11
+ - /home/eric/vrp/vrx/visualruby_examples/active_record/active_record.rb
12
+ open_folders:
13
+ - /home/eric/vrp/vrx/visualruby_examples/active_record
14
+ - /home/eric/vrp/vrx/visualruby_examples/active_record/bin
15
+ - /home/eric/vrp/vrx/visualruby_examples/active_record/bin/glade
16
+ - /home/eric/vrp/vrx/visualruby_examples/active_record/db
17
+ panel_pos: 453
18
+ rdoc_command_line: rdoc -x README
19
+ run_command_line: ruby active_record.rb
20
+ tab_spaces: 2
21
+ width: 934
22
+ builder: !ruby/object:Gtk::Builder {}
23
+ glade_box: !ruby/object:VR::SimpleComboBoxEntry {}
24
+ browser_box: !ruby/object:VR::SimpleComboBoxEntry {}
25
+ buttonChooseFolder: ! '...'
26
+ vbox1: !ruby/object:Gtk::VBox {}
27
+ label7: ! 'Editor Font:'
28
+ label3: ! 'Back-up Path:'
29
+ window1: !ruby/object:Gtk::Window {}
30
+ hbuttonbox1: !ruby/object:Gtk::HButtonBox {}
31
+ buttonCancel: Cancel
32
+ label8: ! 'RDoc Command Line: '
33
+ table1: !ruby/object:Gtk::Table {}
34
+ buttonTryBrowser: Try
35
+ buttonSave: Save
36
+ hboxBrowser: !ruby/object:Gtk::HBox {}
37
+ hboxGlade: !ruby/object:Gtk::HBox {}
38
+ label1: <big><big><b>Visual Ruby Settings</b></big></big>
39
+ label2: ! 'Browser Command Line:'
40
+ label4: ! 'Spaces for Each Tab in Editor:'
41
+ label5: ! 'Glade Command Line:'
42
+ label6: ! 'Command Line when "Run" is pressed:'
43
+ hbox1: !ruby/object:Gtk::HBox {}
44
+ hbox2: !ruby/object:Gtk::HBox {}
45
+ hbox3: !ruby/object:Gtk::HBox {}
46
+ hbox4: !ruby/object:Gtk::HBox {}
47
+ buttonTryGlade: Try
@@ -0,0 +1,52 @@
1
+ require 'vrlib.rb'
2
+ require 'active_record'
3
+
4
+ #make program output in real time so errors visible in VR.
5
+ STDOUT.sync = true
6
+ STDERR.sync = true
7
+
8
+ #everything in these directories will be included
9
+ my_path = File.expand_path(File.dirname(__FILE__))
10
+ require_all Dir.glob(my_path + "/lib/**/*.rb")
11
+ require_all Dir.glob(my_path + "/bin/**/*.rb")
12
+
13
+ ActiveRecord::Base.establish_connection(
14
+ :adapter => "sqlite3",
15
+ :database => "db/development.sqlite3",
16
+ )
17
+
18
+ ChoosePerson.new.show
19
+
20
+
21
+ #ActiveRecord::Schema.define do
22
+ # create_table :people do |table|
23
+ # table.column :name, :string
24
+ # table.column :address, :string
25
+ # table.column :phone, :string
26
+ # table.column :email, :string
27
+ # end
28
+ #end
29
+ #
30
+ #p = Person.create
31
+ #p.name = "Beaufort Klinkscale"
32
+ #p.address = "4675 St Bernard Wy, Lincoln, NE 83748"
33
+ #p.phone = "384-4859"
34
+ #p.email = "beaubeau@klink.com"
35
+ #p.save
36
+ #
37
+ #p = Person.create
38
+ #p.name = "Alex Frederickson"
39
+ #p.address = "675 Westgate, Alexandria, VA 94844"
40
+ #p.phone = "844-4839"
41
+ #p.email = "alex@visualruby.net"
42
+ #p.save
43
+ #
44
+ #p = Person.create
45
+ #p.name = "Tony Williams"
46
+ #p.address = "12 Harvard Ct., Hemet, CA 94849"
47
+ #p.phone = "435-4439"
48
+ #p.email = "bigtony@yahoooo.com"
49
+ #p.save
50
+ #
51
+ #
52
+ #
@@ -0,0 +1,17 @@
1
+
2
+ class ChoosePerson < VR::ListView
3
+
4
+ include GladeGUI
5
+
6
+ def initialize()
7
+ super(:person => Person) # Person class
8
+ end
9
+
10
+ def before_show()
11
+ @builder["scrolledwindow1"].add(self)
12
+ Person.all.each do |p|
13
+ row = add_row(:person => p)
14
+ end
15
+ end
16
+
17
+ end
@@ -0,0 +1,13 @@
1
+ class Person < ActiveRecord::Base
2
+
3
+ include GladeGUI
4
+
5
+ def before_show
6
+ set_glade_all()
7
+ end
8
+
9
+ def to_s
10
+ "#{self.name} (#{self.email})"
11
+ end
12
+
13
+ end
@@ -0,0 +1,61 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.16"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="can_focus">False</property>
8
+ <property name="modal">True</property>
9
+ <property name="default_width">500</property>
10
+ <property name="default_height">300</property>
11
+ <signal name="destroy" handler="destroy_window" swapped="no"/>
12
+ <child>
13
+ <object class="GtkHBox" id="hbox1">
14
+ <property name="visible">True</property>
15
+ <property name="can_focus">False</property>
16
+ <child>
17
+ <object class="GtkVBox" id="vbox1">
18
+ <property name="visible">True</property>
19
+ <property name="can_focus">False</property>
20
+ <child>
21
+ <object class="GtkLabel" id="label1">
22
+ <property name="visible">True</property>
23
+ <property name="can_focus">False</property>
24
+ <property name="label" translatable="yes">&lt;big&gt;&lt;big&gt;Choose Person:&lt;/big&gt;&lt;/big&gt;</property>
25
+ <property name="use_markup">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
+ <child>
34
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
35
+ <property name="visible">True</property>
36
+ <property name="can_focus">True</property>
37
+ <property name="hscrollbar_policy">automatic</property>
38
+ <property name="vscrollbar_policy">automatic</property>
39
+ <child>
40
+ <placeholder/>
41
+ </child>
42
+ </object>
43
+ <packing>
44
+ <property name="expand">True</property>
45
+ <property name="fill">True</property>
46
+ <property name="padding">20</property>
47
+ <property name="position">1</property>
48
+ </packing>
49
+ </child>
50
+ </object>
51
+ <packing>
52
+ <property name="expand">True</property>
53
+ <property name="fill">True</property>
54
+ <property name="padding">15</property>
55
+ <property name="position">0</property>
56
+ </packing>
57
+ </child>
58
+ </object>
59
+ </child>
60
+ </object>
61
+ </interface>