visualruby 1.0.19 → 3.0.2
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.
- checksums.yaml +4 -4
- data/Splash.rb +40 -0
- data/bin/editor/VR_Document.rb +81 -74
- data/bin/editor/VR_TabSearch.rb +5 -7
- data/bin/editor/VR_Tabs.rb +57 -36
- data/bin/editor/VR_TextShell.rb +12 -34
- data/bin/editor/VR_TextViewCommon.rb +9 -28
- data/bin/main/NewProjectGUI.rb +14 -13
- data/bin/main/OpenProject.rb +69 -0
- data/bin/main/ProjectChooserView.rb +3 -2
- data/bin/main/ProjectTree.rb +25 -0
- data/bin/main/RubygemsAPI.rb +15 -11
- data/bin/main/VR_ENV.rb +38 -60
- data/bin/main/VR_ENV_GLOBAL.rb +45 -44
- data/bin/main/VR_File_Tree.rb +29 -21
- data/bin/main/VR_Local_Gem_Tree.rb +4 -19
- data/bin/main/VR_Main.rb +128 -144
- data/bin/main/VR_Remote_Gem_Tree.rb +6 -19
- data/bin/main/glade/NewProjectGUI.glade +94 -98
- data/bin/main/glade/OpenProject.glade +259 -0
- data/bin/main/glade/RubygemsAPI.glade +98 -62
- data/bin/main/glade/VR_ENV.glade +46 -55
- data/bin/main/glade/VR_ENV_GLOBAL.glade +251 -180
- data/bin/main/glade/VR_File_Tree.glade +25 -16
- data/bin/main/glade/VR_Local_Gem_Tree.glade +16 -8
- data/bin/main/glade/VR_Main.glade +410 -449
- data/bin/main/glade/VR_Remote_Gem_Tree.glade +33 -31
- data/bin/tools/VR_Tools.rb +60 -46
- data/{visualruby_examples → examples}/active_record/active_record.rb +16 -10
- data/{visualruby_examples → examples}/active_record/bin/ChoosePerson.rb +7 -0
- data/examples/active_record/bin/Person.rb +21 -0
- data/examples/active_record/bin/glade/ChoosePerson.glade +89 -0
- data/examples/active_record/bin/glade/Person.glade +197 -0
- data/{visualruby_examples → examples}/active_record/db/development.sqlite3 +0 -0
- data/{visualruby_examples → examples}/active_record2/bin/CompanyGUI.rb +7 -7
- data/{visualruby_examples → examples}/active_record2/bin/Employee.rb +0 -0
- data/{visualruby_examples → examples}/active_record2/bin/Employer.rb +0 -0
- data/{visualruby_examples → examples}/active_record2/bin/Paycheck.rb +0 -0
- data/examples/active_record2/bin/glade/CompanyGUI.glade +149 -0
- data/examples/active_record2/bin/glade/Employee.glade +126 -0
- data/{visualruby_examples → examples}/active_record2/bin/glade/Employer.glade +0 -0
- data/{visualruby_examples → examples}/active_record2/bin/glade/Paycheck.glade +0 -0
- data/{visualruby_examples → examples}/active_record2/db/development.sqlite3 +0 -0
- data/{visualruby_examples → examples}/active_record2/main.rb +15 -9
- data/examples/alert_box/bin/AlertBoxDemo.rb +80 -0
- data/examples/alert_box/bin/glade/AlertBoxDemo.glade +234 -0
- data/examples/alert_box/main.rb +12 -0
- data/{visualruby_examples → examples}/all_widgets/bin/AllWidgets.rb +18 -10
- data/{visualruby_examples → examples}/all_widgets/bin/glade/AllWidgets.glade +52 -16
- data/{visualruby_examples → examples}/all_widgets/bin/splash.png +0 -0
- data/examples/all_widgets/main.rb +12 -0
- data/{visualruby_examples → examples}/calculator/bin/Calculator.rb +23 -22
- data/{visualruby_examples → examples}/calculator/bin/glade/Calculator.glade +81 -51
- data/examples/calculator/main.rb +13 -0
- data/examples/child_window/bin/ChildWindowDemo.rb +52 -0
- data/examples/child_window/bin/ModalWindow.rb +9 -0
- data/examples/child_window/bin/ModelessWindow.rb +9 -0
- data/examples/child_window/bin/MyChildClass.rb +21 -0
- data/examples/child_window/bin/glade/ChildWindowDemo.glade +87 -0
- data/examples/child_window/bin/glade/ModalWindow.glade +61 -0
- data/examples/child_window/bin/glade/ModelessWindow.glade +61 -0
- data/{visualruby_examples → examples}/child_window/bin/glade/MyChildClass.glade +14 -12
- data/examples/child_window/main.rb +12 -0
- data/{visualruby_examples → examples}/drag_drop/bin/DragDropDemo.rb +9 -10
- data/examples/drag_drop/bin/glade/DragDropDemo.glade +161 -0
- data/{visualruby_examples → examples}/drag_drop/img/folder.png +0 -0
- data/{visualruby_examples → examples}/drag_drop/img/glade.png +0 -0
- data/{visualruby_examples → examples}/drag_drop/img/gtk-edit.png +0 -0
- data/{visualruby_examples → examples}/drag_drop/img/obj.png +0 -0
- data/{visualruby_examples → examples}/drag_drop/img/png.png +0 -0
- data/{visualruby_examples → examples}/drag_drop/img/rb.png +0 -0
- data/{visualruby_examples → examples}/drag_drop/img/ruby.png +0 -0
- data/{visualruby_examples → examples}/drag_drop/img/unknown.png +0 -0
- data/examples/drag_drop/main.rb +11 -0
- data/examples/filetreeview/bin/ProjectTree.rb +32 -0
- data/examples/filetreeview/bin/ProjectTreeGUI.rb +28 -0
- data/examples/filetreeview/bin/glade/ProjectTreeGUI.glade +156 -0
- data/examples/filetreeview/main.rb +13 -0
- data/{visualruby_examples → examples}/listview/bin/SongListView.rb +24 -20
- data/{visualruby_examples → examples}/listview/bin/SongListViewGUI.rb +12 -11
- data/{visualruby_examples → examples}/listview/bin/audio-x-generic.png +0 -0
- data/examples/listview/bin/glade/SongListViewGUI.glade +195 -0
- data/examples/listview/main.rb +10 -0
- data/examples/listview_objects/bin/DataObject.rb +53 -0
- data/{visualruby_examples → examples}/listview_objects/bin/ListViewObjects.rb +7 -4
- data/examples/listview_objects/bin/ListViewObjectsGUI.rb +26 -0
- data/examples/listview_objects/bin/glade/DataObject.glade +196 -0
- data/examples/listview_objects/bin/glade/ListViewObjectsGUI.glade +87 -0
- data/examples/listview_objects/main.rb +12 -0
- data/examples/settings_file/bin/MainApp.rb +38 -0
- data/examples/settings_file/bin/SavableSettings.rb +39 -0
- data/examples/settings_file/bin/glade/MainApp.glade +87 -0
- data/examples/settings_file/bin/glade/SavableSettings.glade +162 -0
- data/examples/settings_file/main.rb +14 -0
- data/examples/settings_file/settings.yaml +15 -0
- data/examples/simple_ruby_gui/bin/DataObjectGUI.rb +21 -0
- data/examples/simple_ruby_gui/bin/glade/DataObjectGUI.glade +195 -0
- data/examples/simple_ruby_gui/main.rb +16 -0
- data/{visualruby_examples → examples}/treeview/bin/MyClass.rb +1 -5
- data/examples/treeview/bin/glade/MyClass.glade +24 -0
- data/examples/treeview/main.rb +13 -0
- data/skeleton/document/New.glade +3 -4
- data/skeleton/document/NewWindow.rb +1 -1
- data/skeleton/project/bin/MyClass.rb +2 -2
- data/skeleton/project/bin/glade/MyClass.glade +12 -26
- data/skeleton/project/main.rb +4 -8
- data/vr +41 -37
- data/vrlib/lib/Alert.rb +67 -0
- data/vrlib/lib/DragDrop.rb +90 -0
- data/vrlib/lib/GladeGUI.rb +433 -0
- data/vrlib/lib/IconHash.rb +18 -0
- data/vrlib/lib/SavableClass.rb +56 -0
- data/vrlib/lib/SimpleComboBoxEntry.rb +8 -0
- data/vrlib/lib/glade/Alert.glade +119 -0
- data/vrlib/lib/treeview/FileTreeView.rb +113 -0
- data/vrlib/lib/treeview/IterMethods.rb +82 -0
- data/vrlib/lib/treeview/ListView.rb +85 -0
- data/vrlib/lib/treeview/TreeView.rb +43 -0
- data/vrlib/lib/treeview/ViewCommon.rb +370 -0
- data/vrlib/lib/treeview/columns/CalendarCol.rb +89 -0
- data/vrlib/lib/treeview/columns/CellRendererCombo.rb +66 -0
- data/vrlib/lib/treeview/columns/CellRendererDate.rb +45 -0
- data/vrlib/lib/treeview/columns/CellRendererObject.rb +57 -0
- data/vrlib/lib/treeview/columns/CellRendererPhone.rb +45 -0
- data/vrlib/lib/treeview/columns/CellRendererPixbuf.rb +16 -0
- data/vrlib/lib/treeview/columns/CellRendererProgress.rb +17 -0
- data/vrlib/lib/treeview/columns/CellRendererSpin.rb +37 -0
- data/vrlib/lib/treeview/columns/CellRendererText.rb +38 -0
- data/vrlib/lib/treeview/columns/CellRendererToggle.rb +47 -0
- data/vrlib/lib/treeview/columns/ComboCol.rb +43 -0
- data/vrlib/lib/treeview/columns/CurrencyCol.rb +23 -0
- data/vrlib/lib/treeview/columns/DateCol.rb +20 -0
- data/vrlib/lib/treeview/columns/ImageCol.rb +27 -0
- data/vrlib/lib/treeview/columns/ProgressCol.rb +27 -0
- data/vrlib/lib/treeview/columns/SpinCol.rb +11 -0
- data/vrlib/lib/treeview/columns/TextCol.rb +65 -0
- data/vrlib/lib/treeview/columns/TreeViewColumn.rb +93 -0
- data/{bin/main/glade/ProjectChooserGUI.glade → vrlib/lib/treeview/columns/glade/CalendarCol.glade} +71 -63
- data/{bin/main/glade/Splash.glade → vrlib/lib/treeview/columns/glade/ImageCol.glade} +5 -6
- data/vrlib/lib/treeview/columns/glade/TextCol.glade +82 -0
- data/vrlib/rdoc_replace.yaml +77 -0
- data/vrlib/vrlib.rb +7 -0
- metadata +163 -136
- data/bin/editor/glade/VR_Document.glade +0 -160
- data/bin/main/ProjectChooserGUI.rb +0 -41
- data/bin/main/Splash.rb +0 -22
- data/visualruby_examples/active_record/.vr_settings.yaml +0 -47
- data/visualruby_examples/active_record/bin/Person.rb +0 -13
- data/visualruby_examples/active_record/bin/glade/ChoosePerson.glade +0 -61
- data/visualruby_examples/active_record/bin/glade/Person.glade +0 -148
- data/visualruby_examples/active_record2/.vr_settings.yaml +0 -16
- data/visualruby_examples/active_record2/bin/glade/CompanyGUI.glade +0 -167
- data/visualruby_examples/active_record2/bin/glade/Employee.glade +0 -123
- data/visualruby_examples/all_widgets/.vr_settings.yaml +0 -13
- data/visualruby_examples/all_widgets/main.rb +0 -14
- data/visualruby_examples/calculator/.vr_settings.yaml +0 -11
- data/visualruby_examples/calculator/main.rb +0 -13
- data/visualruby_examples/child_window/.vr_settings.yaml +0 -16
- data/visualruby_examples/child_window/bin/ChildWindowDemo.rb +0 -39
- data/visualruby_examples/child_window/bin/MyChildClass.rb +0 -40
- data/visualruby_examples/child_window/bin/glade/ChildWindowDemo.glade +0 -101
- data/visualruby_examples/child_window/main.rb +0 -13
- data/visualruby_examples/drag_drop/.vr_settings.yaml +0 -12
- data/visualruby_examples/drag_drop/bin/glade/DragDropDemo.glade +0 -143
- data/visualruby_examples/drag_drop/main.rb +0 -14
- data/visualruby_examples/listview/.vr_settings.yaml +0 -12
- data/visualruby_examples/listview/bin/glade/SongListViewGUI.glade +0 -220
- data/visualruby_examples/listview/main.rb +0 -19
- data/visualruby_examples/listview_objects/.vr_settings.yaml +0 -16
- data/visualruby_examples/listview_objects/bin/DataObject.rb +0 -32
- data/visualruby_examples/listview_objects/bin/DataObjectGUI.rb +0 -41
- data/visualruby_examples/listview_objects/bin/ListViewObjectsGUI.rb +0 -18
- data/visualruby_examples/listview_objects/bin/glade/DataObject.glade +0 -198
- data/visualruby_examples/listview_objects/bin/glade/ListViewObjectsGUI.glade +0 -102
- data/visualruby_examples/listview_objects/main.rb +0 -13
- data/visualruby_examples/simple_ruby_gui/.vr_settings.yaml +0 -16
- data/visualruby_examples/simple_ruby_gui/bin/DataObjectGUI.rb +0 -20
- data/visualruby_examples/simple_ruby_gui/bin/glade/DataObjectGUI.glade +0 -163
- data/visualruby_examples/simple_ruby_gui/main.rb +0 -16
- data/visualruby_examples/treeview/.vr_settings.yaml +0 -12
- data/visualruby_examples/treeview/bin/glade/MyClass.glade +0 -48
- data/visualruby_examples/treeview/main.rb +0 -14
|
@@ -7,52 +7,53 @@ class SongListViewGUI < SongListView
|
|
|
7
7
|
@builder["scrolledwindow1"].add(self)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
def self__row_activated(*
|
|
10
|
+
def self__row_activated(*args)
|
|
11
11
|
return unless rows = selected_rows
|
|
12
12
|
row = rows[0]
|
|
13
|
-
|
|
13
|
+
alert "You selected\n#{row[:song]}\nby #{row[:artist]}"
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def invisible__toggled(*
|
|
16
|
+
def invisible__toggled(*args)
|
|
17
17
|
v = !@builder["invisible"].active?
|
|
18
18
|
col_visible(:last_name => v, :first_name => v )
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def radio__toggled(*
|
|
21
|
+
def radio__toggled(*args)
|
|
22
22
|
ren_radio(:check => @builder["radio"].active?)
|
|
23
23
|
each_row { |r| r[:check] = false }
|
|
24
24
|
repaint
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
def background__toggled(*
|
|
27
|
+
def background__toggled(*args)
|
|
28
28
|
val = @builder["background"].active? ? "yellow" : "white"
|
|
29
|
-
|
|
29
|
+
renderer(:pix).background = val
|
|
30
|
+
ren_attr(:song, :background => val) # same as set_background( :song => val)
|
|
30
31
|
repaint
|
|
31
32
|
end
|
|
32
33
|
|
|
33
|
-
def xalign__toggled(*
|
|
34
|
+
def xalign__toggled(*args)
|
|
34
35
|
val = @builder["xalign"].active? ? 1 : 0
|
|
35
36
|
ren_xalign(:artist => val)
|
|
36
37
|
repaint
|
|
37
38
|
end
|
|
38
39
|
|
|
39
|
-
def bold__toggled(*
|
|
40
|
+
def bold__toggled(*args)
|
|
40
41
|
val = @builder["bold"].active? ? Pango::WEIGHT_BOLD : Pango::WEIGHT_NORMAL
|
|
41
42
|
ren_weight(:song => val) #number from 100 to 900, BOLD = 700
|
|
42
43
|
repaint
|
|
43
44
|
end
|
|
44
45
|
|
|
45
|
-
def center__toggled(*
|
|
46
|
+
def center__toggled(*args)
|
|
46
47
|
val = @builder["center"].active? ? 0.5 : 0
|
|
47
48
|
col_alignment(:artist => val)
|
|
48
49
|
repaint
|
|
49
50
|
end
|
|
50
51
|
|
|
51
|
-
def editable__toggled(*
|
|
52
|
+
def editable__toggled(*args)
|
|
52
53
|
ren_editable(!@builder["editable"].active?)
|
|
53
54
|
end
|
|
54
55
|
|
|
55
|
-
def digits__toggled(*
|
|
56
|
+
def digits__toggled(*args)
|
|
56
57
|
val = @builder["digits"].active? ? 1 : 0
|
|
57
58
|
ren_digits(:quantity => val)
|
|
58
59
|
repaint
|
|
File without changes
|
|
@@ -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.10"/>
|
|
5
|
+
<object class="GtkWindow" id="window1">
|
|
6
|
+
<property name="can_focus">False</property>
|
|
7
|
+
<property name="title" translatable="yes">ListView Demo</property>
|
|
8
|
+
<property name="window_position">center</property>
|
|
9
|
+
<property name="default_width">960</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">15</property>
|
|
15
|
+
<property name="margin_right">15</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">15</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"><big>ListView Demo</big></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="GtkScrolledWindow" id="scrolledwindow1">
|
|
35
|
+
<property name="width_request">800</property>
|
|
36
|
+
<property name="height_request">200</property>
|
|
37
|
+
<property name="visible">True</property>
|
|
38
|
+
<property name="can_focus">True</property>
|
|
39
|
+
<property name="shadow_type">in</property>
|
|
40
|
+
<child>
|
|
41
|
+
<placeholder/>
|
|
42
|
+
</child>
|
|
43
|
+
</object>
|
|
44
|
+
<packing>
|
|
45
|
+
<property name="expand">False</property>
|
|
46
|
+
<property name="fill">True</property>
|
|
47
|
+
<property name="position">1</property>
|
|
48
|
+
</packing>
|
|
49
|
+
</child>
|
|
50
|
+
<child>
|
|
51
|
+
<object class="GtkGrid" id="grid2">
|
|
52
|
+
<property name="visible">True</property>
|
|
53
|
+
<property name="can_focus">False</property>
|
|
54
|
+
<property name="column_homogeneous">True</property>
|
|
55
|
+
<child>
|
|
56
|
+
<object class="GtkCheckButton" id="invisible">
|
|
57
|
+
<property name="label" translatable="yes">First and Last Name Invisible</property>
|
|
58
|
+
<property name="visible">True</property>
|
|
59
|
+
<property name="can_focus">True</property>
|
|
60
|
+
<property name="receives_default">False</property>
|
|
61
|
+
<property name="xalign">0</property>
|
|
62
|
+
<property name="draw_indicator">True</property>
|
|
63
|
+
</object>
|
|
64
|
+
<packing>
|
|
65
|
+
<property name="left_attach">0</property>
|
|
66
|
+
<property name="top_attach">0</property>
|
|
67
|
+
<property name="width">1</property>
|
|
68
|
+
<property name="height">1</property>
|
|
69
|
+
</packing>
|
|
70
|
+
</child>
|
|
71
|
+
<child>
|
|
72
|
+
<object class="GtkCheckButton" id="xalign">
|
|
73
|
+
<property name="label" translatable="yes">Right Justify Name</property>
|
|
74
|
+
<property name="visible">True</property>
|
|
75
|
+
<property name="can_focus">True</property>
|
|
76
|
+
<property name="receives_default">False</property>
|
|
77
|
+
<property name="xalign">0</property>
|
|
78
|
+
<property name="draw_indicator">True</property>
|
|
79
|
+
</object>
|
|
80
|
+
<packing>
|
|
81
|
+
<property name="left_attach">0</property>
|
|
82
|
+
<property name="top_attach">1</property>
|
|
83
|
+
<property name="width">1</property>
|
|
84
|
+
<property name="height">1</property>
|
|
85
|
+
</packing>
|
|
86
|
+
</child>
|
|
87
|
+
<child>
|
|
88
|
+
<object class="GtkCheckButton" id="bold">
|
|
89
|
+
<property name="label" translatable="yes">Make Song Bold Text</property>
|
|
90
|
+
<property name="visible">True</property>
|
|
91
|
+
<property name="can_focus">True</property>
|
|
92
|
+
<property name="receives_default">False</property>
|
|
93
|
+
<property name="xalign">0</property>
|
|
94
|
+
<property name="draw_indicator">True</property>
|
|
95
|
+
</object>
|
|
96
|
+
<packing>
|
|
97
|
+
<property name="left_attach">0</property>
|
|
98
|
+
<property name="top_attach">2</property>
|
|
99
|
+
<property name="width">1</property>
|
|
100
|
+
<property name="height">1</property>
|
|
101
|
+
</packing>
|
|
102
|
+
</child>
|
|
103
|
+
<child>
|
|
104
|
+
<object class="GtkCheckButton" id="background">
|
|
105
|
+
<property name="label" translatable="yes">Make Song Background Yellow</property>
|
|
106
|
+
<property name="visible">True</property>
|
|
107
|
+
<property name="can_focus">True</property>
|
|
108
|
+
<property name="receives_default">False</property>
|
|
109
|
+
<property name="xalign">0</property>
|
|
110
|
+
<property name="draw_indicator">True</property>
|
|
111
|
+
</object>
|
|
112
|
+
<packing>
|
|
113
|
+
<property name="left_attach">0</property>
|
|
114
|
+
<property name="top_attach">3</property>
|
|
115
|
+
<property name="width">1</property>
|
|
116
|
+
<property name="height">1</property>
|
|
117
|
+
</packing>
|
|
118
|
+
</child>
|
|
119
|
+
<child>
|
|
120
|
+
<object class="GtkCheckButton" id="center">
|
|
121
|
+
<property name="label" translatable="yes">Center Artist Header</property>
|
|
122
|
+
<property name="visible">True</property>
|
|
123
|
+
<property name="can_focus">True</property>
|
|
124
|
+
<property name="receives_default">False</property>
|
|
125
|
+
<property name="xalign">0</property>
|
|
126
|
+
<property name="draw_indicator">True</property>
|
|
127
|
+
</object>
|
|
128
|
+
<packing>
|
|
129
|
+
<property name="left_attach">1</property>
|
|
130
|
+
<property name="top_attach">0</property>
|
|
131
|
+
<property name="width">1</property>
|
|
132
|
+
<property name="height">1</property>
|
|
133
|
+
</packing>
|
|
134
|
+
</child>
|
|
135
|
+
<child>
|
|
136
|
+
<object class="GtkCheckButton" id="editable">
|
|
137
|
+
<property name="label" translatable="yes">Turn Off Editing Cells</property>
|
|
138
|
+
<property name="visible">True</property>
|
|
139
|
+
<property name="can_focus">True</property>
|
|
140
|
+
<property name="receives_default">False</property>
|
|
141
|
+
<property name="xalign">0</property>
|
|
142
|
+
<property name="draw_indicator">True</property>
|
|
143
|
+
</object>
|
|
144
|
+
<packing>
|
|
145
|
+
<property name="left_attach">1</property>
|
|
146
|
+
<property name="top_attach">1</property>
|
|
147
|
+
<property name="width">1</property>
|
|
148
|
+
<property name="height">1</property>
|
|
149
|
+
</packing>
|
|
150
|
+
</child>
|
|
151
|
+
<child>
|
|
152
|
+
<object class="GtkCheckButton" id="radio">
|
|
153
|
+
<property name="label" translatable="yes">Make Ok Boxes Radio Type</property>
|
|
154
|
+
<property name="visible">True</property>
|
|
155
|
+
<property name="can_focus">True</property>
|
|
156
|
+
<property name="receives_default">False</property>
|
|
157
|
+
<property name="margin_top">5</property>
|
|
158
|
+
<property name="margin_bottom">3</property>
|
|
159
|
+
<property name="xalign">0</property>
|
|
160
|
+
<property name="draw_indicator">True</property>
|
|
161
|
+
</object>
|
|
162
|
+
<packing>
|
|
163
|
+
<property name="left_attach">1</property>
|
|
164
|
+
<property name="top_attach">3</property>
|
|
165
|
+
<property name="width">1</property>
|
|
166
|
+
<property name="height">1</property>
|
|
167
|
+
</packing>
|
|
168
|
+
</child>
|
|
169
|
+
<child>
|
|
170
|
+
<object class="GtkCheckButton" id="digits">
|
|
171
|
+
<property name="label" translatable="yes">Show 10ths of Quantity</property>
|
|
172
|
+
<property name="visible">True</property>
|
|
173
|
+
<property name="can_focus">True</property>
|
|
174
|
+
<property name="receives_default">False</property>
|
|
175
|
+
<property name="xalign">0</property>
|
|
176
|
+
<property name="draw_indicator">True</property>
|
|
177
|
+
</object>
|
|
178
|
+
<packing>
|
|
179
|
+
<property name="left_attach">1</property>
|
|
180
|
+
<property name="top_attach">2</property>
|
|
181
|
+
<property name="width">1</property>
|
|
182
|
+
<property name="height">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,53 @@
|
|
|
1
|
+
# This is a basic object that contains data. Using visualruby, you can easily
|
|
2
|
+
# load your objects into a listview and manipulate them. You just define one
|
|
3
|
+
# of the colums's type as the object's name (here DataObject) and it will appear in the
|
|
4
|
+
# ListView.
|
|
5
|
+
|
|
6
|
+
class DataObject
|
|
7
|
+
|
|
8
|
+
include GladeGUI
|
|
9
|
+
|
|
10
|
+
def initialize(name, address, email, phone)
|
|
11
|
+
@name = name
|
|
12
|
+
@address = address
|
|
13
|
+
@email = email
|
|
14
|
+
@phone = phone
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# In the glade form, there are buttons named buttonSave and buttonCancel.
|
|
18
|
+
# By using the naming convention <name>__clicked these methods will be called when the clicked even occurs.
|
|
19
|
+
|
|
20
|
+
def buttonSave__clicked(*args)
|
|
21
|
+
get_glade_variables()
|
|
22
|
+
@builder["window1"].destroy
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def buttonCancel__clicked(*args)
|
|
27
|
+
@builder["window1"].destroy
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
#The to_s method defines how this object appears in the ListView.
|
|
32
|
+
#Think of it like an icon. It should be a short representation
|
|
33
|
+
#of the object. THen when the user clicks on it, they get the full object
|
|
34
|
+
|
|
35
|
+
def to_s
|
|
36
|
+
"#{@name} (#{@email})"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
#The visual_attributes method defines the appearance of the object in the
|
|
40
|
+
#ListView. You can change the background to red for example to flag the object.
|
|
41
|
+
#Here the invalid emails will be shown with a yellow background. Try entering an invalid
|
|
42
|
+
#email, and you'll see it will turn yellow.
|
|
43
|
+
|
|
44
|
+
def visual_attributes()
|
|
45
|
+
{ :background => email_valid? ? "white" : "yellow" }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def email_valid?
|
|
49
|
+
@email =~ /\A[\w\._%-]+@[\w\.-]+\.[a-zA-Z]{2,4}\z/
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
end
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
# This is a listview that contains objects! THe columns contain a date object, a user defined, and
|
|
2
|
+
# a long (blob) text string. The columns are named :join, :name, and :quote.
|
|
2
3
|
|
|
3
4
|
class ListViewObjects < VR::ListView
|
|
4
5
|
|
|
5
6
|
def initialize()
|
|
7
|
+
|
|
8
|
+
#define column types, then call super()
|
|
6
9
|
@cols = {}
|
|
7
10
|
@cols[:join] = VR::CalendarCol
|
|
8
11
|
@cols[:name] = DataObject
|
|
@@ -10,14 +13,14 @@ class ListViewObjects < VR::ListView
|
|
|
10
13
|
super(@cols)
|
|
11
14
|
col_title(:join => "Joined On", :name => "Name (email)", :quote => "Favorite Quote")
|
|
12
15
|
col_width(:join => 200, :name => 300)
|
|
13
|
-
|
|
16
|
+
populate_data()
|
|
14
17
|
end
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
|
|
18
|
-
def
|
|
21
|
+
def populate_data() # just populates model with random data
|
|
19
22
|
row = add_row()
|
|
20
|
-
row[:join] = VR::CalendarCol.new DateTime.new(2011, 1, 15, 7, 23, 0)
|
|
23
|
+
row[:join] = VR::CalendarCol.new DateTime.new(2011, 1, 15, 7, 23, 0)
|
|
21
24
|
row[:name] = DataObject.new("Henry Johnson", "18458 S Beauford St.", "hohohoja@email.net", "154-453-8585")
|
|
22
25
|
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
26
|
row = add_row()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
# This class just adds a GUI to the ListViewObjects class.
|
|
3
|
+
|
|
4
|
+
class ListViewObjectsGUI < ListViewObjects
|
|
5
|
+
|
|
6
|
+
include GladeGUI
|
|
7
|
+
|
|
8
|
+
def before_show
|
|
9
|
+
@builder["scrolledwindow1"].add(self)
|
|
10
|
+
self.visible = true
|
|
11
|
+
# edited_callback is a method that is called after a cell has been edited. It is
|
|
12
|
+
# used to do housekeeping after the value of the cell has changed.
|
|
13
|
+
renderer(:quote).edited_callback = method(:self__cursor_changed)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# When the selection changes, the quote at the bottom of the page needs to be updated.
|
|
17
|
+
# Then the quote matches the selected record. Try it.
|
|
18
|
+
|
|
19
|
+
def self__cursor_changed(*args)
|
|
20
|
+
return unless row = selected_rows.first # iter = selection.selected
|
|
21
|
+
@builder["labelQuote"].label = row[:quote].text
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
<child>
|
|
9
|
+
<object class="GtkBox" id="box1">
|
|
10
|
+
<property name="visible">True</property>
|
|
11
|
+
<property name="can_focus">False</property>
|
|
12
|
+
<property name="margin_left">20</property>
|
|
13
|
+
<property name="margin_right">20</property>
|
|
14
|
+
<property name="orientation">vertical</property>
|
|
15
|
+
<child>
|
|
16
|
+
<object class="GtkLabel" id="label5">
|
|
17
|
+
<property name="visible">True</property>
|
|
18
|
+
<property name="can_focus">False</property>
|
|
19
|
+
<property name="label" translatable="yes"><big><big>Basic Object Demo</big></big>
|
|
20
|
+
This was created with visualruby. See visualruby.net.</property>
|
|
21
|
+
<property name="use_markup">True</property>
|
|
22
|
+
<property name="ellipsize">start</property>
|
|
23
|
+
</object>
|
|
24
|
+
<packing>
|
|
25
|
+
<property name="expand">True</property>
|
|
26
|
+
<property name="fill">True</property>
|
|
27
|
+
<property name="padding">15</property>
|
|
28
|
+
<property name="position">0</property>
|
|
29
|
+
</packing>
|
|
30
|
+
</child>
|
|
31
|
+
<child>
|
|
32
|
+
<object class="GtkGrid" id="grid1">
|
|
33
|
+
<property name="visible">True</property>
|
|
34
|
+
<property name="can_focus">False</property>
|
|
35
|
+
<property name="row_homogeneous">True</property>
|
|
36
|
+
<property name="column_homogeneous">True</property>
|
|
37
|
+
<child>
|
|
38
|
+
<object class="GtkLabel" id="label6">
|
|
39
|
+
<property name="visible">True</property>
|
|
40
|
+
<property name="can_focus">False</property>
|
|
41
|
+
<property name="xalign">1</property>
|
|
42
|
+
<property name="xpad">10</property>
|
|
43
|
+
<property name="label" translatable="yes">Name:</property>
|
|
44
|
+
</object>
|
|
45
|
+
<packing>
|
|
46
|
+
<property name="left_attach">0</property>
|
|
47
|
+
<property name="top_attach">0</property>
|
|
48
|
+
<property name="width">1</property>
|
|
49
|
+
<property name="height">1</property>
|
|
50
|
+
</packing>
|
|
51
|
+
</child>
|
|
52
|
+
<child>
|
|
53
|
+
<object class="GtkLabel" id="label7">
|
|
54
|
+
<property name="visible">True</property>
|
|
55
|
+
<property name="can_focus">False</property>
|
|
56
|
+
<property name="xalign">1</property>
|
|
57
|
+
<property name="xpad">10</property>
|
|
58
|
+
<property name="label" translatable="yes">Address:</property>
|
|
59
|
+
</object>
|
|
60
|
+
<packing>
|
|
61
|
+
<property name="left_attach">0</property>
|
|
62
|
+
<property name="top_attach">1</property>
|
|
63
|
+
<property name="width">1</property>
|
|
64
|
+
<property name="height">1</property>
|
|
65
|
+
</packing>
|
|
66
|
+
</child>
|
|
67
|
+
<child>
|
|
68
|
+
<object class="GtkLabel" id="label8">
|
|
69
|
+
<property name="visible">True</property>
|
|
70
|
+
<property name="can_focus">False</property>
|
|
71
|
+
<property name="xalign">1</property>
|
|
72
|
+
<property name="xpad">10</property>
|
|
73
|
+
<property name="label" translatable="yes">Email:</property>
|
|
74
|
+
</object>
|
|
75
|
+
<packing>
|
|
76
|
+
<property name="left_attach">0</property>
|
|
77
|
+
<property name="top_attach">2</property>
|
|
78
|
+
<property name="width">1</property>
|
|
79
|
+
<property name="height">1</property>
|
|
80
|
+
</packing>
|
|
81
|
+
</child>
|
|
82
|
+
<child>
|
|
83
|
+
<object class="GtkLabel" id="label9">
|
|
84
|
+
<property name="visible">True</property>
|
|
85
|
+
<property name="can_focus">False</property>
|
|
86
|
+
<property name="xalign">1</property>
|
|
87
|
+
<property name="xpad">10</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
|
+
</object>
|
|
102
|
+
<packing>
|
|
103
|
+
<property name="left_attach">1</property>
|
|
104
|
+
<property name="top_attach">0</property>
|
|
105
|
+
<property name="width">1</property>
|
|
106
|
+
<property name="height">1</property>
|
|
107
|
+
</packing>
|
|
108
|
+
</child>
|
|
109
|
+
<child>
|
|
110
|
+
<object class="GtkEntry" id="address">
|
|
111
|
+
<property name="visible">True</property>
|
|
112
|
+
<property name="can_focus">True</property>
|
|
113
|
+
</object>
|
|
114
|
+
<packing>
|
|
115
|
+
<property name="left_attach">1</property>
|
|
116
|
+
<property name="top_attach">1</property>
|
|
117
|
+
<property name="width">1</property>
|
|
118
|
+
<property name="height">1</property>
|
|
119
|
+
</packing>
|
|
120
|
+
</child>
|
|
121
|
+
<child>
|
|
122
|
+
<object class="GtkEntry" id="email">
|
|
123
|
+
<property name="visible">True</property>
|
|
124
|
+
<property name="can_focus">True</property>
|
|
125
|
+
</object>
|
|
126
|
+
<packing>
|
|
127
|
+
<property name="left_attach">1</property>
|
|
128
|
+
<property name="top_attach">2</property>
|
|
129
|
+
<property name="width">1</property>
|
|
130
|
+
<property name="height">1</property>
|
|
131
|
+
</packing>
|
|
132
|
+
</child>
|
|
133
|
+
<child>
|
|
134
|
+
<object class="GtkEntry" id="phone">
|
|
135
|
+
<property name="visible">True</property>
|
|
136
|
+
<property name="can_focus">True</property>
|
|
137
|
+
</object>
|
|
138
|
+
<packing>
|
|
139
|
+
<property name="left_attach">1</property>
|
|
140
|
+
<property name="top_attach">3</property>
|
|
141
|
+
<property name="width">1</property>
|
|
142
|
+
<property name="height">1</property>
|
|
143
|
+
</packing>
|
|
144
|
+
</child>
|
|
145
|
+
</object>
|
|
146
|
+
<packing>
|
|
147
|
+
<property name="expand">True</property>
|
|
148
|
+
<property name="fill">True</property>
|
|
149
|
+
<property name="padding">10</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="margin_top">15</property>
|
|
158
|
+
<property name="margin_bottom">15</property>
|
|
159
|
+
<property name="layout_style">spread</property>
|
|
160
|
+
<child>
|
|
161
|
+
<object class="GtkButton" id="buttonSave">
|
|
162
|
+
<property name="label" translatable="yes">Save</property>
|
|
163
|
+
<property name="visible">True</property>
|
|
164
|
+
<property name="can_focus">True</property>
|
|
165
|
+
<property name="receives_default">True</property>
|
|
166
|
+
</object>
|
|
167
|
+
<packing>
|
|
168
|
+
<property name="expand">False</property>
|
|
169
|
+
<property name="fill">True</property>
|
|
170
|
+
<property name="position">0</property>
|
|
171
|
+
</packing>
|
|
172
|
+
</child>
|
|
173
|
+
<child>
|
|
174
|
+
<object class="GtkButton" id="buttonCancel">
|
|
175
|
+
<property name="label" translatable="yes">Cancel</property>
|
|
176
|
+
<property name="visible">True</property>
|
|
177
|
+
<property name="can_focus">True</property>
|
|
178
|
+
<property name="receives_default">True</property>
|
|
179
|
+
</object>
|
|
180
|
+
<packing>
|
|
181
|
+
<property name="expand">False</property>
|
|
182
|
+
<property name="fill">True</property>
|
|
183
|
+
<property name="position">1</property>
|
|
184
|
+
</packing>
|
|
185
|
+
</child>
|
|
186
|
+
</object>
|
|
187
|
+
<packing>
|
|
188
|
+
<property name="expand">False</property>
|
|
189
|
+
<property name="fill">True</property>
|
|
190
|
+
<property name="position">2</property>
|
|
191
|
+
</packing>
|
|
192
|
+
</child>
|
|
193
|
+
</object>
|
|
194
|
+
</child>
|
|
195
|
+
</object>
|
|
196
|
+
</interface>
|