visualruby 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/editor/VR_Document.rb +219 -0
- data/bin/editor/VR_TabSearch.rb +50 -0
- data/bin/editor/VR_Tabs.rb +99 -0
- data/bin/editor/VR_TextShell.rb +83 -0
- data/bin/editor/VR_TextViewCommon.rb +65 -0
- data/bin/editor/glade/VR_Document.glade +160 -0
- data/bin/main/GemTree.rb +23 -0
- data/bin/main/NewProjectGUI.rb +28 -0
- data/bin/main/ProjectChooserGUI.rb +41 -0
- data/bin/main/ProjectChooserView.rb +39 -0
- data/bin/main/RubygemsAPI.rb +93 -0
- data/bin/main/Splash.rb +22 -0
- data/bin/main/VR_ENV.rb +61 -0
- data/bin/main/VR_ENV_GLOBAL.rb +64 -0
- data/bin/main/VR_File_Tree.rb +120 -0
- data/bin/main/VR_Local_Gem_Tree.rb +80 -0
- data/bin/main/VR_Main.rb +313 -0
- data/bin/main/VR_Remote_Gem_Tree.rb +70 -0
- data/bin/main/glade/NewProjectGUI.glade +141 -0
- data/bin/main/glade/ProjectChooserGUI.glade +140 -0
- data/bin/main/glade/RubygemsAPI.glade +130 -0
- data/bin/main/glade/Splash.glade +18 -0
- data/bin/main/glade/VR_ENV.glade +168 -0
- data/bin/main/glade/VR_ENV_GLOBAL.glade +268 -0
- data/bin/main/glade/VR_File_Tree.glade +65 -0
- data/bin/main/glade/VR_Local_Gem_Tree.glade +45 -0
- data/bin/main/glade/VR_Main.glade +707 -0
- data/bin/main/glade/VR_Remote_Gem_Tree.glade +76 -0
- data/bin/tools/VR_Tools.rb +120 -0
- data/img/close.png +0 -0
- data/img/folder.png +0 -0
- data/img/glade.png +0 -0
- data/img/gtk-edit.png +0 -0
- data/img/obj.png +0 -0
- data/img/png.png +0 -0
- data/img/rb.png +0 -0
- data/img/ruby.png +0 -0
- data/img/splash.png +0 -0
- data/img/unknown.png +0 -0
- data/skeleton/document/New.glade +13 -0
- data/skeleton/document/NewWindow.rb +15 -0
- data/skeleton/project/bin/MyClass.rb +15 -0
- data/skeleton/project/bin/glade/MyClass.glade +45 -0
- data/skeleton/project/main.rb +14 -0
- data/visualruby_examples/active_record/.vr_settings.yaml +47 -0
- data/visualruby_examples/active_record/active_record.rb +52 -0
- data/visualruby_examples/active_record/bin/ChoosePerson.rb +17 -0
- data/visualruby_examples/active_record/bin/Person.rb +13 -0
- data/visualruby_examples/active_record/bin/glade/ChoosePerson.glade +61 -0
- data/visualruby_examples/active_record/bin/glade/Person.glade +148 -0
- data/visualruby_examples/active_record/db/development.sqlite3 +0 -0
- data/visualruby_examples/active_record2/.vr_settings.yaml +48 -0
- data/visualruby_examples/active_record2/active_record2.rb +142 -0
- data/visualruby_examples/active_record2/bin/CompanyGUI.rb +54 -0
- data/visualruby_examples/active_record2/bin/Employee.rb +20 -0
- data/visualruby_examples/active_record2/bin/Employer.rb +11 -0
- data/visualruby_examples/active_record2/bin/Paycheck.rb +11 -0
- data/visualruby_examples/active_record2/bin/glade/CompanyGUI.glade +167 -0
- data/visualruby_examples/active_record2/bin/glade/Employee.glade +123 -0
- data/visualruby_examples/active_record2/bin/glade/Employer.glade +147 -0
- data/visualruby_examples/active_record2/bin/glade/Paycheck.glade +145 -0
- data/visualruby_examples/active_record2/db/development.sqlite3 +0 -0
- data/visualruby_examples/all_widgets/.vr_settings.yaml +20 -0
- data/visualruby_examples/all_widgets/all_widgets.rb +13 -0
- data/visualruby_examples/all_widgets/bin/AllWidgets.rb +43 -0
- data/visualruby_examples/all_widgets/bin/glade/AllWidgets.glade +166 -0
- data/visualruby_examples/all_widgets/bin/splash.png +0 -0
- data/visualruby_examples/calculator/.vr_settings.yaml +21 -0
- data/visualruby_examples/calculator/bin/Calculator.rb +63 -0
- data/visualruby_examples/calculator/bin/glade/Calculator.glade +243 -0
- data/visualruby_examples/calculator/main.rb +13 -0
- data/visualruby_examples/child_window/.vr_settings.yaml +46 -0
- data/visualruby_examples/child_window/bin/ChildWindowDemo.rb +41 -0
- data/visualruby_examples/child_window/bin/MyChildClass.rb +42 -0
- data/visualruby_examples/child_window/bin/glade/ChildWindowDemo.glade +101 -0
- data/visualruby_examples/child_window/bin/glade/MyChildClass.glade +58 -0
- data/visualruby_examples/child_window/main.rb +13 -0
- data/visualruby_examples/drag_drop/.vr_settings.yaml +19 -0
- data/visualruby_examples/drag_drop/bin/DragDropDemo.rb +45 -0
- data/visualruby_examples/drag_drop/bin/glade/DragDropDemo.glade +143 -0
- data/visualruby_examples/drag_drop/img/folder.png +0 -0
- data/visualruby_examples/drag_drop/img/glade.png +0 -0
- data/visualruby_examples/drag_drop/img/gtk-edit.png +0 -0
- data/visualruby_examples/drag_drop/img/obj.png +0 -0
- data/visualruby_examples/drag_drop/img/png.png +0 -0
- data/visualruby_examples/drag_drop/img/rb.png +0 -0
- data/visualruby_examples/drag_drop/img/ruby.png +0 -0
- data/visualruby_examples/drag_drop/img/unknown.png +0 -0
- data/visualruby_examples/drag_drop/main.rb +14 -0
- data/visualruby_examples/listview/.vr_settings.yaml +46 -0
- data/visualruby_examples/listview/bin/SongListView.rb +89 -0
- data/visualruby_examples/listview/bin/SongListViewGUI.rb +67 -0
- data/visualruby_examples/listview/bin/audio-x-generic.png +0 -0
- data/visualruby_examples/listview/bin/glade/SongListViewGUI.glade +220 -0
- data/visualruby_examples/listview/main.rb +19 -0
- data/visualruby_examples/listview_objects/.vr_settings.yaml +46 -0
- data/visualruby_examples/listview_objects/bin/DataObject.rb +32 -0
- data/visualruby_examples/listview_objects/bin/DataObjectGUI.rb +41 -0
- data/visualruby_examples/listview_objects/bin/ListViewObjects.rb +34 -0
- data/visualruby_examples/listview_objects/bin/ListViewObjectsGUI.rb +18 -0
- data/visualruby_examples/listview_objects/bin/glade/DataObject.glade +198 -0
- data/visualruby_examples/listview_objects/bin/glade/ListViewObjectsGUI.glade +102 -0
- data/visualruby_examples/listview_objects/main.rb +13 -0
- data/visualruby_examples/simple_ruby_gui/.vr_settings.yaml +45 -0
- data/visualruby_examples/simple_ruby_gui/bin/DataObjectGUI.rb +20 -0
- data/visualruby_examples/simple_ruby_gui/bin/glade/DataObjectGUI.glade +163 -0
- data/visualruby_examples/simple_ruby_gui/simple_ruby_gui +16 -0
- data/visualruby_examples/treeview/.vr_settings.yaml +18 -0
- data/visualruby_examples/treeview/bin/MyClass.rb +28 -0
- data/visualruby_examples/treeview/bin/glade/MyClass.glade +48 -0
- data/visualruby_examples/treeview/main.rb +14 -0
- data/vr +40 -0
- metadata +202 -0
@@ -0,0 +1,220 @@
|
|
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="title" translatable="yes">VR_ListView Demo</property>
|
9
|
+
<property name="default_width">840</property>
|
10
|
+
<property name="default_height">530</property>
|
11
|
+
<property name="type_hint">dialog</property>
|
12
|
+
<signal name="destroy" handler="destroy_window" swapped="no"/>
|
13
|
+
<child>
|
14
|
+
<object class="GtkHBox" id="hbox1">
|
15
|
+
<property name="visible">True</property>
|
16
|
+
<property name="can_focus">False</property>
|
17
|
+
<child>
|
18
|
+
<object class="GtkVBox" id="vbox1">
|
19
|
+
<property name="visible">True</property>
|
20
|
+
<property name="can_focus">False</property>
|
21
|
+
<child>
|
22
|
+
<object class="GtkHBox" id="hbox2">
|
23
|
+
<property name="visible">True</property>
|
24
|
+
<property name="can_focus">False</property>
|
25
|
+
<child>
|
26
|
+
<object class="GtkLabel" id="label1">
|
27
|
+
<property name="width_request">680</property>
|
28
|
+
<property name="visible">True</property>
|
29
|
+
<property name="can_focus">False</property>
|
30
|
+
<property name="label" translatable="yes"><b><big><big><big>ListView Demo</big></big></big></b>
|
31
|
+
|
32
|
+
<b>This was created with visualruby. Go to visualruby.net for more info.</b>
|
33
|
+
|
34
|
+
Try Double clicking a row. You can edit the cells by double-clicking on them. You can click on the column titles to sort. You can make the headers wider by dragging the edges with your mouse. The artists' names can be sorted in last name order. Also, notice that the music icon and the song title share the same column. When editing is turned off, you can select a row by double-clicking on it.</property>
|
35
|
+
<property name="use_markup">True</property>
|
36
|
+
<property name="wrap">True</property>
|
37
|
+
</object>
|
38
|
+
<packing>
|
39
|
+
<property name="expand">False</property>
|
40
|
+
<property name="fill">False</property>
|
41
|
+
<property name="position">0</property>
|
42
|
+
</packing>
|
43
|
+
</child>
|
44
|
+
</object>
|
45
|
+
<packing>
|
46
|
+
<property name="expand">False</property>
|
47
|
+
<property name="fill">False</property>
|
48
|
+
<property name="padding">10</property>
|
49
|
+
<property name="position">0</property>
|
50
|
+
</packing>
|
51
|
+
</child>
|
52
|
+
<child>
|
53
|
+
<object class="GtkHBox" id="hbox3">
|
54
|
+
<property name="visible">True</property>
|
55
|
+
<property name="can_focus">False</property>
|
56
|
+
<child>
|
57
|
+
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
58
|
+
<property name="visible">True</property>
|
59
|
+
<property name="can_focus">True</property>
|
60
|
+
<property name="hscrollbar_policy">automatic</property>
|
61
|
+
<property name="vscrollbar_policy">automatic</property>
|
62
|
+
<child>
|
63
|
+
<placeholder/>
|
64
|
+
</child>
|
65
|
+
</object>
|
66
|
+
<packing>
|
67
|
+
<property name="expand">True</property>
|
68
|
+
<property name="fill">True</property>
|
69
|
+
<property name="position">0</property>
|
70
|
+
</packing>
|
71
|
+
</child>
|
72
|
+
</object>
|
73
|
+
<packing>
|
74
|
+
<property name="expand">True</property>
|
75
|
+
<property name="fill">True</property>
|
76
|
+
<property name="padding">20</property>
|
77
|
+
<property name="position">1</property>
|
78
|
+
</packing>
|
79
|
+
</child>
|
80
|
+
<child>
|
81
|
+
<object class="GtkTable" id="table1">
|
82
|
+
<property name="visible">True</property>
|
83
|
+
<property name="can_focus">False</property>
|
84
|
+
<property name="n_rows">4</property>
|
85
|
+
<property name="n_columns">2</property>
|
86
|
+
<child>
|
87
|
+
<object class="GtkCheckButton" id="invisible">
|
88
|
+
<property name="label" translatable="yes">Make First & Last Name Invisible</property>
|
89
|
+
<property name="visible">True</property>
|
90
|
+
<property name="can_focus">True</property>
|
91
|
+
<property name="receives_default">False</property>
|
92
|
+
<property name="use_action_appearance">False</property>
|
93
|
+
<property name="draw_indicator">True</property>
|
94
|
+
</object>
|
95
|
+
<packing>
|
96
|
+
<property name="top_attach">2</property>
|
97
|
+
<property name="bottom_attach">3</property>
|
98
|
+
</packing>
|
99
|
+
</child>
|
100
|
+
<child>
|
101
|
+
<object class="GtkCheckButton" id="xalign">
|
102
|
+
<property name="label" translatable="yes">Right Justify Name Column</property>
|
103
|
+
<property name="visible">True</property>
|
104
|
+
<property name="can_focus">True</property>
|
105
|
+
<property name="receives_default">False</property>
|
106
|
+
<property name="use_action_appearance">False</property>
|
107
|
+
<property name="relief">none</property>
|
108
|
+
<property name="draw_indicator">True</property>
|
109
|
+
</object>
|
110
|
+
<packing>
|
111
|
+
<property name="top_attach">1</property>
|
112
|
+
<property name="bottom_attach">2</property>
|
113
|
+
</packing>
|
114
|
+
</child>
|
115
|
+
<child>
|
116
|
+
<object class="GtkCheckButton" id="bold">
|
117
|
+
<property name="label" translatable="yes">Make Song Text Bold</property>
|
118
|
+
<property name="visible">True</property>
|
119
|
+
<property name="can_focus">True</property>
|
120
|
+
<property name="receives_default">False</property>
|
121
|
+
<property name="use_action_appearance">False</property>
|
122
|
+
<property name="draw_indicator">True</property>
|
123
|
+
</object>
|
124
|
+
<packing>
|
125
|
+
<property name="top_attach">3</property>
|
126
|
+
<property name="bottom_attach">4</property>
|
127
|
+
</packing>
|
128
|
+
</child>
|
129
|
+
<child>
|
130
|
+
<object class="GtkCheckButton" id="background">
|
131
|
+
<property name="label" translatable="yes">Make Song Background Yellow</property>
|
132
|
+
<property name="visible">True</property>
|
133
|
+
<property name="can_focus">True</property>
|
134
|
+
<property name="receives_default">False</property>
|
135
|
+
<property name="use_action_appearance">False</property>
|
136
|
+
<property name="draw_indicator">True</property>
|
137
|
+
</object>
|
138
|
+
<packing>
|
139
|
+
<property name="left_attach">1</property>
|
140
|
+
<property name="right_attach">2</property>
|
141
|
+
</packing>
|
142
|
+
</child>
|
143
|
+
<child>
|
144
|
+
<object class="GtkCheckButton" id="center">
|
145
|
+
<property name="label" translatable="yes">Center Artist Header</property>
|
146
|
+
<property name="visible">True</property>
|
147
|
+
<property name="can_focus">True</property>
|
148
|
+
<property name="receives_default">False</property>
|
149
|
+
<property name="use_action_appearance">False</property>
|
150
|
+
<property name="draw_indicator">True</property>
|
151
|
+
</object>
|
152
|
+
<packing>
|
153
|
+
<property name="left_attach">1</property>
|
154
|
+
<property name="right_attach">2</property>
|
155
|
+
<property name="top_attach">1</property>
|
156
|
+
<property name="bottom_attach">2</property>
|
157
|
+
</packing>
|
158
|
+
</child>
|
159
|
+
<child>
|
160
|
+
<object class="GtkCheckButton" id="editable">
|
161
|
+
<property name="label" translatable="yes">Turn Off Editing</property>
|
162
|
+
<property name="visible">True</property>
|
163
|
+
<property name="can_focus">True</property>
|
164
|
+
<property name="receives_default">False</property>
|
165
|
+
<property name="use_action_appearance">False</property>
|
166
|
+
<property name="draw_indicator">True</property>
|
167
|
+
</object>
|
168
|
+
<packing>
|
169
|
+
<property name="left_attach">1</property>
|
170
|
+
<property name="right_attach">2</property>
|
171
|
+
<property name="top_attach">2</property>
|
172
|
+
<property name="bottom_attach">3</property>
|
173
|
+
</packing>
|
174
|
+
</child>
|
175
|
+
<child>
|
176
|
+
<object class="GtkCheckButton" id="digits">
|
177
|
+
<property name="label" translatable="yes">Make Qty Digits show 10ths</property>
|
178
|
+
<property name="visible">True</property>
|
179
|
+
<property name="can_focus">True</property>
|
180
|
+
<property name="receives_default">False</property>
|
181
|
+
<property name="use_action_appearance">False</property>
|
182
|
+
<property name="draw_indicator">True</property>
|
183
|
+
</object>
|
184
|
+
<packing>
|
185
|
+
<property name="left_attach">1</property>
|
186
|
+
<property name="right_attach">2</property>
|
187
|
+
<property name="top_attach">3</property>
|
188
|
+
<property name="bottom_attach">4</property>
|
189
|
+
</packing>
|
190
|
+
</child>
|
191
|
+
<child>
|
192
|
+
<object class="GtkCheckButton" id="radio">
|
193
|
+
<property name="label" translatable="yes">Make Ok Boxes 'Radio' Type</property>
|
194
|
+
<property name="visible">True</property>
|
195
|
+
<property name="can_focus">True</property>
|
196
|
+
<property name="receives_default">False</property>
|
197
|
+
<property name="use_action_appearance">False</property>
|
198
|
+
<property name="draw_indicator">True</property>
|
199
|
+
</object>
|
200
|
+
</child>
|
201
|
+
</object>
|
202
|
+
<packing>
|
203
|
+
<property name="expand">False</property>
|
204
|
+
<property name="fill">False</property>
|
205
|
+
<property name="padding">10</property>
|
206
|
+
<property name="position">2</property>
|
207
|
+
</packing>
|
208
|
+
</child>
|
209
|
+
</object>
|
210
|
+
<packing>
|
211
|
+
<property name="expand">True</property>
|
212
|
+
<property name="fill">True</property>
|
213
|
+
<property name="padding">10</property>
|
214
|
+
<property name="position">0</property>
|
215
|
+
</packing>
|
216
|
+
</child>
|
217
|
+
</object>
|
218
|
+
</child>
|
219
|
+
</object>
|
220
|
+
</interface>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'gtk2'
|
5
|
+
require 'require_all'
|
6
|
+
require 'vrlib'
|
7
|
+
|
8
|
+
#make program output in real time so errors visible in VR.
|
9
|
+
STDOUT.sync = true
|
10
|
+
STDERR.sync = true
|
11
|
+
|
12
|
+
#everything in these directories will be included
|
13
|
+
my_path = File.expand_path(File.dirname(__FILE__))
|
14
|
+
|
15
|
+
require_all Dir.glob(my_path + "/bin/**/*.rb")
|
16
|
+
|
17
|
+
x = SongListViewGUI.new
|
18
|
+
x.show
|
19
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:VR_ENV
|
2
|
+
backup_path: /home/eric
|
3
|
+
browser: firefox
|
4
|
+
current_file: /home/eric/vrp/vrx/visualruby_examples/listview_objects/main.rb
|
5
|
+
font_name: Monospace 10
|
6
|
+
glade_path: glade-gtk2
|
7
|
+
height: 604
|
8
|
+
open_files:
|
9
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview_objects/bin/ListViewObjectsGUI.rb
|
10
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview_objects/bin/ListViewObjects.rb
|
11
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview_objects/main.rb
|
12
|
+
open_folders:
|
13
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview_objects
|
14
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview_objects/bin
|
15
|
+
- /home/eric/vrp/vrx/visualruby_examples/listview_objects/bin/glade
|
16
|
+
panel_pos: 360
|
17
|
+
rdoc_command_line: rdoc -x README
|
18
|
+
run_command_line: ruby main.rb
|
19
|
+
tab_spaces: 2
|
20
|
+
width: 1199
|
21
|
+
builder: !ruby/object:Gtk::Builder {}
|
22
|
+
glade_box: !ruby/object:VR::SimpleComboBoxEntry {}
|
23
|
+
browser_box: !ruby/object:VR::SimpleComboBoxEntry {}
|
24
|
+
buttonChooseFolder: ! '...'
|
25
|
+
vbox1: !ruby/object:Gtk::VBox {}
|
26
|
+
label7: ! 'Editor Font:'
|
27
|
+
label3: ! 'Back-up Path:'
|
28
|
+
window1: !ruby/object:Gtk::Window {}
|
29
|
+
hbuttonbox1: !ruby/object:Gtk::HButtonBox {}
|
30
|
+
buttonCancel: Cancel
|
31
|
+
label8: ! 'RDoc Command Line: '
|
32
|
+
table1: !ruby/object:Gtk::Table {}
|
33
|
+
buttonTryBrowser: Try
|
34
|
+
buttonSave: Save
|
35
|
+
hboxBrowser: !ruby/object:Gtk::HBox {}
|
36
|
+
hboxGlade: !ruby/object:Gtk::HBox {}
|
37
|
+
label1: <big><big><b>Visual Ruby Settings</b></big></big>
|
38
|
+
label2: ! 'Browser Command Line:'
|
39
|
+
label4: ! 'Spaces for Each Tab in Editor:'
|
40
|
+
label5: ! 'Glade Command Line:'
|
41
|
+
label6: ! 'Command Line when "Run" is pressed:'
|
42
|
+
hbox1: !ruby/object:Gtk::HBox {}
|
43
|
+
hbox2: !ruby/object:Gtk::HBox {}
|
44
|
+
hbox3: !ruby/object:Gtk::HBox {}
|
45
|
+
hbox4: !ruby/object:Gtk::HBox {}
|
46
|
+
buttonTryGlade: Try
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class DataObject
|
4
|
+
|
5
|
+
include GladeGUI
|
6
|
+
|
7
|
+
def initialize(name, address, email, phone)
|
8
|
+
@name = name
|
9
|
+
@address = address
|
10
|
+
@email = email
|
11
|
+
@phone = phone
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
def buttonSave__clicked(*args)
|
16
|
+
get_glade_variables()
|
17
|
+
destroy_window()
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
"#{@name} (#{@email})"
|
22
|
+
end
|
23
|
+
|
24
|
+
def visual_attributes()
|
25
|
+
{ :background => email_valid? ? "white" : "yellow" }
|
26
|
+
end
|
27
|
+
|
28
|
+
def email_valid?
|
29
|
+
@email =~ /\A[\w\._%-]+@[\w\.-]+\.[a-zA-Z]{2,4}\z/
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
##
|
2
|
+
# This demonstrates how you can easily add a GUI to any ruby class.
|
3
|
+
# The class DataObject holds all the logic for the class and
|
4
|
+
# DataObjectGUI holds all the GUI elements. This is a very good
|
5
|
+
# way to use visualruby because it keeps your code organized.
|
6
|
+
#
|
7
|
+
# Also, you can easily add a GUI to any of your existing ruby classes by
|
8
|
+
# simply making a class, MyClassGUI, that is a subclass of your existing class.
|
9
|
+
#
|
10
|
+
# In this example, I've added a button to the glade form with the name, "buttonShow.'
|
11
|
+
# The button's "clicked" signal (see 'signal' tab in glade) is set to
|
12
|
+
# "buttonShow_clicked." That means when the user clicks the button,
|
13
|
+
# the method "buttonShow_clicked" will be called in this file. You can see
|
14
|
+
# the code below.
|
15
|
+
#
|
16
|
+
# Notice that in glade, the entry fields are named:
|
17
|
+
#
|
18
|
+
# DataObjectGUI.name
|
19
|
+
# DataObjectGUI.address ...etc.
|
20
|
+
#
|
21
|
+
# This is so that set_glade_all() and get_glade_all() will be able to map them to
|
22
|
+
# the instance variables.
|
23
|
+
#
|
24
|
+
|
25
|
+
class DataObjectGUI < DataObject
|
26
|
+
|
27
|
+
include GladeGUI
|
28
|
+
|
29
|
+
def show()
|
30
|
+
load_glade(__FILE__) #loads file, glade/DataObjectGUI.glade into @builder
|
31
|
+
set_glade_all() #populates glade controls with insance variables from DataObject
|
32
|
+
show_window()
|
33
|
+
end
|
34
|
+
|
35
|
+
def buttonShow__clicked(button)
|
36
|
+
get_glade_all() #this sets the instance variables from values in the glade form.
|
37
|
+
VR::Dialog.message_box("Curent values:\n\n#{@name}\n#{@address}\n#{@email}\n#{@phone}\n")
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
class ListViewObjects < VR::ListView
|
4
|
+
|
5
|
+
def initialize()
|
6
|
+
@cols = {}
|
7
|
+
@cols[:join] = VR::CalendarCol
|
8
|
+
@cols[:name] = DataObject
|
9
|
+
@cols[:quote] = VR::TextCol
|
10
|
+
super(@cols)
|
11
|
+
col_title(:join => "Joined On", :name => "Name (email)", :quote => "Favorite Quote")
|
12
|
+
col_width(:join => 200, :name => 300)
|
13
|
+
refresh()
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
def refresh() # just populates model with random data
|
19
|
+
row = add_row()
|
20
|
+
row[:join] = VR::CalendarCol.new DateTime.new(2011, 1, 15, 7, 23, 0)
|
21
|
+
row[:name] = DataObject.new("Henry Johnson", "18458 S Beauford St.", "hohohoja@email.net", "154-453-8585")
|
22
|
+
row[:quote] = VR::TextCol.new "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth.\n\n- Umberto Eco"
|
23
|
+
row = add_row()
|
24
|
+
row[:join] = VR::CalendarCol.new DateTime.new(1997, 7, 24, 3, 26, 0)
|
25
|
+
row[:name] = DataObject.new("Theo Alexander", "935 Medford Ln.", "noreply@gmail.com", "586-673-9474")
|
26
|
+
row[:quote] = VR::TextCol.new "The instinct of nearly all societies is to lock up anybody who is truly free. First, society begins by trying to beat you up. If this fails, they try to poison you. If this fails too, they finish by loading honors on your head.\n\n- Jean Cocteau (1889-1963)"
|
27
|
+
row = add_row()
|
28
|
+
row[:join] = VR::CalendarCol.new DateTime.new(1987, 5, 11, 6, 43, 0)
|
29
|
+
row[:name] = DataObject.new("Billy Vincent", "675 Telegraph Rd.", "jimmy@visualruby.net", "432-485-5863")
|
30
|
+
row[:quote] = VR::TextCol.new "There are two ways of constructing a software design; one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.\n\n- C. A. R. Hoare"
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
|
2
|
+
class ListViewObjectsGUI < ListViewObjects
|
3
|
+
|
4
|
+
include GladeGUI
|
5
|
+
|
6
|
+
def before_show
|
7
|
+
@builder["scrolledwindow1"].add(self)
|
8
|
+
select_row(0) #in VR::ListView
|
9
|
+
renderer(:quote).edited_callback = method(:selection__changed)
|
10
|
+
end
|
11
|
+
|
12
|
+
def selection__changed(*args)
|
13
|
+
return unless row = selected_rows.first # iter = selection.selected
|
14
|
+
@builder["labelQuote"].label = row[:quote].text
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,198 @@
|
|
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="title" translatable="yes">Basic Object Demo</property>
|
9
|
+
<property name="modal">True</property>
|
10
|
+
<property name="window_position">center-always</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
|
+
<property name="spacing">10</property>
|
21
|
+
<child>
|
22
|
+
<object class="GtkLabel" id="label5">
|
23
|
+
<property name="visible">True</property>
|
24
|
+
<property name="can_focus">False</property>
|
25
|
+
<property name="label" translatable="yes"><big><big>Basic Object Demo</big></big>
|
26
|
+
This was created with visualruby. See visualruby.net.</property>
|
27
|
+
<property name="use_markup">True</property>
|
28
|
+
</object>
|
29
|
+
<packing>
|
30
|
+
<property name="expand">True</property>
|
31
|
+
<property name="fill">True</property>
|
32
|
+
<property name="padding">10</property>
|
33
|
+
<property name="position">0</property>
|
34
|
+
</packing>
|
35
|
+
</child>
|
36
|
+
<child>
|
37
|
+
<object class="GtkTable" id="table1">
|
38
|
+
<property name="visible">True</property>
|
39
|
+
<property name="can_focus">False</property>
|
40
|
+
<property name="n_rows">4</property>
|
41
|
+
<property name="n_columns">2</property>
|
42
|
+
<property name="column_spacing">7</property>
|
43
|
+
<property name="row_spacing">10</property>
|
44
|
+
<child>
|
45
|
+
<object class="GtkLabel" id="label1">
|
46
|
+
<property name="visible">True</property>
|
47
|
+
<property name="can_focus">False</property>
|
48
|
+
<property name="xalign">1</property>
|
49
|
+
<property name="label" translatable="yes">Name:</property>
|
50
|
+
</object>
|
51
|
+
</child>
|
52
|
+
<child>
|
53
|
+
<object class="GtkLabel" id="label2">
|
54
|
+
<property name="visible">True</property>
|
55
|
+
<property name="can_focus">False</property>
|
56
|
+
<property name="xalign">1</property>
|
57
|
+
<property name="label" translatable="yes">Address:</property>
|
58
|
+
</object>
|
59
|
+
<packing>
|
60
|
+
<property name="top_attach">1</property>
|
61
|
+
<property name="bottom_attach">2</property>
|
62
|
+
</packing>
|
63
|
+
</child>
|
64
|
+
<child>
|
65
|
+
<object class="GtkLabel" id="label3">
|
66
|
+
<property name="visible">True</property>
|
67
|
+
<property name="can_focus">False</property>
|
68
|
+
<property name="xalign">1</property>
|
69
|
+
<property name="label" translatable="yes">Email:</property>
|
70
|
+
</object>
|
71
|
+
<packing>
|
72
|
+
<property name="top_attach">2</property>
|
73
|
+
<property name="bottom_attach">3</property>
|
74
|
+
</packing>
|
75
|
+
</child>
|
76
|
+
<child>
|
77
|
+
<object class="GtkLabel" id="label4">
|
78
|
+
<property name="visible">True</property>
|
79
|
+
<property name="can_focus">False</property>
|
80
|
+
<property name="xalign">1</property>
|
81
|
+
<property name="label" translatable="yes">Phone</property>
|
82
|
+
</object>
|
83
|
+
<packing>
|
84
|
+
<property name="top_attach">3</property>
|
85
|
+
<property name="bottom_attach">4</property>
|
86
|
+
</packing>
|
87
|
+
</child>
|
88
|
+
<child>
|
89
|
+
<object class="GtkEntry" id="name">
|
90
|
+
<property name="visible">True</property>
|
91
|
+
<property name="can_focus">True</property>
|
92
|
+
<property name="invisible_char">•</property>
|
93
|
+
<property name="primary_icon_activatable">False</property>
|
94
|
+
<property name="secondary_icon_activatable">False</property>
|
95
|
+
<property name="primary_icon_sensitive">True</property>
|
96
|
+
<property name="secondary_icon_sensitive">True</property>
|
97
|
+
</object>
|
98
|
+
<packing>
|
99
|
+
<property name="left_attach">1</property>
|
100
|
+
<property name="right_attach">2</property>
|
101
|
+
</packing>
|
102
|
+
</child>
|
103
|
+
<child>
|
104
|
+
<object class="GtkEntry" id="address">
|
105
|
+
<property name="visible">True</property>
|
106
|
+
<property name="can_focus">True</property>
|
107
|
+
<property name="invisible_char">•</property>
|
108
|
+
<property name="primary_icon_activatable">False</property>
|
109
|
+
<property name="secondary_icon_activatable">False</property>
|
110
|
+
<property name="primary_icon_sensitive">True</property>
|
111
|
+
<property name="secondary_icon_sensitive">True</property>
|
112
|
+
</object>
|
113
|
+
<packing>
|
114
|
+
<property name="left_attach">1</property>
|
115
|
+
<property name="right_attach">2</property>
|
116
|
+
<property name="top_attach">1</property>
|
117
|
+
<property name="bottom_attach">2</property>
|
118
|
+
</packing>
|
119
|
+
</child>
|
120
|
+
<child>
|
121
|
+
<object class="GtkEntry" id="email">
|
122
|
+
<property name="visible">True</property>
|
123
|
+
<property name="can_focus">True</property>
|
124
|
+
<property name="invisible_char">•</property>
|
125
|
+
<property name="primary_icon_activatable">False</property>
|
126
|
+
<property name="secondary_icon_activatable">False</property>
|
127
|
+
<property name="primary_icon_sensitive">True</property>
|
128
|
+
<property name="secondary_icon_sensitive">True</property>
|
129
|
+
</object>
|
130
|
+
<packing>
|
131
|
+
<property name="left_attach">1</property>
|
132
|
+
<property name="right_attach">2</property>
|
133
|
+
<property name="top_attach">2</property>
|
134
|
+
<property name="bottom_attach">3</property>
|
135
|
+
</packing>
|
136
|
+
</child>
|
137
|
+
<child>
|
138
|
+
<object class="GtkEntry" id="phone">
|
139
|
+
<property name="visible">True</property>
|
140
|
+
<property name="can_focus">True</property>
|
141
|
+
<property name="invisible_char">•</property>
|
142
|
+
<property name="primary_icon_activatable">False</property>
|
143
|
+
<property name="secondary_icon_activatable">False</property>
|
144
|
+
<property name="primary_icon_sensitive">True</property>
|
145
|
+
<property name="secondary_icon_sensitive">True</property>
|
146
|
+
</object>
|
147
|
+
<packing>
|
148
|
+
<property name="left_attach">1</property>
|
149
|
+
<property name="right_attach">2</property>
|
150
|
+
<property name="top_attach">3</property>
|
151
|
+
<property name="bottom_attach">4</property>
|
152
|
+
</packing>
|
153
|
+
</child>
|
154
|
+
</object>
|
155
|
+
<packing>
|
156
|
+
<property name="expand">True</property>
|
157
|
+
<property name="fill">True</property>
|
158
|
+
<property name="position">1</property>
|
159
|
+
</packing>
|
160
|
+
</child>
|
161
|
+
<child>
|
162
|
+
<object class="GtkHButtonBox" id="hbuttonbox1">
|
163
|
+
<property name="visible">True</property>
|
164
|
+
<property name="can_focus">False</property>
|
165
|
+
<child>
|
166
|
+
<object class="GtkButton" id="buttonSave">
|
167
|
+
<property name="label" translatable="yes">Save</property>
|
168
|
+
<property name="visible">True</property>
|
169
|
+
<property name="can_focus">True</property>
|
170
|
+
<property name="receives_default">True</property>
|
171
|
+
<property name="use_action_appearance">False</property>
|
172
|
+
</object>
|
173
|
+
<packing>
|
174
|
+
<property name="expand">False</property>
|
175
|
+
<property name="fill">False</property>
|
176
|
+
<property name="position">0</property>
|
177
|
+
</packing>
|
178
|
+
</child>
|
179
|
+
</object>
|
180
|
+
<packing>
|
181
|
+
<property name="expand">True</property>
|
182
|
+
<property name="fill">True</property>
|
183
|
+
<property name="padding">10</property>
|
184
|
+
<property name="position">2</property>
|
185
|
+
</packing>
|
186
|
+
</child>
|
187
|
+
</object>
|
188
|
+
<packing>
|
189
|
+
<property name="expand">True</property>
|
190
|
+
<property name="fill">True</property>
|
191
|
+
<property name="padding">15</property>
|
192
|
+
<property name="position">0</property>
|
193
|
+
</packing>
|
194
|
+
</child>
|
195
|
+
</object>
|
196
|
+
</child>
|
197
|
+
</object>
|
198
|
+
</interface>
|