visualruby 1.0.19 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/Splash.rb +40 -0
  3. data/bin/editor/VR_Document.rb +81 -74
  4. data/bin/editor/VR_TabSearch.rb +5 -7
  5. data/bin/editor/VR_Tabs.rb +57 -36
  6. data/bin/editor/VR_TextShell.rb +12 -34
  7. data/bin/editor/VR_TextViewCommon.rb +9 -28
  8. data/bin/main/NewProjectGUI.rb +14 -13
  9. data/bin/main/OpenProject.rb +69 -0
  10. data/bin/main/ProjectChooserView.rb +3 -2
  11. data/bin/main/ProjectTree.rb +25 -0
  12. data/bin/main/RubygemsAPI.rb +15 -11
  13. data/bin/main/VR_ENV.rb +38 -60
  14. data/bin/main/VR_ENV_GLOBAL.rb +45 -44
  15. data/bin/main/VR_File_Tree.rb +29 -21
  16. data/bin/main/VR_Local_Gem_Tree.rb +4 -19
  17. data/bin/main/VR_Main.rb +128 -144
  18. data/bin/main/VR_Remote_Gem_Tree.rb +6 -19
  19. data/bin/main/glade/NewProjectGUI.glade +94 -98
  20. data/bin/main/glade/OpenProject.glade +259 -0
  21. data/bin/main/glade/RubygemsAPI.glade +98 -62
  22. data/bin/main/glade/VR_ENV.glade +46 -55
  23. data/bin/main/glade/VR_ENV_GLOBAL.glade +251 -180
  24. data/bin/main/glade/VR_File_Tree.glade +25 -16
  25. data/bin/main/glade/VR_Local_Gem_Tree.glade +16 -8
  26. data/bin/main/glade/VR_Main.glade +410 -449
  27. data/bin/main/glade/VR_Remote_Gem_Tree.glade +33 -31
  28. data/bin/tools/VR_Tools.rb +60 -46
  29. data/{visualruby_examples → examples}/active_record/active_record.rb +16 -10
  30. data/{visualruby_examples → examples}/active_record/bin/ChoosePerson.rb +7 -0
  31. data/examples/active_record/bin/Person.rb +21 -0
  32. data/examples/active_record/bin/glade/ChoosePerson.glade +89 -0
  33. data/examples/active_record/bin/glade/Person.glade +197 -0
  34. data/{visualruby_examples → examples}/active_record/db/development.sqlite3 +0 -0
  35. data/{visualruby_examples → examples}/active_record2/bin/CompanyGUI.rb +7 -7
  36. data/{visualruby_examples → examples}/active_record2/bin/Employee.rb +0 -0
  37. data/{visualruby_examples → examples}/active_record2/bin/Employer.rb +0 -0
  38. data/{visualruby_examples → examples}/active_record2/bin/Paycheck.rb +0 -0
  39. data/examples/active_record2/bin/glade/CompanyGUI.glade +149 -0
  40. data/examples/active_record2/bin/glade/Employee.glade +126 -0
  41. data/{visualruby_examples → examples}/active_record2/bin/glade/Employer.glade +0 -0
  42. data/{visualruby_examples → examples}/active_record2/bin/glade/Paycheck.glade +0 -0
  43. data/{visualruby_examples → examples}/active_record2/db/development.sqlite3 +0 -0
  44. data/{visualruby_examples → examples}/active_record2/main.rb +15 -9
  45. data/examples/alert_box/bin/AlertBoxDemo.rb +80 -0
  46. data/examples/alert_box/bin/glade/AlertBoxDemo.glade +234 -0
  47. data/examples/alert_box/main.rb +12 -0
  48. data/{visualruby_examples → examples}/all_widgets/bin/AllWidgets.rb +18 -10
  49. data/{visualruby_examples → examples}/all_widgets/bin/glade/AllWidgets.glade +52 -16
  50. data/{visualruby_examples → examples}/all_widgets/bin/splash.png +0 -0
  51. data/examples/all_widgets/main.rb +12 -0
  52. data/{visualruby_examples → examples}/calculator/bin/Calculator.rb +23 -22
  53. data/{visualruby_examples → examples}/calculator/bin/glade/Calculator.glade +81 -51
  54. data/examples/calculator/main.rb +13 -0
  55. data/examples/child_window/bin/ChildWindowDemo.rb +52 -0
  56. data/examples/child_window/bin/ModalWindow.rb +9 -0
  57. data/examples/child_window/bin/ModelessWindow.rb +9 -0
  58. data/examples/child_window/bin/MyChildClass.rb +21 -0
  59. data/examples/child_window/bin/glade/ChildWindowDemo.glade +87 -0
  60. data/examples/child_window/bin/glade/ModalWindow.glade +61 -0
  61. data/examples/child_window/bin/glade/ModelessWindow.glade +61 -0
  62. data/{visualruby_examples → examples}/child_window/bin/glade/MyChildClass.glade +14 -12
  63. data/examples/child_window/main.rb +12 -0
  64. data/{visualruby_examples → examples}/drag_drop/bin/DragDropDemo.rb +9 -10
  65. data/examples/drag_drop/bin/glade/DragDropDemo.glade +161 -0
  66. data/{visualruby_examples → examples}/drag_drop/img/folder.png +0 -0
  67. data/{visualruby_examples → examples}/drag_drop/img/glade.png +0 -0
  68. data/{visualruby_examples → examples}/drag_drop/img/gtk-edit.png +0 -0
  69. data/{visualruby_examples → examples}/drag_drop/img/obj.png +0 -0
  70. data/{visualruby_examples → examples}/drag_drop/img/png.png +0 -0
  71. data/{visualruby_examples → examples}/drag_drop/img/rb.png +0 -0
  72. data/{visualruby_examples → examples}/drag_drop/img/ruby.png +0 -0
  73. data/{visualruby_examples → examples}/drag_drop/img/unknown.png +0 -0
  74. data/examples/drag_drop/main.rb +11 -0
  75. data/examples/filetreeview/bin/ProjectTree.rb +32 -0
  76. data/examples/filetreeview/bin/ProjectTreeGUI.rb +28 -0
  77. data/examples/filetreeview/bin/glade/ProjectTreeGUI.glade +156 -0
  78. data/examples/filetreeview/main.rb +13 -0
  79. data/{visualruby_examples → examples}/listview/bin/SongListView.rb +24 -20
  80. data/{visualruby_examples → examples}/listview/bin/SongListViewGUI.rb +12 -11
  81. data/{visualruby_examples → examples}/listview/bin/audio-x-generic.png +0 -0
  82. data/examples/listview/bin/glade/SongListViewGUI.glade +195 -0
  83. data/examples/listview/main.rb +10 -0
  84. data/examples/listview_objects/bin/DataObject.rb +53 -0
  85. data/{visualruby_examples → examples}/listview_objects/bin/ListViewObjects.rb +7 -4
  86. data/examples/listview_objects/bin/ListViewObjectsGUI.rb +26 -0
  87. data/examples/listview_objects/bin/glade/DataObject.glade +196 -0
  88. data/examples/listview_objects/bin/glade/ListViewObjectsGUI.glade +87 -0
  89. data/examples/listview_objects/main.rb +12 -0
  90. data/examples/settings_file/bin/MainApp.rb +38 -0
  91. data/examples/settings_file/bin/SavableSettings.rb +39 -0
  92. data/examples/settings_file/bin/glade/MainApp.glade +87 -0
  93. data/examples/settings_file/bin/glade/SavableSettings.glade +162 -0
  94. data/examples/settings_file/main.rb +14 -0
  95. data/examples/settings_file/settings.yaml +15 -0
  96. data/examples/simple_ruby_gui/bin/DataObjectGUI.rb +21 -0
  97. data/examples/simple_ruby_gui/bin/glade/DataObjectGUI.glade +195 -0
  98. data/examples/simple_ruby_gui/main.rb +16 -0
  99. data/{visualruby_examples → examples}/treeview/bin/MyClass.rb +1 -5
  100. data/examples/treeview/bin/glade/MyClass.glade +24 -0
  101. data/examples/treeview/main.rb +13 -0
  102. data/skeleton/document/New.glade +3 -4
  103. data/skeleton/document/NewWindow.rb +1 -1
  104. data/skeleton/project/bin/MyClass.rb +2 -2
  105. data/skeleton/project/bin/glade/MyClass.glade +12 -26
  106. data/skeleton/project/main.rb +4 -8
  107. data/vr +41 -37
  108. data/vrlib/lib/Alert.rb +67 -0
  109. data/vrlib/lib/DragDrop.rb +90 -0
  110. data/vrlib/lib/GladeGUI.rb +433 -0
  111. data/vrlib/lib/IconHash.rb +18 -0
  112. data/vrlib/lib/SavableClass.rb +56 -0
  113. data/vrlib/lib/SimpleComboBoxEntry.rb +8 -0
  114. data/vrlib/lib/glade/Alert.glade +119 -0
  115. data/vrlib/lib/treeview/FileTreeView.rb +113 -0
  116. data/vrlib/lib/treeview/IterMethods.rb +82 -0
  117. data/vrlib/lib/treeview/ListView.rb +85 -0
  118. data/vrlib/lib/treeview/TreeView.rb +43 -0
  119. data/vrlib/lib/treeview/ViewCommon.rb +370 -0
  120. data/vrlib/lib/treeview/columns/CalendarCol.rb +89 -0
  121. data/vrlib/lib/treeview/columns/CellRendererCombo.rb +66 -0
  122. data/vrlib/lib/treeview/columns/CellRendererDate.rb +45 -0
  123. data/vrlib/lib/treeview/columns/CellRendererObject.rb +57 -0
  124. data/vrlib/lib/treeview/columns/CellRendererPhone.rb +45 -0
  125. data/vrlib/lib/treeview/columns/CellRendererPixbuf.rb +16 -0
  126. data/vrlib/lib/treeview/columns/CellRendererProgress.rb +17 -0
  127. data/vrlib/lib/treeview/columns/CellRendererSpin.rb +37 -0
  128. data/vrlib/lib/treeview/columns/CellRendererText.rb +38 -0
  129. data/vrlib/lib/treeview/columns/CellRendererToggle.rb +47 -0
  130. data/vrlib/lib/treeview/columns/ComboCol.rb +43 -0
  131. data/vrlib/lib/treeview/columns/CurrencyCol.rb +23 -0
  132. data/vrlib/lib/treeview/columns/DateCol.rb +20 -0
  133. data/vrlib/lib/treeview/columns/ImageCol.rb +27 -0
  134. data/vrlib/lib/treeview/columns/ProgressCol.rb +27 -0
  135. data/vrlib/lib/treeview/columns/SpinCol.rb +11 -0
  136. data/vrlib/lib/treeview/columns/TextCol.rb +65 -0
  137. data/vrlib/lib/treeview/columns/TreeViewColumn.rb +93 -0
  138. data/{bin/main/glade/ProjectChooserGUI.glade → vrlib/lib/treeview/columns/glade/CalendarCol.glade} +71 -63
  139. data/{bin/main/glade/Splash.glade → vrlib/lib/treeview/columns/glade/ImageCol.glade} +5 -6
  140. data/vrlib/lib/treeview/columns/glade/TextCol.glade +82 -0
  141. data/vrlib/rdoc_replace.yaml +77 -0
  142. data/vrlib/vrlib.rb +7 -0
  143. metadata +163 -136
  144. data/bin/editor/glade/VR_Document.glade +0 -160
  145. data/bin/main/ProjectChooserGUI.rb +0 -41
  146. data/bin/main/Splash.rb +0 -22
  147. data/visualruby_examples/active_record/.vr_settings.yaml +0 -47
  148. data/visualruby_examples/active_record/bin/Person.rb +0 -13
  149. data/visualruby_examples/active_record/bin/glade/ChoosePerson.glade +0 -61
  150. data/visualruby_examples/active_record/bin/glade/Person.glade +0 -148
  151. data/visualruby_examples/active_record2/.vr_settings.yaml +0 -16
  152. data/visualruby_examples/active_record2/bin/glade/CompanyGUI.glade +0 -167
  153. data/visualruby_examples/active_record2/bin/glade/Employee.glade +0 -123
  154. data/visualruby_examples/all_widgets/.vr_settings.yaml +0 -13
  155. data/visualruby_examples/all_widgets/main.rb +0 -14
  156. data/visualruby_examples/calculator/.vr_settings.yaml +0 -11
  157. data/visualruby_examples/calculator/main.rb +0 -13
  158. data/visualruby_examples/child_window/.vr_settings.yaml +0 -16
  159. data/visualruby_examples/child_window/bin/ChildWindowDemo.rb +0 -39
  160. data/visualruby_examples/child_window/bin/MyChildClass.rb +0 -40
  161. data/visualruby_examples/child_window/bin/glade/ChildWindowDemo.glade +0 -101
  162. data/visualruby_examples/child_window/main.rb +0 -13
  163. data/visualruby_examples/drag_drop/.vr_settings.yaml +0 -12
  164. data/visualruby_examples/drag_drop/bin/glade/DragDropDemo.glade +0 -143
  165. data/visualruby_examples/drag_drop/main.rb +0 -14
  166. data/visualruby_examples/listview/.vr_settings.yaml +0 -12
  167. data/visualruby_examples/listview/bin/glade/SongListViewGUI.glade +0 -220
  168. data/visualruby_examples/listview/main.rb +0 -19
  169. data/visualruby_examples/listview_objects/.vr_settings.yaml +0 -16
  170. data/visualruby_examples/listview_objects/bin/DataObject.rb +0 -32
  171. data/visualruby_examples/listview_objects/bin/DataObjectGUI.rb +0 -41
  172. data/visualruby_examples/listview_objects/bin/ListViewObjectsGUI.rb +0 -18
  173. data/visualruby_examples/listview_objects/bin/glade/DataObject.glade +0 -198
  174. data/visualruby_examples/listview_objects/bin/glade/ListViewObjectsGUI.glade +0 -102
  175. data/visualruby_examples/listview_objects/main.rb +0 -13
  176. data/visualruby_examples/simple_ruby_gui/.vr_settings.yaml +0 -16
  177. data/visualruby_examples/simple_ruby_gui/bin/DataObjectGUI.rb +0 -20
  178. data/visualruby_examples/simple_ruby_gui/bin/glade/DataObjectGUI.glade +0 -163
  179. data/visualruby_examples/simple_ruby_gui/main.rb +0 -16
  180. data/visualruby_examples/treeview/.vr_settings.yaml +0 -12
  181. data/visualruby_examples/treeview/bin/glade/MyClass.glade +0 -48
  182. data/visualruby_examples/treeview/main.rb +0 -14
@@ -7,12 +7,12 @@ class CompanyGUI
7
7
  def before_show()
8
8
  @employer_view = VR::ListView.new(:employer => Employer, :address => String, :company_type => String)
9
9
  @builder["scroll_employer"].add(@employer_view)
10
- @employer_view.selection.signal_connect("changed") { employer_view__changed }
10
+ # @employer_view.selection.signal_connect("changed") { employer_view__changed }
11
11
  @employer_view.col_width(:employer => 160, :address => 340, :company_type => 180)
12
12
 
13
13
  @employee_view = VR::ListView.new(:employer => Employer, :employee => Employee, :address => String, :balance => String)
14
14
  @builder["scroll_employee"].add(@employee_view)
15
- @employee_view.selection.signal_connect("changed") { employee_view__changed }
15
+ ## @employee_view.selection.signal_connect("changed") { employee_view__changed }
16
16
  @employee_view.col_width(:employer => 160, :employee => 150, :address => 320)
17
17
 
18
18
  @paycheck_view = VR::ListView.new(:employee => Employee, :date => DateTime, :description => String, :amt => Paycheck)
@@ -24,12 +24,12 @@ class CompanyGUI
24
24
  row[:employer] = e
25
25
  row.load_object(e)
26
26
  end
27
-
28
- @employer_view.select_row(0)
27
+ @builder[:window1].show_all
28
+ # @employer_view.select_row()
29
29
  end
30
30
 
31
31
 
32
- def employer_view__changed
32
+ def employer_view__cursor_changed(*a)
33
33
  return unless row = @employer_view.selected_rows[0]
34
34
  @employee_view.model.clear
35
35
  Employee.where(:employer_id => row[:employer].id).each do |e|
@@ -37,10 +37,10 @@ class CompanyGUI
37
37
  row[:employee] = e
38
38
  row.load_object(e)
39
39
  end
40
- @employee_view.select_row(0)
40
+ # @employee_view.select_row(0)
41
41
  end
42
42
 
43
- def employee_view__changed
43
+ def employee_view__cursor_changed(*a)
44
44
  return unless row = @employee_view.selected_rows[0]
45
45
  @paycheck_view.model.clear
46
46
  Paycheck.where(:employee_id => row[:employee].id).each do |e|
@@ -0,0 +1,149 @@
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
+ <property name="default_width">900</property>
9
+ <property name="default_height">800</property>
10
+ <child>
11
+ <object class="GtkBox" id="box1">
12
+ <property name="visible">True</property>
13
+ <property name="can_focus">False</property>
14
+ <property name="margin_left">20</property>
15
+ <property name="margin_right">20</property>
16
+ <property name="margin_top">20</property>
17
+ <property name="margin_bottom">20</property>
18
+ <property name="orientation">vertical</property>
19
+ <property name="spacing">3</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;Paychecks For All Employees&lt;/big&gt;&lt;/big&gt;</property>
25
+ <property name="use_markup">True</property>
26
+ </object>
27
+ <packing>
28
+ <property name="expand">False</property>
29
+ <property name="fill">True</property>
30
+ <property name="position">0</property>
31
+ </packing>
32
+ </child>
33
+ <child>
34
+ <object class="GtkLabel" id="label2">
35
+ <property name="visible">True</property>
36
+ <property name="can_focus">False</property>
37
+ <property name="xalign">0.019999999552965164</property>
38
+ <property name="ypad">5</property>
39
+ <property name="label" translatable="yes">&lt;big&gt;Companies:&lt;/big&gt;</property>
40
+ <property name="use_markup">True</property>
41
+ </object>
42
+ <packing>
43
+ <property name="expand">False</property>
44
+ <property name="fill">True</property>
45
+ <property name="position">1</property>
46
+ </packing>
47
+ </child>
48
+ <child>
49
+ <object class="GtkScrolledWindow" id="scroll_employer">
50
+ <property name="visible">True</property>
51
+ <property name="can_focus">True</property>
52
+ <child>
53
+ <placeholder/>
54
+ </child>
55
+ </object>
56
+ <packing>
57
+ <property name="expand">True</property>
58
+ <property name="fill">True</property>
59
+ <property name="position">2</property>
60
+ </packing>
61
+ </child>
62
+ <child>
63
+ <object class="GtkLabel" id="label3">
64
+ <property name="visible">True</property>
65
+ <property name="can_focus">False</property>
66
+ <property name="xalign">0.019999999552965164</property>
67
+ <property name="ypad">5</property>
68
+ <property name="label" translatable="yes">&lt;big&gt;Employees:&lt;/big&gt;</property>
69
+ <property name="use_markup">True</property>
70
+ </object>
71
+ <packing>
72
+ <property name="expand">False</property>
73
+ <property name="fill">True</property>
74
+ <property name="position">3</property>
75
+ </packing>
76
+ </child>
77
+ <child>
78
+ <object class="GtkScrolledWindow" id="scroll_employee">
79
+ <property name="visible">True</property>
80
+ <property name="can_focus">True</property>
81
+ <child>
82
+ <placeholder/>
83
+ </child>
84
+ </object>
85
+ <packing>
86
+ <property name="expand">True</property>
87
+ <property name="fill">True</property>
88
+ <property name="position">4</property>
89
+ </packing>
90
+ </child>
91
+ <child>
92
+ <object class="GtkLabel" id="label4">
93
+ <property name="visible">True</property>
94
+ <property name="can_focus">False</property>
95
+ <property name="xalign">0.019999999552965164</property>
96
+ <property name="ypad">5</property>
97
+ <property name="label" translatable="yes">&lt;big&gt;Paychecks:&lt;/big&gt;</property>
98
+ <property name="use_markup">True</property>
99
+ </object>
100
+ <packing>
101
+ <property name="expand">False</property>
102
+ <property name="fill">True</property>
103
+ <property name="position">5</property>
104
+ </packing>
105
+ </child>
106
+ <child>
107
+ <object class="GtkScrolledWindow" id="scroll_paycheck">
108
+ <property name="visible">True</property>
109
+ <property name="can_focus">True</property>
110
+ <child>
111
+ <placeholder/>
112
+ </child>
113
+ </object>
114
+ <packing>
115
+ <property name="expand">True</property>
116
+ <property name="fill">True</property>
117
+ <property name="position">6</property>
118
+ </packing>
119
+ </child>
120
+ <child>
121
+ <object class="GtkButtonBox" id="buttonbox1">
122
+ <property name="visible">True</property>
123
+ <property name="can_focus">False</property>
124
+ <property name="spacing">10</property>
125
+ <property name="layout_style">end</property>
126
+ <child>
127
+ <object class="GtkButton" id="buttonCancel">
128
+ <property name="label" translatable="yes">Cancel</property>
129
+ <property name="visible">True</property>
130
+ <property name="can_focus">True</property>
131
+ <property name="receives_default">True</property>
132
+ </object>
133
+ <packing>
134
+ <property name="expand">False</property>
135
+ <property name="fill">True</property>
136
+ <property name="position">1</property>
137
+ </packing>
138
+ </child>
139
+ </object>
140
+ <packing>
141
+ <property name="expand">False</property>
142
+ <property name="fill">True</property>
143
+ <property name="position">7</property>
144
+ </packing>
145
+ </child>
146
+ </object>
147
+ </child>
148
+ </object>
149
+ </interface>
@@ -0,0 +1,126 @@
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
+ <property name="default_width">440</property>
9
+ <child>
10
+ <object class="GtkBox" id="box1">
11
+ <property name="visible">True</property>
12
+ <property name="can_focus">False</property>
13
+ <property name="margin_left">20</property>
14
+ <property name="margin_right">20</property>
15
+ <property name="margin_top">20</property>
16
+ <property name="margin_bottom">20</property>
17
+ <property name="orientation">vertical</property>
18
+ <property name="spacing">10</property>
19
+ <child>
20
+ <object class="GtkLabel" id="label5">
21
+ <property name="visible">True</property>
22
+ <property name="can_focus">False</property>
23
+ <property name="yalign">0.4699999988079071</property>
24
+ <property name="label" translatable="yes">&lt;big&gt;&lt;big&gt;Edit Employee&lt;/big&gt;&lt;/big&gt;</property>
25
+ <property name="use_markup">True</property>
26
+ </object>
27
+ <packing>
28
+ <property name="expand">False</property>
29
+ <property name="fill">False</property>
30
+ <property name="padding">15</property>
31
+ <property name="position">0</property>
32
+ </packing>
33
+ </child>
34
+ <child>
35
+ <object class="GtkGrid" id="grid1">
36
+ <property name="visible">True</property>
37
+ <property name="can_focus">False</property>
38
+ <property name="row_spacing">10</property>
39
+ <property name="column_spacing">10</property>
40
+ <child>
41
+ <object class="GtkLabel" id="label1">
42
+ <property name="visible">True</property>
43
+ <property name="can_focus">False</property>
44
+ <property name="label" translatable="yes">Name</property>
45
+ </object>
46
+ <packing>
47
+ <property name="left_attach">0</property>
48
+ <property name="top_attach">0</property>
49
+ <property name="width">1</property>
50
+ <property name="height">1</property>
51
+ </packing>
52
+ </child>
53
+ <child>
54
+ <object class="GtkLabel" id="label2">
55
+ <property name="visible">True</property>
56
+ <property name="can_focus">False</property>
57
+ <property name="label" translatable="yes">Address</property>
58
+ </object>
59
+ <packing>
60
+ <property name="left_attach">0</property>
61
+ <property name="top_attach">1</property>
62
+ <property name="width">1</property>
63
+ <property name="height">1</property>
64
+ </packing>
65
+ </child>
66
+ <child>
67
+ <object class="GtkEntry" id="name">
68
+ <property name="visible">True</property>
69
+ <property name="can_focus">True</property>
70
+ <property name="hexpand">True</property>
71
+ </object>
72
+ <packing>
73
+ <property name="left_attach">1</property>
74
+ <property name="top_attach">0</property>
75
+ <property name="width">1</property>
76
+ <property name="height">1</property>
77
+ </packing>
78
+ </child>
79
+ <child>
80
+ <object class="GtkEntry" id="address">
81
+ <property name="visible">True</property>
82
+ <property name="can_focus">True</property>
83
+ </object>
84
+ <packing>
85
+ <property name="left_attach">1</property>
86
+ <property name="top_attach">1</property>
87
+ <property name="width">1</property>
88
+ <property name="height">1</property>
89
+ </packing>
90
+ </child>
91
+ </object>
92
+ <packing>
93
+ <property name="expand">False</property>
94
+ <property name="fill">True</property>
95
+ <property name="position">1</property>
96
+ </packing>
97
+ </child>
98
+ <child>
99
+ <object class="GtkButtonBox" id="buttonbox1">
100
+ <property name="visible">True</property>
101
+ <property name="can_focus">False</property>
102
+ <property name="layout_style">end</property>
103
+ <child>
104
+ <object class="GtkButton" id="buttonCancel">
105
+ <property name="label" translatable="yes">Cancel</property>
106
+ <property name="visible">True</property>
107
+ <property name="can_focus">True</property>
108
+ <property name="receives_default">True</property>
109
+ </object>
110
+ <packing>
111
+ <property name="expand">False</property>
112
+ <property name="fill">True</property>
113
+ <property name="position">0</property>
114
+ </packing>
115
+ </child>
116
+ </object>
117
+ <packing>
118
+ <property name="expand">False</property>
119
+ <property name="fill">True</property>
120
+ <property name="position">2</property>
121
+ </packing>
122
+ </child>
123
+ </object>
124
+ </child>
125
+ </object>
126
+ </interface>
@@ -1,13 +1,19 @@
1
- require 'vrlib'
2
- require 'active_record'
3
1
 
4
- #make program output in real time so errors visible in VR.
5
- STDOUT.sync = true
6
- STDERR.sync = true
2
+ # ignore -- this is for development, same as require 'vrlib'
3
+ require File.exists?("./../../vrlib/vrlib.rb") ? "./../../vrlib/vrlib.rb" : "vrlib"
4
+
5
+ begin
6
+ require 'active_record'
7
+ require 'sqlite3'
8
+ rescue LoadError
9
+ alert "You must install activerecord gem to use this example. " +
10
+ "Just enter at command prompt:\n\n<b>gem install activerecord\ngem install sqlite3</b>"
11
+ exit
12
+ end
13
+
14
+ # from require_all gem:
15
+ require_rel 'bin/'
7
16
 
8
- #everything in these directories will be included
9
- my_path = File.expand_path(File.dirname(__FILE__))
10
- require_all Dir.glob(my_path + "/bin/**/*.rb")
11
17
 
12
18
  ActiveRecord::Base.establish_connection(
13
19
  :adapter => "sqlite3",
@@ -15,7 +21,7 @@ ActiveRecord::Base.establish_connection(
15
21
  )
16
22
 
17
23
 
18
- CompanyGUI.new.show
24
+ CompanyGUI.new.show_glade()
19
25
 
20
26
  # This code just populates the database
21
27
 
@@ -0,0 +1,80 @@
1
+
2
+ # Simple alert examples. Alert box returns true, false or nil for "x" button.
3
+ # If the flag :input_text is set, it will show a textbox. Then it will return
4
+ # the String value of the textbox, false or nil.
5
+ #
6
+ # Returns:
7
+ # true or String = :button_yes pressed
8
+ # false = :button_no pressed
9
+ # nil = "x" button closed window
10
+ #
11
+ #
12
+ # the flags for the alert() method are:
13
+ #
14
+ # :buton_yes = label for button that returns true (default: "Ok", "Save" when input_text is set))
15
+ # :button_no = label for button that returns false (default "Cancel" when input_text is set)
16
+ # :button_cancel = label for button that returns nil
17
+ # :input_text = default text for input box. Triggers appearance of input box.
18
+ # :width = with of window (used to make longer messages with wrapping look good.)
19
+ # :title = title of the window (appears in bar at top) Default = :headline
20
+ # :headline = large text that appears at the top.
21
+ # :parent = reference to parent window. Alert box will always be on top of this parent. Usually=self!
22
+ #
23
+ # ALL THESE FLAGS ARE OPTIONAL
24
+
25
+ class AlertBoxDemo
26
+
27
+
28
+ include GladeGUI
29
+
30
+ def buttonSimple__clicked(*a)
31
+
32
+ path = ENV["HOME"]
33
+ alert("The example projects are installed in this folder:\n\n<b>#{path}</b>\n\n "+
34
+ "Use your <b>/home/visualruby</b> folder for all your visualruby projects.",
35
+ :parent => self,
36
+ :headline => "Installing Example Projects...",
37
+ :width => 500)
38
+
39
+ alert "I'll be back"
40
+ end
41
+
42
+ def buttonSimpleInput__clicked(*a)
43
+ alert("Enter your age:", :input_text => "")
44
+ end
45
+
46
+ #its best to include a parent so alert box always on top:
47
+ def buttonYesNo__clicked(*a)
48
+ if alert("Do you want to continue?", :button_yes => "Yes", :button_no => "No", :parent => self) #on top
49
+ alert "Ok we'll contine..." # not always on top
50
+ end
51
+ end
52
+
53
+ # input boxes will return the string entered, false, or nil for "X" button:
54
+ def buttonInput__clicked(*a)
55
+ if answer = alert("Enter your full name:", :input_text => "Ralph",
56
+ :button_yes => "Go", :headline => "Enter Name")
57
+ alert "You entered:\n\n<b>" + answer + "</b>"
58
+ elsif answer == false
59
+ alert "You pressed the <b>Cancel</b> button"
60
+ elsif answer.nil?
61
+ alert "You pressed the <b>'X'</b> button"
62
+ else
63
+ alert "Error: Should return String (yes), false (no) or nil (quit button)"
64
+ end
65
+ end
66
+
67
+ def buttonQuestion__clicked(*a)
68
+ if answer = alert("Your pants are on <b><u>fire</u></b>. What do you want to do?", :width => 500, :button_cancel => "Quit",
69
+ :button_yes => "Jump in Pool", :button_no => "Panic!", :title => "Pants on Fire", :headline => "Warning")
70
+ alert "Get going!"
71
+ end
72
+ end
73
+
74
+
75
+ def buttonQuit__clicked(*a)
76
+ @builder[:window1].destroy
77
+ end
78
+
79
+ end
80
+