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
@@ -0,0 +1,195 @@
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="title" translatable="yes">Basic Ruby Object Demo</property>
8
+ <property name="window_position">center</property>
9
+ <property name="default_width">400</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">10</property>
20
+ <child>
21
+ <object class="GtkLabel" id="label5">
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;Basic Object Demo&lt;/big&gt;&lt;/big&gt;
25
+ This was created with visualruby. See visualruby.net.</property>
26
+ <property name="use_markup">True</property>
27
+ </object>
28
+ <packing>
29
+ <property name="expand">True</property>
30
+ <property name="fill">True</property>
31
+ <property name="padding">10</property>
32
+ <property name="position">0</property>
33
+ </packing>
34
+ </child>
35
+ <child>
36
+ <object class="GtkGrid" id="grid1">
37
+ <property name="visible">True</property>
38
+ <property name="can_focus">False</property>
39
+ <property name="row_spacing">10</property>
40
+ <property name="column_spacing">10</property>
41
+ <child>
42
+ <object class="GtkLabel" id="label6">
43
+ <property name="visible">True</property>
44
+ <property name="can_focus">False</property>
45
+ <property name="xalign">0.97000002861022949</property>
46
+ <property name="label" translatable="yes">Name:</property>
47
+ </object>
48
+ <packing>
49
+ <property name="left_attach">0</property>
50
+ <property name="top_attach">0</property>
51
+ <property name="width">1</property>
52
+ <property name="height">1</property>
53
+ </packing>
54
+ </child>
55
+ <child>
56
+ <object class="GtkLabel" id="label7">
57
+ <property name="visible">True</property>
58
+ <property name="can_focus">False</property>
59
+ <property name="xalign">0.97000002861022949</property>
60
+ <property name="label" translatable="yes">Address:</property>
61
+ </object>
62
+ <packing>
63
+ <property name="left_attach">0</property>
64
+ <property name="top_attach">1</property>
65
+ <property name="width">1</property>
66
+ <property name="height">1</property>
67
+ </packing>
68
+ </child>
69
+ <child>
70
+ <object class="GtkLabel" id="label8">
71
+ <property name="visible">True</property>
72
+ <property name="can_focus">False</property>
73
+ <property name="xalign">0.97000002861022949</property>
74
+ <property name="label" translatable="yes">Email:</property>
75
+ </object>
76
+ <packing>
77
+ <property name="left_attach">0</property>
78
+ <property name="top_attach">2</property>
79
+ <property name="width">1</property>
80
+ <property name="height">1</property>
81
+ </packing>
82
+ </child>
83
+ <child>
84
+ <object class="GtkLabel" id="label9">
85
+ <property name="visible">True</property>
86
+ <property name="can_focus">False</property>
87
+ <property name="xalign">0.97000002861022949</property>
88
+ <property name="label" translatable="yes">Phone:</property>
89
+ </object>
90
+ <packing>
91
+ <property name="left_attach">0</property>
92
+ <property name="top_attach">3</property>
93
+ <property name="width">1</property>
94
+ <property name="height">1</property>
95
+ </packing>
96
+ </child>
97
+ <child>
98
+ <object class="GtkEntry" id="name">
99
+ <property name="visible">True</property>
100
+ <property name="can_focus">True</property>
101
+ <property name="hexpand">True</property>
102
+ </object>
103
+ <packing>
104
+ <property name="left_attach">1</property>
105
+ <property name="top_attach">0</property>
106
+ <property name="width">1</property>
107
+ <property name="height">1</property>
108
+ </packing>
109
+ </child>
110
+ <child>
111
+ <object class="GtkEntry" id="address">
112
+ <property name="visible">True</property>
113
+ <property name="can_focus">True</property>
114
+ </object>
115
+ <packing>
116
+ <property name="left_attach">1</property>
117
+ <property name="top_attach">1</property>
118
+ <property name="width">1</property>
119
+ <property name="height">1</property>
120
+ </packing>
121
+ </child>
122
+ <child>
123
+ <object class="GtkEntry" id="email">
124
+ <property name="visible">True</property>
125
+ <property name="can_focus">True</property>
126
+ </object>
127
+ <packing>
128
+ <property name="left_attach">1</property>
129
+ <property name="top_attach">2</property>
130
+ <property name="width">1</property>
131
+ <property name="height">1</property>
132
+ </packing>
133
+ </child>
134
+ <child>
135
+ <object class="GtkEntry" id="phone">
136
+ <property name="visible">True</property>
137
+ <property name="can_focus">True</property>
138
+ </object>
139
+ <packing>
140
+ <property name="left_attach">1</property>
141
+ <property name="top_attach">3</property>
142
+ <property name="width">1</property>
143
+ <property name="height">1</property>
144
+ </packing>
145
+ </child>
146
+ </object>
147
+ <packing>
148
+ <property name="expand">False</property>
149
+ <property name="fill">True</property>
150
+ <property name="position">1</property>
151
+ </packing>
152
+ </child>
153
+ <child>
154
+ <object class="GtkButtonBox" id="buttonbox1">
155
+ <property name="visible">True</property>
156
+ <property name="can_focus">False</property>
157
+ <property name="spacing">10</property>
158
+ <property name="layout_style">end</property>
159
+ <child>
160
+ <object class="GtkButton" id="buttonCancel">
161
+ <property name="label" translatable="yes">Cancel</property>
162
+ <property name="visible">True</property>
163
+ <property name="can_focus">True</property>
164
+ <property name="receives_default">True</property>
165
+ </object>
166
+ <packing>
167
+ <property name="expand">False</property>
168
+ <property name="fill">True</property>
169
+ <property name="position">0</property>
170
+ </packing>
171
+ </child>
172
+ <child>
173
+ <object class="GtkButton" id="buttonShow">
174
+ <property name="label" translatable="yes">Show</property>
175
+ <property name="visible">True</property>
176
+ <property name="can_focus">True</property>
177
+ <property name="receives_default">True</property>
178
+ </object>
179
+ <packing>
180
+ <property name="expand">False</property>
181
+ <property name="fill">True</property>
182
+ <property name="position">1</property>
183
+ </packing>
184
+ </child>
185
+ </object>
186
+ <packing>
187
+ <property name="expand">False</property>
188
+ <property name="fill">True</property>
189
+ <property name="position">2</property>
190
+ </packing>
191
+ </child>
192
+ </object>
193
+ </child>
194
+ </object>
195
+ </interface>
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/ruby
2
+
3
+ #Updated for Gtk3!
4
+
5
+ # ignore -- this is for development, same as require 'vrlib'
6
+ require File.exists?("./../../vrlib/vrlib.rb") ? "./../../vrlib/vrlib.rb" : "vrlib"
7
+
8
+ # from require_all gem:
9
+ require_rel 'bin/'
10
+
11
+
12
+ x = DataObjectGUI.new("Harvey Milktoast", "123 Main, Hemet, CA 90090",
13
+ "harvey@harveyserver.com", "132-243-4323")
14
+ x.show_glade()
15
+
16
+
@@ -17,12 +17,8 @@ class MyClass #(change name)
17
17
  harvey = @tree.add_row(top)
18
18
  harvey[:name] = "Harvey"
19
19
  harvey[:age] = 60
20
- @scrolledwindow1 = @tree
20
+ @scrolledwindow1 = @tree #adds tree to the scrolledwindow
21
21
  end
22
22
 
23
- def button1__clicked(*args)
24
- @builder["button1"].label = @builder["button1"].label == "Hello World" ? "Goodbye World" : "Hello World"
25
- end
26
-
27
23
  end
28
24
 
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generated with glade 3.18.3 -->
3
+ <interface>
4
+ <requires lib="gtk+" version="3.0"/>
5
+ <object class="GtkWindow" id="window1">
6
+ <property name="visible">True</property>
7
+ <property name="can_focus">False</property>
8
+ <property name="title" translatable="yes">TreeView Demo</property>
9
+ <property name="modal">True</property>
10
+ <property name="window_position">center</property>
11
+ <property name="default_width">300</property>
12
+ <property name="default_height">200</property>
13
+ <child>
14
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
15
+ <property name="visible">True</property>
16
+ <property name="can_focus">True</property>
17
+ <property name="shadow_type">in</property>
18
+ <child>
19
+ <placeholder/>
20
+ </child>
21
+ </object>
22
+ </child>
23
+ </object>
24
+ </interface>
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/ruby
2
+
3
+ #Updated for Gtk3!
4
+
5
+ # ignore -- this is for development, same as: require 'vrlib'
6
+ require File.exists?("./../../vrlib/vrlib.rb") ? "./../../vrlib/vrlib.rb" : "vrlib"
7
+
8
+ # from require_all gem:
9
+ require_rel 'bin/'
10
+
11
+
12
+ MyClass.new.show_glade()
13
+
@@ -1,11 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generated with glade 3.16.1 -->
2
3
  <interface>
3
- <requires lib="gtk+" version="2.16"/>
4
- <!-- interface-naming-policy project-wide -->
4
+ <requires lib="gtk+" version="3.0"/>
5
5
  <object class="GtkWindow" id="window1">
6
- <property name="visible">True</property>
6
+ <property name="can_focus">False</property>
7
7
  <property name="modal">True</property>
8
- <signal name="destroy" handler="destroy_window"/>
9
8
  <child>
10
9
  <placeholder/>
11
10
  </child>
@@ -8,7 +8,7 @@ class MyClass #(change name)
8
8
  @var1 = "Hello World"
9
9
  end
10
10
 
11
- def widget__clicked(*args)
11
+ def widget__clicked(*args)
12
12
  #code that runs when widget named "widget" in glade is clicked.
13
13
  end
14
14
 
@@ -1,6 +1,6 @@
1
1
 
2
2
  class MyClass #(change name)
3
-
3
+
4
4
  include GladeGUI
5
5
 
6
6
  def before_show()
@@ -8,7 +8,7 @@ class MyClass #(change name)
8
8
  end
9
9
 
10
10
  def button1__clicked(*args)
11
- @builder["button1"].label = @builder["button1"].label == "Hello World" ? "Goodbye World" : "Hello World"
11
+ @builder["button1"].label = "Goodbye World"
12
12
  end
13
13
 
14
14
  end
@@ -1,37 +1,23 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generated with glade 3.18.3 -->
2
3
  <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>
4
+ <requires lib="gtk+" version="3.0"/>
5
+ <object class="GtkApplicationWindow" id="window1">
7
6
  <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
7
  <child>
14
- <object class="GtkVBox" id="vbox1">
8
+ <object class="GtkButtonBox" id="buttonbox1">
15
9
  <property name="visible">True</property>
16
10
  <property name="can_focus">False</property>
11
+ <property name="halign">center</property>
12
+ <property name="valign">center</property>
13
+ <property name="orientation">vertical</property>
14
+ <property name="layout_style">start</property>
17
15
  <child>
18
- <object class="GtkHButtonBox" id="hbuttonbox1">
16
+ <object class="GtkButton" id="button1">
17
+ <property name="label" translatable="yes">button</property>
19
18
  <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>
19
+ <property name="can_focus">True</property>
20
+ <property name="receives_default">True</property>
35
21
  </object>
36
22
  <packing>
37
23
  <property name="expand">True</property>
@@ -1,14 +1,10 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'vrlib'
3
+ require "vrlib"
4
4
 
5
- #make program output in real time so errors visible in VR.
6
- STDOUT.sync = true
7
- STDERR.sync = true
5
+ # from require_all gem:
6
+ require_rel 'bin/'
8
7
 
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
8
 
13
- MyClass.new.show
9
+ MyClass.new.show_glade()
14
10
 
data/vr CHANGED
@@ -1,37 +1,41 @@
1
- #!/usr/bin/env ruby
2
- #
3
-
4
- require "gtksourceview2"
5
- require "yaml" #needed
6
- require "net/http" #needed
7
- require "net/https" #needed
8
- require "find" #needed
9
- require "fileutils" #needed
10
- require "rubygems/installer"
11
- require "rubygems/uninstaller"
12
- require "rubygems/package"
13
- require "rubygems/specification"
14
-
15
- #rubygems uses rubygems/package as of ruby 2.0.0
16
- begin
17
- require "rubygems/builder"
18
- rescue LoadError
19
- end
20
-
21
-
22
- #make program output in real time so errors visible
23
- STDOUT.sync = true
24
- STDERR.sync = true
25
-
26
- my_path = File.expand_path(File.dirname(__FILE__))
27
- if my_path =~ /^\/home\/eric\/vrp\/.*/
28
- require File.expand_path(my_path + "/../vrlib") + "/vrlib.rb"
29
- else
30
- require "vrlib"
31
- end
32
-
33
- require_all Dir.glob(my_path + "/bin/**/*.rb") # cant require_all root because .rb files in root will run????
34
-
35
- VR_Main.new(ARGV).show
36
-
37
-
1
+ require "gtk3"
2
+
3
+ def load_everything
4
+ require "rubygems"
5
+ require "gtksourceview3"
6
+ require "yaml" #needed
7
+ require "net/http" #needed
8
+ require "net/https" #needed
9
+ require "find" #needed
10
+ require "fileutils" #needed
11
+ require "rubygems/installer"
12
+ require "rubygems/uninstaller"
13
+ require "rubygems/package"
14
+ require "rubygems/specification"
15
+ require "date"
16
+
17
+ require 'require_all'
18
+
19
+ require_rel 'vrlib/lib/'
20
+ require_rel 'bin/'
21
+
22
+ VR_Main.new(ARGV).show_glade()
23
+
24
+ end
25
+
26
+ $splash = Gtk::Window.new()
27
+ $splash.type_hint = :dialog
28
+ $splash.position = :center_always
29
+ $splash.add Gtk::Image.new(:file => File.join(File.dirname(__FILE__), "img", "splash.png"))
30
+ $splash.decorated = false
31
+
32
+ $splash.show_all
33
+
34
+
35
+ GLib::Timeout.add(40) {
36
+ load_everything
37
+ }
38
+
39
+ Gtk.main
40
+
41
+
@@ -0,0 +1,67 @@
1
+
2
+ module VR
3
+
4
+ class Alert
5
+
6
+ attr_accessor :answer
7
+
8
+ include GladeGUI
9
+
10
+ def initialize(message, answer, flags = {})
11
+ @flags = flags
12
+ @answer = answer
13
+ @message = message
14
+ @p = nil
15
+
16
+ end
17
+
18
+ def before_show
19
+ @flags[:title] = @flags[:title] ? @flags[:title] : @flags[:headline]
20
+ @builder[:window1].title = @flags[:title] if @flags[:title]
21
+ @builder[:window1].resize(@flags[:width],100) if @flags[:width].to_i > 100
22
+ @builder[:headline].show if @flags[:headline]
23
+
24
+ if text = @flags[:input_text]
25
+ @flags[:button_yes] ||= "Save"
26
+ @flags[:button_no] ||= "Cancel"
27
+ @builder[:input_text].show
28
+ end
29
+
30
+ @builder[:button_no].show if @flags[:button_no]
31
+ @builder[:button_cancel].show if @flags[:button_cancel]
32
+ set_glade_hash(@flags)
33
+ end
34
+
35
+ def button_yes__clicked(but)
36
+ @answer.answer = @flags[:input_text] ? @builder[:input_text].text : true
37
+ @builder[:window1].destroy
38
+ end
39
+
40
+ def button_no__clicked(but)
41
+ @answer.answer = false
42
+ @builder[:window1].destroy
43
+ end
44
+
45
+ def button_cancel__clicked(but) #answer stays nil
46
+ @builder[:window1].destroy
47
+ end
48
+
49
+
50
+ end
51
+
52
+ #so it can be passed by reference
53
+ class DialogAnswer
54
+ attr_accessor :answer
55
+ end
56
+
57
+ end
58
+
59
+
60
+ def alert(msg, flags = {})
61
+ @answer = VR::DialogAnswer.new()
62
+ VR::Alert.new(msg, @answer, flags).show_glade(flags[:parent])
63
+ return @answer.answer
64
+ end
65
+
66
+
67
+
@@ -0,0 +1,90 @@
1
+ #nodoc
2
+
3
+ module VR
4
+
5
+ module Draggable
6
+ def add_target_widget(widget)
7
+ @target_widgets ||= []
8
+ @target_widgets << widget
9
+ ar = [[ self.object_id.to_s, :same_app, 12_345]]
10
+ drag_source_set(Gdk::ModifierType::BUTTON1_MASK |
11
+ Gdk::ModifierType::BUTTON2_MASK,
12
+ ar,
13
+ Gdk::DragAction::COPY |
14
+ Gdk::DragAction::MOVE)
15
+ widget.extend(VR::Droppable) unless widget.is_a?(VR::Droppable)
16
+ widget.add_source_widget(self)
17
+ # if not self.respond_to?(:drag_begin)
18
+ self.signal_connect("drag_begin") do |widget, context|
19
+ @target_widgets.each { |widg| widg.dragged_widget = self }
20
+ end
21
+ # end
22
+ end
23
+ end
24
+
25
+ module Droppable
26
+
27
+ attr_accessor :dragged_widget, :source_widgets
28
+
29
+
30
+ @dragged_widget = nil
31
+
32
+ def add_source_widget(widget)
33
+ @source_widgets ||= []
34
+ @source_widgets << [widget.object_id.to_s, :same_app, 12_345]
35
+ drag_dest_set(Gtk::DestDefaults::MOTION |
36
+ Gtk::DestDefaults::HIGHLIGHT,
37
+ @source_widgets,
38
+ Gdk::DragAction::COPY |
39
+ Gdk::DragAction::MOVE)
40
+ end
41
+
42
+ end
43
+ end
44
+
45
+ # module DragDrop
46
+ #
47
+ # attr_accessor :dragged_widget, :drag_array
48
+ #
49
+ # def drag_array(element = nil)
50
+ # @dnd ||= []
51
+ # @dnd.push(element) if not element.nil?
52
+ # return @dnd
53
+ # end
54
+ #
55
+ #
56
+ # def drag_to(target_widget) #Gdk::Window::BUTTON1_MASK)
57
+ #
58
+ # @target_widgets ||= []
59
+ # @target_widgets << target_widget
60
+ #
61
+ ## @drag_array ||= []
62
+ ## @drag_array <<
63
+ #
64
+ # ar = [[ self.object_id.to_s, :same_app, 12_345]]
65
+ # drag_source_set(Gdk::ModifierType::BUTTON1_MASK |
66
+ # Gdk::ModifierType::BUTTON2_MASK,
67
+ # ar,
68
+ # Gdk::DragAction::COPY |
69
+ # Gdk::DragAction::MOVE)
70
+ #
71
+ # ar = target_widget.drag_array([ self.object_id.to_s, :same_app, 12_345])
72
+ # target_widget.drag_dest_set(Gtk::DestDefaults::MOTION |
73
+ # Gtk::DestDefaults::HIGHLIGHT,
74
+ # ar,
75
+ # Gdk::DragAction::COPY |
76
+ # Gdk::DragAction::MOVE)
77
+ #
78
+ # if not @done
79
+ # @done = true
80
+ # self.signal_connect("drag_begin") do |widget, context|
81
+ # @target_widgets.each { |widg| widg.dragged_widget = self }
82
+ # end
83
+ # end
84
+ #
85
+ # end
86
+ #
87
+ # end
88
+ #
89
+ #end
90
+